Skip to content

osd/OSD: introduce reset_purged_snaps_last - #53579

Merged
rzarzynski merged 2 commits into
ceph:mainfrom
Matan-B:wip-matanb-reset_purged_snaps_last
Oct 11, 2023
Merged

rzarzynski merged 2 commits into
ceph:mainfrom
Matan-B:wip-matanb-reset_purged_snaps_last

Conversation

@Matan-B

@Matan-B Matan-B commented Sep 21, 2023 •

Copy link
Copy Markdown
Contributor
When the OSD preboots it sends a MMonGetPurgedSnaps message to
the monitor (`_get_purged_snaps`).
The monitor will reply with all the purged snapshots that their purged_epoch_ is in the
range of superblock.purged_snaps_last + 1 up to the last superblock.current_epoch + 1.
When the OSD will handle the reply from the mon (`handle_get_purged_snaps_reply`)
it will call `record_purged_snaps` to write those purged snapshots in the
OSD store as well (PSN_ keys).

Once purged_snaps_last is reset, in the following OSD reboot, *all* the snapshots that were marked
as purged (purged_snaps_ keys) in the mon's store will be also marked,
correspondingly, in the OSD store.
That way `scrub_purged_snaps` will be able to re-trim the snapshots that weren't
marked as purged in the OSD side (for some reason)

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

Contribution Guidelines

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 retest this please
  • 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 render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox
  • jenkins test windows

@Matan-B
Matan-B requested a review from rzarzynski September 21, 2023 12:27
@github-actions github-actions Bot added the core label Sep 21, 2023
@Matan-B
Matan-B requested a review from athanatos September 21, 2023 12:41

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

Yep, this seems like a reasonable fix.

@athanatos

Copy link
Copy Markdown
Contributor

Oh, if the monitors have already trimmed maps (and, in general, they will have), do the mons send all purged snaps anyway?

@Matan-B

Matan-B commented Sep 26, 2023

Copy link
Copy Markdown
Contributor Author

Oh, if the monitors have already trimmed maps (and, in general, they will have), do the mons send all purged snaps anyway?

Yes, mon's purged_snap_ keys are not trimmed.

@Matan-B
Matan-B force-pushed the wip-matanb-reset_purged_snaps_last branch from 2d0b918 to 3d6f7d1 Compare September 26, 2023 07:47
@Matan-B
Matan-B marked this pull request as ready for review September 26, 2023 07:47
@Matan-B
Matan-B requested a review from a team as a code owner September 26, 2023 07:47
Comment thread src/osd/OSD.cc Resolved
@idryomov

Copy link
Copy Markdown
Contributor

Yes, mon's purged_snap_ keys are not trimmed.

There was a thread on the dev list recently where this came up [1]. Ignore the rbd-mirror discussion there -- it was only tangentially related. I'm linking it to highlight that we seem to have recurring issues in the snapshot trimming area: OSDs aren't picking up purged snap IDs from the monitors [2], monitor db growing many millions of osd_snap/purged_snap_ key which causes monitor startup slowness, etc.

Manually resetting superblock.purged_snaps_last should help with clearing up the backlog, but do we know where it's coming from to begin with?

[1] https://lists.ceph.io/hyperkitty/list/[email protected]/message/UOJG46YXTIPOXJUSELIN42ATAD5FPMDY/
[2] https://bugzilla.redhat.com/show_bug.cgi?id=2223533

@rzarzynski

Copy link
Copy Markdown
Contributor

We should be able to backport this, so ticket + Fixes are needed.

@Matan-B
Matan-B force-pushed the wip-matanb-reset_purged_snaps_last branch from 3d6f7d1 to cc42cbf Compare September 26, 2023 10:00
@Matan-B

Matan-B commented Sep 26, 2023

Copy link
Copy Markdown
Contributor Author

There was a thread on the dev list recently where this came up [1]. Ignore the rbd-mirror discussion there -- it was only tangentially related. I'm linking it to highlight that we seem to have recurring issues in the snapshot trimming area: OSDs aren't picking up purged snap IDs from the monitors [2], monitor db growing many millions of osd_snap/purged_snap_ key which causes monitor startup slowness, etc.

Manually resetting superblock.purged_snaps_last should help with clearing up the backlog, but do we know where it's coming from to begin with?

[1] https://lists.ceph.io/hyperkitty/list/[email protected]/message/UOJG46YXTIPOXJUSELIN42ATAD5FPMDY/ [2] https://bugzilla.redhat.com/show_bug.cgi?id=2223533

Thanks for sharing the thread.
The 2 issues shared aren't related. As to the one reported in the thread, I agree we should have a solution in hand. Simply trimming the old keys is probably possible. However, the fact that we never trimmed those keys proved that it may be useful for cases such as the one in the BZ attached.
We should probably be able to better compress/merge contiguous keys also after they are stored. I'll open a separate tracker for it as this is out of the scope of this PR.

@idryomov

idryomov commented Sep 26, 2023 •

Copy link
Copy Markdown
Contributor

We should probably be able to better compress/merge contiguous keys also after they are stored. I'll open a separate tracker for it as this is out of the scope of this PR.

Sounds good.

What is in scope of this PR is the issue of OSDs not picking up purged snap IDs from the monitors under normal operation. Do we know what is causing that?

Comment thread src/osd/OSD.cc Resolved
@Matan-B
Matan-B force-pushed the wip-matanb-reset_purged_snaps_last branch 2 times, most recently from 0b09309 to f410422 Compare September 26, 2023 10:37
Comment thread src/osd/OSD.cc Resolved
@Matan-B

Matan-B commented Sep 26, 2023

Copy link
Copy Markdown
Contributor Author

Sounds good.

What is in scope of this PR is the issue of OSDs not picking up purged snap IDs from the monitors under normal operation. Do we know what is causing that?

Not yet. This issue was never reported (AFAIK) and this PR is proposed specifically to address the single known instance of it.
Hopefully, if it will appear in the future again, we will be able to better investigate the root cause.

When the OSD preboots it sends a MMonGetPurgedSnaps message to
the monitor (`_get_purged_snaps`).
The monitor will reply with all the purged snapshots that their purged_epoch_ is in the
range of superblock.purged_snaps_last + 1 up to the last superblock.current_epoch + 1.
When the OSD will handle the reply from the mon (`handle_get_purged_snaps_reply`)
it will call `record_purged_snaps` to write those purged snapshots in the
OSD store as well (PSN_ keys).

Once purged_snaps_last is reset, in the following OSD reboot, the snapshots that were marked as
purged (purged_snaps_ keys) in the mon's store will be also marked,
correspondingly, in the OSD store.
That way `scrub_purged_snaps` will be able to re-trim the snapshots that weren't
marked as purged in the OSD side (for some reason)

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

Signed-off-by: Matan Breizman <[email protected]>
@Matan-B
Matan-B force-pushed the wip-matanb-reset_purged_snaps_last branch from f410422 to 120ed0f Compare September 26, 2023 10:49
@idryomov

idryomov commented Sep 26, 2023 •

Copy link
Copy Markdown
Contributor

This issue was never reported (AFAIK) and this PR is proposed specifically to address the single known instance of it.

I think I saw at least one more report but I can't find it right now. It was a small test cluster suffering from other issues too, so it ended up just being recreated.

@Matan-B

Matan-B commented Sep 27, 2023

Copy link
Copy Markdown
Contributor Author

@rzarzynski, what is you opinion regarding merging this since it's only called on command? Do you prefer adding the command to the thrash tests as a sanity check?

@athanatos

Copy link
Copy Markdown
Contributor

@Matan-B It seems pretty simple to add it to the thrashing test, so I think we should. A command tested in teuthology is vastly easier to recommend to a user than one that isn't.

@github-actions github-actions Bot added the tests label Sep 28, 2023
@Matan-B
Matan-B force-pushed the wip-matanb-reset_purged_snaps_last branch 2 times, most recently from cb23d25 to a896027 Compare September 28, 2023 11:26
@Matan-B
Matan-B force-pushed the wip-matanb-reset_purged_snaps_last branch from a896027 to 680e088 Compare October 10, 2023 12:05
@Matan-B

Matan-B commented Oct 10, 2023

Copy link
Copy Markdown
Contributor Author

@rzarzynski, tests look good.
I don't think it requires additional qa as this command won't be called in any other (non-thrash) tests.

https://pulpito.ceph.com/matan-2023-10-10_12:05:40-rados:thrash-wip-matanb-reset_purged_snaps_last-test-distro-default-smithi/

@athanatos

Copy link
Copy Markdown
Contributor

jenkins test windows

@athanatos

Copy link
Copy Markdown
Contributor

jenkins test make check arm64

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

Seems good to merge to me once the checks pass.

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.

4 participants