Skip to content

perf(test): poll is_compacting instead of a fixed sleep in replication test#3561

Merged
git-hulk merged 2 commits into
apache:unstablefrom
ishita-0301:perf/replication-test-compact-poll
Jul 20, 2026
Merged

perf(test): poll is_compacting instead of a fixed sleep in replication test#3561
git-hulk merged 2 commits into
apache:unstablefrom
ishita-0301:perf/replication-test-compact-poll

Conversation

@ishita-0301

Copy link
Copy Markdown
Contributor

What this does

TestReplicationShareCheckpoint runs COMPACT and then blindly
time.Sleep(time.Second) before starting the replicas. That is slower
than necessary and potentially flaky — on a loaded CI runner one second
may not be enough for the manual compaction to finish, so the test can
proceed while compaction is still running.

This replaces the fixed sleep with the same is_compacting poll already
used elsewhere in the same file (TestReplicationWithHole), returning as
soon as compaction completes:

require.Eventually(t, func() bool {
    return util.FindInfoEntry(masterClient, "is_compacting") == "no"
}, 10*time.Second, 100*time.Millisecond)

Related

Part of #3524, addresses #3527.

Note on testing

I was not able to run the full Go integration suite locally for this
change; it mirrors an existing, already-tested pattern in the same file
rather than introducing new behavior. Happy to adjust if maintainers
prefer a different approach.

…n test

TestReplicationShareCheckpoint issued `COMPACT` and then blindly
`time.Sleep(time.Second)` before starting the replicas. This is both
slower than necessary and potentially flaky: on a loaded CI runner one
second may not be enough for the manual compaction to finish, so the
test could proceed while compaction is still running.

Replace the fixed sleep with the same `is_compacting` poll already used
elsewhere in this file (TestReplicationWithHole, lines ~349-351),
waiting up to 10s at a 100ms interval. This returns as soon as
compaction completes and removes the blind wait.

Part of apache#3524, addresses apache#3527.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves the stability and runtime of the Go replication integration test suite by removing a fixed time.Sleep(1 * time.Second) after triggering manual compaction and instead waiting deterministically for compaction to finish via the is_compacting INFO field (matching an existing pattern already used in the same file).

Changes:

  • Replace a fixed sleep in TestReplicationShareCheckpoint with require.Eventually polling on is_compacting == "no".
  • Reduce potential test flakiness on slow/loaded CI runners while also avoiding unnecessary waiting when compaction completes quickly.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jihuayu

jihuayu commented Jul 20, 2026

Copy link
Copy Markdown
Member

Hi @ishita-0301. If you can't run the tests locally, you can use the GitHub Actions workflow in your repository: https://github.com/ishita-0301/kvrocks/actions to make sure all tests are passing.

@git-hulk
git-hulk enabled auto-merge (squash) July 20, 2026 12:12
@git-hulk
git-hulk merged commit 1512515 into apache:unstable Jul 20, 2026
37 checks passed
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 50%)

See analysis details on SonarQube Cloud

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.

4 participants