Skip to content

Commit c676c31

Browse files
committed
rgw/notification: Store the value of persistent_queue for existing persistent topic.
Fixes https://tracker.ceph.com/issues/66097 Signed-off-by: kchheda3 <[email protected]>
1 parent 26e6bb0 commit c676c31

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

src/rgw/rgw_rest_pubsub.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,8 @@ void RGWPSCreateTopicOp::execute(optional_yield y) {
422422
<< op_ret << dendl;
423423
return;
424424
}
425+
} else if (already_persistent) { // redundant call to CreateTopic
426+
dest.persistent_queue = topic->dest.persistent_queue;
425427
}
426428
const RGWPubSub ps(driver, get_account_or_tenant(s->owner.id), *s->penv.site);
427429
op_ret = ps.create_topic(this, topic_name, dest, topic_arn.to_string(),
@@ -882,7 +884,7 @@ void RGWPSSetTopicAttributesOp::execute(optional_yield y) {
882884
<< op_ret << dendl;
883885
return;
884886
}
885-
} else if (already_persistent) {
887+
} else if (already_persistent && !topic_needs_queue(dest)) {
886888
// changing the persistent topic to non-persistent.
887889
op_ret = driver->remove_persistent_topic(this, y, result.dest.persistent_queue);
888890
if (op_ret != -ENOENT && op_ret < 0) {

src/test/rgw/bucket_notification/test_bn.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,7 @@ def test_ps_s3_topic_admin_on_master():
662662
assert_equal(topic_arn2,
663663
'arn:aws:sns:' + zonegroup + ':' + tenant + ':' + topic_name + '_2')
664664
endpoint_address = 'http://127.0.0.1:9002'
665-
endpoint_args = 'push-endpoint='+endpoint_address
665+
endpoint_args = 'push-endpoint=' + endpoint_address + '&persistent=true'
666666
topic_conf3 = PSTopicS3(conn, topic_name+'_3', zonegroup, endpoint_args=endpoint_args)
667667
topic_arn3 = topic_conf3.set_config()
668668
assert_equal(topic_arn3,
@@ -674,6 +674,24 @@ def test_ps_s3_topic_admin_on_master():
674674
assert_equal(parsed_result['arn'], topic_arn3)
675675
matches = [tenant, UID_PREFIX]
676676
assert_true( all([x in parsed_result['owner'] for x in matches]))
677+
assert_equal(parsed_result['dest']['persistent_queue'],
678+
tenant + ":" + topic_name + '_3')
679+
680+
# recall CreateTopic and verify the owner and persistent_queue remain same.
681+
topic_conf3 = PSTopicS3(conn, topic_name + '_3', zonegroup,
682+
endpoint_args=endpoint_args)
683+
topic_arn3 = topic_conf3.set_config()
684+
assert_equal(topic_arn3,
685+
'arn:aws:sns:' + zonegroup + ':' + tenant + ':' + topic_name + '_3')
686+
# get topic 3 via commandline
687+
result = admin(
688+
['topic', 'get', '--topic', topic_name + '_3', '--tenant', tenant],
689+
get_config_cluster())
690+
parsed_result = json.loads(result[0])
691+
assert_equal(parsed_result['arn'], topic_arn3)
692+
assert_true(all([x in parsed_result['owner'] for x in matches]))
693+
assert_equal(parsed_result['dest']['persistent_queue'],
694+
tenant + ":" + topic_name + '_3')
677695

678696
# delete topic 3
679697
_, result = admin(['topic', 'rm', '--topic', topic_name+'_3', '--tenant', tenant], get_config_cluster())

0 commit comments

Comments
 (0)