Skip to content

Commit

Permalink
issue-1146: add setters for in-memory state, temporary get rid of _Ve…
Browse files Browse the repository at this point in the history
…r tables (#1961)

* issue-1146: add setters for in-memory state, temporary get rid of _Ver tables
  • Loading branch information
debnatkh authored Sep 12, 2024
1 parent 60994f4 commit 5a2bae2
Show file tree
Hide file tree
Showing 9 changed files with 486 additions and 278 deletions.
6 changes: 3 additions & 3 deletions cloud/filestore/config/storage.proto
Original file line number Diff line number Diff line change
Expand Up @@ -351,11 +351,11 @@ message TStorageConfig
optional bool InMemoryIndexCacheEnabled = 371;
// Capacity of in-memory index cache, in number of entries per each table
optional uint64 InMemoryIndexCacheNodesCapacity = 372;
optional uint64 InMemoryIndexCacheNodesVerCapacity = 373;
reserved 373; // InMemoryIndexCacheNodesVerCapacity
optional uint64 InMemoryIndexCacheNodeAttrsCapacity = 374;
optional uint64 InMemoryIndexCacheNodeAttrsVerCapacity = 375;
reserved 375; // InMemoryIndexCacheNodeAttrsVerCapacity
optional uint64 InMemoryIndexCacheNodeRefsCapacity = 376;
optional uint64 InMemoryIndexCacheNodeRefsVerCapacity = 377;
reserved 377; // InMemoryIndexCacheNodeRefsVerCapacity

// Used to send non-network metrics as network ones to HIVE,
// while we use them for load balancing
Expand Down
3 changes: 0 additions & 3 deletions cloud/filestore/libs/storage/core/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,8 @@ using TAliases = NProto::TStorageConfig::TFilestoreAliases;
\
xxx(InMemoryIndexCacheEnabled, bool, false )\
xxx(InMemoryIndexCacheNodesCapacity, ui64, 0 )\
xxx(InMemoryIndexCacheNodesVerCapacity, ui64, 0 )\
xxx(InMemoryIndexCacheNodeAttrsCapacity, ui64, 0 )\
xxx(InMemoryIndexCacheNodeAttrsVerCapacity, ui64, 0 )\
xxx(InMemoryIndexCacheNodeRefsCapacity, ui64, 0 )\
xxx(InMemoryIndexCacheNodeRefsVerCapacity, ui64, 0 )\
xxx(NonNetworkMetricsBalancingFactor, ui32, 1_KB )\
\
xxx(AsyncDestroyHandleEnabled, bool, false )\
Expand Down
3 changes: 0 additions & 3 deletions cloud/filestore/libs/storage/core/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -228,11 +228,8 @@ class TStorageConfig

bool GetInMemoryIndexCacheEnabled() const;
ui64 GetInMemoryIndexCacheNodesCapacity() const;
ui64 GetInMemoryIndexCacheNodesVerCapacity() const;
ui64 GetInMemoryIndexCacheNodeAttrsCapacity() const;
ui64 GetInMemoryIndexCacheNodeAttrsVerCapacity() const;
ui64 GetInMemoryIndexCacheNodeRefsCapacity() const;
ui64 GetInMemoryIndexCacheNodeRefsVerCapacity() const;

bool GetAsyncDestroyHandleEnabled() const;
TDuration GetAsyncHandleOperationPeriod() const;
Expand Down
34 changes: 10 additions & 24 deletions cloud/filestore/libs/storage/tablet/tablet_database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1877,16 +1877,13 @@ void TIndexTabletDatabaseProxy::WriteNodeVer(
const NProto::TNode& attrs)
{
TIndexTabletDatabase::WriteNodeVer(nodeId, minCommitId, maxCommitId, attrs);
NodeUpdates.emplace_back(TInMemoryIndexState::TWriteNodeVerRequest{
.NodesVerKey = {nodeId, minCommitId},
.NodesVerRow = {.MaxCommitId = maxCommitId, .Node = attrs}});
// TODO(#1146): _Ver tables not yet supported
}

void TIndexTabletDatabaseProxy::DeleteNodeVer(ui64 nodeId, ui64 commitId)
{
TIndexTabletDatabase::DeleteNodeVer(nodeId, commitId);
NodeUpdates.emplace_back(TInMemoryIndexState::TDeleteNodeVerRequest{
.NodesVerKey{nodeId, commitId}});
// TODO(#1146): _Ver tables not yet supported
}

void TIndexTabletDatabaseProxy::WriteNodeAttr(
Expand All @@ -1906,8 +1903,8 @@ void TIndexTabletDatabaseProxy::WriteNodeAttr(
void TIndexTabletDatabaseProxy::DeleteNodeAttr(ui64 nodeId, const TString& name)
{
TIndexTabletDatabase::DeleteNodeAttr(nodeId, name);
NodeUpdates.emplace_back(TInMemoryIndexState::TDeleteNodeAttrsRequest{
.NodeAttrsKey = {nodeId, name}});
NodeUpdates.emplace_back(
TInMemoryIndexState::TDeleteNodeAttrsRequest{nodeId, name});
}

void TIndexTabletDatabaseProxy::WriteNodeAttrVer(
Expand All @@ -1925,10 +1922,7 @@ void TIndexTabletDatabaseProxy::WriteNodeAttrVer(
name,
value,
version);
NodeUpdates.emplace_back(TInMemoryIndexState::TWriteNodeAttrsVerRequest{
.NodeAttrsVerKey = {nodeId, name, minCommitId},
.NodeAttrsVerRow =
{.MaxCommitId = maxCommitId, .Value = value, .Version = version}});
// TODO(#1146): _Ver tables not yet supported
}

void TIndexTabletDatabaseProxy::DeleteNodeAttrVer(
Expand All @@ -1937,8 +1931,7 @@ void TIndexTabletDatabaseProxy::DeleteNodeAttrVer(
const TString& name)
{
TIndexTabletDatabase::DeleteNodeAttrVer(nodeId, commitId, name);
NodeUpdates.emplace_back(TInMemoryIndexState::TDeleteNodeAttrsVerRequest{
.NodeAttrsVerKey = {nodeId, name, commitId}});
// TODO(#1146): _Ver tables not yet supported
}

void TIndexTabletDatabaseProxy::WriteNodeRef(
Expand Down Expand Up @@ -1968,8 +1961,8 @@ void TIndexTabletDatabaseProxy::WriteNodeRef(
void TIndexTabletDatabaseProxy::DeleteNodeRef(ui64 nodeId, const TString& name)
{
TIndexTabletDatabase::DeleteNodeRef(nodeId, name);
NodeUpdates.emplace_back(TInMemoryIndexState::TDeleteNodeRefsRequest{
.NodeRefsKey = {nodeId, name}});
NodeUpdates.emplace_back(
TInMemoryIndexState::TDeleteNodeRefsRequest{nodeId, name});
}

void TIndexTabletDatabaseProxy::WriteNodeRefVer(
Expand All @@ -1989,13 +1982,7 @@ void TIndexTabletDatabaseProxy::WriteNodeRefVer(
childNode,
followerId,
followerName);
NodeUpdates.emplace_back(TInMemoryIndexState::TWriteNodeRefsVerRequest{
.NodeRefsVerKey = {nodeId, name, minCommitId},
.NodeRefsVerRow = {
.MaxCommitId = maxCommitId,
.ChildId = childNode,
.FollowerId = followerId,
.FollowerName = followerName}});
// TODO(#1146): _Ver tables not yet supported
}

void TIndexTabletDatabaseProxy::DeleteNodeRefVer(
Expand All @@ -2004,8 +1991,7 @@ void TIndexTabletDatabaseProxy::DeleteNodeRefVer(
const TString& name)
{
TIndexTabletDatabase::DeleteNodeRefVer(nodeId, commitId, name);
NodeUpdates.emplace_back(TInMemoryIndexState::TDeleteNodeRefsVerRequest{
.NodeRefsVerKey = {nodeId, name, commitId}});
// TODO(#1146): _Ver tables not yet supported
}

} // namespace NCloud::NFileStore::NStorage
6 changes: 2 additions & 4 deletions cloud/filestore/libs/storage/tablet/tablet_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,9 @@ void TIndexTabletState::LoadState(
Impl->NodeIndexCache.Reset(config.GetNodeIndexCacheMaxNodes());
Impl->InMemoryIndexState.Reset(
config.GetInMemoryIndexCacheNodesCapacity(),
config.GetInMemoryIndexCacheNodesVerCapacity(),
config.GetInMemoryIndexCacheNodeAttrsCapacity(),
config.GetInMemoryIndexCacheNodeAttrsVerCapacity(),
config.GetInMemoryIndexCacheNodeRefsCapacity(),
config.GetInMemoryIndexCacheNodeRefsVerCapacity());
config.GetInMemoryIndexCacheNodeRefsCapacity());

for (const auto& deletionMarker: largeDeletionMarkers) {
Impl->LargeBlocks.AddDeletionMarker(deletionMarker);
}
Expand Down
Loading

0 comments on commit 5a2bae2

Please sign in to comment.