]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/pubsub: support eventId in push mode 32221/head
authorYuval Lifshitz <yuvalif@yahoo.com>
Sun, 1 Dec 2019 18:08:12 +0000 (20:08 +0200)
committerNathan Cutler <ncutler@suse.com>
Fri, 24 Jan 2020 15:11:53 +0000 (16:11 +0100)
Signed-off-by: Yuval Lifshitz <yuvalif@yahoo.com>
(cherry picked from commit 19832a0daeb7b23006d1c38059ad14f0c239d32a)

Conflicts:
PendingReleaseNotes

PendingReleaseNotes
doc/radosgw/notifications.rst
doc/radosgw/pubsub-module.rst
src/rgw/rgw_notify.cc
src/rgw/rgw_pubsub.cc
src/rgw/rgw_pubsub.h
src/rgw/rgw_sync_module_pubsub.cc

index 2b6fc9b0fa1e76f64a3a0457533c3de9d6a41f59..f70af61496b28a783c4a6d4a15bcb4b477834885 100644 (file)
@@ -1,123 +1,4 @@
-14.2.4
-------
-
-* In the Zabbix Mgr Module there was a typo in the key being send
-  to Zabbix for PGs in backfill_wait state. The key that was sent
-  was 'wait_backfill' and the correct name is 'backfill_wait'.
-  Update your Zabbix template accordingly so that it accepts the
-  new key being send to Zabbix.
-
-14.2.3
---------
-
-* Nautilus-based librbd clients can now open images on Jewel clusters.
-
-* The RGW "num_rados_handles" has been removed.
-  If you were using a value of "num_rados_handles" greater than 1
-  multiply your current "objecter_inflight_ops" and
-  "objecter_inflight_op_bytes" paramaeters by the old
-  "num_rados_handles" to get the same throttle behavior.
-  
-* The ``bluestore_no_per_pool_stats_tolerance`` config option has been
-  replaced with ``bluestore_fsck_error_on_no_per_pool_stats``
-  (default: false).  The overall default behavior has not changed:
-  fsck will warn but not fail on legacy stores, and repair will
-  convert to per-pool stats.
-
-14.2.2
-------
-
-* The no{up,down,in,out} related commands has been revamped.
-  There are now 2 ways to set the no{up,down,in,out} flags:
-  the old 'ceph osd [un]set <flag>' command, which sets cluster-wide flags;
-  and the new 'ceph osd [un]set-group <flags> <who>' command,
-  which sets flags in batch at the granularity of any crush node,
-  or device class.
-
-* RGW: radosgw-admin introduces two subcommands that allow the
-  managing of expire-stale objects that might be left behind after a
-  bucket reshard in earlier versions of RGW. One subcommand lists such
-  objects and the other deletes them. Read the troubleshooting section
-  of the dynamic resharding docs for details.
-
-14.2.5
-------
-
-* The telemetry module now has a 'device' channel, enabled by default, that
-  will report anonymized hard disk and SSD health metrics to telemetry.ceph.com
-  in order to build and improve device failure prediction algorithms.  Because
-  the content of telemetry reports has changed, you will need to either re-opt-in
-  with::
-
-    ceph telemetry on
-
-  You can view exactly what information will be reported first with::
-
-    ceph telemetry show
-    ceph telemetry show device   # specifically show the device channel
-
-  If you are not comfortable sharing device metrics, you can disable that
-  channel first before re-opting-in:
-
-    ceph config set mgr mgr/telemetry/channel_crash false
-    ceph telemetry on
-
-* The telemetry module now reports more information about CephFS file systems,
-  including:
-
-    - how many MDS daemons (in total and per file system)
-    - which features are (or have been) enabled
-    - how many data pools
-    - approximate file system age (year + month of creation)
-    - how many files, bytes, and snapshots
-    - how much metadata is being cached
-
-  We have also added:
-
-    - which Ceph release the monitors are running
-    - whether msgr v1 or v2 addresses are used for the monitors
-    - whether IPv4 or IPv6 addresses are used for the monitors
-    - whether RADOS cache tiering is enabled (and which mode)
-    - whether pools are replicated or erasure coded, and
-      which erasure code profile plugin and parameters are in use
-    - how many hosts are in the cluster, and how many hosts have each type of daemon
-    - whether a separate OSD cluster network is being used
-    - how many RBD pools and images are in the cluster, and how many pools have RBD mirroring enabled
-    - how many RGW daemons, zones, and zonegroups are present; which RGW frontends are in use
-    - aggregate stats about the CRUSH map, like which algorithms are used, how big buckets are, how many rules are defined, and what tunables are in use
-
-  If you had telemetry enabled, you will need to re-opt-in with::
-
-    ceph telemetry on
-
-  You can view exactly what information will be reported first with::
-
-    ceph telemetry show        # see everything
-    ceph telemetry show basic  # basic cluster info (including all of the new info)
-
-* A health warning is now generated if the average osd heartbeat ping
-  time exceeds a configurable threshold for any of the intervals
-  computed.  The OSD computes 1 minute, 5 minute and 15 minute
-  intervals with average, minimum and maximum values.  New configuration
-  option ``mon_warn_on_slow_ping_ratio`` specifies a percentage of
-  ``osd_heartbeat_grace`` to determine the threshold.  A value of zero
-  disables the warning.  New configuration option
- ``mon_warn_on_slow_ping_time`` specified in milliseconds over-rides the
-  computed value, causes a warning
-  when OSD heartbeat pings take longer than the specified amount.
-  New admin command ``ceph daemon mgr.# dump_osd_network [threshold]`` command will
-  list all connections with a ping time longer than the specified threshold or
-  value determined by the config options, for the average for any of the 3 intervals.
-  New admin command ``ceph daemon osd.# dump_osd_network [threshold]`` will
-  do the same but only including heartbeats initiated by the specified OSD.
-
-* New OSD daemon command dump_recovery_reservations which reveals the
-  recovery locks held (in_progress) and waiting in priority queues.
-
-* New OSD daemon command dump_scrub_reservations which reveals the
-  scrub reservations that are held for local (primary) and remote (replica) PGs.
-
-14.2.6
+14.2.7
 ------
 
 * The following OSD memory config options related to bluestore cache autotuning can now
 
     ceph config set global <option> <value>
 
-14.2.7
-------
-
 * The MGR now accepts 'profile rbd' and 'profile rbd-read-only' user caps.
   These caps can be used to provide users access to MGR-based RBD functionality
   such as 'rbd perf image iostat' an 'rbd perf image iotop'.
   would not allow a pool to ever have completely balanced PGs.  For example, if
   crush requires 1 replica on each of 3 racks, but there are fewer OSDs in 1 of
   the racks.  In those cases, the configuration value can be increased.
+
+* RGW: a mismatch between the bucket notification documentation and the actual
+  message format was fixed. This means that any endpoints receiving bucket 
+  notification, will now receive the same notifications inside an JSON array
+  named 'Records'. Note that this does not affect pulling bucket notification
+  from a subscription in a 'pubsub' zone, as these are already wrapped inside
+  that array.
index 152dc03f83cf35fa9509f4ab2484927c7f4d3218..f3c43831a168702d31fa5f4e28199ad80d9f4b95 100644 (file)
@@ -258,7 +258,7 @@ pushed or pulled using the pubsub sync module.
                    "eTag":"",
                    "versionId":"",
                    "sequencer": "",
-                   "metadata":""
+                   "metadata":[]
                }
            },
            "eventId":"",
@@ -283,7 +283,7 @@ pushed or pulled using the pubsub sync module.
 - s3.object.version: object version in case of versioned bucket
 - s3.object.sequencer: monotonically increasing identifier of the change per object (hexadecimal format)
 - s3.object.metadata: any metadata set on the object sent as: ``x-amz-meta-`` (an extension to the S3 notification API) 
-- s3.eventId: not supported (an extension to the S3 notification API)
+- s3.eventId: unique ID of the event, that could be used for acking (an extension to the S3 notification API)
 
 .. _PubSub Module : ../pubsub-module
 .. _S3 Notification Compatibility: ../s3-notification-compatibility
index 11dbd7e1e3f43f7a7139655f9eaa1c4f5eb158c0..ba11aa4bfaf6a5a03995d315e88180ab02d5880b 100644 (file)
@@ -438,7 +438,7 @@ the events will have an S3-compatible record format (JSON):
                    "eTag":"",
                    "versionId":"",
                    "sequencer":"",
-                   "metadata":""
+                   "metadata":[]
                }
            },
            "eventId":"",
@@ -452,7 +452,6 @@ the events will have an S3-compatible record format (JSON):
 - requestParameters: not supported
 - responseElements: not supported
 - s3.configurationId: notification ID that created the subscription for the event
-- s3.eventId: unique ID of the event, that could be used for acking (an extension to the S3 notification API)
 - s3.bucket.name: name of the bucket
 - s3.bucket.ownerIdentity.principalId: owner of the bucket
 - s3.bucket.arn: ARN of the bucket
index c2454b1babacd0e3e638bf45c10324b07e2539d4..8d87c4a2f61efff641d768751ee168baf8b07168 100644 (file)
@@ -19,15 +19,11 @@ void populate_record_from_request(const req_state *s,
         const std::string& etag, 
         EventType event_type,
         rgw_pubsub_s3_record& record) { 
-  record.eventVersion = "2.1";
-  record.eventSource = "aws:s3";
   record.eventTime = mtime;
   record.eventName = to_string(event_type);
   record.userIdentity = s->user->user_id.id;    // user that triggered the change
-  record.sourceIPAddress = "";                  // IP address of client that triggered the change: TODO
   record.x_amz_request_id = s->req_id;          // request ID of the original change
   record.x_amz_id_2 = s->host_id;               // RGW on which the change was made
-  record.s3SchemaVersion = "1.0";
   // configurationId is filled from subscription configuration
   record.bucket_name = s->bucket_name;
   record.bucket_ownerIdentity = s->bucket_owner.get_id().id;
@@ -40,10 +36,7 @@ void populate_record_from_request(const req_state *s,
   const utime_t ts(real_clock::now());
   boost::algorithm::hex((const char*)&ts, (const char*)&ts + sizeof(utime_t), 
           std::back_inserter(record.object_sequencer));
-  // event ID is rgw extension (not in the S3 spec), used for acking the event
-  // same format is used in both S3 compliant and Ceph specific events
-  // not used in case of push-only mode
-  record.id = "";
+  set_event_id(record.id, etag, ts);
   record.bucket_id = s->bucket.bucket_id;
   // pass meta data
   record.x_meta_map = s->info.x_meta_map;
index bb53dc9aaad4c1bf06caa6e0afc9ea13580924b4..404bb45ade0e2ba0989bb1c08c8656d8b9322042 100644 (file)
 
 #define dout_subsys ceph_subsys_rgw
 
+void set_event_id(std::string& id, const std::string& hash, const utime_t& ts) {
+  char buf[64];
+  const auto len = snprintf(buf, sizeof(buf), "%010ld.%06ld.%s", (long)ts.sec(), (long)ts.usec(), hash.c_str());
+  if (len > 0) {
+    id.assign(buf, len);
+  }
+}
+
 bool rgw_s3_key_filter::decode_xml(XMLObj* obj) {
   XMLObjIter iter = obj->find("FilterRule");
   XMLObj *o;
index 8c8f0a7fc6da850e3efdad47b2e6dc5d74c2e414..167722da6cefa5152fb2abd9a014461df3e501a5 100644 (file)
@@ -108,7 +108,7 @@ class rgw_pubsub_topic_filter;
           <Name></Name>
           <Value></Value>
         </FilterRule>
-      </s3Metadata>
+      </S3Metadata>
     </Filter>
     <Id>notification1</Id>
     <Topic>arn:aws:sns:<region>:<account>:<topic></Topic>
@@ -195,17 +195,16 @@ struct rgw_pubsub_s3_notifications {
 
 struct rgw_pubsub_s3_record {
   constexpr static const char* const json_type_plural = "Records";
-  // 2.2
-  std::string eventVersion;
+  std::string eventVersion = "2.2";
   // aws:s3
-  std::string eventSource;
+  std::string eventSource = "ceph:s3";
   // zonegroup
   std::string awsRegion;
   // time of the request
   ceph::real_time eventTime;
   // type of the event
   std::string eventName;
-  // user that sent the requet (not implemented)
+  // user that sent the request
   std::string userIdentity;
   // IP address of source of the request (not implemented)
   std::string sourceIPAddress;
@@ -213,20 +212,19 @@ struct rgw_pubsub_s3_record {
   std::string x_amz_request_id;
   // radosgw that received the request
   std::string x_amz_id_2;
-  // 1.0
-  std::string s3SchemaVersion;
+  std::string s3SchemaVersion = "1.0";
   // ID received in the notification request
   std::string configurationId;
   // bucket name
   std::string bucket_name;
-  // bucket owner (not implemented)
+  // bucket owner
   std::string bucket_ownerIdentity;
   // bucket ARN
   std::string bucket_arn;
   // object key
   std::string object_key;
-  // object size (not implemented)
-  uint64_t object_size;
+  // object size
+  uint64_t object_size = 0;
   // object etag
   std::string object_etag;
   // object version id bucket is versioned
@@ -235,7 +233,7 @@ struct rgw_pubsub_s3_record {
   std::string object_sequencer;
   // this is an rgw extension (not S3 standard)
   // used to store a globally unique identifier of the event
-  // that could be used for acking
+  // that could be used for acking or any other identification of the event
   std::string id;
   // this is an rgw extension holding the internal bucket id
   std::string bucket_id;
@@ -334,6 +332,9 @@ struct rgw_pubsub_event {
 };
 WRITE_CLASS_ENCODER(rgw_pubsub_event)
 
+// settign a unique ID for an event/record based on object hash and timestamp
+void set_event_id(std::string& id, const std::string& hash, const utime_t& ts);
+
 struct rgw_pubsub_sub_dest {
   std::string bucket_name;
   std::string oid_prefix;
index 3fae724a78dba69bd6919e7d644b869e515f0a5d..c4df0fd67f540e42505129a19d9d19d56096b0e9 100644 (file)
@@ -380,14 +380,6 @@ struct objstore_event {
   }
 };
 
-static void set_event_id(std::string& id, const std::string& hash, const utime_t& ts) {
-  char buf[64];
-  const auto len = snprintf(buf, sizeof(buf), "%010ld.%06ld.%s", (long)ts.sec(), (long)ts.usec(), hash.c_str());
-  if (len > 0) {
-    id.assign(buf, len);
-  }
-}
-
 static void make_event_ref(CephContext *cct, const rgw_bucket& bucket,
                        const rgw_obj_key& key,
                        const ceph::real_time& mtime,
@@ -419,22 +411,18 @@ static void make_s3_record_ref(CephContext *cct, const rgw_bucket& bucket,
   *record = std::make_shared<rgw_pubsub_s3_record>();
 
   EventRef<rgw_pubsub_s3_record>& r = *record;
-  r->eventVersion = "2.1";
-  r->eventSource = "aws:s3";
   r->eventTime = mtime;
   r->eventName = rgw::notify::to_string(event_type);
-  r->userIdentity = "";         // user that triggered the change: not supported in sync module
-  r->sourceIPAddress = "";      // IP address of client that triggered the change: not supported in sync module
-  r->x_amz_request_id = "";     // request ID of the original change: not supported in sync module
-  r->x_amz_id_2 = "";           // RGW on which the change was made: not supported in sync module
-  r->s3SchemaVersion = "1.0";
+  // userIdentity: not supported in sync module
+  // x_amz_request_id: not supported in sync module
+  // x_amz_id_2: not supported in sync module
   // configurationId is filled from subscription configuration
   r->bucket_name = bucket.name;
   r->bucket_ownerIdentity = owner.to_str();
   r->bucket_arn = to_string(rgw::ARN(bucket));
   r->bucket_id = bucket.bucket_id; // rgw extension
   r->object_key = key.name;
-  r->object_size = 0;           // not supported in sync module
+  // object_size not supported in sync module
   objstore_event oevent(bucket, key, mtime, attrs);
   r->object_etag = oevent.get_hash();
   r->object_versionId = key.instance;
@@ -444,8 +432,6 @@ static void make_s3_record_ref(CephContext *cct, const rgw_bucket& bucket,
   boost::algorithm::hex((const char*)&ts, (const char*)&ts + sizeof(utime_t), 
           std::back_inserter(r->object_sequencer));
  
-  // event ID is rgw extension (not in the S3 spec), used for acking the event
-  // same format is used in both S3 compliant and Ceph specific events
   set_event_id(r->id, r->object_etag, ts);
 }