Skip to content

[Filestore] issue-3687: implement pagination during ListNodes for local filestore #3691

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

budevg
Copy link
Collaborator

@budevg budevg commented Jun 17, 2025

Copy link
Contributor

github-actions bot commented Jun 17, 2025

Note

This is an automated comment that will be appended during run.

🔴 linux-x86_64-relwithdebinfo: some tests FAILED for commit ab547e6.

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
8599 8590 0 8 1 0

🟢 linux-x86_64-relwithdebinfo: all tests PASSED for commit ab547e6.

TESTS PASSED ERRORS FAILED SKIPPED MUTED?
41 41 0 0 0 0

@@ -123,6 +123,9 @@ message TLocalServiceConfig

// Trust guest kernel to check user permissions for fuse operations
optional bool GuestOnlyPermissionsCheckEnabled = 21;

// Max entries each list nodes will return
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

each ListNodes

struct TListDirResult
{
TVector<std::pair<TString, TFileStat>> DirEntries;
uint64_t DirOffset;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

давай проинициализируем (на всякий случай)

@@ -105,6 +105,14 @@ struct TOpenOrCreateResult

////////////////////////////////////////////////////////////////////////////////

struct TListDirResult
{
TVector<std::pair<TString, TFileStat>> DirEntries;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TVector<TDirEntry>?

}
}

res.DirOffset = telldir(dir);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

telldir может вернуть ошибку

в этом случае вылетит исключение ниже?

это не отравит нам работу с другими запросами/фсками?

@@ -123,6 +123,9 @@ message TLocalServiceConfig

// Trust guest kernel to check user permissions for fuse operations
optional bool GuestOnlyPermissionsCheckEnabled = 21;

// Max entries each list nodes will return
optional uint32 MaxEntriesPerListNodes = 22;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Предлагаю консистентный нейминг этого параметра:

xxx(MaxResponseEntries, ui32, 1000 )\

uint64_t offset = 0;
auto& cookie = request.GetCookie();
if (cookie) {
offset = FromString(cookie);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TryFromString + обработка ошибки?

return NLowLevel::ListDirAt(NodeFd, ignoreErrors);
auto res = NLowLevel::ListDirAt(
NodeFd,
0, // start at begining of dir
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

at the beginning

@@ -320,7 +322,11 @@ TVector<std::pair<TString, TFileStat>> ListDirAt(
}
};

TVector<std::pair<TString, TFileStat>> results;
if (offset) {
seekdir(dir, offset);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А я правильно понимаю, что opendir не переживает сейчас рестарты nfs-vhost в local режиме?

@@ -237,6 +245,7 @@ NProto::TListNodesResponse TLocalFileSystem::ListNodes(
ConvertStats(entry.second, *response.MutableNodes()->Add());
}

response.SetCookie(ToString(listRes.DirOffset));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://libfuse.github.io/doxygen/structfuse__lowlevel__ops.html#a65b7d7fc14d3958d7fb7d215fda20301

However, addition or removal of entries must never cause readdir() to skip over unrelated entries or to report them more than once. This means that off_t can not be a simple index that enumerates the entries that have been returned but must contain sufficient information to uniquely determine the next directory entry to return even when the set of entries is changing.

}
};

auto res = NLowLevel::ListDirAt(rootNode, 0, 5, false);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Нет теста, где limit=0

@@ -58,6 +58,55 @@ Y_UNIT_TEST_SUITE(TLowlevelTest)
res = NLowLevel::OpenOrCreateAt(node, "2.txt", O_WRONLY, 0755);
UNIT_ASSERT(!res.WasCreated);
}

Y_UNIT_TEST(ShouldDoIterativeListDir)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

@SvartMetal SvartMetal Jun 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants