bugfix(livestore): skip lookback replay when partition is Inactive#7101
Merged
zhxiaogg merged 3 commits intografana:mainfrom May 5, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adjusts live-store Kafka startup behavior so that when a live-store’s ingest partition is already marked Inactive (typical during downscaling/draining), the process does not force a lookback replay solely because local WAL-derived state is empty after restart. This prevents expensive/unnecessary replay during intermediate restarts while a scale-down is in progress.
Changes:
- Refactors the “force lookback replay when no local instances exist” decision into
shouldForceFromLookback(ctx). - Skips forced lookback replay when the partition ring reports the partition state as
PartitionInactive. - Adds unit tests covering the three key branches (instances exist, no instances + inactive, no instances + non-inactive) and updates the changelog.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
modules/livestore/live_store.go |
Introduces shouldForceFromLookback() and uses partition state to skip lookback replay when Inactive. |
modules/livestore/live_store_test.go |
Adds tests validating the new decision logic for lookback replay. |
CHANGELOG.md |
Adds a [BUGFIX] entry documenting the behavior change. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does:
/prepare-partition-downscale, then the Livestore instance should not replay from the beginning of the partition for any intermediate restarts.Why:
This is to avoid partition lag due to concurrent scaling down and rolling restarts:
/prepare-partition-downscalewould set target partitions to be inactiveWhich issue(s) this PR fixes:
Fixes N/A
Checklist
CHANGELOG.mdupdated - the order of entries should be[CHANGE],[FEATURE],[ENHANCEMENT],[BUGFIX]