Skip to content

tools/cephfs: provide an estimate completion time for offline tools - #65495

Merged
vshankar merged 4 commits into
ceph:mainfrom
edwinzrodriguez:ceph-wip-64214
Jan 7, 2026
Merged

vshankar merged 4 commits into
ceph:mainfrom
edwinzrodriguez:ceph-wip-64214

Conversation

@edwinzrodriguez

@edwinzrodriguez edwinzrodriguez commented Sep 11, 2025 •

Copy link
Copy Markdown
Contributor

Implement ProgressTracker to calculate percentage and ETA for operations
Add support to report progress using ceph mgr cli to make progress visible with ceph status

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands

@edwinzrodriguez

Copy link
Copy Markdown
Contributor Author

jenkins test make check arm64

@edwinzrodriguez

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@edwinzrodriguez

Copy link
Copy Markdown
Contributor Author

jenkins test make check arm64

@edwinzrodriguez

Copy link
Copy Markdown
Contributor Author

jenkins test make check

1 similar comment
@edwinzrodriguez

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@edwinzrodriguez

Copy link
Copy Markdown
Contributor Author

jenkins test make check arm64

@edwinzrodriguez

Copy link
Copy Markdown
Contributor Author

jenkins test make check arm64

@edwinzrodriguez

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@edwinzrodriguez
edwinzrodriguez force-pushed the ceph-wip-64214 branch 2 times, most recently from 3bce69c to 2371199 Compare September 17, 2025 13:33
@edwinzrodriguez

Copy link
Copy Markdown
Contributor Author

jenkins test make check arm64

Comment thread src/tools/cephfs/ProgressTracker.cc Resolved
Comment thread src/tools/cephfs/ProgressTracker.cc Resolved
Comment thread src/tools/cephfs/ProgressTracker.cc Resolved
@vshankar

Copy link
Copy Markdown
Contributor

@rishabh-d-dave - PTAL for reviews.

@edwinzrodriguez
edwinzrodriguez requested review from a team as code owners September 30, 2025 16:13
@edwinzrodriguez

Copy link
Copy Markdown
Contributor Author

jenkins test api

@edwinzrodriguez

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@gregsfortytwo

Copy link
Copy Markdown
Member

You were asking about how to apply clang-format to files as we go.
Is there a reason you applied them only to the changed lines? I'm not sure if we want to do that or should just apply it to the whole file at once, since the change is already quite large.
I guess I'm envisioning a change to the MDS files and it would conflict with every other patch in progress, so maybe that's a reason not to do whole-file conversions.

Tragically, clang-format is making changes to the actual line content (ie, moving line breaks in variable lists), so we can't really check it without actually reading every function (which probably won't happen). So can you share the exact invocation used in the commit message, for future reproducibility/checking?

@edwinzrodriguez

Copy link
Copy Markdown
Contributor Author

I ran "git clang-format" on the changes, which applies the formatting rules just to the changed lines. I figured it might be controversial which is why I kept it a separate SHA. Thats the incremental approach that avoids having a massive formatting only change that messes up blame history, though there is an option '--ignore-revs-file' that can help with that.
I tried explaining the use of "git clang-format" in the PR #65049

@edwinzrodriguez

Copy link
Copy Markdown
Contributor Author

jenkins test make check arm64

@vshankar vshankar 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.

LGTM. Minor comment.

Comment thread src/tools/cephfs/JournalTool.cc Resolved
@github-actions

github-actions Bot commented Dec 1, 2025

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

@vshankar

vshankar commented Dec 1, 2025

Copy link
Copy Markdown
Contributor

@edwinzrodriguez - mind rebasing this please? Also PTAL at comment #65495 (comment).

I want to put this to test this week.

@vshankar

vshankar commented Dec 3, 2025

Copy link
Copy Markdown
Contributor

I will run this through tests @edwinzrodriguez. Also regarding comment #65495 (comment), I need to have a closer look at that part of the code.

@vshankar

vshankar commented Dec 4, 2025

Copy link
Copy Markdown
Contributor

@vshankar

vshankar commented Dec 8, 2025

Copy link
Copy Markdown
Contributor

@edwinzrodriguez - I'm seeing a related test failure: https://pulpito.ceph.com/vshankar-2025-12-05_01:29:03-fs-wip-vshankar-testing-20251204.133709-debug-for-linus-default-smithi/8642368/

From the logs:

2025-12-05T02:06:19.125 DEBUG:teuthology.orchestra.run.smithi172:> sudo adjust-ulimits ceph-coverage /home/ubuntu/cephtest/archive/coverage timeout 120 ceph --cluster ceph mgr module enable cli_api.
...
...
...
2025-12-05T02:06:19.570 INFO:teuthology.orchestra.run.smithi172.stderr:2025-12-05T02:06:19.570+0000 7f391a7fc640  1 -- 172.21.15.172:0/3310950524 <== mon.0 v2:172.21.15.172:3300/0 7 ==== mon_command_ack([{"prefix": "mgr module enable", "module": "cli_api"}]=-2 all mgr daemons do not support module 'cli_api', pass --force to force enablement v5) ==== 167+0+0 (secure 0 0 0) 0x7f391c15d920 con 0x7f391c141fc0
2025-12-05T02:06:19.571 INFO:teuthology.orchestra.run.smithi172.stderr:Error ENOENT: all mgr daemons do not support module 'cli_api', pass --force to force enablement

qa teuthology log: http://qa-proxy.ceph.com/teuthology/vshankar-2025-12-05_01:29:03-fs-wip-vshankar-testing-20251204.133709-debug-for-linus-default-smithi/8642368/teuthology.log

I haven't worked with cli_api, so maybe this just requires passing --force to the command?

@edwinzrodriguez

Copy link
Copy Markdown
Contributor Author

jenkins test make check arm64

1 similar comment
@edwinzrodriguez

Copy link
Copy Markdown
Contributor Author

jenkins test make check arm64

@gregsfortytwo

Copy link
Copy Markdown
Member

@edwinzrodriguez - I'm seeing a related test failure: https://pulpito.ceph.com/vshankar-2025-12-05_01:29:03-fs-wip-vshankar-testing-20251204.133709-debug-for-linus-default-smithi/8642368/

From the logs:

2025-12-05T02:06:19.125 DEBUG:teuthology.orchestra.run.smithi172:> sudo adjust-ulimits ceph-coverage /home/ubuntu/cephtest/archive/coverage timeout 120 ceph --cluster ceph mgr module enable cli_api.
...
...
...
2025-12-05T02:06:19.570 INFO:teuthology.orchestra.run.smithi172.stderr:2025-12-05T02:06:19.570+0000 7f391a7fc640  1 -- 172.21.15.172:0/3310950524 <== mon.0 v2:172.21.15.172:3300/0 7 ==== mon_command_ack([{"prefix": "mgr module enable", "module": "cli_api"}]=-2 all mgr daemons do not support module 'cli_api', pass --force to force enablement v5) ==== 167+0+0 (secure 0 0 0) 0x7f391c15d920 con 0x7f391c141fc0
2025-12-05T02:06:19.571 INFO:teuthology.orchestra.run.smithi172.stderr:Error ENOENT: all mgr daemons do not support module 'cli_api', pass --force to force enablement

qa teuthology log: http://qa-proxy.ceph.com/teuthology/vshankar-2025-12-05_01:29:03-fs-wip-vshankar-testing-20251204.133709-debug-for-linus-default-smithi/8642368/teuthology.log

I haven't worked with cli_api, so maybe this just requires passing --force to the command?

How could a mgr not support a module unless we’re mid-upgrade and it doesn’t exist yet? This seems like something we need to properly debug.

@edwinzrodriguez

Copy link
Copy Markdown
Contributor Author

@gregsfortytwo Looking at the code in src/mon/MgrMonitor.cc I think the likely cause is that not all mgr nodes are up when the call to enable the module is made. I suppose its also possible there is version mismatch between mgr nodes that could cause a problem.

@vshankar

vshankar commented Dec 9, 2025

Copy link
Copy Markdown
Contributor

@gregsfortytwo Looking at the code in src/mon/MgrMonitor.cc I think the likely cause is that not all mgr nodes are up when the call to enable the module is made.

I checked the monitor log: ./remote/smithi172/log/ceph-mon.a.log.gz

2025-12-05T02:06:19.570+0000 7f5d23bf1640  0 log_channel(audit) log [INF] : from='client.? 172.21.15.172:0/3310950524' entity='client.admin' cmd={"prefix": "mgr module enable", "module": "cli_api"} : dispatch
2025-12-05T02:06:19.570+0000 7f5d23bf1640  1 -- [v2:172.21.15.172:3300/0,v1:172.21.15.172:6789/0] --> [v2:172.21.15.172:3300/0,v1:172.21.15.172:6789/0] -- log(1 entries from seq 1489 at 2025-12-05T02:06:19.570635+0000) -- 0x48c76c0 con 0x278a800
2025-12-05T02:06:19.570+0000 7f5d23bf1640 10 mon.a@0(leader).paxosservice(mgr 1..5) dispatch 0x3229380 mon_command({"prefix": "mgr module enable", "module": "cli_api"} v 0) from client.? 172.21.15.172:0/3310950524 con 0x2e4f000
2025-12-05T02:06:19.570+0000 7f5d23bf1640  5 mon.a@0(leader).paxos(paxos active c 754..1426) is_readable = 1 - now=2025-12-05T02:06:19.570661+0000 lease_expire=2025-12-05T02:06:23.972600+0000 has v0 lc 1426
2025-12-05T02:06:19.570+0000 7f5d23bf1640  4 mon.a@0(leader).mgr e5 prepare_command done, r=-2
2025-12-05T02:06:19.570+0000 7f5d23bf1640  2 mon.a@0(leader) e1 send_reply 0x309db00 0x4bc2820 mon_command_ack([{"prefix": "mgr module enable", "module": "cli_api"}]=-2 all mgr daemons do not support module 'cli_api', pass --force to force enablement v5)
2025-12-05T02:06:19.570+0000 7f5d23bf1640  1 -- [v2:172.21.15.172:3300/0,v1:172.21.15.172:6789/0] --> 172.21.15.172:0/3310950524 -- mon_command_ack([{"prefix": "mgr module enable", "module": "cli_api"}]=-2 all mgr daemons do not support module 'cli_api', pass --force to force enablement v5) -- 0x4bc2820 con 0x2e4f000

This is coming from src/mon/MgrMonitor.cc::prepare_command():

  } else if (prefix == "mgr module enable") {
    ...
    ...
    ...
    bool force = false;
    cmd_getval_compat_cephbool(cmdmap, "force", force);
    if (!pending_map.all_support_module(module) &&
        !force) {
      ss << "all mgr daemons do not support module '" << module << "', pass "
         << "--force to force enablement";
      r = -ENOENT;
      goto out;
    }

pending_map.all_support_module() calls into src/mon/MgrMap.h::all_support_module() and then into src/mon/MgrMap.h::have_module() which is basically:

    bool have_module(const std::string &module_name) const
    {
      auto it = std::find_if(available_modules.begin(),
          available_modules.end(),
          [module_name](const ModuleInfo &m) -> bool {
            return m.name == module_name;
          });

      return it != available_modules.end();
    }

So, it's possible that cli_api wasn't "available" yet when the test code tries to enable it. If that's true, then it's a side effect of invoking the calls a bit too early. There were similar issues where mgr commands failed due to module declaring itself as available but the module is still being loaded.

@vshankar

vshankar commented Dec 9, 2025

Copy link
Copy Markdown
Contributor

@edwinzrodriguez - I think for now, to test the PR, it might suffice to introduce a slight delay before enabling the module rather than using --force argument. I have to dig the PR that Laura had which fixes up the above mention race in ceph-mgr.

mah3shm and others added 4 commits December 9, 2025 13:05
Adding a new progress tracking class in the cephfs offline tools dir that is consumed by multiple
utilities namely cephfs-data-scan, cephfs-journal-tool, cephfs-table-tool.

Multiple commands under each utility now have progress tracking included by default.
The progress tracking is not option based- i.e. no "--progress" option required.
This is because if we keep it option based and the user forgets to include the option while
firing the command, then the only recourse is to kill the execution and restart. This is not
suitable for state changing operations, hence better to include progress tracking by default.

Exact command list where progress tracking is included is specified in the tracker.
Testing updates also posted in tracker, initial testing with single and multi-threaded
loads on FS with 4M objects succeeded for cephfs-data-scan.

- Updated DataScan to use worker_n and worker_m for better clarity and functionality.
- Added set_progress_operation_name method to manage operation names during progress tracking.
- Enhanced ProgressTracker with new methods for detailed progress reporting and ETA calculations.
- Improved thread safety and performance in progress updates.
- Added terminal width detection and line padding for better display.
- Introduced write_console_line function to manage console output.
- Updated progress display logic to throttle updates based on time.
- Removed display_interval variable to streamline progress updates.

Fixes: https://tracker.ceph.com/issues/63191
Signed-off-by: Edwin Rodriguez <[email protected]>

Signed-off-by: Edwin Rodriguez <[email protected]>
Basic progress tracking - Tests that scan_extents and scan_inodes report progress
Event completion - Verifies events transition to completed state
Multiple workers - Tests progress with parallel execution
Graceful degradation - Ensures scans work without cli_api module
Unique event IDs - Verifies each process creates unique progress events with PID
ETA calculation - Checks that progress messages include time estimates
Rate limiting - Verifies progress updates respect the 5-second interval

Fixes: https://tracker.ceph.com/issues/63191
Signed-off-by: Edwin Rodriguez <[email protected]>
@edwinzrodriguez

Copy link
Copy Markdown
Contributor Author

@vshankar I added a 2 sec delay before trying to enable cli_api

@vshankar

Copy link
Copy Markdown
Contributor

@vshankar I added a 2 sec delay before trying to enable cli_api

Test fails with the same reason. https://pulpito.ceph.com/vshankar-2025-12-10_13:32:17-fs-wip-vshankar-testing-20251204.133709-debug-for-linus-default-smithi/8649438/

2025-12-10T14:08:48.130 INFO:teuthology.orchestra.run.smithi077.stderr:2025-12-10T14:08:48.127+0000 7fdf08ff9640  1 -- 172.21.15.77:0/1700489533 <== mon.0 v2:172.21.15.77:3300/0 7 ==== mon_command_ack([{"prefix": "mgr module enable
", "module": "cli_api"}]=-2 all mgr daemons do not support module 'cli_api', pass --force to force enablement v5) ==== 167+0+0 (secure 0 0 0) 0x7fdefc05ead0 con 0x7fdf0c165550
2025-12-10T14:08:48.130 INFO:teuthology.orchestra.run.smithi077.stderr:Error ENOENT: all mgr daemons do not support module 'cli_api', pass --force to force enablement

I'm sure I used the latest update from this PR where a 2 second delay is added. I will have a look closely.

@vshankar

vshankar commented Jan 5, 2026

Copy link
Copy Markdown
Contributor

I have tested this locally since I still don't have access to the (new) lab. I plan to merge this and then fix any bugs (at least one related to timing mentioned here: #65495 (comment)) over the coming weeks.

@vshankar

vshankar commented Jan 5, 2026

Copy link
Copy Markdown
Contributor

jenkins test rook e2e

@vshankar

vshankar commented Jan 5, 2026

Copy link
Copy Markdown
Contributor

jenkins test dashboard

@vshankar

vshankar commented Jan 5, 2026

Copy link
Copy Markdown
Contributor

jenkins retest this please

@edwinzrodriguez

Copy link
Copy Markdown
Contributor Author

jenkins test windows

@mchangir mchangir 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.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

10 participants