]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
remove collection_rename 2124/head
authorSage Weil <sage@redhat.com>
Sat, 19 Jul 2014 19:04:19 +0000 (12:04 -0700)
committerSage Weil <sage@redhat.com>
Mon, 27 Oct 2014 23:59:30 +0000 (16:59 -0700)
No more users!  Complicated semantics!

Signed-off-by: Sage Weil <sage@redhat.com>
src/os/FileStore.cc
src/os/FileStore.h
src/os/KeyValueStore.cc
src/os/KeyValueStore.h
src/os/MemStore.cc
src/os/MemStore.h
src/os/ObjectStore.h
src/os/Transaction.cc
src/tracing/objectstore.tp

index d1b4d8c3f541395d0ec8110ce88b8e5ac39d6d20..4833c3aeb4d0da8f220de5cc80755c0e998be832 100644 (file)
@@ -2560,9 +2560,7 @@ unsigned FileStore::_do_transaction(
       {
        coll_t cid(i.decode_cid());
        coll_t ncid(i.decode_cid());
-        tracepoint(objectstore, coll_rename_enter, osr_name);
-       r = _collection_rename(cid, ncid, spos);
-        tracepoint(objectstore, coll_rename_exit, r);
+       r = -EOPNOTSUPP;
       }
       break;
 
@@ -4322,56 +4320,6 @@ int FileStore::_collection_remove_recursive(const coll_t &cid,
   return _destroy_collection(cid);
 }
 
-int FileStore::_collection_rename(const coll_t &cid, const coll_t &ncid,
-                                 const SequencerPosition& spos)
-{
-  char new_coll[PATH_MAX], old_coll[PATH_MAX];
-  get_cdir(cid, old_coll, sizeof(old_coll));
-  get_cdir(ncid, new_coll, sizeof(new_coll));
-
-  if (_check_replay_guard(cid, spos) < 0) {
-    return 0;
-  }
-
-  if (_check_replay_guard(ncid, spos) < 0) {
-    return _collection_remove_recursive(cid, spos);
-  }
-
-  if (!collection_exists(cid)) {
-    if (replaying) {
-      // already happened
-      return 0;
-    } else {
-      return -ENOENT;
-    }
-  }
-  _set_global_replay_guard(cid, spos);
-
-  int ret = 0;
-  if (::rename(old_coll, new_coll)) {
-    if (replaying && !backend->can_checkpoint() &&
-       (errno == EEXIST || errno == ENOTEMPTY))
-      ret = _collection_remove_recursive(cid, spos);
-    else
-      ret = -errno;
-
-    dout(10) << "collection_rename '" << cid << "' to '" << ncid << "'"
-            << ": ret = " << ret << dendl;
-    return ret;
-  }
-
-  if (ret >= 0) {
-    int fd = ::open(new_coll, O_RDONLY);
-    assert(fd >= 0);
-    _set_replay_guard(fd, spos);
-    VOID_TEMP_FAILURE_RETRY(::close(fd));
-  }
-
-  dout(10) << "collection_rename '" << cid << "' to '" << ncid << "'"
-          << ": ret = " << ret << dendl;
-  return ret;
-}
-
 // --------------------------
 // collections
 
index 139c83965c3311340c138ee3f1d433b4d30756a4..ab9f47f60f49ca1040233a6ed76a923778395a6a 100644 (file)
@@ -595,8 +595,6 @@ public:
   int _collection_setattrs(coll_t cid, map<string,bufferptr> &aset);
   int _collection_remove_recursive(const coll_t &cid,
                                   const SequencerPosition &spos);
-  int _collection_rename(const coll_t &cid, const coll_t &ncid,
-                        const SequencerPosition& spos);
 
   // collections
   int list_collections(vector<coll_t>& ls);
index 71b61d3efc71b6571819a3abbbf428703c2b6c3f..7e1bf046d4b580fdf6c70479782cc519fd69cc73 100644 (file)
@@ -1433,7 +1433,7 @@ unsigned KeyValueStore::_do_transaction(Transaction& transaction,
       {
         coll_t cid(i.decode_cid());
         coll_t ncid(i.decode_cid());
-        r = _collection_rename(cid, ncid, t);
+        r = -EOPNOTSUPP;
       }
       break;
 
@@ -2562,61 +2562,6 @@ int KeyValueStore::_collection_remove_recursive(const coll_t &cid,
   return 0;
 }
 
-int KeyValueStore::_collection_rename(const coll_t &cid, const coll_t &ncid,
-                                      BufferTransaction &t)
-{
-  dout(10) << __func__ << " origin cid " << cid << " new cid " << ncid
-           << dendl;
-
-  StripObjectMap::StripObjectHeaderRef header;
-
-  int r = t.lookup_cached_header(get_coll_for_coll(),
-                                 make_ghobject_for_coll(ncid),
-                                 &header, false);
-  if (r == 0) {
-    dout(2) << __func__ << ": " << ncid << " DNE" << dendl;
-    return -EEXIST;
-  }
-
-  r = t.lookup_cached_header(get_coll_for_coll(), make_ghobject_for_coll(cid),
-                             &header, false);
-  if (r < 0) {
-    dout(2) << __func__ << ": " << cid << " DNE" << dendl;
-    return 0;
-  }
-
-  vector<ghobject_t> objects;
-  ghobject_t next, current;
-  int move_size = 0;
-  while (1) {
-    collection_list_partial(cid, current, get_ideal_list_min(),
-                            get_ideal_list_max(), 0, &objects, &next);
-
-    dout(20) << __func__ << cid << "objects size: " << objects.size()
-             << dendl;
-
-    if (objects.empty())
-      break;
-
-    for (vector<ghobject_t>::iterator i = objects.begin();
-        i != objects.end(); ++i) {
-      if (_collection_move_rename(cid, *i, ncid, *i, t) < 0) {
-        return -1;
-      }
-      move_size++;
-    }
-
-    objects.clear();
-    current = next;
-  }
-
-  t.rename_buffer(header, get_coll_for_coll(), make_ghobject_for_coll(ncid));
-
-  dout(10) << __func__ << " origin cid " << cid << " new cid " << ncid
-           << dendl;
-  return 0;
-}
-
 int KeyValueStore::list_collections(vector<coll_t>& ls)
 {
   dout(10) << __func__ << " " << dendl;
index 86cd7aec69d24f5cd9b1b93ae810712edce91233..0f13df649324f9833be3b9423e886d50427c0ad2 100644 (file)
@@ -610,8 +610,6 @@ class KeyValueStore : public ObjectStore,
                               BufferTransaction &t);
   int _collection_remove_recursive(const coll_t &cid,
                                    BufferTransaction &t);
-  int _collection_rename(const coll_t &cid, const coll_t &ncid,
-                         BufferTransaction &t);
   int list_collections(vector<coll_t>& ls);
   bool collection_exists(coll_t c);
   bool collection_empty(coll_t c);
index f3c4c3021059d23e0ce063341560db26c634a2bb..b6ca64b5f3d7998181165d6e44abe3b44f0e955a 100644 (file)
@@ -911,7 +911,7 @@ void MemStore::_do_transaction(Transaction& t)
       {
        coll_t cid(i.decode_cid());
        coll_t ncid(i.decode_cid());
-       r = _collection_rename(cid, ncid);
+       r = -EOPNOTSUPP;
       }
       break;
 
@@ -1485,19 +1485,6 @@ int MemStore::_collection_rmattr(coll_t cid, const char *name)
   return 0;
 }
 
-int MemStore::_collection_rename(const coll_t &cid, const coll_t &ncid)
-{
-  dout(10) << __func__ << " " << cid << " -> " << ncid << dendl;
-  RWLock::WLocker l(coll_lock);
-  if (coll_map.count(cid) == 0)
-    return -ENOENT;
-  if (coll_map.count(ncid))
-    return -EEXIST;
-  coll_map[ncid] = coll_map[cid];
-  coll_map.erase(cid);
-  return 0;
-}
-
 int MemStore::_split_collection(coll_t cid, uint32_t bits, uint32_t match,
                                coll_t dest)
 {
index 3feeb24e1c18ddf4bcb07c27f24f5a730f4a3296..078959781eed59d893c1f446612060d8ec09624d 100644 (file)
@@ -218,7 +218,6 @@ private:
                          size_t size);
   int _collection_setattrs(coll_t cid, map<string,bufferptr> &aset);
   int _collection_rmattr(coll_t cid, const char *name);
-  int _collection_rename(const coll_t &cid, const coll_t &ncid);
   int _split_collection(coll_t cid, uint32_t bits, uint32_t rem, coll_t dest);
 
   int _save();
index 255e5cb5c95472bc13fde342876883432f1e6c6e..d11fcdcadbff41f40a82db5c3fdada50030c6dd8 100644 (file)
@@ -941,14 +941,6 @@ public:
       ::encode(aset, tbl);
       ops++;
     }
-    /// Change the name of a collection
-    void collection_rename(coll_t cid, coll_t ncid) {
-      __u32 op = OP_COLL_RENAME;
-      ::encode(op, tbl);
-      ::encode(cid, tbl);
-      ::encode(ncid, tbl);
-      ops++;
-    }
 
     /// Remove omap from oid
     void omap_clear(
index b7360de76144020fb6be9925009f6a3ae54e41cc..674eef43cd0ee4cfea51e2c96502804f94e086b1 100644 (file)
@@ -485,6 +485,5 @@ void ObjectStore::Transaction::generate_test_instances(list<ObjectStore::Transac
   t->collection_setattr(c, "this", bl);
   t->collection_rmattr(c, "foo");
   t->collection_setattrs(c, m);
-  t->collection_rename(c, c2);
   o.push_back(t);  
 }
index 9c3c45f9f13f7f32460920f8e107fd511942fbea..506a03b9c15ee084fc755de715e9fa3c86335664 100644 (file)
@@ -447,22 +447,6 @@ TRACEPOINT_EVENT(objectstore, omap_clear_exit,
     )
 )
 
-TRACEPOINT_EVENT(objectstore, coll_rename_enter,
-    TP_ARGS(
-        const char *, osr_name),
-    TP_FIELDS(
-        ctf_string(osr_name, osr_name)
-    )
-)
-
-TRACEPOINT_EVENT(objectstore, coll_rename_exit,
-    TP_ARGS(
-        int, retval),
-    TP_FIELDS(
-        ctf_integer(int, retval, retval)
-    )
-)
-
 TRACEPOINT_EVENT(objectstore, startsync_enter,
     TP_ARGS(
         const char *, osr_name),