Skip to content

rgw/notify: report topic queue ownership in topic stats - #71092

Merged
yuvalif merged 2 commits into
ceph:mainfrom
akkki007:wip-rgw-notify-topic-stats-owner
Oct 6, 2026
Merged

yuvalif merged 2 commits into
ceph:mainfrom
akkki007:wip-rgw-notify-topic-stats-owner

Conversation

@akkki007

Copy link
Copy Markdown
Contributor

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

Problem

There was no way to tell which radosgw is processing a persistent topic, or until when it holds it. radosgw-admin topic stats reported only reservations, size and entries.

Fix

The information is already in the queue's cls_lock, so report it from topic stats. Per the tracker discussion:

  • Owner per shard. Each queue shard has its own lock, and in a cluster with several gateways the shards of one topic may be owned by different ones, so every shard is reported separately even when the owner is the same.
  • The daemon name is now stored in the lock description. rgw_notify previously passed an empty description. Neither of the fields cls_lock already stored identifies a gateway usefully: the entity name is client.<global_id> assigned by the monitor at connect time, and the address is the librados client address, whose port is an ephemeral messenger port rather than the S3 frontend. Locks taken before this change carry an empty description until their next renewal.
  • No cookie. It is random per daemon and cannot be correlated with a gateway.
  • Expiration only, not a derived next-renewal time.
  • A shard that no gateway owns is reported without owner fields.

Testing

vstart, 2 radosgws, one persistent topic (11 shards):

"Shards": [
    {
        "Name": ":owner-test",
        "Owner": "client.rgw.8000",
        "Owner Address": "172.20.10.5:0/1630196608",
        "Ownership Expiration": "2026-08-17T12:08:46.841268+0530"
    },
    ...
]

All 11 shards reported client.rgw.8000. Killing that gateway with kill -9 at 12:07:40 moved every shard to client.rgw.8001 by 12:08:53, inside the 90s ownership timeout, so the reported owner follows the actual one.

No automated test: verifying this needs two gateways and a failover, which the bucket notification tests cannot currently set up.

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)

@akkki007
akkki007 requested review from a team as code owners August 17, 2026 07:27
@github-actions

Copy link
Copy Markdown

Thank you for your contribution. Since you are not yet a member of the Ceph organization with write permissions on ceph/ceph.git, our CI will not automatically run. Any member of the Ceph organization may label this PR ci-approved to allow Jenkins CI jobs to run.

@akkki007

Copy link
Copy Markdown
Contributor Author

Hii @yuvalif

Check this PR once and let me know if any changes

@akkki007

akkki007 commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

Gentle ping on this one — it's been sitting since 17 Aug with the needs-ci-approval label, so CI has never run on it and there's nothing for a reviewer to look at yet.

It's small (+58/-1 across two rgw_notify files and the notifications doc) and implements what was agreed on the tracker for #78693: reporting per-shard queue lock ownership and expiry in radosgw-admin topic stats, using the information already held in the queue's cls_lock.

@adamemerson you enabled CI on my other two RGW PRs — would you mind doing the same here? And @yuvalif, since you raised the original issue, I'd value your read on whether the reported shape matches what you had in mind.

No rush if it's simply low priority — I'd just like to know whether it's worth keeping current, or whether you'd rather it be closed.

Comment thread src/rgw/driver/rados/rgw_notify.h Resolved
Comment thread src/rgw/driver/rados/rgw_notify.h Resolved
Comment thread src/rgw/driver/rados/rgw_notify.cc Resolved
@yuvalif

yuvalif commented Sep 1, 2026

Copy link
Copy Markdown
Contributor
  • please show a sample output of the command
  • please add test. see: "src/test/rgw/bucket_notification/test_bn.py"

The owner of a persistent topic queue was not exposed anywhere, so there
was no way to tell which radosgw is processing a topic, or until when it
holds it. The information is already in the queue's lock, so report it
from "radosgw-admin topic stats".

Each queue shard is reported separately, since in a cluster with several
gateways the shards of one topic may be owned by different ones. A shard
which is not owned by any gateway is reported without an owner.

The daemon name is now stored in the lock description, so that the owner
can be identified. A lock held by a gateway that predates this carries an
empty description, which can be seen while an upgrade is ongoing, so the
ownership is kept as an optional whose absence means the shard is not
owned at all.

Fixes: https://tracker.ceph.com/issues/78693
Signed-off-by: Akshay Nazare <[email protected]>
Add a test that a persistent topic reports each of its queue shards, that
the ownership fields of a shard appear together or not at all, and that a
shard being processed names the gateway holding its lock.

The lock is held for as long as the gateway processes the queue and is
renewed meanwhile, so the ownership is still there once the queue has
drained and the test does not have to race it.

Signed-off-by: Akshay Nazare <[email protected]>
@akkki007
akkki007 force-pushed the wip-rgw-notify-topic-stats-owner branch from 393c971 to e83ed4b Compare September 1, 2026 12:01
@github-actions github-actions Bot added the tests label Sep 1, 2026
@akkki007

akkki007 commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

Both done, and the two code comments turned up real problems — thanks.

Sample output. From a vstart cluster with one gateway, after creating a persistent topic and writing one object. Truncated to the first three shards, since the default rgw_bucket_persistent_notif_num_shards is 11:

{
    "Topic Stats": {
        "Reservations": 0,
        "Size": 529,
        "Entries": 1,
        "Shards": [
            {
                "Name": ":sample-topic",
                "Owner": "client.rgw.8000",
                "Owner Address": "172.20.10.5:0/3549198245",
                "Ownership Expiration": "2026-09-01T17:29:54.108770+0530"
            },
            {
                "Name": ":sample-topic.1",
                "Owner": "client.rgw.8000",
                "Owner Address": "172.20.10.5:0/3549198245",
                "Ownership Expiration": "2026-09-01T17:29:54.123207+0530"
            },
            {
                "Name": ":sample-topic.2",
                "Owner": "client.rgw.8000",
                "Owner Address": "172.20.10.5:0/3549198245",
                "Ownership Expiration": "2026-09-01T17:29:54.140132+0530"
            }
        ]
    }
}

And the same topic after stopping the gateway and letting the locks expire, which is how an unowned shard reads:

        "Shards": [
            {
                "Name": ":sample-topic"
            },
            {
                "Name": ":sample-topic.1"
            },
            {
                "Name": ":sample-topic.2"
            }
        ]

Test. Added test_persistent_topic_stats_shard_owner to src/test/rgw/bucket_notification/test_bn.py, marked http_test so it needs no broker. It checks that every shard is reported, that the ownership fields appear together or not at all, and that a shard being processed names the gateway holding its lock. It is in its own commit so it can be read separately from the change itself.

The -ENOENT branch is gone — it was unreachable and would have masked a missing shard object. The boolean is gone too, replaced by a std::optional holding the name, address and expiration as a unit; the JSON is unchanged. Details in the individual replies.

@akkki007
akkki007 requested a review from yuvalif September 1, 2026 12:53
@adamemerson

Copy link
Copy Markdown
Contributor

ok to test

@yuvalif

yuvalif commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

@akkki007 seems to be an issue with the owner address:

   "Owner Address": "172.20.10.5:0/3549198245",

what does : "0/3549198245" mean?

@akkki007

akkki007 commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor Author

@yuvalif
That's the standard entity_addr_t rendering, <ip>:<port>/<nonce> — so port 0, nonce 3549198245.

The port is 0 because the lock is taken over a client connection: the gateway has no listening port for it, and cls_lock records the locker's address as seen from the request origin. The nonce is the random per-process value Ceph uses to tell instances apart, so it is what distinguishes two gateways on the same host, or the same gateway before and after a restart.

It comes from get_legacy_str(), which is that same form minus the v1:/v2: prefix you get from the normal entity_addr_t operator. I'm ready to switch it to the prefixed form, or drop the address altogether since Owner already names the daemon — whichever you prefer.

@yuvalif

yuvalif commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

@yuvalif That's the standard entity_addr_t rendering, <ip>:<port>/<nonce> — so port 0, nonce 3549198245.

The port is 0 because the lock is taken over a client connection: the gateway has no listening port for it, and cls_lock records the locker's address as seen from the request origin. The nonce is the random per-process value Ceph uses to tell instances apart, so it is what distinguishes two gateways on the same host, or the same gateway before and after a restart.

It comes from get_legacy_str(), which is that same form minus the v1:/v2: prefix you get from the normal entity_addr_t operator. I'm ready to switch it to the prefixed form, or drop the address altogether since Owner already names the daemon — whichever you prefer.

thanks for the info. please keep it. it would help top identify an rgw restart where the "owner" looks the same, but the address is different.

@anrao19

anrao19 commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

jenkins test windows

@anrao19

anrao19 commented Sep 28, 2026

Copy link
Copy Markdown
Contributor

This PR has been added to main integration testing by anuchaithra started 2026-09-28-05:23.

@anrao19

anrao19 commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

This PR has been added to main integration testing by anuchaithra started 2026-09-28-05:23.

pr testing completed and approved by @ivancich , more details in : https://tracker.ceph.com/issues/80952
@akkki007 , if no further testing is need then this pr can be merged

@yuvalif
yuvalif merged commit 39077b7 into ceph:main Oct 6, 2026
18 checks passed
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