From f677d0e96058901f5a754680384832c41619959d Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Fri, 19 May 2017 09:22:29 -0700 Subject: [PATCH] cls/rgw: modify logshard key The logshard key shouldn't include bucket id. Signed-off-by: Yehuda Sadeh --- src/cls/rgw/cls_rgw.cc | 6 +++--- src/rgw/rgw_reshard.cc | 9 ++++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/cls/rgw/cls_rgw.cc b/src/cls/rgw/cls_rgw.cc index ce80f4d030c..dda7726c9d3 100644 --- a/src/cls/rgw/cls_rgw.cc +++ b/src/cls/rgw/cls_rgw.cc @@ -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) diff --git a/src/rgw/rgw_reshard.cc b/src/rgw/rgw_reshard.cc index 7c9e414df10..7a5c3b2b411 100644 --- a/src/rgw/rgw_reshard.cc +++ b/src/rgw/rgw_reshard.cc @@ -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::listreshard_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; } -- 2.39.5