-
Notifications
You must be signed in to change notification settings - Fork 11
fix(inkless:consolidation): don't fence a consolidating leader below the seal #677
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3321,8 +3321,11 @@ class ReplicaManager(val config: KafkaConfig, | |
| * - LEO > seal: truncate down to the seal unless the local suffix [seal, LEO) is already | ||
| * materialized consolidated diskless data. | ||
| * - LEO == seal and HW < seal: advance HW to the seal so consumers can cross into diskless. | ||
| * - LEO < seal: fence offline. The classic prefix is incomplete, so serving it would hide a | ||
| * hole in acknowledged data. | ||
| * - LEO < seal: fence offline, unless this is a consolidating diskless topic with remote | ||
| * storage enabled. In that case the classic prefix [0, seal) lives in the remote tier and | ||
| * can be rebuilt, so the partition is left online for the ConsolidationReconciler to | ||
| * rebuild from remote (the inline comment below carries the mechanism). Fencing here would | ||
| * preempt that recovery: the reconciler only sees online partitions. | ||
| * | ||
| * Must run after makeLeader (so the log exists) and before any consolidation fetcher starts. | ||
| */ | ||
|
|
@@ -3350,11 +3353,21 @@ class ReplicaManager(val config: KafkaConfig, | |
| stateChangeLogger.info(s"Stale high watermark detected: advanced high watermark to seal offset $seal for " + | ||
| s"switched leader partition $tp") | ||
| } else if (log.logEndOffset < seal) { | ||
| // This is unreachable in normal operation | ||
| stateChangeLogger.error(s"Leader partition $tp has LEO ${log.logEndOffset} below " + | ||
| s"classic-to-diskless start offset $seal; cannot catch up from another replica. " + | ||
| s"Marking the partition offline as its local log is corrupt below the committed seal.") | ||
| markPartitionOffline(tp) | ||
| if (isConsolidatingPartition(partition) && log.remoteLogEnabled()) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. personal note: this can be simplified when #678 lands -- not a blocker |
||
| // The leader's local classic prefix was lost (full local-storage wipe / DR). | ||
| // [0, seal) lives in the remote tier, so leave the partition online and let the | ||
| // ConsolidationReconciler arm consolidation at the current LEO: the first fetch | ||
| // lands below the diskless WAL start, answers OFFSET_MOVED_TO_TIERED_STORAGE, and | ||
| // the tier-state machine rebuilds the log from remote. | ||
| stateChangeLogger.warn(s"Switched leader partition $tp is below the classic-to-diskless " + | ||
| s"seal $seal at LEO ${log.logEndOffset} with remote storage enabled; leaving online " + | ||
| s"for consolidation to rebuild the classic prefix from the remote tier.") | ||
| } else { | ||
| stateChangeLogger.error(s"Leader partition $tp has LEO ${log.logEndOffset} below " + | ||
| s"classic-to-diskless start offset $seal; cannot catch up from another replica. " + | ||
| s"Marking the partition offline as its local log is corrupt below the committed seal.") | ||
|
viktorsomogyi marked this conversation as resolved.
Outdated
|
||
| markPartitionOffline(tp) | ||
| } | ||
| } | ||
| } | ||
| } catch { | ||
|
|
@@ -3658,8 +3671,16 @@ class ReplicaManager(val config: KafkaConfig, | |
| } | ||
|
|
||
| if (consolidatingDisklessPartitionsToStartFetching.nonEmpty) { | ||
| consolidationReconciler.foreach(_.startConsolidationFetchers(consolidatingDisklessPartitionsToStartFetching)) | ||
| stateChangeLogger.info(s"Started consolidating diskless fetchers as part of become-leader for ${consolidatingDisklessPartitionsToStartFetching.size} partitions") | ||
| // maybeReconcileSwitchedLeader above may have fenced a below-seal leader whose local log | ||
| // cannot be rebuilt from remote. Skip any partition that is no longer online so the | ||
| // reconciler does not dereference a fenced partition's local log. | ||
| val onlineToStartFetching = consolidatingDisklessPartitionsToStartFetching.filter { | ||
| case (tp, _) => onlinePartition(tp).isDefined | ||
| } | ||
| if (onlineToStartFetching.nonEmpty) { | ||
| consolidationReconciler.foreach(_.startConsolidationFetchers(onlineToStartFetching)) | ||
| stateChangeLogger.info(s"Started consolidating diskless fetchers as part of become-leader for ${onlineToStartFetching.size} partitions") | ||
| } | ||
| } | ||
| } | ||
|
|
||
|
|
||
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.