Skip to content

Conversation

@teamconfx
Copy link

This PR is for fixing #6050.

Summary

  • Fixed inverted condition in Wait.waitFor() that was waiting for compactions to be empty instead of waiting for a compaction to start
  • Added pre-condition assertion to verify no compactions are running before the test begins, catching any leftover state from other tests

Description

In ExternalCompactionProgressIT.testCompactionDurationContinuesAfterCoordinatorStop(), the Wait.waitFor() condition was inverted. The code comment indicated it should "Wait until the compaction starts", but the actual condition compactions == null || compactions.isEmpty() was waiting for the opposite—no compactions to be running.

Before:

  Wait.waitFor(() -> {
    Map<String,TExternalCompaction> compactions =
        getRunningCompactions(getCluster().getServerContext()).getCompactions();
    return compactions == null || compactions.isEmpty();  // BUG: waits for NO compactions
  }, 30_000, 100, "Compaction did not start within the expected time");

After:

  Wait.waitFor(() -> {
    Map<String,TExternalCompaction> compactions =
        getRunningCompactions(getCluster().getServerContext()).getCompactions();
    return compactions != null && !compactions.isEmpty();  // Correctly waits for compaction to start
  }, 30_000, 100, "Compaction did not start within the expected time");

The test was still passing because sleepUninterruptibly(6, TimeUnit.SECONDS) followed the wait, giving enough time for the compaction to actually start. However, compactionStartTime was not
accurately reflecting when the compaction truly started.

Additionally, a pre-condition check was added to ensure no compactions are running before the test begins, which helps catch any accidental leftover state from other tests as requested in #6050.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant