-
Notifications
You must be signed in to change notification settings - Fork 32
[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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,7 +67,9 @@ class TIndexNode | |
TIndexNodePtr CreateSymlink(const TString& name, const TString& target); | ||
TIndexNodePtr CreateSocket(const TString& name, int flags); | ||
|
||
TVector<std::pair<TString, TFileStat>> List(bool ignoreErrors = false); | ||
TVector<NLowLevel::TDirEntry> List(bool ignoreErrors = false); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. а может не делать дефолты в параметрах? |
||
NLowLevel::TListDirResult | ||
List(uint64_t offset, size_t entriesLimit, bool ignoreErrors = false); | ||
|
||
void Rename( | ||
const TString& name, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -297,8 +297,10 @@ TFileSystemStat StatFs(const TFileHandle& handle) | |
return GetFileSystemStat(fs); | ||
} | ||
|
||
TVector<std::pair<TString, TFileStat>> ListDirAt( | ||
TListDirResult ListDirAt( | ||
const TFileHandle& handle, | ||
uint64_t offset, | ||
size_t entriesLimit, | ||
bool ignoreErrors) | ||
{ | ||
auto fd = openat(Fd(handle), ".", O_RDONLY); | ||
|
@@ -320,7 +322,11 @@ TVector<std::pair<TString, TFileStat>> ListDirAt( | |
} | ||
}; | ||
|
||
TVector<std::pair<TString, TFileStat>> results; | ||
if (offset) { | ||
seekdir(dir, offset); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. А я правильно понимаю, что opendir не переживает сейчас рестарты nfs-vhost в local режиме? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. да у нас есть issue на эту тему #2390 |
||
} | ||
|
||
TListDirResult res; | ||
|
||
errno = 0; | ||
while (auto* entry = readdir(dir)) { | ||
|
@@ -332,22 +338,34 @@ TVector<std::pair<TString, TFileStat>> ListDirAt( | |
if (ignoreErrors) { | ||
try { | ||
auto stat = StatAt(handle, name); | ||
results.emplace_back(std::move(name), stat); | ||
res.DirEntries.emplace_back(std::move(name), stat); | ||
} catch (const TServiceError& err) { | ||
errno = 0; | ||
continue; | ||
} | ||
} else { | ||
auto stat = StatAt(handle, name); | ||
results.emplace_back(std::move(name), stat); | ||
res.DirEntries.emplace_back(std::move(name), stat); | ||
} | ||
|
||
if (entriesLimit && --entriesLimit == 0) { | ||
break; | ||
} | ||
} | ||
|
||
Y_ENSURE_EX(errno == 0, TServiceError(GetSystemErrorCode()) | ||
<< "failed to list: " | ||
<< LastSystemErrorText()); | ||
|
||
return results; | ||
long loc = telldir(dir); | ||
|
||
Y_ENSURE_EX(loc != -1, TServiceError(GetSystemErrorCode()) | ||
<< "failed to telldir: " | ||
<< LastSystemErrorText()); | ||
|
||
res.DirOffset = loc; | ||
|
||
return res; | ||
} | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
почему не const?