Skip to content

rgw/notifications: add support for sharded persistent bucket notifications - #64018

Merged
yuriw merged 1 commit into
ceph:mainfrom
9401adarsh:wip-adashoka-71677
Sep 18, 2025
Merged

yuriw merged 1 commit into
ceph:mainfrom
9401adarsh:wip-adashoka-71677

Conversation

@9401adarsh

@9401adarsh 9401adarsh commented Jun 18, 2025 •

Copy link
Copy Markdown
Contributor

This PR contains changes to add support for sharded persistent bucket notifications.

Fixes: https://tracker.ceph.com/issues/71677
Signed-off-by: Adarsh Ashokan [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 Jun 21, 2025 •

Copy link
Copy Markdown

Config Diff Tool Output

+ added: rgw_bucket_persistent_notif_num_shards (rgw.yaml.in)

The above configuration changes are found in the PR. Please update the relevant release documentation if necessary.

@9401adarsh

Copy link
Copy Markdown
Contributor Author

Hi @yuvalif, have added code for shard creation and deletion based on create topic, delete topic and set topic attributes as discussed.

Comment thread src/rgw/rgw_rest_pubsub.cc Resolved
Comment thread src/rgw/rgw_rest_pubsub.cc Resolved
@9401adarsh

9401adarsh commented Jun 23, 2025 •

Copy link
Copy Markdown
Contributor Author

Hi @yuvalif, have added simple code for enqueuing notification to respective shards as well.

Comment thread src/rgw/driver/rados/rgw_notify.cc Outdated

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 think this is redundant ? am i wrong to assume that an event will always have an object associated with it so object name will res.object_name will never be nullptr

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.

you should probably store the shard name in the reservation, instead of recalculating it

Comment thread src/rgw/driver/rados/rgw_notify.cc Outdated

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.

we assume dpp is a valid pointer. no need to check

Comment thread src/rgw/driver/rados/rgw_notify.cc Outdated

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.

no need to pass unit64_t as const ref.
also, assuming the number of shards is not too big, you can probably use a uint32 or even uint16

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.

will convert it to a uint32.

Comment thread src/rgw/rgw_pubsub.h Resolved
Comment thread src/rgw/rgw_pubsub.h Outdated

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.

unlikely to happen, but this won't be called for version < 4
please set the default number of shards in an "else" statement after line 321

Comment thread src/rgw/rgw_rest_pubsub.cc Outdated

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.

i think that if the conf num of shards is different, we can emit a different log message ("warning")

Comment thread src/rgw/rgw_pubsub.cc Outdated

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.

i like the idea that you have an internal name generator that is used in all other places, and you don't copy the name creation logic to multiple places.
however, this implementation is pretty inefficient (you create a buch of strings and copy them into the vector)

in c++20 there is the concept of views of ranges, that do lazy evaluation/generation.
you can use these views in a for loop without storing the values in a container.
e.g.

auto names() {
    return std::ranges::views::iota(1, shard_count)
    | std::ranges::views::transform([&base_name](int i) {
            return base_name + std::to_string(i);
        });
}

for (const auto& name : names()) {
    ...
}

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.

understood, will delve into this more and make the change.

Comment thread src/rgw/driver/rados/rgw_notify.cc Outdated

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.

same here. put the shard name in the reservation and use it here

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

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.

pleas eremove rgw_bucket_persistent_notif_shard_enable

@9401adarsh
9401adarsh force-pushed the wip-adashoka-71677 branch from d0bdf07 to a824c2b Compare July 3, 2025 14:02
Comment thread src/rgw/rgw_pubsub.h Resolved
Comment thread src/rgw/driver/rados/rgw_notify.cc Resolved
Comment thread src/rgw/driver/rados/rgw_notify.cc Resolved
Comment thread src/rgw/driver/rados/rgw_notify.cc Resolved
Comment thread src/rgw/rgw_pubsub.cc Resolved
Comment thread src/rgw/rgw_rest_pubsub.cc Resolved
Comment thread PendingReleaseNotes Outdated

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.

Notifications lowercase please.

suggest:

The number of shards is specified by the central config option rgw_bucket_persistent_notif_num_shards.

Comment thread doc/radosgw/notifications.rst Outdated

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.

There's only one config value, so I think a list is overkill, unless there will be more in the future. Suggest:

Persistent bucket notifications are managed by the following central configuration options:

Comment thread doc/radosgw/notifications.rst Outdated

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.

A topic might be created by a Ceph upgrade? Or is this a timing thing? Suggest:

.. note:: When a topic is created during a Ceph upgrade, per-key ..

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.

in an ideal scenario, we wouldn't expect users to create topics during upgrade. however in-case they do, this is something the current design doesn't guarantee.

Comment thread src/rgw/driver/rados/rgw_notify.cc Outdated

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.

Suggest recasting the possessive to be less awkward:

"ERROR: failed to get the shard: " << shard_name << "'s size or the number of entries: "
->
"ERROR: failed to get the size or number of entries for queue shard: " << shard_name <<"

@adamemerson adamemerson changed the title rgw: (notifications) add support for sharded persistent bucket notifications rgw/notifications: add support for sharded persistent bucket notifications Aug 15, 2025
@yuvalif

yuvalif commented Aug 26, 2025

Copy link
Copy Markdown
Contributor

/config check ok

@yuvalif

yuvalif commented Aug 26, 2025

Copy link
Copy Markdown
Contributor

rerun of notification tests in teuthology:
https://pulpito.ceph.com/yuvalif-2025-08-26_08:27:49-rgw:notifications-wip-adashoka-71677-distro-default-smithi/

  • ignoring the valgrind issues
  • ignoring git clone failure in amqp test
  • http tests, including the new ones for the sharded queues are passing
  • existing kafka tests are passing
    • test_persistent_sharded_topic_config_change_kafka is failing (similar to previous run)
    • test_backward_compatibility_persistent_sharded_topic_kafka is passing

@9401adarsh

Copy link
Copy Markdown
Contributor Author

checking the following test: test_persistent_sharded_topic_config_change_kafka

@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

@9401adarsh

9401adarsh commented Aug 28, 2025 •

Copy link
Copy Markdown
Contributor Author

rebased off latest main to resolve merge conflicts.

@9401adarsh

Copy link
Copy Markdown
Contributor Author

jenkins make check

@9401adarsh

Copy link
Copy Markdown
Contributor Author

jenkins test make check arm64

@9401adarsh

Copy link
Copy Markdown
Contributor Author

jenkins test make check

1 similar comment
@9401adarsh

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@yuvalif

yuvalif commented Sep 3, 2025

Copy link
Copy Markdown
Contributor

in latest run only valgrind issues are seen: https://pulpito.ceph.com/yuvalif-2025-09-03_08:33:09-rgw:notifications-wip-adashoka-71677-distro-default-smithi/

* sharding is based on hash of bucket_name:object_key
* compatible with v1 topics
* include tests to cover backward compatibility and mixed cluster

Signed-off-by: Adarsh <[email protected]>
@yuvalif

yuvalif commented Sep 10, 2025

Copy link
Copy Markdown
Contributor

jenkins test make check

3 similar comments
@yuvalif

yuvalif commented Sep 10, 2025

Copy link
Copy Markdown
Contributor

jenkins test make check

@yuvalif

yuvalif commented Sep 10, 2025

Copy link
Copy Markdown
Contributor

jenkins test make check

@9401adarsh

Copy link
Copy Markdown
Contributor Author

jenkins test make check

@yuriw
yuriw merged commit f348f6c into ceph:main Sep 18, 2025
@github-actions

Copy link
Copy Markdown

This is an automated message by src/script/redmine-upkeep.py.

I have resolved the following tracker ticket due to the merge of this PR:

No backports are pending for the ticket. If this is incorrect, please update the tracker
ticket and reset to Pending Backport state.

Update Log: https://github.com/ceph/ceph/actions/runs/17833553931

@yuvalif

yuvalif commented Sep 18, 2025

Copy link
Copy Markdown
Contributor

@yuriw was this passing rgw regression in teuthology?

@9401adarsh
9401adarsh deleted the wip-adashoka-71677 branch March 12, 2026 21:41
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