]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: remove unneeded and duplicate code
authorYehuda Sadeh <yehuda@redhat.com>
Tue, 23 May 2017 00:10:14 +0000 (17:10 -0700)
committerYehuda Sadeh <yehuda@redhat.com>
Mon, 5 Jun 2017 20:17:57 +0000 (13:17 -0700)
Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_reshard.cc
src/rgw/rgw_reshard.h

index 8a8791e2738010c013ea5ddada0ebaf31a0d7af1..5bdf32d0afbe72eb49c7761eefff55c11b68b178 100644 (file)
@@ -721,12 +721,10 @@ int RGWReshard::process_single_logshard(int logshard_num)
          return ret;
        }
 
-       Formatter* formatter = new JSONFormatter(false);
-       auto formatter_ptr = std::unique_ptr<Formatter>(formatter);
-       RGWBucketAdminOpState bucket_op;
-       ret = reshard_bucket(formatter, entry.new_num_shards, bucket, bucket_info, new_bucket_info,
-                            max_entries, bucket_op, true);
-       formatter->flush(cout);
+        RGWBucketAdminOpState bucket_op;
+        RGWBucketReshard reshard_op(store, bucket_info, attrs);
+        ret = reshard_op.do_reshard(entry.new_num_shards, new_bucket_info,
+                                    max_entries, false, nullptr, nullptr);
        if (ret < 0) {
          return ret;
        }
@@ -836,50 +834,3 @@ void RGWReshard::ReshardWorker::stop()
   Mutex::Locker l(lock);
   cond.Signal();
 }
-
-#if 0
-BucketIndexLockGuard::BucketIndexLockGuard(RGWRados* _store,
-                                          const string& bucket_instance_id, const string& _oid, const librados::IoCtx& _io_ctx) :
-  store(_store),
-  l(create_bucket_index_lock_name(bucket_instance_id)),
-  oid(_oid), io_ctx(_io_ctx),locked(false)
-{
-}
-
-int BucketIndexLockGuard::lock()
-{
-  if (!locked) {
-    int ret = l.lock_shared(&store->reshard_pool_ctx, oid);
-    if (ret == -EBUSY) {
-      ldout(store->ctx(), 0) << "RGWReshardLog::add failed to acquire lock on " << oid << dendl;
-      return 0;
-    }
-    if (ret < 0) {
-      return ret;
-    }
-    locked = true;
-    return ret;
-  } else {
-    ldout(store->ctx(), 0) << " % alread lock" << oid << dendl;
-    return -EBUSY;
-  }
-}
-
-int BucketIndexLockGuard::unlock()
-{
-  if (locked) {
-    int ret = l.unlock(&io_ctx, oid);
-    if (ret <0) {
-      ldout(store->ctx(), 0) << "failed to unlock " << oid << dendl;
-    } else {
-      locked = false;
-    }
-    return ret;
-  }
-  return 0;
-}
-
-BucketIndexLockGuard::~BucketIndexLockGuard()
-{
-  unlock();
-}
index 8c1b393050c3cbe4dcf6841fc4a6d3aba5f3fd29..2010ac4a478ceb9a7572bfd800c8c14f6bb7bcac 100644 (file)
@@ -14,30 +14,9 @@ class CephContext;
 class RGWRados;
 
 
-#if 0
-/* gets a locked lock , release it when exiting context */
-class BucketIndexLockGuard
-{
-   RGWRados *store;
-   rados::cls::lock::Lock l;
-   string oid;
-   librados::IoCtx io_ctx;
-   bool locked;
-
-public:
-  BucketIndexLockGuard(RGWRados* store, const string& bucket_instance_id,
-                                        const string& oid, const librados::IoCtx& io_ctx);
-  /* unlocks the lock */
-  ~BucketIndexLockGuard();
-protected:
+class RGWBucketReshard {
   friend class RGWReshard;
-  int lock();
-  int unlock();
-};
-#endif
-
 
-class RGWBucketReshard {
   RGWRados *store;
   RGWBucketInfo bucket_info;
   std::map<string, bufferlist> bucket_attrs;
@@ -109,15 +88,6 @@ public:
   int list(int logshard_num, string& marker, uint32_t max, std::list<cls_rgw_reshard_entry>& entries, bool *is_truncated);
   int clear_bucket_resharding(const string& bucket_instance_oid, cls_rgw_reshard_entry& entry);
 
-  int reshard_bucket(Formatter *formatter,
-                     int num_shards,
-                     rgw_bucket& bucket,
-                     RGWBucketInfo& bucket_info,
-                     RGWBucketInfo& new_bucket_info,
-                     int max_entries,
-                     RGWBucketAdminOpState& bucket_op,
-                     bool verbose = false);
-
   /* reshard thread */
   int process_single_logshard(int logshard_num);
   int process_all_logshards();