New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rgw/notifications: fix tag based filtering to work on all ops #38246
Conversation
f8099cd
to
6fc477f
Compare
multisite tests suit is teuthology (with fixed tests) is passing: http://pulpito.front.sepia.ceph.com/yuvalif-2020-11-24_13:36:00-rgw:multisite-wip-yuval-fix-48321-distro-basic-gibba/ |
src/rgw/rgw_notify.cc
Outdated
return src_obj; | ||
} | ||
|
||
void metadata_from_attributes(const req_state* s, rgw::sal::RGWObject* obj, KeyValueList& metadata) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change KeyValueList
to KeyValueMap
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks great, couple of comments
src/rgw/rgw_notify.cc
Outdated
return src_obj; | ||
} | ||
|
||
void metadata_from_attributes(const req_state* s, rgw::sal::RGWObject* obj, KeyValueList& metadata) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
per call, KeyValueList sounds fine ("using flat_map<...") but maybe name it something-map, so we won't think it's an assoc-list?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
// not able to decode tags | ||
return; | ||
} | ||
tags = std::move(obj_tags.get_tags()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is unexpected: the code assumes that KeyValueList is of the same underlying type as RGWObjTags::get_tags() returns?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure what you mean by "unexpected"?
if the type was different, then this would have been a compilation error.
BTW, if the tags types don't match there will be other places in the code where compilation would fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unexpected to me the reader, not the compiler
src/rgw/rgw_notify.cc
Outdated
tags = std::move(obj_tags.get_tags()); | ||
} | ||
} | ||
|
||
// populate record from request | ||
void populate_record_from_request(const req_state *s, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is "record" part of notification terminology? what exactly is it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the term "record" is taken from the structure here: https://docs.aws.amazon.com/AmazonS3/latest/dev/notification-content-structure.html :
{
"Records":[
{
"eventVersion":"2.2",
"eventSource":"aws:s3",
"awsRegion":"us-west-2",
...
however, we could have used the term "event" or the term "notification" (also used in the AWS doc).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, I think match and record are a bit free of context for me, but whatevs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will change to "event" as this is what AWS uses in their doc.
"record" is just the term inside the xml
return false; | ||
} | ||
} else { | ||
// try to fetch the metadata from the attributes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
src/rgw/rgw_notify.cc
Outdated
// opaque data will be filled from topic configuration | ||
} | ||
|
||
bool match(const rgw_pubsub_topic_filter& filter, const req_state* s, const rgw::sal::RGWObject* obj, EventType event) { | ||
bool match(const rgw_pubsub_topic_filter& filter, const req_state* s, rgw::sal::RGWObject* obj, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"match" is a pretty generic and context free name for what this function does?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is namespaced under rgw::notify
.
the different "match()" functions have different prototypes according to the filter they use.
note that I used the term "match()" and not "filter()" so there is less ambiguity in whether you "filter out" or "filter in".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the namespace isn't very visible here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how about changing to notification_match()
?
then in publish_reserve()
may be clearer:
if (!notification_match(topic_filter, res.s, res.object, event_type, req_tags)) {
// notification does not apply to req_state
continue;
}
6fc477f
to
51b2a8b
Compare
51b2a8b
to
0ae2e5f
Compare
jenkins retest this please |
fixes: https://tracker.ceph.com/issues/48321 Signed-off-by: Yuval Lifshitz <ylifshit@redhat.com>
0ae2e5f
to
c6181ba
Compare
as well as some other nameing changes for clarifications Signed-off-by: Yuval Lifshitz <ylifshit@redhat.com>
@mattbenjamin did the name changes in the 2nd commit |
fixes: https://tracker.ceph.com/issues/48321
Signed-off-by: Yuval Lifshitz ylifshit@redhat.com
Show available Jenkins commands
jenkins retest this please
jenkins test classic perf
jenkins test crimson perf
jenkins test signed
jenkins test make check
jenkins test make check arm64
jenkins test submodules
jenkins test dashboard
jenkins test api
jenkins test docs
jenkins render docs
jenkins test ceph-volume all
jenkins test ceph-volume tox
]