Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue-1146: decrease verbosity of loading nodes and noderefs and add option to space out this loading over time #2899

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions cloud/filestore/config/storage.proto
Original file line number Diff line number Diff line change
Expand Up @@ -512,4 +512,7 @@ message TStorageConfig
// proportional to the aforementioned value multiplied my the size of
// TRange
optional uint64 MixedBlocksOffloadedRangesCapacity = 415;

// During the InMemoryIndexCache load, the time between the batches loading
optional uint32 InMemoryIndexCacheLoadScheduleTimeout = 416;
debnatkh marked this conversation as resolved.
Show resolved Hide resolved
}
3 changes: 3 additions & 0 deletions cloud/filestore/libs/storage/core/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,9 @@ using TAliases = NProto::TStorageConfig::TFilestoreAliases;
xxx(InMemoryIndexCacheNodesToNodeRefsCapacityRatio, ui64, 0 )\
xxx(InMemoryIndexCacheLoadOnTabletStart, bool, false )\
xxx(InMemoryIndexCacheLoadOnTabletStartRowsPerTx, ui64, 1000000 )\
debnatkh marked this conversation as resolved.
Show resolved Hide resolved
xxx(InMemoryIndexCacheLoadScheduleTimeout, \
TDuration, \
TDuration::MilliSeconds(0) )\
SvartMetal marked this conversation as resolved.
Show resolved Hide resolved
\
xxx(NonNetworkMetricsBalancingFactor, ui32, 1_KB )\
\
Expand Down
1 change: 1 addition & 0 deletions cloud/filestore/libs/storage/core/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ class TStorageConfig
ui64 GetInMemoryIndexCacheNodesToNodeRefsCapacityRatio() const;
bool GetInMemoryIndexCacheLoadOnTabletStart() const;
ui64 GetInMemoryIndexCacheLoadOnTabletStartRowsPerTx() const;
TDuration GetInMemoryIndexCacheLoadScheduleTimeout() const;

bool GetAsyncDestroyHandleEnabled() const;
TDuration GetAsyncHandleOperationPeriod() const;
Expand Down
27 changes: 25 additions & 2 deletions cloud/filestore/libs/storage/tablet/tablet_actor_loadstate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,21 +313,44 @@ void TIndexTabletActor::CompleteTx_LoadState(
{
const ui64 maxRows =
Config->GetInMemoryIndexCacheLoadOnTabletStartRowsPerTx();
const TDuration timeout =
Config->GetInMemoryIndexCacheLoadScheduleTimeout();

// If necessary, code can iteratively call ReadNodeRefs for all nodes.
// This will populate cache with node refs and allow us to perform
// ListNodes using in-memory index state by knowing that the nodeRefs
// cache is exhaustive
LOG_INFO(
ctx,
TFileStoreComponents::TABLET,
"%s LoadNodeRefs started (maxNodeRefs: %lu, timeout: %s)",
LogTag.c_str(),
maxRows,
timeout.ToString());
ctx.Send(
SelfId(),
new TEvIndexTabletPrivate::TEvLoadNodeRefsRequest(0, "", maxRows));
new TEvIndexTabletPrivate::TEvLoadNodeRefsRequest(
0,
"",
maxRows,
timeout));

// Same logic is performed for batch loading nodes as well. The only
// difference is that we do not need to keep track of the exhaustiveness
// of the cache
LOG_INFO(
ctx,
TFileStoreComponents::TABLET,
"%s LoadNodes started (maxNodes: %lu, timeout: %s)",
LogTag.c_str(),
maxRows,
timeout.ToString());
ctx.Send(
SelfId(),
new TEvIndexTabletPrivate::TEvLoadNodesRequest(0, maxRows));
new TEvIndexTabletPrivate::TEvLoadNodesRequest(
0,
maxRows,
timeout));
}

ScheduleSyncSessions(ctx);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ bool TIndexTabletActor::ValidateTx_LoadNodeRefs(
const TActorContext& ctx,
TTxIndexTablet::TLoadNodeRefs& args)
{
LOG_INFO(
LOG_DEBUG(
ctx,
TFileStoreComponents::TABLET,
"%s LoadingNodeRefs (nodeId: %lu, name: %s, maxNodeRefs: %lu)",
Expand All @@ -36,7 +36,7 @@ bool TIndexTabletActor::PrepareTx_LoadNodeRefs(
args.NextNodeId,
args.NextCookie);

LOG_INFO(
LOG_DEBUG(
ctx,
TFileStoreComponents::TABLET,
"%s LoadingNodeRefs (nodeId: %lu, name: %s, maxNodeRefs: %lu), read "
Expand All @@ -55,7 +55,7 @@ void TIndexTabletActor::CompleteTx_LoadNodeRefs(
const TActorContext& ctx,
TTxIndexTablet::TLoadNodeRefs& args)
{
LOG_INFO(
LOG_DEBUG(
ctx,
TFileStoreComponents::TABLET,
"%s LoadNodeRefs iteration completed, next nodeId: %lu, next cookie: "
Expand All @@ -70,7 +70,8 @@ void TIndexTabletActor::CompleteTx_LoadNodeRefs(
new TEvIndexTabletPrivate::TEvLoadNodeRefsRequest(
args.NextNodeId,
args.NextCookie,
args.MaxNodeRefs));
args.MaxNodeRefs,
args.ScheduleTimeout));
} else {
LOG_INFO(
ctx,
Expand All @@ -90,7 +91,7 @@ void TIndexTabletActor::HandleLoadNodeRefsRequest(
{
auto* msg = ev->Get();

LOG_INFO(
LOG_DEBUG(
ctx,
TFileStoreComponents::TABLET,
"%s LoadNodeRefs iteration started (nodeId: %lu, name: %s, "
Expand All @@ -109,7 +110,8 @@ void TIndexTabletActor::HandleLoadNodeRefsRequest(
std::move(requestInfo),
msg->NodeId,
msg->Cookie,
msg->MaxNodeRefs);
msg->MaxNodeRefs,
msg->ScheduleTimeout);
}

} // namespace NCloud::NFileStore::NStorage
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ bool TIndexTabletActor::ValidateTx_LoadNodes(
const TActorContext& ctx,
TTxIndexTablet::TLoadNodes& args)
{
LOG_INFO(
LOG_DEBUG(
ctx,
TFileStoreComponents::TABLET,
"%s LoadingNodes (nodeId: %lu, maxNodes: %lu)",
Expand All @@ -31,7 +31,7 @@ bool TIndexTabletActor::PrepareTx_LoadNodes(
bool ready =
db.ReadNodes(args.NodeId, args.MaxNodes, args.NextNodeId, nodes);

LOG_INFO(
LOG_DEBUG(
ctx,
TFileStoreComponents::TABLET,
"%s LoadingNodes (nodeId: %lu, maxNodes: %lu), read %lu nodes: %s",
Expand All @@ -48,7 +48,7 @@ void TIndexTabletActor::CompleteTx_LoadNodes(
const TActorContext& ctx,
TTxIndexTablet::TLoadNodes& args)
{
LOG_INFO(
LOG_DEBUG(
ctx,
TFileStoreComponents::TABLET,
"%s LoadNodes iteration completed, next nodeId: %lu",
Expand All @@ -60,7 +60,8 @@ void TIndexTabletActor::CompleteTx_LoadNodes(
SelfId(),
new TEvIndexTabletPrivate::TEvLoadNodesRequest(
args.NextNodeId,
args.MaxNodes));
args.MaxNodes,
args.ScheduleTimeout));
} else {
LOG_INFO(
ctx,
Expand All @@ -78,7 +79,7 @@ void TIndexTabletActor::HandleLoadNodesRequest(
{
auto* msg = ev->Get();

LOG_INFO(
LOG_DEBUG(
ctx,
TFileStoreComponents::TABLET,
"%s LoadNodes iteration started (nodeId: %lu, maxNodes: %lu)",
Expand All @@ -94,7 +95,8 @@ void TIndexTabletActor::HandleLoadNodesRequest(
ctx,
std::move(requestInfo),
msg->NodeId,
msg->MaxNodes);
msg->MaxNodes,
msg->ScheduleTimeout);
}

} // namespace NCloud::NFileStore::NStorage
10 changes: 8 additions & 2 deletions cloud/filestore/libs/storage/tablet/tablet_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -534,14 +534,17 @@ struct TEvIndexTabletPrivate
const ui64 NodeId;
const TString Cookie;
const ui32 MaxNodeRefs;
const TDuration ScheduleTimeout;

TLoadNodeRefsRequest(
ui64 nodeId,
TString cookie,
ui32 maxNodeRefs)
ui32 maxNodeRefs,
TDuration scheduleTimeout)
: NodeId(nodeId)
, Cookie(std::move(cookie))
, MaxNodeRefs(maxNodeRefs)
, ScheduleTimeout(scheduleTimeout)
{}
};

Expand All @@ -553,12 +556,15 @@ struct TEvIndexTabletPrivate
{
const ui64 NodeId;
const ui32 MaxNodes;
const TDuration ScheduleTimeout;

TLoadNodesRequest(
ui64 nodeId,
ui32 maxNodes)
ui32 maxNodes,
TDuration scheduleTimeout)
: NodeId(nodeId)
, MaxNodes(maxNodes)
, ScheduleTimeout(scheduleTimeout)
{}
};

Expand Down
10 changes: 8 additions & 2 deletions cloud/filestore/libs/storage/tablet/tablet_tx.h
Original file line number Diff line number Diff line change
Expand Up @@ -2256,6 +2256,7 @@ struct TTxIndexTablet
const ui64 NodeId;
const TString Cookie;
const ui64 MaxNodeRefs;
const TDuration ScheduleTimeout;

ui64 NextNodeId = 0;
TString NextCookie;
Expand All @@ -2264,11 +2265,13 @@ struct TTxIndexTablet
TRequestInfoPtr requestInfo,
ui64 nodeId,
TString cookie,
ui64 maxNodeRefs)
ui64 maxNodeRefs,
TDuration scheduleTimeout)
: RequestInfo(std::move(requestInfo))
, NodeId(nodeId)
, Cookie(std::move(cookie))
, MaxNodeRefs(maxNodeRefs)
, ScheduleTimeout(scheduleTimeout)
{}

void Clear()
Expand All @@ -2289,16 +2292,19 @@ struct TTxIndexTablet
const TRequestInfoPtr RequestInfo;
const ui64 NodeId;
const ui64 MaxNodes;
const TDuration ScheduleTimeout;

ui64 NextNodeId = 0;

TLoadNodes(
TRequestInfoPtr requestInfo,
ui64 nodeId,
ui64 maxNodes)
ui64 maxNodes,
TDuration scheduleTimeout)
: RequestInfo(std::move(requestInfo))
, NodeId(nodeId)
, MaxNodes(maxNodes)
, ScheduleTimeout(scheduleTimeout)
{}

void Clear()
Expand Down
2 changes: 2 additions & 0 deletions cloud/filestore/libs/storage/tablet/tablet_ut_cache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -920,6 +920,8 @@ Y_UNIT_TEST_SUITE(TIndexTabletTest_NodesCache)
storageConfig.SetInMemoryIndexCacheNodeRefsCapacity(100);
storageConfig.SetInMemoryIndexCacheLoadOnTabletStart(true);
storageConfig.SetInMemoryIndexCacheLoadOnTabletStartRowsPerTx(1);
storageConfig.SetInMemoryIndexCacheLoadScheduleTimeout(
TDuration::Seconds(1).MilliSeconds());
TTestEnv env({}, storageConfig);
env.CreateSubDomain("nfs");

Expand Down
Loading