@@ -2058,6 +2058,9 @@ void TPDisk::KillOwner(TOwner owner, TOwnerRound killOwnerRound, TCompletionEven
2058
2058
for (ui32 i = 0 ; i < ChunkState.size (); ++i) {
2059
2059
TChunkState &state = ChunkState[i];
2060
2060
if (state.OwnerId == owner) {
2061
+ if (TPDisk::IS_SHRED_ENABLED) {
2062
+ state.IsDirty = true ;
2063
+ }
2061
2064
if (state.CommitState == TChunkState::DATA_RESERVED
2062
2065
|| state.CommitState == TChunkState::DATA_DECOMMITTED
2063
2066
|| state.CommitState == TChunkState::DATA_RESERVED_DECOMMIT_IN_PROGRESS
@@ -4213,8 +4216,40 @@ void TPDisk::ProgressShredState() {
4213
4216
return ;
4214
4217
}
4215
4218
}
4219
+ // Looks good, but there still can be chunks that need to be shredded still int transition between states.
4220
+ // For example, log chunks are removed from the log chunk list on log cut but added to free chunk list on log cut
4221
+ // write operation completion. So, walk through the whole chunk list and check.
4222
+ for (ui32 chunkIdx = Format.SystemChunkCount ; chunkIdx < ChunkState.size (); ++chunkIdx) {
4223
+ TChunkState &state = ChunkState[chunkIdx];
4224
+ if (state.IsDirty && state.ShredGeneration < ShredGeneration) {
4225
+ if (ContinueShredsInFlight) {
4226
+ // There are continue shreds in flight, so we don't need to schedule a new one.
4227
+ // Just wait for it to arrive.
4228
+ LOG_DEBUG_S (*PCtx->ActorSystem , NKikimrServices::BS_PDISK_SHRED,
4229
+ " PDisk# " << PCtx->PDiskId
4230
+ << " found a dirtyInTransition chunkIdx# " << chunkIdx
4231
+ << " state# " << state.ToString ()
4232
+ << " , there are already ContinueShredsInFlight# " << ContinueShredsInFlight.load ()
4233
+ << " so just wait for it to arrive. "
4234
+ << " ShredGeneration# " << ShredGeneration);
4235
+ return ;
4236
+ } else {
4237
+ LOG_DEBUG_S (*PCtx->ActorSystem , NKikimrServices::BS_PDISK_SHRED,
4238
+ " PDisk# " << PCtx->PDiskId
4239
+ << " found a dirtyInTransition chunkIdx# " << chunkIdx
4240
+ << " state# " << state.ToString ()
4241
+ << " , scheduling ContinueShred. "
4242
+ << " ShredGeneration# " << ShredGeneration);
4243
+ ContinueShredsInFlight++;
4244
+ PCtx->ActorSystem ->Schedule (TDuration::MilliSeconds (50 ),
4245
+ new IEventHandle (PCtx->PDiskActor , PCtx->PDiskActor , new TEvContinueShred (), 0 , 0 ));
4246
+ return ;
4247
+ }
4248
+ }
4249
+ }
4216
4250
ShredIsWaitingForCutLog = 0 ;
4217
4251
4252
+
4218
4253
LOG_DEBUG_S (*PCtx->ActorSystem , NKikimrServices::BS_PDISK_SHRED,
4219
4254
" PDisk# " << PCtx->PDiskId
4220
4255
<< " has finished all shred requests"
0 commit comments