Skip to content

Commit

Permalink
FlushBytes should respect TBlobCompressionInfo; fix subtle bug with m…
Browse files Browse the repository at this point in the history
…issing TBlobCompressionInfo in UpdateBlockLists
  • Loading branch information
SvartMetal committed Jan 1, 2025
1 parent 5f8c7f8 commit 302119c
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
2 changes: 0 additions & 2 deletions cloud/filestore/libs/storage/tablet/model/mixed_blocks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,6 @@ TMixedBlobMeta TMixedBlocks::FindBlob(ui32 rangeId, TPartialBlobId blobId) const
const auto* range = Impl->Ranges.FindPtr(rangeId);
Y_ABORT_UNLESS(range);

TVector<TMixedBlobMeta> result;

auto it = range->Blobs.find(blobId);
Y_ABORT_UNLESS(it != range->Blobs.end());

Expand Down
6 changes: 3 additions & 3 deletions cloud/filestore/libs/storage/tablet/tablet_actor_addblob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -270,7 +270,7 @@ class TAddBlobsExecutor
db,
blob.BlobId,
blob.Blocks,
TBlobCompressionInfo() /* uncompressed */)
blob.BlobCompressionInfo)
) {
stats.BlobsCount += 1;
// conservative estimate
Expand Down Expand Up @@ -314,7 +314,7 @@ class TAddBlobsExecutor
db,
blob.BlobId,
blob.Blocks,
TBlobCompressionInfo() /* uncompressed */)
blob.BlobCompressionInfo)
) {
stats.BlobsCount += 1;
// conservative estimate
Expand Down
11 changes: 7 additions & 4 deletions cloud/filestore/libs/storage/tablet/tablet_actor_flush_bytes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class TReadBlockVisitor final
static_cast<TBlock&>(ref) = block;
ref.BlobId = blobId;
ref.BlobOffset = blobOffset;
ref.BlobCompressionInfo = blobCompressionInfo;
Block.Block = std::move(ref);
}
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -684,8 +685,6 @@ void TIndexTabletActor::CompleteTx_FlushBytes(
}
};



THashMap<TBlockLocation, TBlockWithBytes, TBlockLocationHash> blockMap;

struct TSrcBlobInfo
Expand Down Expand Up @@ -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<const TBlock&>(*ref)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

Expand Down
2 changes: 1 addition & 1 deletion cloud/filestore/libs/storage/tablet/tablet_state_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -883,7 +883,7 @@ bool TIndexTabletState::UpdateBlockLists(
rangeId,
blob.BlobId,
blob.Blocks,
TBlobCompressionInfo() /* remains unchanged */);
blob.BlobCompressionInfo);
}

ui32 TIndexTabletState::CleanupBlockDeletions(
Expand Down

0 comments on commit 302119c

Please sign in to comment.