@@ -234,7 +234,13 @@ bool verify_topic_permission(const DoutPrefixProvider* dpp, req_state* s,
234234 return verify_topic_permission (dpp, s, topic.owner , arn, policy, op);
235235}
236236
237- // command (AWS compliant):
237+ bool should_forward_request_to_master (req_state* s, rgw::sal::Driver* driver) {
238+ return (!driver->is_meta_master () &&
239+ rgw::all_zonegroups_support (*s->penv .site ,
240+ rgw::zone_features::notification_v2));
241+ }
242+
243+ // command (AWS compliant):
238244// POST
239245// Action=CreateTopic&Name=<topic-name>[&OpaqueData=data][&push-endpoint=<endpoint>[&persistent][&<arg1>=<value1>]]
240246class RGWPSCreateTopicOp : public RGWOp {
@@ -273,7 +279,7 @@ class RGWPSCreateTopicOp : public RGWOp {
273279 // Remove the args that are parsed, so the push_endpoint_args only contains
274280 // necessary one's which is parsed after this if. but only if master zone,
275281 // else we do not remove as request is forwarded to master.
276- if (driver-> is_meta_master ( )) {
282+ if (! should_forward_request_to_master (s, driver )) {
277283 s->info .args .remove (" OpaqueData" );
278284 s->info .args .remove (" push-endpoint" );
279285 s->info .args .remove (" persistent" );
@@ -396,7 +402,7 @@ class RGWPSCreateTopicOp : public RGWOp {
396402
397403void RGWPSCreateTopicOp::execute (optional_yield y) {
398404 // master request will replicate the topic creation.
399- if (!driver-> is_meta_master ( )) {
405+ if (should_forward_request_to_master (s, driver )) {
400406 op_ret = rgw_forward_request_to_master (
401407 this , *s->penv .site , s->owner .id , &bl_post_body, nullptr , s->info , y);
402408 if (op_ret < 0 ) {
@@ -863,7 +869,7 @@ class RGWPSSetTopicAttributesOp : public RGWOp {
863869};
864870
865871void RGWPSSetTopicAttributesOp::execute (optional_yield y) {
866- if (!driver-> is_meta_master ( )) {
872+ if (should_forward_request_to_master (s, driver )) {
867873 op_ret = rgw_forward_request_to_master (
868874 this , *s->penv .site , s->owner .id , &bl_post_body, nullptr , s->info , y);
869875 if (op_ret < 0 ) {
@@ -1008,9 +1014,10 @@ class RGWPSDeleteTopicOp : public RGWOp {
10081014};
10091015
10101016void RGWPSDeleteTopicOp::execute (optional_yield y) {
1011- if (!driver-> is_meta_master ( )) {
1017+ if (should_forward_request_to_master (s, driver )) {
10121018 op_ret = rgw_forward_request_to_master (
10131019 this , *s->penv .site , s->owner .id , &bl_post_body, nullptr , s->info , y);
1020+
10141021 if (op_ret < 0 ) {
10151022 ldpp_dout (this , 1 )
10161023 << " DeleteTopic forward_request_to_master returned ret = " << op_ret
@@ -1260,7 +1267,7 @@ int RGWPSCreateNotifOp::verify_permission(optional_yield y) {
12601267}
12611268
12621269void RGWPSCreateNotifOp::execute (optional_yield y) {
1263- if (!driver-> is_meta_master ( )) {
1270+ if (should_forward_request_to_master (s, driver )) {
12641271 op_ret = rgw_forward_request_to_master (
12651272 this , *s->penv .site , s->owner .id , &data, nullptr , s->info , y);
12661273 if (op_ret < 0 ) {
@@ -1462,7 +1469,7 @@ int RGWPSDeleteNotifOp::verify_permission(optional_yield y) {
14621469}
14631470
14641471void RGWPSDeleteNotifOp::execute (optional_yield y) {
1465- if (!driver-> is_meta_master ( )) {
1472+ if (should_forward_request_to_master (s, driver )) {
14661473 bufferlist indata;
14671474 op_ret = rgw_forward_request_to_master (
14681475 this , *s->penv .site , s->owner .id , &indata, nullptr , s->info , y);
0 commit comments