Skip to content
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/notification: remove non x-amz-meta-* attributes from bucket notifications #51308

Merged
merged 1 commit into from May 9, 2023

Conversation

jzhu116-bloomberg
Copy link
Contributor

Do not populate x-amz-meta-* attributes to the metadata section of the notification events.

Fixes: https://tracker.ceph.com/issues/59592
Signed-off-by: Jane Zhu jzhu116@bloomberg.net

Contribution Guidelines

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
  • 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 dashboard cephadm
  • jenkins test api
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox
  • jenkins test windows

@jzhu116-bloomberg jzhu116-bloomberg requested a review from a team as a code owner May 2, 2023 00:16
@github-actions github-actions bot added the rgw label May 2, 2023
@jzhu116-bloomberg
Copy link
Contributor Author

Tests look good. An example:
{ "Records": [ { "eventVersion": "2.2", "eventSource": "ceph:s3", "awsRegion": "zg1", "eventTime": "2023-05-01T23:04:59.686582Z", "eventName": "ObjectCreated:Put", "userIdentity": { "principalId": "zone.user" }, "requestParameters": { "sourceIPAddress": "" }, "responseElements": { "x-amz-request-id": "ae3edd61-a8e2-47de-9ad5-f184a718c267.4158.12721181013944665849", "x-amz-id-2": "103e-zg1-1-zg1" }, "s3": { "s3SchemaVersion": "1.0", "configurationId": "notif1", "bucket": { "name": "fish", "ownerIdentity": { "principalId": "zone.user" }, "arn": "arn:aws:s3:zg1::fish", "id": "ae3edd61-a8e2-47de-9ad5-f184a718c267.4160.1" }, "object": { "key": "myfile", "size": 52428800, "eTag": "63e8040a86587b5d0f044eba23bd06d4", "versionId": "Kinu5q1XLiAC9DW9yuqJKTSlkkIXGyy", "sequencer": "9B455064E965CE2E", "metadata": [ { "key": "x-amz-meta-foo", "val": "bar" }, { "key": "x-amz-meta-ka", "val": "boom" } ], "tags": [ { "key": "Key1", "val": "Value1" } ] } }, "eventId": "1682982299.785278.63e8040a86587b5d0f044eba23bd06d4", "opaqueData": "" } ] }

@mattbenjamin
Copy link
Contributor

the notifications feature has automated tests; could we add such a test there?

@jzhu116-bloomberg
Copy link
Contributor Author

the notifications feature has automated tests; could we add such a test there?

will do

std::copy_if(res.x_meta_map.cbegin(), res.x_meta_map.cend(),
std::inserter(event.x_meta_map, event.x_meta_map.end()),
[](const auto& m) {
return (m.first.rfind("x-amz-meta-", 0) == 0);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the condition for being a metadata attribute is in line 646:

boost::algorithm::starts_with(attr.first, RGW_ATTR_META_PREFIX)

also, not clear to me how these attributes get into the reservation object in the first place. since the above condition should make sure only metadata attributes are inserted to the map

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if the map isn't general, then yes, it would be preferable to not add them ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

made the changes to stop populating non-metadata attributes to the reservation object

@jzhu116-bloomberg
Copy link
Contributor Author

the notifications feature has automated tests; could we add such a test there?

It looks we don't need a new test case for this. I just added metadata checking in verify_s3_records_by_elements.

…a section of the regular notifications

Signed-off-by: Juan Zhu <jzhu4@dev-10-34-20-139.pw1.bcc.bloomberg.com>
@jzhu116-bloomberg
Copy link
Contributor Author

@mattbenjamin, @yuvalif, it looks like the failure in ceph API tests has nothing to do with the changes. I don't have the privilege to re-run it in the jenkins pipeline. Can either of please re-trigger it?

@yuvalif yuvalif self-requested a review May 4, 2023 14:00
@yuvalif
Copy link
Contributor

yuvalif commented May 4, 2023

jenkins test api

@yuvalif
Copy link
Contributor

yuvalif commented May 9, 2023

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants