]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/archive: record the bucket creation time at archive zone 68675/head
authorShilpa Jagannath <smanjara@redhat.com>
Wed, 29 Apr 2026 18:02:05 +0000 (18:02 +0000)
committerShilpa Jagannath <smanjara@redhat.com>
Wed, 29 Apr 2026 18:05:38 +0000 (18:05 +0000)
source bucket deletion triggers a new bucket instance creation
at archive zone. record its mtime and display in bucket stats.
store it as an attr RGW_ATTR_ARCHIVE_INSTANCE_MTIME

Signed-off-by: Shilpa Jagannath <smanjara@redhat.com>
src/rgw/driver/rados/rgw_bucket.cc
src/rgw/rgw_common.h

index 233163ce78ba7adcd002dff0f2692b84ac930a8d..0074f15e24fa05fbaf6c4660474bb9dfaed370f8 100644 (file)
@@ -1641,6 +1641,21 @@ static int bucket_stats(rgw::sal::Driver* driver, const rgw::SiteConfig& site,
   }
   ut.gmtime(formatter->dump_stream("mtime"));
   ctime_ut.gmtime(formatter->dump_stream("creation_time"));
+
+  // if this is an archive zone "-deleted-" bucket, expose when this instance was created
+  auto archive_mtime_iter = bucket->get_attrs().find(RGW_ATTR_ARCHIVE_INSTANCE_MTIME);
+  if (archive_mtime_iter != bucket->get_attrs().end()) {
+    try {
+      ceph::real_time archive_instance_mtime;
+      auto bliter = archive_mtime_iter->second.cbegin();
+      decode(archive_instance_mtime, bliter);
+      utime_t archive_mtime_ut(archive_instance_mtime);
+      archive_mtime_ut.gmtime(formatter->dump_stream("archive_instance_mtime"));
+    } catch (buffer::error& err) {
+      ldpp_dout(dpp, 0) << "WARNING: failed to decode archive_instance_mtime attr" << dendl;
+    }
+  }
+
   encode_json("bucket_quota", bucket_info.quota, formatter);
 
   // bucket tags
@@ -2642,7 +2657,7 @@ static void get_md5_digest(const RGWBucketEntryPoint *be, string& md5_digest) {
    md5_digest = md5;
 }
 
-#define ARCHIVE_META_ATTR RGW_ATTR_PREFIX "zone.archive.info" 
+#define ARCHIVE_META_ATTR RGW_ATTR_PREFIX "zone.archive.info"
 
 struct archive_meta_info {
   rgw_bucket orig_bucket;
@@ -2757,6 +2772,11 @@ class RGWArchiveBucketMetadataHandler : public RGWBucketMetadataHandler {
 
     new_be.bucket.name = new_bucket_name;
 
+    ceph::real_time instance_mtime = ceph::real_clock::now();
+    bufferlist bl;
+    encode(instance_mtime, bl);
+    attrs_m[RGW_ATTR_ARCHIVE_INSTANCE_MTIME] = std::move(bl);
+
     ret = ctl_bucket->store_bucket_instance_info(new_be.bucket, new_bi, y, dpp, RGWBucketCtl::BucketInstance::PutParams()
                                                                     .set_exclusive(false)
                                                                     .set_mtime(orig_mtime)
index 8f95f4ef6716971ba1228754ca6569231817c09b..38d7520ae39b52a64bc98dc1f1c2c1dc8904de73 100644 (file)
@@ -115,6 +115,7 @@ using ceph::crypto::MD5;
 #define RGW_ATTR_BUCKET_LOGGING RGW_ATTR_PREFIX "logging"
 #define RGW_ATTR_BUCKET_LOGGING_MTIME RGW_ATTR_PREFIX "logging-mtime"
 #define RGW_ATTR_BUCKET_LOGGING_SOURCES RGW_ATTR_PREFIX "logging-sources"
+#define RGW_ATTR_ARCHIVE_INSTANCE_MTIME RGW_ATTR_PREFIX "zone.archive.instance.mtime"
 
 /* S3 Object Lock*/
 #define RGW_ATTR_OBJECT_LOCK        RGW_ATTR_PREFIX "object-lock"