Skip to content

Commit

Permalink
issue-1795: writing LargeDeletionMarkers instead of normal DeletionMa…
Browse files Browse the repository at this point in the history
…rkers if the deleted range is big enough and the corresponding StorageServiceConfig params are set
  • Loading branch information
qkrorlqr committed Aug 30, 2024
1 parent d8217d9 commit 070358e
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,6 @@ void TIndexTabletActor::ExecuteTx_AllocateData(
if (args.CommitId == InvalidCommitId) {
return RebootTabletOnCommitOverflow(ctx, "AllocateData");
}
// TODO: We should not use this range request because tx size
// is limited. Need some generic process range mechanism after
// NBS-2979
ZeroRange(
db,
args.NodeId,
Expand Down
4 changes: 4 additions & 0 deletions cloud/filestore/libs/storage/tablet/tablet_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ void TIndexTabletState::LoadState(
ChannelMinFreeSpace = config.GetChannelMinFreeSpace() / 100.;
ChannelFreeSpaceThreshold = config.GetChannelFreeSpaceThreshold() / 100.;

LargeDeletionMarkersEnabled = config.GetLargeDeletionMarkersEnabled();
LargeDeletionMarkerBlocks = config.GetLargeDeletionMarkerBlocks();
LargeDeletionMarkersThreshold = config.GetLargeDeletionMarkersThreshold();

FileSystem.CopyFrom(fileSystem);
FileSystemStats.CopyFrom(fileSystemStats);
TabletStorageInfo.CopyFrom(tabletStorageInfo);
Expand Down
3 changes: 3 additions & 0 deletions cloud/filestore/libs/storage/tablet/tablet_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ class TIndexTabletState
/*const*/ ui32 SessionHistoryEntryCount = 0;
/*const*/ double ChannelMinFreeSpace = 0;
/*const*/ double ChannelFreeSpaceThreshold = 1;
/*const*/ bool LargeDeletionMarkersEnabled = false;
/*const*/ ui64 LargeDeletionMarkerBlocks = 0;
/*const*/ ui64 LargeDeletionMarkersThreshold = 0;

bool StateLoaded = false;

Expand Down
45 changes: 33 additions & 12 deletions cloud/filestore/libs/storage/tablet/tablet_state_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,18 +177,39 @@ void TIndexTabletState::DeleteRange(
range.FirstAlignedBlock(),
deletedBlockCount);

SplitRange(
range.FirstAlignedBlock(),
deletedBlockCount,
BlockGroupSize,
[&] (ui32 blockOffset, ui32 blocksCount) {
MarkMixedBlocksDeleted(
db,
nodeId,
commitId,
range.FirstAlignedBlock() + blockOffset,
blocksCount);
});
const bool useLargeDeletionMarkers = LargeDeletionMarkersEnabled
&& deletedBlockCount >= LargeDeletionMarkersThreshold;
if (useLargeDeletionMarkers) {
SplitRange(
range.FirstAlignedBlock(),
deletedBlockCount,
LargeDeletionMarkerBlocks,
[&] (ui32 blockOffset, ui32 blocksCount) {
Impl->LargeBlocks.AddDeletionMarker({
nodeId,
commitId,
blockOffset,
blocksCount});
db.WriteLargeDeletionMarkers(
nodeId,
commitId,
blockOffset,
blocksCount);
});
} else {
SplitRange(
range.FirstAlignedBlock(),
deletedBlockCount,
BlockGroupSize,
[&] (ui32 blockOffset, ui32 blocksCount) {
MarkMixedBlocksDeleted(
db,
nodeId,
commitId,
range.FirstAlignedBlock() + blockOffset,
blocksCount);
});
}
}

WriteFreshBytesDeletionMarker(
Expand Down

0 comments on commit 070358e

Please sign in to comment.