Skip to content

issue-1751 [Filestore]: Create a tool to manipulate state files of WriteBackCache - #6563

Closed
e673 wants to merge 5 commits into
mainfrom
users/nasonov/wbc-toolset
Closed

e673 wants to merge 5 commits into
mainfrom
users/nasonov/wbc-toolset

Conversation

@e673

@e673 e673 commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

Notes

Usage: ./filestore-write-back-cache-state-tool [OPTIONS] command

Options:
  --svnrevision        print svn version
  {-?|--help}          print usage
  --state-dir STR      path to a directory with write-back cache state files
                       (default: "/Berkanavt/nfs-vhost/state")
  --fs-id STR          file system id
  --session-id STR     session id (can be omitted if there is only a single
                       session)
  --state-file STR     state file path (can be used instead of
                       <state_dir>/<fs_id>/<session_id>)
  {-I|--input} STR     provide arguments for 'patch' command
  {-O|--output} STR    write results of 'dump' command to the provided file
  --unsafe-ignore-lock do not check and acquire advisory lock (dangerous, will
                       be removed) (default: 0)

Free args: min: 1, max: 1
  command  specify command:
  - list: list states and give summary;
  - check: check integrity of the state file;
  - dump: output the contents of the state file in a JSON format, the payload is replaced with a hash;
  - patch: apply changes to the data returned by 'dump' command.

Issue

#1751

@github-actions

github-actions Bot commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

Note

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

Note

All workloads for linux-x86_64-relwithdebinfo have completed.

Tip

Planned checks for linux-x86_64-relwithdebinfo.

🟢 linux-x86_64-relwithdebinfo target: cloud/tasks/,cloud/storage/ (test time: 262s): all tests PASSED for commit 58518c4.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
1183 1183 0 0 0 0 0

🟢 linux-x86_64-relwithdebinfo target: cloud/disk_manager/ (test time: 257s): all tests PASSED for commit 58518c4.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
1562 1562 0 0 0 0 0

🔴 linux-x86_64-relwithdebinfo target: cloud/blockstore/ (test time: 1923s): some tests FAILED for commit 58518c4.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
6807 6651 0 12 0 144 0

🟢 linux-x86_64-relwithdebinfo target: cloud/blockstore/ (test time: 122s): all tests PASSED for commit 58518c4.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
674 674 0 0 0 0 0

🔴 linux-x86_64-relwithdebinfo target: cloud/filestore/ (test time: 4885s): some tests FAILED for commit 58518c4.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
4135 4134 0 1 0 0 0

🟢 linux-x86_64-relwithdebinfo target: cloud/filestore/ (test time: 62s): all tests PASSED for commit 58518c4.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
2 2 0 0 0 0 0

@e673
e673 force-pushed the users/nasonov/wbc-toolset branch from 58518c4 to 034c95e Compare July 21, 2026 20:42
@github-actions

github-actions Bot commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

Note

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

Note

All workloads for linux-x86_64-relwithdebinfo have completed.

Tip

Planned checks for linux-x86_64-relwithdebinfo.

🟢 linux-x86_64-relwithdebinfo target: cloud/tasks/,cloud/storage/ (test time: 255s): all tests PASSED for commit 034c95e.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
1183 1183 0 0 0 0 0

🟢 linux-x86_64-relwithdebinfo target: cloud/disk_manager/ (test time: 279s): all tests PASSED for commit 034c95e.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
1562 1562 0 0 0 0 0

🟢 linux-x86_64-relwithdebinfo target: cloud/blockstore/ (test time: 1522s): all tests PASSED for commit 034c95e.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
6807 6806 0 0 0 1 0

🔴 linux-x86_64-relwithdebinfo target: cloud/filestore/ (test time: 5067s): some tests FAILED for commit 034c95e.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
4135 4134 0 1 0 0 0

🟢 linux-x86_64-relwithdebinfo target: cloud/filestore/ (test time: 56s): all tests PASSED for commit 034c95e.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
2 2 0 0 0 0 0

@e673
e673 force-pushed the users/nasonov/wbc-toolset branch from 034c95e to d961043 Compare July 22, 2026 12:17
@github-actions

github-actions Bot commented Jul 22, 2026 •

Copy link
Copy Markdown
Contributor

Note

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

Note

All workloads for linux-x86_64-relwithdebinfo have completed.

Tip

Planned checks for linux-x86_64-relwithdebinfo.

🔴 linux-x86_64-relwithdebinfo target: cloud/disk_manager/ (test time: 254s): some tests FAILED for commit d961043.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
1562 1561 0 1 0 0 0

🟢 linux-x86_64-relwithdebinfo target: cloud/tasks/,cloud/storage/ (test time: 257s): all tests PASSED for commit d961043.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
1183 1183 0 0 0 0 0

🟢 linux-x86_64-relwithdebinfo target: cloud/disk_manager/ (test time: 211s): all tests PASSED for commit d961043.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
48 48 0 0 0 0 0

🟢 linux-x86_64-relwithdebinfo target: cloud/blockstore/ (test time: 1324s): all tests PASSED for commit d961043.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
6807 6806 0 0 0 1 0

🟢 linux-x86_64-relwithdebinfo target: cloud/filestore/ (test time: 4935s): all tests PASSED for commit d961043.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
4135 4135 0 0 0 0 0

@e673
e673 force-pushed the users/nasonov/wbc-toolset branch from d961043 to 6649903 Compare July 23, 2026 21:48
@github-actions

github-actions Bot commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

Note

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

Note

All workloads for linux-x86_64-relwithdebinfo have completed.

Tip

Planned checks for linux-x86_64-relwithdebinfo.

🟢 linux-x86_64-relwithdebinfo target: cloud/tasks/,cloud/storage/ (test time: 257s): all tests PASSED for commit 6649903.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
1183 1183 0 0 0 0 0

🟢 linux-x86_64-relwithdebinfo target: cloud/disk_manager/ (test time: 263s): all tests PASSED for commit 6649903.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
1562 1562 0 0 0 0 0

🟢 linux-x86_64-relwithdebinfo target: cloud/blockstore/ (test time: 1407s): all tests PASSED for commit 6649903.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
6807 6806 0 0 0 1 0

🟢 linux-x86_64-relwithdebinfo target: cloud/filestore/ (test time: 4837s): all tests PASSED for commit 6649903.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
4135 4135 0 0 0 0 0

@e673
e673 force-pushed the users/nasonov/wbc-toolset branch from 6649903 to 9dd79ea Compare July 24, 2026 12:47
@github-actions

github-actions Bot commented Jul 24, 2026 •

Copy link
Copy Markdown
Contributor

Note

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

Note

All workloads for linux-x86_64-relwithdebinfo have completed.

Tip

Planned checks for linux-x86_64-relwithdebinfo.

🟢 linux-x86_64-relwithdebinfo target: cloud/tasks/,cloud/storage/ (test time: 259s): all tests PASSED for commit 9dd79ea.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
1183 1183 0 0 0 0 0

🟢 linux-x86_64-relwithdebinfo target: cloud/disk_manager/ (test time: 254s): all tests PASSED for commit 9dd79ea.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
1562 1562 0 0 0 0 0

🟢 linux-x86_64-relwithdebinfo target: cloud/blockstore/ (test time: 1373s): all tests PASSED for commit 9dd79ea.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
6807 6806 0 0 0 1 0

🟢 linux-x86_64-relwithdebinfo target: cloud/filestore/ (test time: 4776s): all tests PASSED for commit 9dd79ea.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
4135 4135 0 0 0 0 0

@e673
e673 force-pushed the users/nasonov/wbc-toolset branch from 9dd79ea to 918e018 Compare July 28, 2026 21:35
@github-actions

github-actions Bot commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

Note

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

Note

All workloads for linux-x86_64-relwithdebinfo have completed.

Tip

Planned checks for linux-x86_64-relwithdebinfo.

🟢 linux-x86_64-relwithdebinfo target: cloud/tasks/,cloud/storage/ (test time: 263s): all tests PASSED for commit 918e018.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
1227 1227 0 0 0 0 0

🟢 linux-x86_64-relwithdebinfo target: cloud/disk_manager/ (test time: 279s): all tests PASSED for commit 918e018.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
1589 1589 0 0 0 0 0

🟢 linux-x86_64-relwithdebinfo target: cloud/blockstore/ (test time: 1347s): all tests PASSED for commit 918e018.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
6864 6863 0 0 0 1 0

🟢 linux-x86_64-relwithdebinfo target: cloud/filestore/ (test time: 5000s): all tests PASSED for commit 918e018.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
4354 4354 0 0 0 0 0

@e673
e673 force-pushed the users/nasonov/wbc-toolset branch from 918e018 to 6794961 Compare July 28, 2026 23:57
@github-actions

github-actions Bot commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

Note

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

Note

All workloads for linux-x86_64-relwithdebinfo have completed.

Tip

Planned checks for linux-x86_64-relwithdebinfo.

🟢 linux-x86_64-relwithdebinfo target: cloud/tasks/,cloud/storage/ (test time: 257s): all tests PASSED for commit 6794961.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
1227 1227 0 0 0 0 0

🟢 linux-x86_64-relwithdebinfo target: cloud/disk_manager/ (test time: 270s): all tests PASSED for commit 6794961.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
1589 1589 0 0 0 0 0

🟢 linux-x86_64-relwithdebinfo target: cloud/blockstore/ (test time: 1137s): all tests PASSED for commit 6794961.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
6864 6863 0 0 0 1 0

🟢 linux-x86_64-relwithdebinfo target: cloud/filestore/ (test time: 4651s): all tests PASSED for commit 6794961.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
4354 4354 0 0 0 0 0

@e673
e673 force-pushed the users/nasonov/wbc-toolset branch from 6794961 to 7e2f409 Compare July 30, 2026 21:37
@github-actions

github-actions Bot commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

Note

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

Note

All workloads for linux-x86_64-relwithdebinfo have completed.

Tip

Planned checks for linux-x86_64-relwithdebinfo.

🔴 linux-x86_64-relwithdebinfo target: cloud/disk_manager/ (test time: 36s): some tests FAILED for commit 7e2f409.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
360 0 0 0 360 0 0

🔴 linux-x86_64-relwithdebinfo target: cloud/tasks/,cloud/storage/ (test time: 258s): some tests FAILED for commit 7e2f409.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
1274 1273 0 1 0 0 0

🔴 linux-x86_64-relwithdebinfo target: cloud/tasks/,cloud/storage/ (test time: 11s): some tests FAILED for commit 7e2f409.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
2 1 0 1 0 0 0

🔴 linux-x86_64-relwithdebinfo target: cloud/tasks/,cloud/storage/ (test time: 10s): some tests FAILED for commit 7e2f409.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
2 1 0 1 0 0 0

🟢 linux-x86_64-relwithdebinfo target: cloud/disk_manager/ (test time: 258s): all tests PASSED for commit 7e2f409.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
1589 1589 0 0 0 0 0

🔴 linux-x86_64-relwithdebinfo target: cloud/blockstore/ (test time: 1240s): some tests FAILED for commit 7e2f409.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
6911 6909 0 1 0 1 0

🔴 linux-x86_64-relwithdebinfo target: cloud/blockstore/ (test time: 23s): some tests FAILED for commit 7e2f409.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
2 1 0 1 0 0 0

🔴 linux-x86_64-relwithdebinfo target: cloud/blockstore/ (test time: 13s): some tests FAILED for commit 7e2f409.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
2 1 0 1 0 0 0

@github-actions

github-actions Bot commented Jul 30, 2026 •

Copy link
Copy Markdown
Contributor

Note

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

Note

All workloads for linux-x86_64-relwithdebinfo have completed.

Tip

Planned checks for linux-x86_64-relwithdebinfo.

🟢 linux-x86_64-relwithdebinfo target: cloud/tasks/,cloud/storage/ (test time: 263s): all tests PASSED for commit cb2203d.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
1274 1274 0 0 0 0 0

🟢 linux-x86_64-relwithdebinfo target: cloud/disk_manager/ (test time: 290s): all tests PASSED for commit cb2203d.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
1589 1589 0 0 0 0 0

🟢 linux-x86_64-relwithdebinfo target: cloud/blockstore/ (test time: 1263s): all tests PASSED for commit cb2203d.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
6911 6910 0 0 0 1 0

🟢 linux-x86_64-relwithdebinfo target: cloud/filestore/ (test time: 4792s): all tests PASSED for commit cb2203d.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
4401 4401 0 0 0 0 0

@e673
e673 force-pushed the users/nasonov/wbc-toolset branch from cb2203d to 5cc96a1 Compare July 31, 2026 11:44
@e673
e673 marked this pull request as ready for review July 31, 2026 11:44
@e673
e673 requested review from SvartMetal, Copilot and neihar July 31, 2026 11:44
@github-actions

github-actions Bot commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

Note

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

Note

All workloads for linux-x86_64-relwithdebinfo have completed.

Tip

Planned checks for linux-x86_64-relwithdebinfo.

🟢 linux-x86_64-relwithdebinfo target: cloud/tasks/,cloud/storage/ (test time: 258s): all tests PASSED for commit 5cc96a1.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
1290 1290 0 0 0 0 0

🟢 linux-x86_64-relwithdebinfo target: cloud/disk_manager/ (test time: 278s): all tests PASSED for commit 5cc96a1.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
1600 1600 0 0 0 0 0

🟢 linux-x86_64-relwithdebinfo target: cloud/blockstore/ (test time: 1610s): all tests PASSED for commit 5cc96a1.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
6947 6946 0 0 0 1 0

🔴 linux-x86_64-relwithdebinfo target: cloud/filestore/ (test time: 5312s): some tests FAILED for commit 5cc96a1.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
4497 4488 0 2 0 7 0

🟢 linux-x86_64-relwithdebinfo target: cloud/filestore/ (test time: 399s): all tests PASSED for commit 5cc96a1.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
71 71 0 0 0 0 0

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR adds an operational tool for inspecting and patching filestore write-back cache state files, and refactors the underlying file ring buffer implementation by introducing an accessor/validator layer (including updated format capabilities and test coverage). It also drops support for the legacy V4 file ring buffer format and adjusts migrations/tests accordingly.

Changes:

  • Introduced TFileRingBufferAccessor / TFileMapFileRingBufferAccessor to centralize mapping + validation of file ring buffer state.
  • Added filestore-write-back-cache-state-tool (list/check/dump/patch) plus supporting library/protos and unit tests.
  • Removed V4 format support from ring buffer format code and updated ring buffer migration behavior and tests.

Reviewed changes

Copilot reviewed 22 out of 28 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
cloud/storage/core/libs/file_backed_containers/ya.make Adds new accessor source to the library build.
cloud/storage/core/libs/file_backed_containers/ut/ya.make Adds new accessor unit test to the test build.
cloud/storage/core/libs/file_backed_containers/file_ring_buffer.cpp Refactors ring buffer to use accessor; adjusts migration/validation paths.
cloud/storage/core/libs/file_backed_containers/file_ring_buffer_ut.cpp Updates tests for removed V4 support and revised migration semantics.
cloud/storage/core/libs/file_backed_containers/file_ring_buffer_format.h Removes V4 enum; adds atomic-processing capability flag.
cloud/storage/core/libs/file_backed_containers/file_ring_buffer_format.cpp Removes V4 processor; wires new capability flag; updates supported versions.
cloud/storage/core/libs/file_backed_containers/file_ring_buffer_format_ut.cpp Drops V4 from format test version matrix.
cloud/storage/core/libs/file_backed_containers/file_ring_buffer_accessor.h New accessor API for raw data/header/processor/capabilities.
cloud/storage/core/libs/file_backed_containers/file_ring_buffer_accessor.cpp New mapping/validation implementation for ring buffer files.
cloud/storage/core/libs/file_backed_containers/file_ring_buffer_accessor_ut.cpp Unit tests for accessor validation behavior.
cloud/filestore/tools/ya.make Registers the new ops tool subtree.
cloud/filestore/tools/ops/write_back_cache_state_tool/ya.make Adds ya.make for the new tool component.
cloud/filestore/tools/ops/write_back_cache_state_tool/README.md Documents tool usage, commands, options, and safety notes.
cloud/filestore/tools/ops/write_back_cache_state_tool/protos/ya.make Adds protobuf library target for tool data model.
cloud/filestore/tools/ops/write_back_cache_state_tool/protos/write_back_cache_state_tool.proto Defines dump/list models used for JSON I/O and patching.
cloud/filestore/tools/ops/write_back_cache_state_tool/lib/ya.make Adds tool library target (locator + processor).
cloud/filestore/tools/ops/write_back_cache_state_tool/lib/ut/ya.make Adds unit test target for the tool library.
cloud/filestore/tools/ops/write_back_cache_state_tool/lib/state_file_processor.h Declares dump/patch operations over ring buffer accessor.
cloud/filestore/tools/ops/write_back_cache_state_tool/lib/state_file_processor.cpp Implements dump/patch logic and patch validation rules.
cloud/filestore/tools/ops/write_back_cache_state_tool/lib/state_file_processor_ut.cpp Unit tests for dump/patch behavior and safety checks.
cloud/filestore/tools/ops/write_back_cache_state_tool/lib/state_file_locator.h Locator interface for discovering state files.
cloud/filestore/tools/ops/write_back_cache_state_tool/lib/state_file_locator.cpp Implements directory traversal + lock probing + selection logic.
cloud/filestore/tools/ops/write_back_cache_state_tool/bin/ya.make Adds the tool binary build target.
cloud/filestore/tools/ops/write_back_cache_state_tool/bin/options.h Declares CLI options and command enum.
cloud/filestore/tools/ops/write_back_cache_state_tool/bin/options.cpp Parses CLI options and free-arg command.
cloud/filestore/tools/ops/write_back_cache_state_tool/bin/main.cpp Tool entrypoint with exception-to-stderr handling.
cloud/filestore/tools/ops/write_back_cache_state_tool/bin/app.h Declares AppMain.
cloud/filestore/tools/ops/write_back_cache_state_tool/bin/app.cpp Implements command dispatch and file open/lock/map workflow.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cloud/storage/core/libs/file_backed_containers/file_ring_buffer_accessor.cpp Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5cc96a162a

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread cloud/filestore/tools/ops/write_back_cache_state_tool/bin/app.cpp
@e673
e673 force-pushed the users/nasonov/wbc-toolset branch from 5cc96a1 to 837be59 Compare July 31, 2026 20:35
@github-actions

github-actions Bot commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

Note

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

Note

All workloads for linux-x86_64-relwithdebinfo have completed.

Tip

Planned checks for linux-x86_64-relwithdebinfo.

🟢 linux-x86_64-relwithdebinfo target: cloud/tasks/,cloud/storage/ (test time: 260s): all tests PASSED for commit 837be59.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
1306 1306 0 0 0 0 0

🟢 linux-x86_64-relwithdebinfo target: cloud/disk_manager/ (test time: 287s): all tests PASSED for commit 837be59.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
1604 1604 0 0 0 0 0

🟢 linux-x86_64-relwithdebinfo target: cloud/blockstore/ (test time: 1645s): all tests PASSED for commit 837be59.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
6963 6962 0 0 0 1 0

@e673
e673 force-pushed the users/nasonov/wbc-toolset branch from 837be59 to a9e64cf Compare August 6, 2026 21:39
@e673
e673 force-pushed the users/nasonov/wbc-toolset branch from a9e64cf to 437b4a1 Compare August 7, 2026 12:05
@github-actions

github-actions Bot commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

Note

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

Note

All workloads for linux-x86_64-relwithdebinfo have completed.

Tip

Planned checks for linux-x86_64-relwithdebinfo.

🟢 linux-x86_64-relwithdebinfo target: cloud/tasks/,cloud/storage/ (test time: 267s): all tests PASSED for commit 437b4a1.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
1311 1311 0 0 0 0 0

🟢 linux-x86_64-relwithdebinfo target: cloud/disk_manager/ (test time: 292s): all tests PASSED for commit 437b4a1.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
1613 1613 0 0 0 0 0

🟢 linux-x86_64-relwithdebinfo target: cloud/blockstore/ (test time: 1643s): all tests PASSED for commit 437b4a1.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
6971 6970 0 0 0 1 0

🔴 linux-x86_64-relwithdebinfo target: cloud/filestore/ (test time: 5003s): some tests FAILED for commit 437b4a1.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
4432 4431 0 0 1 0 0

🔴 linux-x86_64-relwithdebinfo target: cloud/filestore/ (test time: 4550s): some tests FAILED for commit 437b4a1.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
4432 4431 0 0 1 0 0

🔴 linux-x86_64-relwithdebinfo target: cloud/filestore/ (test time: 4492s): some tests FAILED for commit 437b4a1.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
4432 4431 0 0 1 0 0

@e673
e673 changed the base branch from main to users/nasonov/file-ring-buffer-accessor August 7, 2026 17:13
@e673
e673 force-pushed the users/nasonov/file-ring-buffer-accessor branch from 02b0951 to bbbdff7 Compare August 7, 2026 17:15
@e673
e673 force-pushed the users/nasonov/wbc-toolset branch from 437b4a1 to 2e9368b Compare August 7, 2026 17:16
@github-actions

github-actions Bot commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

Note

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

Note

All workloads for linux-x86_64-relwithdebinfo have completed.

Tip

Planned checks for linux-x86_64-relwithdebinfo.

🟢 linux-x86_64-relwithdebinfo target: cloud/tasks/,cloud/storage/ (test time: 267s): all tests PASSED for commit 2e9368b.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
1311 1311 0 0 0 0 0

🟢 linux-x86_64-relwithdebinfo target: cloud/disk_manager/ (test time: 288s): all tests PASSED for commit 2e9368b.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
1614 1614 0 0 0 0 0

@e673
e673 force-pushed the users/nasonov/wbc-toolset branch from 2e9368b to 6f20f71 Compare August 7, 2026 18:14
@github-actions

github-actions Bot commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

Note

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

Note

All workloads for linux-x86_64-relwithdebinfo have completed.

Tip

Planned checks for linux-x86_64-relwithdebinfo.

🟢 linux-x86_64-relwithdebinfo target: cloud/disk_manager/ (test time: 265s): all tests PASSED for commit 6f20f71.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
1613 1613 0 0 0 0 0

🟢 linux-x86_64-relwithdebinfo target: cloud/tasks/,cloud/storage/ (test time: 265s): all tests PASSED for commit 6f20f71.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
1311 1311 0 0 0 0 0

🟢 linux-x86_64-relwithdebinfo target: cloud/blockstore/ (test time: 1591s): all tests PASSED for commit 6f20f71.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
6971 6970 0 0 0 1 0

🟢 linux-x86_64-relwithdebinfo target: cloud/filestore/ (test time: 4824s): all tests PASSED for commit 6f20f71.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
4466 4466 0 0 0 0 0

@e673
e673 force-pushed the users/nasonov/file-ring-buffer-accessor branch 3 times, most recently from 4cf7de0 to e2b8753 Compare August 10, 2026 12:49
Base automatically changed from users/nasonov/file-ring-buffer-accessor to main August 11, 2026 09:43
e673 added a commit that referenced this pull request Aug 11, 2026
### Notes
Extracted from #6563

Introduce `TFileRingBufferAccessor` to access memory mapped file from
`TFileRingBuffer`:
- Extract common code that will be used in
#6563;
- Strengthen data validation and give verbose messages;
- Replace `Y_ABORT_UNLESS` and throwing exceptions with
`NProto::TError`.

Also:
- Fixed the test `TFileRingBufferTest::ShouldMigrate` when migrating to
V6 (test was passed because validation was not complete).

### Issue
#1751
#3781

---------

Co-authored-by: Andrei Nasonov <nasonov@nebius.com>
@e673
e673 force-pushed the users/nasonov/wbc-toolset branch from 6f20f71 to 7977d7b Compare August 11, 2026 16:48
@github-actions

github-actions Bot commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Note

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

Note

All workloads for linux-x86_64-relwithdebinfo have completed.

Tip

Planned checks for linux-x86_64-relwithdebinfo.

🟢 linux-x86_64-relwithdebinfo target: cloud/tasks/,cloud/storage/ (test time: 262s): all tests PASSED for commit 7977d7b.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
1317 1317 0 0 0 0 0

🟢 linux-x86_64-relwithdebinfo target: cloud/disk_manager/ (test time: 284s): all tests PASSED for commit 7977d7b.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
1614 1614 0 0 0 0 0

🟢 linux-x86_64-relwithdebinfo target: cloud/blockstore/ (test time: 1465s): all tests PASSED for commit 7977d7b.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
6983 6982 0 0 0 1 0

🟢 linux-x86_64-relwithdebinfo target: cloud/filestore/ (test time: 4857s): all tests PASSED for commit 7977d7b.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
4495 4495 0 0 0 0 0

@e673
e673 force-pushed the users/nasonov/wbc-toolset branch from 7977d7b to d98cf91 Compare September 24, 2026 14:38
@github-actions

github-actions Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Note

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

Note

All workloads for linux-x86_64-relwithdebinfo have completed.

Tip

Planned checks for linux-x86_64-relwithdebinfo.

🟢 linux-x86_64-relwithdebinfo target: cloud/tasks/,cloud/storage/,cloud/fastshard/ (test time: 276s): all tests PASSED for commit d98cf91.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
1662 1662 0 0 0 0 0

🟢 linux-x86_64-relwithdebinfo target: cloud/disk_manager/ (test time: 321s): all tests PASSED for commit d98cf91.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
1746 1746 0 0 0 0 0

🟢 linux-x86_64-relwithdebinfo target: cloud/blockstore/ (test time: 2058s): all tests PASSED for commit d98cf91.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
7437 7436 0 0 0 1 0

🟢 linux-x86_64-relwithdebinfo target: cloud/filestore/ (test time: 4492s): all tests PASSED for commit d98cf91.

TESTS PASSED ERRORS FAILED FAILED BUILD SKIPPED MUTED?
4857 4855 0 0 0 2 0

@e673

e673 commented Sep 24, 2026

Copy link
Copy Markdown
Collaborator Author

The diff endpoint redirects to a blocked host. Let me get it via git instead.All new files, ~2100 lines. Let me extract and read them all.Now let me examine the underlying TFileRingBufferAccessor library to check the ring-buffer semantics against the tool's assumptions.Build hygiene check — the lib uses file_backed_containers and Crc32c but doesn't declare them. Let me verify:Now the unit tests:Let me check whether the actual WriteBackCache service holds the advisory lock the tool relies on:Let me check whether ValidateAndInitialize can mutate the file (the dump computes its checksum around that call):I've now read the entire PR (all 18 new files) plus the underlying TFileRingBufferAccessor/format library and the WriteBackCache code it interacts with. Here's what I found, ordered roughly by severity.

Functional bugs

  1. --state-file is dead code. options.cpp parses and stores it (.StoreResult(&StateFile)), the README and help text document it, but Options.StateFile is never read anywhere — ExecuteAction in app.cpp unconditionally goes through CreateStateFileLocator(Options.StateDir) → LocateStateFile(FsId, SessionId, ...). Running with only --state-file will throw Y_ENSURE(!fsId.empty(), "File system ID must not be empty") from the locator instead of using the given path.

Implemented.

  1. The advisory-lock safety mechanism is one-sided. I grepped the whole tree: nothing else in cloud/filestore (the vhost daemon, TFileRingBuffer, persistent_storage) takes an flock/TFileLock on the state file — the only TFileLock users are this new tool. Consequences: the exclusive lock in ExecuteAction only protects against concurrent tool runs, not against a live service mutating the mmap'd file underneath the patch; and list's IsLocked field will report false for files actively in use by a running service, which is actively misleading for an operator deciding whether it's safe to patch. The "(dangerous, will be removed)" note hints service-side locking is planned — that should either land first or the README should state explicitly that the lock does not detect a running service today.

You are wrong, look at loop.cpp.

PersistentState->AcquireWriteBackCacheStateFile(

  1. Patch validates everything strictly except the two most dangerous fields. ValidateHeaderPatch rejects changes to seven immutable header fields but performs zero validation on the new ReadPos/WritePos: no <= DataCapacity bound, no alignment check (V6 requires 8-byte alignment), no check that they land on entry boundaries. Given the tool's whole purpose is repairing state files without making things worse, a typo'd WritePos sails through and produces a corrupted file. Cheap checks (range, alignment, ideally "must equal 0 or an EntryPos from the dump or the end of the last entry") would close most of that.

Added validation.

  1. ListStateFiles hard-fails the entire listing on any stray entry — one temp file or unexpected subdirectory anywhere under the state dir returns E_INVALID_STATE for everything. Because every command routes through the locator (see docs: unable to run example #1), a single stray file makes the whole tool unusable on that host — the opposite of what you want from recovery tooling. Skip-and-warn per entry would be more robust.

I disagree - I want to keep this as an error, not as a warning.
A user can bypass this check by manually providing the state file via --state-file.

Robustness / maintainability

  1. On-disk format struct is duplicated. state_file_processor.cpp re-declares TSerializedWriteDataRequestHeader instead of including it from cloud/filestore/libs/vfs_fuse/write_back_cache/write_data_request.h. The layouts match today, but if the cache format evolves the tool will silently misdecode NodeId/Handle/Offset — and this tool writes those fields back. If the dependency is undesirable, at least share a header or add a static_assert tying the two together.

I refactored WriteBackCache in previous PRs and now reference it.

  1. lib/ya.make doesn't declare its real dependencies. The sources include cloud/storage/core/libs/file_backed_containers/... and library/cpp/digest/crc32c/crc32c.h, but neither is in the lib's PEERDIR — it only links because bin and ut happen to pull them in transitively.

Added

  1. No durability/crash-safety on patch. PatchStateFile writes the header (ReadPos/WritePos) before patching entries, all via mmap with no msync. A crash mid-patch leaves a half-applied state. Patching entries first, header last, plus an msync between, would make the write ordering match how you'd want a partially-applied patch to fail.

Added

  1. TFileLock's constructor uses OpenAlways — it creates the file if it doesn't exist. If the service removes a state file between listing and locking, the tool silently recreates an empty one. Also, check/dump take an exclusive lock for read-only work; a shared lock would let two dumps coexist.

Added TExistingFileLock

Smaller points

  • DumpStateFile diverges from the accessor's validation traversal in corrupt cases: a DataSize == 0 marker at ReadPos when WritePos != 0 is treated as a wrap-to-zero (validation calls this an error), so a corrupt dump can show phantom entries starting at 0. Fine for a debug tool, but worth a comment. The two identical while-loops could also be one helper, and pos = 0; break; in the second loop is dead assignment.

Done

  • FillEntryInfo uses sizeof(header) < eh.DataSize (strict), so an exactly-24-byte entry (zero-length write) isn't decoded as a request; <= with Size = 0 would be more precise.

I'd keep requests with Size == 0 technically correct.

  • The dump can't help fix a MetadataChecksum mismatch, because the actual metadata CRC isn't exposed anywhere in the dump (only in check's error message). Adding an ActualMetadataChecksum field, mirroring ActualDataChecksum, would make README scenario-style fixes self-contained.

Fixed.

  • Test gaps: state_file_locator.cpp (211 lines: traversal, error branches, lock probing) has no tests at all, and the JSON round-trip actually used by the CLI (Proto2Json with MissingKeyDefault → user edit → Json2Proto) is untested — the unit tests patch proto objects directly.

Added

  • Cosmetics: trailing space in the "file system id " help string; PrintJson appends \n for stdout but not for -O files; empty RECURSE_FOR_TESTS() in bin/ya.make; the tool's top ya.make doesn't recurse into protos; ActionCheck returns 1 for both "corrupted" and "not initialized" — distinct exit codes would help scripting, and an empty freshly-created file arguably isn't a check failure.

Fixed

The core patch-validation design is actually quite good — index-pinned EntryPos, the whole-file CRC staleness guard, and the ActualDataChecksum gate before allowing metadata edits are all sensible, and the free/unfree checksum recomputation correctly matches the V5/V6 conventions (including the V6 header-hash XOR, which is handled inside the data processor). The items I'd insist on before merge are #1 (dead option), #3 (unvalidated ReadPos/WritePos), and clarifying #2 in the README.

@e673
e673 removed this pull request from stack #6729 October 6, 2026 15:51
@e673

e673 commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator Author

Superceded by a PR stack
#7454
#7455
#7456
#7457
#7458

@e673 e673 closed this Oct 8, 2026
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.

2 participants