Skip to content

[Filestore] Proper byte size calculation in ReadNodeRefs upon ListNodes #5148

@debnatkh

Description

@debnatkh

The ReadNodeRefs function in

bytes += refs.back().Name.size();
has a FIXME regarding byte size calculation. The current implementation uses an incorrect size estimation.

There are two problems with that:

  1. When we precharge nodeRefs, we take into consideration the entire row size, but when we iterate over them, we only take into consideration the name size, meaning that we definitely will not precharge enough bytes and force the PrepareTx restart:

  2. Different callers may need different size calculations depending on their target, specifically:

  • DirEntry: FUSE fuse_dirent size (FUSE_DIRENT_ALIGN(24 + namelen))
  • DirEntryPlus: FUSE fuse_direntplus size (includes fuse_entry_out ~120+ bytes + dirent)
  • (optional) Legacy: name.size() only (original behavior)
  • (optional) RefSize: Full TNodeRef struct size (sizeof(ui64) * 4 + Name.size() + ShardId.size() + ShardNodeName.size())

This is needed, because API explicitly specifies: https://libfuse.github.io/doxygen/structfuse__lowlevel__ops.html#af621ef96ffc2a71af8c7768c109b880e

Send a buffer filled using fuse_add_direntry(), with size not exceeding the requested size. Send an empty buffer on end of stream.

Metadata

Metadata

Assignees

Labels

filestoreAdd this label to run only cloud/filestore build and tests on PR

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions