diff options
author | cthulhu <cthulhu@ydb.tech> | 2022-08-31 19:50:16 +0300 |
---|---|---|
committer | cthulhu <cthulhu@ydb.tech> | 2022-08-31 19:50:16 +0300 |
commit | d34df8ec792a0722c031eca4f55830041ff2d122 (patch) | |
tree | 23d6aaaf32d42eabca866642f0b22a754a9d8e87 | |
parent | 4b26da7aedd5af7518f43bbd462d0ee8873776c0 (diff) | |
download | ydb-d34df8ec792a0722c031eca4f55830041ff2d122.tar.gz |
Fix reading/writing decommited chunks,
Fix reading/writing decommited chunks,
-rw-r--r-- | ydb/core/blobstorage/pdisk/blobstorage_pdisk_impl.cpp | 12 | ||||
-rw-r--r-- | ydb/core/blobstorage/pdisk/blobstorage_pdisk_impl_log.cpp | 8 |
2 files changed, 18 insertions, 2 deletions
diff --git a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_impl.cpp b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_impl.cpp index 54c671d312..91897656ba 100644 --- a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_impl.cpp +++ b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_impl.cpp @@ -1256,6 +1256,7 @@ void TPDisk::ChunkForget(TChunkForget &evChunkForget) { (ui32)PDiskId, (ui32)chunkIdx, (ui32)state.OwnerId, (ui32)OwnerUnallocated); Y_VERIFY(state.OwnerId == evChunkForget.Owner); Mon.UncommitedDataChunks->Dec(); + state.OwnerId = OwnerUnallocated; state.CommitState = TChunkState::FREE; Keeper.PushFreeOwnerChunk(evChunkForget.Owner, chunkIdx); break; @@ -2556,7 +2557,11 @@ bool TPDisk::PreprocessRequest(TRequestBase *request) { SendChunkReadError(read, err, NKikimrProto::ERROR); return false; } - if (state.CommitState != TChunkState::DATA_RESERVED && state.CommitState != TChunkState::DATA_COMMITTED) { + if (state.CommitState != TChunkState::DATA_RESERVED + && state.CommitState != TChunkState::DATA_COMMITTED + && state.CommitState != TChunkState::DATA_DECOMMITTED + && state.CommitState != TChunkState::DATA_RESERVED_DECOMMIT_IN_PROGRESS + && state.CommitState != TChunkState::DATA_COMMITTED_DECOMMIT_IN_PROGRESS) { err << "chunk has unexpected CommitState# " << state.CommitState; SendChunkReadError(read, err, NKikimrProto::ERROR); return false; @@ -2638,7 +2643,10 @@ bool TPDisk::PreprocessRequest(TRequestBase *request) { return false; } if (state.CommitState != TChunkState::DATA_RESERVED - && state.CommitState != TChunkState::DATA_COMMITTED) { + && state.CommitState != TChunkState::DATA_COMMITTED + && state.CommitState != TChunkState::DATA_DECOMMITTED + && state.CommitState != TChunkState::DATA_RESERVED_DECOMMIT_IN_PROGRESS + && state.CommitState != TChunkState::DATA_COMMITTED_DECOMMIT_IN_PROGRESS) { err << "Can't write chunkIdx# " << ev.ChunkIdx << " destination chunk has CommitState# " << state.CommitState << " ownerId# " << ev.Owner; diff --git a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_impl_log.cpp b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_impl_log.cpp index 68aee602f8..0552ca8c88 100644 --- a/ydb/core/blobstorage/pdisk/blobstorage_pdisk_impl_log.cpp +++ b/ydb/core/blobstorage/pdisk/blobstorage_pdisk_impl_log.cpp @@ -963,6 +963,7 @@ bool TPDisk::ValidateCommitChunk(ui32 chunkIdx, TOwner owner, TStringStream& out return true; } +// Called when commit record is successfully saved to the disk. void TPDisk::CommitChunk(ui32 chunkIdx) { TGuard<TMutex> guard(StateMutex); TChunkState &state = ChunkState[chunkIdx]; @@ -975,6 +976,12 @@ void TPDisk::CommitChunk(ui32 chunkIdx) { case TChunkState::DATA_COMMITTED: state.CommitState = TChunkState::DATA_COMMITTED; break; + case TChunkState::DATA_RESERVED_DECOMMIT_IN_PROGRESS: + [[fallthrough]]; + case TChunkState::DATA_COMMITTED_DECOMMIT_IN_PROGRESS: + [[fallthrough]]; + case TChunkState::DATA_DECOMMITTED: + [[fallthrough]]; case TChunkState::DATA_ON_QUARANTINE: [[fallthrough]]; case TChunkState::DATA_COMMITTED_DELETE_ON_QUARANTINE: @@ -1025,6 +1032,7 @@ bool TPDisk::ValidateDeleteChunk(ui32 chunkIdx, TOwner owner, TStringStream& out } // Marks chunk deleted but does not move it to the free list. +// Called when commit record is successfully saved to the disk. void TPDisk::DeleteChunk(ui32 chunkIdx, TOwner owner) { TGuard<TMutex> guard(StateMutex); TChunkState &state = ChunkState[chunkIdx]; |