Skip to content

tools/cephfs_mirror: optimize decoding/reading snap metadata from PeerReplayer::build_snap_map - #71027

Merged
kotreshhr merged 2 commits into
ceph:mainfrom
dparmar18:i79460
Oct 26, 2026
Merged

kotreshhr merged 2 commits into
ceph:mainfrom
dparmar18:i79460

Conversation

@dparmar18

@dparmar18 dparmar18 commented Aug 13, 2026 •

Copy link
Copy Markdown
Contributor

specifically PeerReplayer::initialize_checkpoints which builds
the local snap map then a block down the line it also decodes the
metadata per snap path but we can achieve this from a single call.

Fixes: https://tracker.ceph.com/issues/79460

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

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

@github-actions github-actions Bot added the cephfs Ceph File System label Aug 13, 2026
@dparmar18
dparmar18 requested review from a team, karthik-us1 and kotreshhr August 13, 2026 10:42

@karthik-us1 karthik-us1 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.

The commit message is misleading. It says the initialize_checkpoints was calling build_snap_map(), decoding the snap metadata and discarding it, and re-fetching it later using the read_snap_metadata.
The decoding was happening in build_snap_map only for remote, since we wanted to get its matching snap_id from the metadata. For local it was not doing the decode and was not discarding it. The optimization that you are doing is now adding the decode if it is asked for, to avoid that extra read_snap_metadata.

Comment thread src/tools/cephfs_mirror/PeerReplayer.cc Resolved
Comment thread src/tools/cephfs_mirror/PeerReplayer.cc Resolved
@dparmar18

dparmar18 commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor Author

The commit message is misleading. It says the initialize_checkpoints was calling build_snap_map(), decoding the snap metadata and discarding it, and re-fetching it later using the read_snap_metadata. The decoding was happening in build_snap_map only for remote, since we wanted to get its matching snap_id from the metadata. For local it was not doing the decode and was not discarding it. The optimization that you are doing is now adding the decode if it is asked for, to avoid that extra read_snap_metadata.

Correct me if i'm wrong here but initialize_checkpoints() decodes for every local snap path under its for (const auto &[snap_id, snap_name] : local_snap_map) {} while build_snap_map() does the same for remote. My aim was to eliminate the extra decode() for local but as you rightly pointed out build_snap_map() only ever does it for remote (mb!). I'll incorporate the required changes as per #71027 (comment)

@dparmar18 dparmar18 changed the title tools/cephfs_mirror: optimize fetching and reading snap metadata in PeerReplayer::initialize_checkpoints tools/cephfs_mirror: optimize decoding/reading snap metadata from PeerReplayer::build_snap_map Sep 10, 2026
@karthik-us1

Copy link
Copy Markdown
Contributor

The commit message is misleading. It says the initialize_checkpoints was calling build_snap_map(), decoding the snap metadata and discarding it, and re-fetching it later using the read_snap_metadata. The decoding was happening in build_snap_map only for remote, since we wanted to get its matching snap_id from the metadata. For local it was not doing the decode and was not discarding it. The optimization that you are doing is now adding the decode if it is asked for, to avoid that extra read_snap_metadata.

Correct me if i'm wrong here but initialize_checkpoints() decodes for every local snap path under its for (const auto &[snap_id, snap_name] : local_snap_map) {} while build_snap_map() does the same for remote. My aim was to eliminate the extra decode() for local but as you rightly pointed out build_snap_map() only ever does it for remote (mb!). I'll incorporate the required changes as per #71027 (comment)

Yes, your understanding is correct. The initialize_checkpoints was decoding the metadata only for the local snaps in that for loop, and build_snap_maps was doing it only for remote. With the suggested guard in that comment, now the decode is being done only in the build_snap_map for both the cases when required, which was your intention and it will eliminate the extra round trip.

Comment thread src/tools/cephfs_mirror/PeerReplayer.cc Resolved
Comment thread src/tools/cephfs_mirror/Types.h Resolved
Comment thread src/tools/cephfs_mirror/PeerReplayer.cc Resolved
@dparmar18
dparmar18 force-pushed the i79460 branch 2 times, most recently from c89bb2e to 151b879 Compare October 6, 2026 13:17
…rReplayer::build_snap_map

specifically PeerReplayer::initialize_checkpoints which builds
the local snap map then a block down the line it also decodes the
metadata per snap path but we can achieve this from a single call.

Fixes: https://tracker.ceph.com/issues/79460
Signed-off-by: Dhairya Parmar <[email protected]>

@karthik-us1 karthik-us1 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

@dparmar18

Copy link
Copy Markdown
Contributor Author

I'd like to test this up real quick. Can someone advice what's the exact qa suite(s) to run with? @vshankar @kotreshhr ?

@kotreshhr

Copy link
Copy Markdown
Contributor

I'd like to test this up real quick. Can someone advice what's the exact qa suite(s) to run with? @vshankar @kotreshhr ?

I will put this to test

@dparmar18

Copy link
Copy Markdown
Contributor Author

I'd like to test this up real quick. Can someone advice what's the exact qa suite(s) to run with? @vshankar @kotreshhr ?

I will put this to test

thanks!

@kotreshhr

Copy link
Copy Markdown
Contributor

This PR has been added to main integration testing by khiremat started 2026-10-08-19:27.

@kotreshhr

kotreshhr commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

@dparmar18
The test_cephfs_mirror_remote_snap_corrupt_fails_synced_snapshot is failing because of the PR. Please fix it.
https://pulpito.ceph.com/khiremat-2026-10-17_05:41:39-fs-wip-khiremat-testing-20261008.192634-distro-default-trial/

Root cause by llm:

The PR changed the daemon message in PeerReplayer::build_snap_map:

Before: snapshot 'snap_b' has invalid metadata
After: remote fs snapshot 'snap_b' has invalid metadata

I think it's better to fix the testcase since the new message is more clear

test_cephfs_mirror_remote_snap_corrupt_fails_synced_snapshot checked for
failure_reason which has been changed as part of ceph#71027:

Before: snapshot 'snap_b' has invalid metadata
After: remote fs snapshot 'snap_b' has invalid metadata

Fixes: https://tracker.ceph.com/issues/79460
Signed-off-by: Dhairya Parmar <[email protected]>
@github-actions github-actions Bot added the tests label Oct 19, 2026
@dparmar18

Copy link
Copy Markdown
Contributor Author

@dparmar18 The test_cephfs_mirror_remote_snap_corrupt_fails_synced_snapshot is failing because of the PR. Please fix it. https://pulpito.ceph.com/khiremat-2026-10-17_05:41:39-fs-wip-khiremat-testing-20261008.192634-distro-default-trial/

Root cause by llm:

The PR changed the daemon message in PeerReplayer::build_snap_map:

Before: snapshot 'snap_b' has invalid metadata
After: remote fs snapshot 'snap_b' has invalid metadata

I think it's better to fix the testcase since the new message is more clear

fixed f4ed4ee

@kotreshhr

Copy link
Copy Markdown
Contributor

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.

3 participants