Skip to content

rgw: emit structured JSON for sync status --format - #70160

Open
RaminNietzsche wants to merge 1 commit into
ceph:mainfrom
RaminNietzsche:wip-rgw-admin-sync-status-json
Open

RaminNietzsche wants to merge 1 commit into
ceph:mainfrom
RaminNietzsche:wip-rgw-admin-sync-status-json

Conversation

@RaminNietzsche

@RaminNietzsche RaminNietzsche commented Jul 13, 2026 •

Copy link
Copy Markdown
Member

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
  • jenkins test classic perf
  • jenkins test crimson perf
  • jenkins test signed
  • jenkins test make check
  • jenkins test make check arm64
  • jenkins test submodules
  • jenkins test dashboard
  • jenkins test dashboard cephadm
  • jenkins test api
  • jenkins test docs
  • jenkins test ceph-volume all
  • jenkins test windows
  • jenkins test rook e2e

You must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.

Summary

  • radosgw-admin sync status previously ignored --format and always printed plaintext.
  • With --format=json (or another formatter), emit a structured summary aligned with the human-readable output: typed full_sync / incremental_sync counts, caught_up, shards_behind, behind_shards[], oldest_incremental_change, and data-sync recovering_*.
  • Default (no --format) remains plaintext for compatibility.
  • Do not dump per-shard marker blobs (those are huge and not part of the plaintext summary).

Testing

Local (vstart single-site + test-rgw-multisite.sh 2 zones + induced lag):

Scenario Result
Single-site workunit OK (skipped=1) — master shape; secondary test skipped
Multisite c1 (master) workunit OK (skipped=1)
Multisite c2 (secondary) workunit OK (skipped=1); JSON has typed full_sync / incremental_sync / behind_shards
Lag (stop c2 RGW, put objects on c1) lag scenario OK — metadata behind 5 shards, data behind 11 shards, oldest_incremental_change present

Also: smoke asserts no messages / no raw sync_status markers; plaintext/JSON count parity; light perf comparable (~0.13s both paths).

QA added:

  • qa/workunits/rgw/test_rgw_sync_status_json.py (+ runner + verify suite yaml)
  • Multisite nose @attr('sync_status') in src/test/rgw/rgw_multi/tests.py

CI: please comment ok to test if needed for external contributors, then jenkins test make check.

@RaminNietzsche
RaminNietzsche requested review from a team as code owners July 13, 2026 15:27
@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

16 similar comments
@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@RaminNietzsche

Copy link
Copy Markdown
Member Author

Local testing summary (vstart + multisite + induced lag on /var/test/ceph):

  1. Single-site — workunit OK (skipped=1) (master / no secondary shape).
  2. Multisite c1/c2 — workunit OK on both; secondary JSON exposes typed full_sync / incremental_sync / behind_shards.
  3. Lag — stop c2 RGW, put 64 objects on c1 → JSON reports metadata behind 5 shards and data behind 11 shards with oldest_incremental_change present (lag scenario OK).

Plaintext default unchanged; JSON path omits per-shard marker dumps. Please ok to test if required for CI.

@RaminNietzsche

Copy link
Copy Markdown
Member Author

Hi @ceph/rgw — gentle ping for review when you have a moment.

This adds structured JSON for radosgw-admin sync status --format=json (plaintext default unchanged). Local multisite / lag testing notes are in the comment above.

Could someone please take a look, and also comment ok to test so Jenkins can run? Thanks!

@RaminNietzsche

Copy link
Copy Markdown
Member Author

Hi @yehudasa @awojno-bloomberg — pinging you for review based on git blame: you two show up the most around the existing sync_status / related code in radosgw-admin.cc, so it seemed fair to ask you first.

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

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

@RaminNietzsche

Copy link
Copy Markdown
Member Author

Rebased onto current main and force-pushed wip-rgw-admin-sync-status-json.

Conflict resolution in radosgw-admin.cc: kept main's guard that rejects --bucket on sync status (pointing at bucket sync status), and kept this PR's sync_status(formatter, format_arg_passed) JSON path.

Local build: ninja radosgw-admin OK (gcc 12 / Release).

@RaminNietzsche
RaminNietzsche requested review from a team and removed request for a team and awojno-bloomberg November 21, 2026 12:24
@RaminNietzsche
RaminNietzsche force-pushed the wip-rgw-admin-sync-status-json branch from 7348830 to 7ae5105 Compare November 21, 2026 12:29
@RaminNietzsche
RaminNietzsche force-pushed the wip-rgw-admin-sync-status-json branch from 7ae5105 to ec7802e Compare November 21, 2026 15:17
@RaminNietzsche

Copy link
Copy Markdown
Member Author

jenkins test make check

@RaminNietzsche

RaminNietzsche commented Nov 21, 2026 •

Copy link
Copy Markdown
Member Author

cert-review (SEI CERT, ceph profile)

Checked the C++ slice of this PR with cert-review-mcp 1.1.2 (current main / raminnietzsche/cert-review-mcp:latest, also listed as io.github.RaminNietzsche/cert-review-mcp in the MCP Registry). Unified diff for radosgw-admin.cc and sync_status_report.{cc,h} (main..HEAD), tools clang-tidy, Clang Static Analyzer, cppcheck, changed lines only, min confidence 0.5.

check_diff

  • 3 files materialized from the patch (no full tree needed on the host; since 1.1.1).
  • 0 CERT-mapped findings.
  • cppcheck: ok (3 files).
  • clangsa: ok (3 files).
  • clang-tidy: partial — radosgw-admin.cc does not parse fully without a Ceph compile_commands.json, so zero findings are not a full parse proof for that file.

build_review_packet

  • 10 hunks; 0 static findings attached.
  • Frequent manual-review candidates (heuristics, not reported violations): CTR50-CPP / CTR51-CPP / CTR57-CPP on sync_markers / map loops (profile ceph notes on iterator invalidation), plus the usual static_cast<RadosStore*> admin pattern — same as before the refactor.

Takeaway: no CERT static blocker from this pass. The change is mostly extract + JSON; merge confidence should still come from the sync-status JSON QA added in this PR.

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

docs lgtm

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

This generally is looking like more improvement for our old friend radosgw-admin! I did have a couple of things I'd like you to peek at/consider again, but in general this is a big improvement.

)
cls.ceph_conf = find_ceph_conf()
try:
probe = cls._run_static(['sync', 'status'], check=False)

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.

check=False seems a bit odd to me: so if the command fails, what is the ultimate fate of these exceptions? We'll see a message and a SKIPPED test, not a failed one? That doesn't seem right to me, but I'm not entirely up on how the workunits tests are meant to work. Please check that it's the correct behavior.

if (ret < 0) {
out->error = string("failed to retrieve sync info: sync.init() failed: ") +
cpp_strerror(-ret);
return;

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.

Just a general question here. As we're generally restructuring things, is the function both not returning anything AND not raising an exception when an error has occurred the right behavior here? (And, in general.) We're breaking things up into more discrete units, which is terrific-- but it might be a good time to start thinking about this. If this is the pattern that already exists, then we should definitely address it in a future change (exception handling would make this program yet smaller and for the most part from what I see less complicated). If this is something we've added, we might want to make sure to handle things in some way that communicates failure to the caller.

sync status ignored Formatter and always printed plaintext, so
--format=json had no effect. Collect metadata and data sync state once
into report structs, then render human text or JSON from the same
snapshot (shard counts, behind lists, oldest incremental change,
recovering shards) without serializing per-shard markers.

Preserve the guard that rejects --bucket on sync status and points users
at bucket sync status. Add workunit and multisite test coverage plus docs.

Address review: include common/Formatter.h, self-contained headers, legacy
plaintext shard list brackets, switch default-first with indented cases,
-enoent handling, workunit probe SkipTest comment, and document
out->error matching legacy sync status exit behavior.

Signed-off-by: ramin.najarbashi <[email protected]>
@RaminNietzsche
RaminNietzsche force-pushed the wip-rgw-admin-sync-status-json branch from ec7802e to 65b0ba7 Compare November 30, 2026 08:55
@RaminNietzsche

Copy link
Copy Markdown
Member Author

Rebased on current ceph/main → tip 65b0ba7d0f9 (squashed). Clarified workunit probe SkipTest vs fail and documented out->error / exit-code behavior per review.

@RaminNietzsche

Copy link
Copy Markdown
Member Author

jenkins test make check

@RaminNietzsche

Copy link
Copy Markdown
Member Author

@chardan Re: review #70160 (review)

Workunit check=False: only the setUpClass probe — SkipTest when the cluster is unavailable; test methods still use _run() with check=True so real failures fail the workunit. Comment added in test_rgw_sync_status_json.py on tip 65b0ba7d0f9.

out->error: collectors + formatters mirror legacy sync status (error in output; no exit-code change at the handler). Note added in sync_status_report.h. Happy to follow up project-wide in a separate change.

@github-actions

Copy link
Copy Markdown

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

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants