Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
proller committed Oct 18, 2024
1 parent a4b51b0 commit 7a02c7e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
5 changes: 2 additions & 3 deletions cloud/filestore/tools/testing/loadtest/lib/request_replay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,8 @@ IReplayRequestGenerator::ExecuteNextRequest()
RequestName(request.GetRequestType()).c_str(),
request.ShortDebugString().Quote().c_str());

if (const auto future = ProcessRequest(request);
future.Initialized())
{
const auto future = ProcessRequest(request);
if (future.Initialized()) {
return future;
}
}
Expand Down
32 changes: 17 additions & 15 deletions cloud/filestore/tools/testing/loadtest/lib/request_replay_fs.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
TODO:
TODO(#1733):
create file/dir modes
create handle modes (now rw)
create handle modes (now only rw)
compare log and actual result ( S_OK E_FS_NOENT ...)
read/write with multiranges (now only first processed)
*/
Expand Down Expand Up @@ -51,7 +51,7 @@ class TReplayRequestGeneratorFs final
// Map between log and actual local fs node id's
THashMap<TNodeLog, TNodeLocal> NodesLogToLocal{{RootNodeId, RootNodeId}};

// Relative to local root path of node. Dirs ends with /
// Full path of node
THashMap<TNodeLocal, TFsPath> NodePath;

// Collected info for log node id's
Expand All @@ -68,6 +68,7 @@ class TReplayRequestGeneratorFs final
THashMap<THandleLocal, TFile> OpenHandles;

const TString LostName = "__lost__";
const TString UnknownNodeNamePrefix = "_nodeid_";

public:
TReplayRequestGeneratorFs(
Expand Down Expand Up @@ -187,16 +188,17 @@ class TReplayRequestGeneratorFs final

{
auto parentPath = PathByNode(NodeIdMapped(it->second.ParentLog));
if (parentPath.IsDefined() && parent) {
if (!parentPath.IsDefined() && parent != InvalidNodeId) {
parentPath = PathByNode(parent);
}
if (parentPath.IsDefined()) {
parentPath = PathByNode(RootNodeId) / LostName / "_nodeid_" +
ToString(it->second.ParentLog);
if (!parentPath.IsDefined()) {
parentPath =
PathByNode(RootNodeId) / LostName / UnknownNodeNamePrefix +
ToString(it->second.ParentLog);
}
const auto name =
parentPath / (it->second.Name.empty()
? "_nodeid_" + ToString(nodeIdLog)
? UnknownNodeNamePrefix + ToString(nodeIdLog)
: it->second.Name);
const auto nodeId = MakeDirectoryRecursive(name);
NodePath[nodeId] = name;
Expand Down Expand Up @@ -261,14 +263,15 @@ class TReplayRequestGeneratorFs final
}

if (parentNode == InvalidNodeId) {
STORAGE_ERROR(
"Create handle %lu fail: no parent=%lu",
logRequest.GetNodeInfo().GetHandle(),
logRequest.GetNodeInfo().GetParentNodeId());
return MakeFuture(TCompletedRequest{
NProto::ACTION_CREATE_HANDLE,
Started,
MakeError(E_FAIL, "cancelled")});
MakeError(
E_FAIL,
Sprintf(
"Create handle %lu fail: no parent=%lu",
logRequest.GetNodeInfo().GetHandle(),
logRequest.GetNodeInfo().GetParentNodeId()))});
}

auto nodeName = logRequest.GetNodeInfo().GetNodeName();
Expand Down Expand Up @@ -573,7 +576,7 @@ class TReplayRequestGeneratorFs final
break;
}
case NProto::E_LINK_NODE: {
// {"TimestampMcs":1727703903595285,"DurationMcs":2432,"RequestType":26,"ErrorCode":0,"NodeInfo":{"NewParentNodeId":267,"NewNodeName":"pack-ebe666445578da0c6157f4172ad581cd731742ec.idx","Mode":292,"Type":3,"NodeId":274,"Size":245792}}
// {"TimestampMcs":1000000000000000,"DurationMcs":2432,"RequestType":26,"ErrorCode":0,"NodeInfo":{"NewParentNodeId":267,"NewNodeName":"name.ext","Mode":292,"Type":3,"NodeId":274,"Size":245792}}

const auto targetNode =
NodeIdMapped(logRequest.GetNodeInfo().GetNodeId());
Expand Down Expand Up @@ -605,7 +608,6 @@ class TReplayRequestGeneratorFs final
nodeid = TFileStat{fullName}.INode;
}

// CreateIfMissing(PathByNode())
if (nodeid) {
NodesLogToLocal[logRequest.GetNodeInfo().GetNodeId()] = nodeid;
NodePath[nodeid] = PathByNode(parentNode) /
Expand Down

0 comments on commit 7a02c7e

Please sign in to comment.