Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public class FlushFailingOnNotificationSubscriberTest extends CQLTester
private final AtomicInteger numFailedFlushes = new AtomicInteger();

volatile long maxTimeSinceCleanup = 0;
volatile long lastTimePoolNeededCleaning = System.nanoTime();
volatile long lastTimePoolNeededCleaning = 0;

static AtomicDouble failFlushProbability = new AtomicDouble(FLUSH_FAILURE_PROBABILITY);

Expand Down Expand Up @@ -116,14 +116,7 @@ public void flushFailingOnSSTableAddingNotificationVSWritesTest() throws Interru
}

idx++;
if (MEMORY_POOL.needsCleaning())
{
lastTimePoolNeededCleaning = System.nanoTime();
}
else
{
updateMaxTimeSinceCleanup();
}
updateMaxTimeSinceCleanup();

if (MEMORY_POOL.getNumPendingtasks() > 2)
{
Expand Down Expand Up @@ -164,7 +157,19 @@ public void flushFailingOnSSTableAddingNotificationVSWritesTest() throws Interru

private void updateMaxTimeSinceCleanup()
{
maxTimeSinceCleanup = Math.max(maxTimeSinceCleanup, (System.nanoTime() - lastTimePoolNeededCleaning) / TimeUnit.MILLISECONDS.toNanos(1));
long now = System.nanoTime();
if (MEMORY_POOL.needsCleaning())
{
if (lastTimePoolNeededCleaning == 0)
lastTimePoolNeededCleaning = now;

maxTimeSinceCleanup = Math.max(maxTimeSinceCleanup, (now - lastTimePoolNeededCleaning) / TimeUnit.MILLISECONDS.toNanos(1));
}
else if (lastTimePoolNeededCleaning != 0)
{
maxTimeSinceCleanup = Math.max(maxTimeSinceCleanup, (now - lastTimePoolNeededCleaning) / TimeUnit.MILLISECONDS.toNanos(1));
lastTimePoolNeededCleaning = 0;
}
}

private void logState()
Expand Down Expand Up @@ -209,7 +214,7 @@ private void successfulUserFlush()
{
failFlushProbability.set(0.0);
getCurrentColumnFamilyStore().forceFlush(ColumnFamilyStore.FlushReason.UNIT_TESTS).get();
lastTimePoolNeededCleaning = System.nanoTime();
lastTimePoolNeededCleaning = 0;
failFlushProbability.set(FLUSH_FAILURE_PROBABILITY);
}
catch (InterruptedException | ExecutionException e)
Expand Down
Loading