Skip to content

rgw: implements timestamp-based epochs for versioned objects - #62469

Merged
cbodley merged 1 commit into
ceph:mainfrom
igomon-bloomberg:wip-timestamp-ver-epoch
Sep 16, 2025
Merged

cbodley merged 1 commit into
ceph:mainfrom
igomon-bloomberg:wip-timestamp-ver-epoch

Conversation

@igomon-bloomberg

Copy link
Copy Markdown
Contributor

rgw: implements timestamp-based epochs for objects in versioned buckets.

Fixes: https://tracker.ceph.com/issues/68466
Signed-off-by: Igor Gomon [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)
    • 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 Apr 4, 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

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

very nice, thanks for adding the comments!

Comment thread src/cls/rgw/cls_rgw.cc Resolved
Comment thread src/cls/rgw/cls_rgw.cc Resolved
Comment thread src/cls/rgw/cls_rgw.cc Resolved
Comment thread src/cls/rgw/cls_rgw.cc Resolved
Comment thread src/cls/rgw/cls_rgw_ops.h Resolved
Comment thread src/rgw/driver/rados/rgw_rados.cc Resolved
Comment thread src/cls/rgw/cls_rgw.cc Resolved
@igomon-bloomberg
igomon-bloomberg force-pushed the wip-timestamp-ver-epoch branch 2 times, most recently from e93a694 to 0aa3fd8 Compare June 25, 2025 19:47

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

code changes look good 👍

Comment thread src/test/rgw/rgw_multi/tests.py Resolved
Comment thread src/test/rgw/rgw_multi/tests.py Resolved
Comment thread src/test/rgw/rgw_multi/tests.py Resolved
Comment thread src/test/rgw/rgw_multi/tests.py Resolved
Comment thread src/test/rgw/rgw_multi/tests.py Resolved
Comment thread src/test/rgw/rgw_multi/tests.py Resolved
Comment thread src/cls/rgw/cls_rgw.cc Resolved
Comment thread src/cls/rgw/cls_rgw.cc Resolved
Comment thread src/cls/rgw/cls_rgw_ops.h Resolved
Comment thread src/test/rgw/rgw_multi/tests.py Resolved
Comment thread src/test/rgw/rgw_multi/tests.py Outdated
Comment on lines 4052 to 4056

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.

so this relies on radosgw-admin bucket list for access to olh epochs, and reproduces internal logic for ordering.. but wouldn't we get the same test coverage by comparing the outputs from s3 ListObjectVersions?

zonegroup_bucket_checkpoint() is already calling check_bucket_eq() to verify that versioned listings look the same on all zones. are you sure we need check_modification_history()?

@igomon-bloomberg igomon-bloomberg Sep 5, 2025 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved away from using s3 ListObjectVersions because I noticed in some more intense tests I did it was truncating the mtime - so my test would start to fail.

zonegroup_bucket_checkpoint() is already calling check_bucket_eq() to verify that versioned listings look the same

Oh - I didn't realize that.. hmm

@igomon-bloomberg igomon-bloomberg Sep 5, 2025 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing that check_modification_history() does (that I don't see in check_bucket_eq()) is checking for out-of-order versions. This was a problem with monotonically increasing epochs but shouldn't be a problem with the timestamp-based epochs. Thus I believe we should keep. Do you agree?

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.

One thing that check_modification_history() does (that I don't see in check_bucket_eq()) is checking for out-of-order versions

my understanding of for k1, k2 in zip_longest(b1_versions, b2_versions) in check_bucket_eq() is that it compares the listings entry-by-entry, so we'd see comparisons fail if ordered differently

@igomon-bloomberg igomon-bloomberg Sep 5, 2025 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but versions might be listed in both zones out of order: older first, newer then. With monotonically increasing epochs when an epoch collision would happen it would be resolved view lexicographical comparison - so older version might get ahead of the newer in the OLH history - thus bucket listing would not be in chronological order in both zones. Not so with timestamp-based epochs. Hence the check.

@cbodley cbodley Sep 9, 2025 •

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.

ok, but src/test/cls_rgw/test_cls_rgw.cc would probably be a better place to set up specific races and verify that listing gives the order we expect. this stuff is best exercised against a single index shard on a single zone

edit to add: the problem with relying on multisite tests for this coverage is that we can't reliably produce these races. if the races are probabilistic, a passing test doesn't prove correctness

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As agreed I will publish a separate PR that will add a new test in test_cls_rgw.cc to reproduce race conditions in a deterministic manner

@igomon-bloomberg
igomon-bloomberg force-pushed the wip-timestamp-ver-epoch branch 2 times, most recently from c448012 to 03fb249 Compare September 9, 2025 15:55
@cbodley

cbodley commented Sep 10, 2025

Copy link
Copy Markdown
Contributor

from https://jenkins.ceph.com/job/ceph-pull-requests-arm64/80683/

The following tests FAILED:
	298 - run-tox-qa (Failed)
	312 - run-tox-alerts-check (Failed)
	315 - run-tox-alerts-lint (Failed)

you wouldn't think these are related, but they're linting our tests:

tasks/rgw_multi/tests.py:4061: error: Argument 1 to "ObjVersion" has incompatible type "Any | None"; expected "str"  [arg-type]
tasks/rgw_multi/tests.py:4061: error: Argument 2 to "ObjVersion" has incompatible type "Any | None"; expected "str"  [arg-type]
tasks/rgw_multi/tests.py:4061: error: Argument 4 to "ObjVersion" has incompatible type "Any | None"; expected "int"  [arg-type]
tasks/rgw_multi/tests.py:4062: error: Argument 1 to "get" of "dict" has incompatible type "Any | None"; expected "str"  [arg-type]
tasks/rgw_multi/tests.py:4063: error: Invalid index type "Any | None" for "dict[str, list[ObjVersion]]"; expected type "str"  [index]
tasks/rgw_multi/tests.py:4064: error: Invalid index type "Any | None" for "dict[str, list[ObjVersion]]"; expected type "str"  [index]
tasks/rgw_multi/tests_es.py:15: error: Name "datetime" already defined (by an import)  [no-redef]
Found 7 errors in 2 files (checked 294 source files)
mypy: exit 1 (95.15 seconds) /home/jenkins-build/build/workspace/ceph-pull-requests-arm64/qa> mypy --no-namespace-packages . pid=2698859
mypy: FAIL ✖ in 1 minute 48.19 seconds

@cbodley

cbodley commented Sep 12, 2025

Copy link
Copy Markdown
Contributor

Comment thread src/test/rgw/rgw_multi/tests.py Outdated
Comment on lines 3983 to 3985

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.

nit: i searched the test results for test_timestamp_based_epochs but it doesn't show up. when nose runs this test, it's displayed as:

tasks.rgw_multisite_tests:the test generates objects/instance in both zones: for each of NUM_OBJECTS NUM_VERSIONS are generated; ... ok

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I've added the docstring to my test. Should I remove it?

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.

maybe just put test_timestamp_based_epochs by itself on the first line? up to you

please also squash the commits, and this is ready to merge

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.

@cbodley Can this merge, or is it waiting for something?

@adamemerson just waiting on above ^

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cbodley commits squashed, about the test_timestamp_based_epochs() - I'm not sure what you meant...

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.

@igomon-bloomberg in the nose log output, i'd prefer to see the function name instead of first line of docstring:

tasks.rgw_multisite_tests:the test generates objects/instance in both zones: for each of NUM_OBJECTS NUM_VERSIONS are generated; ... ok

most other test cases don't have a docstring. the ones that do, like test_sync_multiple_buckets_to_single(), repeat the function name as the first line of docstring:

def test_sync_multiple_buckets_to_single():
    """
    test_sync_multiple_buckets_to_single:
        directional flow
        (a) pipe: sync zoneA bucketA,bucketB to zoneB bucketB

        (b) configure another policy at bucketA level with pipe configured
        to sync from multiple buckets (bucketA & bucketB)

        verify zoneA bucketA & bucketB syncs to zoneB BucketB
    """

this way we can still grep the log for test function names to verify that they ran/passed

@igomon-bloomberg igomon-bloomberg Sep 16, 2025 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@cbodley

cbodley commented Sep 12, 2025

Copy link
Copy Markdown
Contributor

qa pending in https://pulpito.ceph.com/cbodley-2025-09-12_13:58:27-rgw-wip-68466-distro-default-gibba

results look great!

the two-zone multisite job passed
the two-zonegroup multisite job had a single failure tracked in https://tracker.ceph.com/issues/70858

FAIL: rgw_multi.tests.test_bucket_log_trim_after_delete_bucket_secondary_reshard

@adamemerson

Copy link
Copy Markdown
Contributor

jenkins test make check arm64

@adamemerson

Copy link
Copy Markdown
Contributor

@cbodley Can this merge, or is it waiting for something?

@cbodley

cbodley commented Sep 16, 2025

Copy link
Copy Markdown
Contributor

@cbodley

cbodley commented Sep 16, 2025

Copy link
Copy Markdown
Contributor

jenkins test make check arm64

@cbodley
cbodley merged commit 297f7e5 into ceph:main Sep 16, 2025
@cbodley

cbodley commented Sep 16, 2025

Copy link
Copy Markdown
Contributor

thanks @igomon-bloomberg!

@ivancich

ivancich commented Apr 2, 2026

Copy link
Copy Markdown
Member

@igomon-bloomberg : We have a tracker that matches a downstream issue we faced, and the fix was to revert the one commit in this PR. The same issue has now been reported upstream here: https://tracker.ceph.com/issues/75777 .

So would you prefer to revert this PR or would you like to try to address the tracker (or alternatively show that this PR is not responsible)?

Thanks! cc: @cbodley .

@cbodley

cbodley commented Apr 2, 2026

Copy link
Copy Markdown
Contributor

thanks @ivancich. the downstream reproducer for https://tracker.ceph.com/issues/75777 was showing a ton of leftover olh/instance entries, which is why listings started to fail with EFBIG

i think https://tracker.ceph.com/issues/74428 is the most relevant tracker for this, and @jzhu116-bloomberg is working on this in #67661 for https://tracker.ceph.com/issues/75340

@igomon-bloomberg

igomon-bloomberg commented Apr 2, 2026 •

Copy link
Copy Markdown
Contributor Author

Yes, @jzhu116-bloomberg is already working on the fix in #67661, I believe.

jhoblitt added a commit to jhoblitt/rgw-go that referenced this pull request Oct 16, 2026
…read

decreasing_str prints every epoch from 2^32 up as a negative or 21-digit
number. decode_list_index_key refuses both, so bucket listings skip those
versions, and the negative form sorts in ascending epoch order ahead of the
lower bands, so deleting the current version can make an older one than the
next-newest current, or remove the key. That holds on Squid and Tentacle;
v21.0.0 widens the bands (ceph/ceph#62469). read_olh_log dereferences the
first epoch of a pending log before it knows the log holds one, which
changes no answer.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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