]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cls/rgw: modify logshard key
authorYehuda Sadeh <yehuda@redhat.com>
Fri, 19 May 2017 16:22:29 +0000 (09:22 -0700)
committerYehuda Sadeh <yehuda@redhat.com>
Mon, 5 Jun 2017 20:17:53 +0000 (13:17 -0700)
The logshard key shouldn't include bucket id.

Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/cls/rgw/cls_rgw.cc
src/rgw/rgw_reshard.cc

index ce80f4d030c76d51ecc3b864784cdb09decc8ded..dda7726c9d303f2f73b509d7a2a638fa5cdbc6ce 100644 (file)
@@ -3485,14 +3485,14 @@ static int rgw_cls_lc_get_head(cls_method_context_t hctx, bufferlist *in,  buffe
   return 0;
 }
 
-static void generate_reshard_key(const string& bucket_name, const string& bucket_id, string *key)
+static void generate_reshard_key(const string& tenant, const string& bucket_name, string *key)
 {
-  *key = bucket_name + "." + bucket_id;
+  *key = tenant + ":" + bucket_name;
 }
 
 static void generate_reshard_key(const cls_rgw_reshard_entry& entry, string *key)
 {
-  generate_reshard_key(entry.bucket_name, entry.bucket_id, key);
+  generate_reshard_key(entry.tenant, entry.bucket_name, key);
 }
 
 static int rgw_reshard_add(cls_method_context_t hctx, bufferlist *in, bufferlist *out)
index 7c9e414df10a27ffd70e4c56e717a222c1af9fd8..7a5c3b2b411e7afc8b7e42eb01a821fed7420ad9 100644 (file)
@@ -12,7 +12,7 @@
 #define dout_context g_ceph_context
 #define dout_subsys ceph_subsys_rgw
 
-const string reshard_oid_prefix = "reshard";
+const string reshard_oid_prefix = "reshard.";
 const string reshard_lock_name = "reshard_process";
 const string bucket_instance_lock_name = "bucket_instance_lock";
 
@@ -483,7 +483,7 @@ RGWReshard::RGWReshard(RGWRados* _store): store(_store), instance_lock(bucket_in
 
 string RGWReshard::get_logshard_key(const string& tenant, const string& bucket_name)
 {
-  return bucket_name + ":" + tenant; /* transposed on purpose */
+  return tenant + ":" + bucket_name;
 }
 
 #define MAX_RESHARD_LOGSHARDS_PRIME 7877
@@ -525,10 +525,13 @@ int RGWReshard::list(int logshard_num, string& marker, uint32_t max, std::list<c
   get_logshard_oid(logshard_num, &logshard_oid);
 
   int ret = cls_rgw_reshard_list(store->reshard_pool_ctx, logshard_oid, marker, max, entries, is_truncated);
-  if (ret < 0) {
+  if (ret < 0 && ret != -ENOENT) {
     lderr(store->ctx()) << "ERROR: failed to list reshard log entries, oid=" << logshard_oid << dendl;
     return ret;
   }
+  if (ret == -ENOENT) {
+    *is_truncated = false;
+  }
   return 0;
 }