From 302119c62a0e70359fe6e7fc7d573249b56690b4 Mon Sep 17 00:00:00 2001 From: Mikhail Montsev Date: Wed, 1 Jan 2025 11:22:17 +0000 Subject: [PATCH] FlushBytes should respect TBlobCompressionInfo; fix subtle bug with missing TBlobCompressionInfo in UpdateBlockLists --- .../libs/storage/tablet/model/mixed_blocks.cpp | 2 -- .../libs/storage/tablet/tablet_actor_addblob.cpp | 6 +++--- .../libs/storage/tablet/tablet_actor_flush_bytes.cpp | 11 +++++++---- .../libs/storage/tablet/tablet_actor_readdata.cpp | 2 +- .../libs/storage/tablet/tablet_state_data.cpp | 2 +- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/cloud/filestore/libs/storage/tablet/model/mixed_blocks.cpp b/cloud/filestore/libs/storage/tablet/model/mixed_blocks.cpp index 9d4cbdf00da..2dc6f3a0217 100644 --- a/cloud/filestore/libs/storage/tablet/model/mixed_blocks.cpp +++ b/cloud/filestore/libs/storage/tablet/model/mixed_blocks.cpp @@ -352,8 +352,6 @@ TMixedBlobMeta TMixedBlocks::FindBlob(ui32 rangeId, TPartialBlobId blobId) const const auto* range = Impl->Ranges.FindPtr(rangeId); Y_ABORT_UNLESS(range); - TVector result; - auto it = range->Blobs.find(blobId); Y_ABORT_UNLESS(it != range->Blobs.end()); diff --git a/cloud/filestore/libs/storage/tablet/tablet_actor_addblob.cpp b/cloud/filestore/libs/storage/tablet/tablet_actor_addblob.cpp index b3bc1e4fd28..ef7160c0384 100644 --- a/cloud/filestore/libs/storage/tablet/tablet_actor_addblob.cpp +++ b/cloud/filestore/libs/storage/tablet/tablet_actor_addblob.cpp @@ -225,7 +225,7 @@ class TAddBlobsExecutor db, blob.BlobId, blob.Blocks, - TBlobCompressionInfo() /* uncompressed */); + blob.BlobCompressionInfo); if (written) { ui32 rangeId = Tablet.GetMixedRangeIndex(blob.Blocks); AccessCompactionRangeInfo(rangeId).Stats.BlobsCount += 1; @@ -270,7 +270,7 @@ class TAddBlobsExecutor db, blob.BlobId, blob.Blocks, - TBlobCompressionInfo() /* uncompressed */) + blob.BlobCompressionInfo) ) { stats.BlobsCount += 1; // conservative estimate @@ -314,7 +314,7 @@ class TAddBlobsExecutor db, blob.BlobId, blob.Blocks, - TBlobCompressionInfo() /* uncompressed */) + blob.BlobCompressionInfo) ) { stats.BlobsCount += 1; // conservative estimate diff --git a/cloud/filestore/libs/storage/tablet/tablet_actor_flush_bytes.cpp b/cloud/filestore/libs/storage/tablet/tablet_actor_flush_bytes.cpp index e9399e0b15a..5ae31796c7d 100644 --- a/cloud/filestore/libs/storage/tablet/tablet_actor_flush_bytes.cpp +++ b/cloud/filestore/libs/storage/tablet/tablet_actor_flush_bytes.cpp @@ -69,6 +69,7 @@ class TReadBlockVisitor final static_cast(ref) = block; ref.BlobId = blobId; ref.BlobOffset = blobOffset; + ref.BlobCompressionInfo = blobCompressionInfo; Block.Block = std::move(ref); } } @@ -265,7 +266,7 @@ void TFlushBytesActor::ReadBlobs(const TActorContext& ctx) request->Blobs.emplace_back( blobToRead.BlobId, std::move(blocks), - TBlobCompressionInfo() /* uncompressed */); + blobToRead.BlobCompressionInfo); request->Blobs.back().Async = true; Buffers[blobToRead.BlobId] = request->Buffer; @@ -392,7 +393,7 @@ void TFlushBytesActor::AddBlob(const TActorContext& ctx) request->MixedBlobs.emplace_back( blob.BlobId, std::move(blocks), - TBlobCompressionInfo()); + TBlobCompressionInfo() /* uncompressed */); } for (auto& srcBlob: request->SrcBlobs) { @@ -684,8 +685,6 @@ void TIndexTabletActor::CompleteTx_FlushBytes( } }; - - THashMap blockMap; struct TSrcBlobInfo @@ -761,7 +760,11 @@ void TIndexTabletActor::CompleteTx_FlushBytes( if (!srcBlobInfo.SrcBlob.BlobId) { const auto rangeId = GetMixedRangeIndex(bytes.NodeId, blockIndex); srcBlobInfo.SrcBlob = FindBlob(rangeId, ref->BlobId); + srcBlobInfo.SrcBlob.BlobCompressionInfo = ref->BlobCompressionInfo; + srcBlobInfo.SrcBlobToRead.BlobId = ref->BlobId; + srcBlobInfo.SrcBlobToRead.BlobCompressionInfo = + ref->BlobCompressionInfo; } srcBlobInfo.SrcBlobToRead.Blocks.push_back( static_cast(*ref) diff --git a/cloud/filestore/libs/storage/tablet/tablet_actor_readdata.cpp b/cloud/filestore/libs/storage/tablet/tablet_actor_readdata.cpp index bb841197730..83d2531d1e7 100644 --- a/cloud/filestore/libs/storage/tablet/tablet_actor_readdata.cpp +++ b/cloud/filestore/libs/storage/tablet/tablet_actor_readdata.cpp @@ -425,7 +425,7 @@ void TReadDataActor::ReadBlob(const TActorContext& ctx) blockOffset - 1); if (block.BlobCompressionInfo.BlobCompressed()) { blobCompressionInfoByBlobId[block.BlobId] = - std::move(block.BlobCompressionInfo); + block.BlobCompressionInfo; } } diff --git a/cloud/filestore/libs/storage/tablet/tablet_state_data.cpp b/cloud/filestore/libs/storage/tablet/tablet_state_data.cpp index d37f9e33e40..574e2d3c96b 100644 --- a/cloud/filestore/libs/storage/tablet/tablet_state_data.cpp +++ b/cloud/filestore/libs/storage/tablet/tablet_state_data.cpp @@ -883,7 +883,7 @@ bool TIndexTabletState::UpdateBlockLists( rangeId, blob.BlobId, blob.Blocks, - TBlobCompressionInfo() /* remains unchanged */); + blob.BlobCompressionInfo); } ui32 TIndexTabletState::CleanupBlockDeletions(