Skip to content

rgw/cls: fix usage log issues caused by incorrect form of name-by-user keys - #65329

Merged
cbodley merged 1 commit into
ceph:mainfrom
matt-akamai:usage_trim_log_fixes
Oct 22, 2025
Merged

cbodley merged 1 commit into
ceph:mainfrom
matt-akamai:usage_trim_log_fixes

Conversation

@matt-akamai

@matt-akamai matt-akamai commented Sep 2, 2025 •

Copy link
Copy Markdown

We are upstreaming a change we worked on in-house to fix issue we've observed with trimming the usage log. Without this patch we are seeing keys being skipped, and the log grow exponentially over time leading to large OMAP warnings.

This patch resolves issues when the name-by-user keys have a user/payer ID that starts with 0. As part of this patch we've introduced a format change to the keys for user/payer IDs. To handle both the new and previous format, a new rgw config boolean is introduced to allow handling both formats of keys.

fixes https://tracker.ceph.com/issues/72593

@davidhall586 @yjin-aka

Signed-off-by: Matthew H [email protected]

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)
    • [X ] 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

@github-actions

github-actions Bot commented Sep 2, 2025

Copy link
Copy Markdown

Config Diff Tool Output

+ added: rgw_usage_log_key_transition (rgw.yaml.in)

The above configuration changes are found in the PR. Please update the relevant release documentation if necessary.
Ignore this comment if docs are already updated. To make the "Check ceph config changes" CI check pass, please comment /config check ok and re-run the test.

Comment thread src/cls/rgw/cls_rgw.cc Resolved
Comment thread src/cls/rgw/cls_rgw.cc Resolved
@cbodley

cbodley commented Sep 8, 2025

Copy link
Copy Markdown
Contributor

for docs:

@github-actions

github-actions Bot commented Sep 9, 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

Comment thread src/common/options/rgw.yaml.in Resolved

@yjin-aka yjin-aka 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.

Of course, I will approve this PR since it is the same one I created in Akamai.

Comment thread PendingReleaseNotes Resolved
@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

Comment thread doc/radosgw/admin.rst Resolved
@matt-akamai
matt-akamai requested a review from cbodley September 29, 2025 21:27
@cbodley

cbodley commented Sep 30, 2025

Copy link
Copy Markdown
Contributor

Signed-off-by — one or more commits in this PR are not signed

please sign the new commit, or squash it into the previous one. regarding the previous commit,

Signed-off-by: mheler <[email protected]>

please use your full name instead of mheler

1. The old name-by-user keys start with user/payer IDs. If those IDs
   start with '0', the resulting name-by-user keys could fall within
   the range of name-by-time keys, which has the prefix of '0' followed
   by 11 digits of the epoch. The intermingle of name-by-user and
   name-by-time keys causes the usage function to mistakenly treat
   name-by-user usage logs as name-by-time logs. This leads issues like
   failure to trim old logs because some name-by-user logs with later
   epoch listed BEFORE name-by-time logs with earlier epoch, causing
   the trim logic to stop prematurally.
2. To fix the above issue, adding prefix '~' in name-by-user keys when
   the user/payer IDs starting with '0'.
3. Introduce a rgw config option to indicate the need to deal with
   the co-existence of old and new name-by-user keys. Since handling
   both keys incurs performance penalty, this option helps avoid it
   once the cluster no longer has the old keys.
4. usage_iterate_range() is splitted to usage_iterate_range_by_user()
   and usage_iterate_range_by_time() as only the former needs to deal
   with the potential co-existence of old and new name-by-user keys.
   This split intends to simplify the logic.
5. "usage_basic" test in test_cls_rgw.cc is adapted slightly to reproduce
   the issue mentioned above.
6. A new test case "usage_key_transition" is added to test the handling
   of the co-existence of old and new keys.

Signed-off-by: Matthew N Heler <[email protected]>
@ivancich

Copy link
Copy Markdown
Member

@matt-akamai The tracker does not have an assignee. And I don't see Matt Heler listed among the potential assignees. Do you have a tracker account?

@anrao19

anrao19 commented Oct 22, 2025

Copy link
Copy Markdown
Contributor

pr testing completed and approved by @ivancich. Please find the details : https://tracker.ceph.com/issues/73371
@matt-akamai, if there is not further testing needed this can be merged. Please let me know

@anrao19

anrao19 commented Oct 22, 2025

Copy link
Copy Markdown
Contributor

jenkins test make check

@cbodley
cbodley merged commit efbde33 into ceph:main Oct 22, 2025
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.

6 participants