Skip to content

Enable consensus compaction by default - #5903

Merged
timvisee merged 2 commits into
devfrom
enable-consensus-compaction
Feb 4, 2025
Merged

timvisee merged 2 commits into
devfrom
enable-consensus-compaction

Conversation

@timvisee

@timvisee timvisee commented Jan 29, 2025 •

Copy link
Copy Markdown
Member

Depends on #5905

Enable compaction of consensus operations by default. This imposes two key benefits:

  • joining peers don't have to replay a huge amount of operations and can get up to speed quickly through a consensus snapshot
  • more robust consensus because consensus snapshots provides a fixed state as new starting point

We should confirm if #5900 fixes the current ongoing consensus problems in chaos testing before merging this PR.

I used 128 instead of 100 because it is a nice round number 😃

All Submissions:

  • Contributions should target the dev branch. Did you create your branch from dev?
  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

New Feature Submissions:

  1. Does your submission pass tests?
  2. Have you formatted your code locally using cargo +nightly fmt --all command prior to submission?
  3. Have you checked your code using cargo clippy --all --all-features command?

@timvisee

Copy link
Copy Markdown
Member Author

I'm surprised by the failing CI test.

FAILED tests/consensus_tests/test_peer_snapshot_bootstrap.py::test_peer_snapshot_bootstrap - Exception: Timeout waiting for condition check_cluster_size to be satisfied in 30 seconds

Removing the explicit POST /cluster/recover calls in the tests make it green.

@timvisee

Copy link
Copy Markdown
Member Author

Depends on #5905. A rebase on top of dev once it is merged will resolve the red CI.

@timvisee
timvisee force-pushed the enable-consensus-compaction branch from e2853de to 65bc34d Compare January 30, 2025 09:04
@timvisee
timvisee marked this pull request as ready for review January 30, 2025 09:04
@timvisee
timvisee force-pushed the enable-consensus-compaction branch from 65bc34d to 7fd190d Compare January 30, 2025 10:17
@ffuugoo

ffuugoo commented Jan 30, 2025 •

Copy link
Copy Markdown
Contributor

I figured it out. The debug_assert in ConsensusManager::compact_wal is too strict. There's one valid corner-case: when we apply Raft snapshot, we completely "clear" Raft WAL, and then assertion fails.

We need to relax the assertion a bit:

        debug_assert!(
            last_applied_index >= first_entry.index - 1,
            "Raft WAL is missing {} unapplied entries (last applied index: {}, first WAL entry index: {})",
            first_entry.index - last_applied_index - 1,
            last_applied_index,
            first_entry.index,
        );

test_collection_recovery works on my machine with updated assertion.

@timvisee
timvisee force-pushed the enable-consensus-compaction branch from 7fd190d to 74733d9 Compare January 30, 2025 13:56
@timvisee

Copy link
Copy Markdown
Member Author

Assertion fix implemented in #5914, this has been rebased upon it.

This PR is ready for review. CI is green now.

1 similar comment
@timvisee

Copy link
Copy Markdown
Member Author

Assertion fix implemented in #5914, this has been rebased upon it.

This PR is ready for review. CI is green now.

@timvisee
timvisee requested a review from generall January 31, 2025 09:17
@timvisee
timvisee merged commit cc1c824 into dev Feb 4, 2025
@timvisee
timvisee deleted the enable-consensus-compaction branch February 4, 2025 14:05
timvisee added a commit that referenced this pull request Feb 11, 2025
* Enable consensus compaction by default

* Also set new compaction default in code
@timvisee timvisee mentioned this pull request Feb 11, 2025
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.

3 participants