-
Notifications
You must be signed in to change notification settings - Fork 740
Fix PDisk shred free chunks in transit and after vdisk deletion #18279
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 all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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 | ||||
|---|---|---|---|---|---|---|
|
|
@@ -2058,6 +2058,9 @@ void TPDisk::KillOwner(TOwner owner, TOwnerRound killOwnerRound, TCompletionEven | |||||
| for (ui32 i = 0; i < ChunkState.size(); ++i) { | ||||||
| TChunkState &state = ChunkState[i]; | ||||||
| if (state.OwnerId == owner) { | ||||||
| if (TPDisk::IS_SHRED_ENABLED) { | ||||||
| state.IsDirty = true; | ||||||
| } | ||||||
| if (state.CommitState == TChunkState::DATA_RESERVED | ||||||
| || state.CommitState == TChunkState::DATA_DECOMMITTED | ||||||
| || state.CommitState == TChunkState::DATA_RESERVED_DECOMMIT_IN_PROGRESS | ||||||
|
|
@@ -4213,8 +4216,40 @@ void TPDisk::ProgressShredState() { | |||||
| return; | ||||||
| } | ||||||
| } | ||||||
| // Looks good, but there still can be chunks that need to be shredded still int transition between states. | ||||||
| // For example, log chunks are removed from the log chunk list on log cut but added to free chunk list on log cut | ||||||
| // write operation completion. So, walk through the whole chunk list and check. | ||||||
| for (ui32 chunkIdx = Format.SystemChunkCount; chunkIdx < ChunkState.size(); ++chunkIdx) { | ||||||
| TChunkState &state = ChunkState[chunkIdx]; | ||||||
| if (state.IsDirty && state.ShredGeneration < ShredGeneration) { | ||||||
| if (ContinueShredsInFlight) { | ||||||
| // There are continue shreds in flight, so we don't need to schedule a new one. | ||||||
| // Just wait for it to arrive. | ||||||
| LOG_DEBUG_S(*PCtx->ActorSystem, NKikimrServices::BS_PDISK_SHRED, | ||||||
| "PDisk# " << PCtx->PDiskId | ||||||
| << " found a dirtyInTransition chunkIdx# " << chunkIdx | ||||||
| << " state# " << state.ToString() | ||||||
| << ", there are already ContinueShredsInFlight# " << ContinueShredsInFlight.load() | ||||||
| << " so just wait for it to arrive. " | ||||||
| << " ShredGeneration# " << ShredGeneration); | ||||||
| return; | ||||||
| } else { | ||||||
| LOG_DEBUG_S(*PCtx->ActorSystem, NKikimrServices::BS_PDISK_SHRED, | ||||||
| "PDisk# " << PCtx->PDiskId | ||||||
| << " found a dirtyInTransition chunkIdx# " << chunkIdx | ||||||
| << " state# " << state.ToString() | ||||||
| << ", scheduling ContinueShred. " | ||||||
| << " ShredGeneration# " << ShredGeneration); | ||||||
| ContinueShredsInFlight++; | ||||||
| PCtx->ActorSystem->Schedule(TDuration::MilliSeconds(50), | ||||||
|
||||||
| PCtx->ActorSystem->Schedule(TDuration::MilliSeconds(50), | |
| PCtx->ActorSystem->Schedule(TDuration::MilliSeconds(CONTINUE_SHRED_DELAY_MS), |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The early return within the loop means that only the first matching dirty chunk is processed per call. If this is intended, please add a comment to clarify that scheduling only one continue shred per invocation is by design.