]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Kill collection_list
authorXiaoxi Chen <xiaoxi.chen@intel.com>
Sat, 25 Apr 2015 03:56:09 +0000 (11:56 +0800)
committerSage Weil <sage@redhat.com>
Fri, 7 Aug 2015 12:45:32 +0000 (08:45 -0400)
use collection_list_impl as well.

Signed-off-by: Xiaoxi Chen <xiaoxi.chen@intel.com>
12 files changed:
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/osd/OSD.cc
src/test/objectstore/FileStoreDiff.cc
src/test/objectstore/store_test.cc
src/test/os/TestFlatIndex.cc
src/test/os/TestLFNIndex.cc

index 1f3ecabfa296908d785f98807c5e268ee9b6dff1..0e0abe0e724a24b626f9109cc76f56fcb4ab2d64 100644 (file)
@@ -4646,6 +4646,9 @@ int FileStore::collection_list_impl(coll_t c, ghobject_t start, ghobject_t end,
   if (start.is_max())
     return 0;
 
+  ghobject_t temp_next;
+  if (!next)
+    next = &temp_next;
   // figure out the pool id.  we need this in order to generate a
   // meaningful 'next' value.
   int64_t pool = -1;
@@ -4716,31 +4719,6 @@ int FileStore::collection_list_impl(coll_t c, ghobject_t start, ghobject_t end,
   return 0;
 }
 
-int FileStore::collection_list(coll_t c, vector<ghobject_t>& ls)
-{  
-  tracepoint(objectstore, collection_list_enter, c.c_str());
-
-  if (!c.is_temp() && !c.is_meta()) {
-    coll_t temp = c.get_temp();
-    int r = collection_list(temp, ls);
-    if (r < 0)
-      return r;
-  }
-
-  Index index;
-  int r = get_index(c, &index);
-  if (r < 0)
-    return r;
-
-  assert(NULL != index.index);
-  RWLock::RLocker l((index.index)->access_lock);
-
-  r = index->collection_list(&ls);
-  assert(!m_filestore_fail_eio || r != -EIO);
-  tracepoint(objectstore, collection_list_exit, r);
-  return r;
-}
-
 int FileStore::omap_get(coll_t c, const ghobject_t &hoid,
                        bufferlist *header,
                        map<string, bufferlist> *out)
index bb08ecaef720e58af7deadf718f35e57d4a732f1..5f5e8ab69b8382ea92cf0083265d9fe64be73752 100644 (file)
@@ -625,7 +625,6 @@ public:
   int collection_stat(coll_t c, struct stat *st);
   bool collection_exists(coll_t c);
   bool collection_empty(coll_t c);
-  int collection_list(coll_t c, vector<ghobject_t>& oid);
 
   // omap (see ObjectStore.h for documentation)
   int omap_get(coll_t c, const ghobject_t &oid, bufferlist *header,
index 8868920f2c420b44a0b4934d74df6b08a65635ce..b69833aaf8e0cc496dcf82cb85feae33eeb1961b 100644 (file)
@@ -2510,11 +2510,6 @@ int KeyValueStore::collection_list_impl(coll_t c, ghobject_t start,
   return r;
 }
 
-int KeyValueStore::collection_list(coll_t c, vector<ghobject_t>& ls)
-{
-  return collection_list_impl(c, ghobject_t(), ghobject_t::get_max(), 0, 0, &ls, 0);
-}
-
 int KeyValueStore::collection_version_current(coll_t c, uint32_t *version)
 {
   *version = COLLECTION_VERSION;
index 3cb6bc014b8709dd94746229c06c99bacef53580..51078b63e0ba0b0049cbd6b3b5fe1a010a33ba6d 100644 (file)
@@ -618,7 +618,6 @@ class KeyValueStore : public ObjectStore,
   int list_collections(vector<coll_t>& ls);
   bool collection_exists(coll_t c);
   bool collection_empty(coll_t c);
-  int collection_list(coll_t c, vector<ghobject_t>& oid);
   int collection_list_impl(coll_t c, ghobject_t start, ghobject_t end,
                               int max, snapid_t snap,
                               vector<ghobject_t> *ls, ghobject_t *next);
index bfebdbd0e060bdda9c0ac571b973e3faac8589f5..8b4b01d117db3b402bff3aac71ab37d2d4708771 100644 (file)
@@ -421,21 +421,6 @@ bool MemStore::collection_empty(coll_t cid)
   return c->object_map.empty();
 }
 
-int MemStore::collection_list(coll_t cid, vector<ghobject_t>& o)
-{
-  dout(10) << __func__ << " " << cid << dendl;
-  CollectionRef c = get_collection(cid);
-  if (!c)
-    return -ENOENT;
-  RWLock::RLocker l(c->lock);
-
-  for (map<ghobject_t,ObjectRef>::iterator p = c->object_map.begin();
-       p != c->object_map.end();
-       ++p)
-    o.push_back(p->first);
-  return 0;
-}
-
 int MemStore::collection_list_impl(coll_t cid, ghobject_t start, ghobject_t end,
                                      int max, snapid_t snap,
                                      vector<ghobject_t> *ls, ghobject_t *next)
@@ -447,7 +432,7 @@ int MemStore::collection_list_impl(coll_t cid, ghobject_t start, ghobject_t end,
 
   map<ghobject_t,ObjectRef>::iterator p = c->object_map.lower_bound(start);
   while (p != c->object_map.end() &&
-        (max == -1 || ls->size() < (unsigned)max) &&
+         ls->size() < (unsigned)max &&
          p->first < end) {
     ls->push_back(p->first);
     ++p;
index 97f41429da2acd7cf7dfa5063e412558e75d83e8..63e30b2f90c5c57c23daeab840c97c820d03e155 100644 (file)
@@ -306,7 +306,6 @@ public:
   int list_collections(vector<coll_t>& ls);
   bool collection_exists(coll_t c);
   bool collection_empty(coll_t c);
-  int collection_list(coll_t cid, vector<ghobject_t>& o);
   int collection_list_impl(coll_t cid, ghobject_t start, ghobject_t end,
                              int max, snapid_t snap,
                              vector<ghobject_t> *ls, ghobject_t *next);
index e0a517787f1980bf4c54871345acaacc199aebfe..441ba537feae18e014a2f17986ef2e3b870775e6 100644 (file)
@@ -2028,15 +2028,6 @@ public:
    */
   virtual bool collection_empty(coll_t c) = 0;
 
-  /**
-   * collection_list - get all objects of a collection in sorted order
-   *
-   * @param c collection name
-   * @param o [out] list of objects
-   * @returns 0 on success, negative error code on failure
-   */
-  virtual int collection_list(coll_t c, vector<ghobject_t>& o) = 0;
-
   /**
    * list contents of a collection that fall in the range [start, end) and no more than a specified many result
    *
index b5b6d630ed44af642f83ff074253819cc6aac28a..3334593a552c4cbc922201ec6db1dc2a05cea465 100644 (file)
@@ -2506,10 +2506,9 @@ void OSD::clear_temp_objects()
     ghobject_t next;
     while (1) {
       vector<ghobject_t> objects;
-      store->collection_list_partial(*p, next,
-                                    store->get_ideal_list_min(),
-                                    store->get_ideal_list_max(),
-                                    0, &objects, &next);
+      store->collection_list_impl(*p, next, ghobject_t::get_max(),
+                                 store->get_ideal_list_max(),
+                                 0, &objects, &next);
       if (objects.empty())
        break;
       vector<ghobject_t>::iterator q;
@@ -2547,7 +2546,7 @@ void OSD::recursive_remove_collection(ObjectStore *store, spg_t pgid, coll_t tmp
   SnapMapper mapper(&driver, 0, 0, 0, pgid.shard);
 
   vector<ghobject_t> objects;
-  store->collection_list(tmp, objects);
+  store->collection_list_impl(tmp, ghobject_t(), ghobject_t::get_max(), INT_MAX, 0, &objects, 0);
 
   // delete them.
   unsigned removed = 0;
index ad4f62bff73e41bd1f340bcc4f87a51c89217072..a40437a522e82248dd2552335cbc4db361a49264 100644 (file)
@@ -132,13 +132,13 @@ bool FileStoreDiff::diff_objects(FileStore *a_store, FileStore *b_store, coll_t
 
   int err;
   std::vector<ghobject_t> b_objects, a_objects;
-  err = b_store->collection_list(coll, b_objects);
+  err = b_store->collection_list_impl(coll, ghobject_t(), ghobject_t::get_max(), INT_MAX, 0, &b_objects, NULL);
   if (err < 0) {
     dout(0) << "diff_objects list on verify coll " << coll.to_str()
            << " returns " << err << dendl;
     return true;
   }
-  err = a_store->collection_list(coll, a_objects);
+  err = a_store->collection_list_impl(coll, ghobject_t(), ghobject_t::get_max(), INT_MAX, 0, &a_objects, NULL);
   if (err < 0) {
     dout(0) << "diff_objects list on store coll " << coll.to_str()
               << " returns " << err << dendl;
index e13518855075c340e8df3588c95c56666b1d02bf..fdf64b8164eda1cd6af3a65b8d7f345fc30ba135 100644 (file)
@@ -585,7 +585,7 @@ TEST_P(StoreTest, ManyObjectTest) {
 
   set<ghobject_t> listed;
   vector<ghobject_t> objects;
-  r = store->collection_list(cid, objects);
+  r = store->collection_list_impl(cid, ghobject_t(), ghobject_t::get_max(), INT_MAX, 0, &objects, 0);
   ASSERT_EQ(r, 0);
 
   cerr << "objects.size() is " << objects.size() << std::endl;
@@ -1117,7 +1117,7 @@ public:
       ASSERT_GT(available_objects.count(*i), (unsigned)0);
     }
 
-    int r = store->collection_list(cid, objects);
+    int r = store->collection_list_impl(cid, ghobject_t(), ghobject_t::get_max(), INT_MAX, 0, &objects, 0);
     ASSERT_EQ(r, 0);
     objects_set2.insert(objects.begin(), objects.end());
     ASSERT_EQ(objects_set2.size(), available_objects.size());
@@ -1313,7 +1313,7 @@ TEST_P(StoreTest, HashCollisionTest) {
   }
   }
   vector<ghobject_t> objects;
-  r = store->collection_list(cid, objects);
+  r = store->collection_list_impl(cid, ghobject_t(), ghobject_t::get_max(), INT_MAX, 0, &objects, 0);
   ASSERT_EQ(r, 0);
   set<ghobject_t> listed(objects.begin(), objects.end());
   cerr << "listed.size() is " << listed.size() << " and created.size() is " << created.size() << std::endl;
@@ -1408,7 +1408,7 @@ TEST_P(StoreTest, ScrubTest) {
   }
 
   vector<ghobject_t> objects;
-  r = store->collection_list(cid, objects);
+  r = store->collection_list_impl(cid, ghobject_t(), ghobject_t::get_max(), INT_MAX, 0, &objects, 0);
   ASSERT_EQ(r, 0);
   set<ghobject_t> listed(objects.begin(), objects.end());
   cerr << "listed.size() is " << listed.size() << " and created.size() is " << created.size() << std::endl;
@@ -1706,7 +1706,7 @@ void colsplittest(
 
   ObjectStore::Transaction t;
   vector<ghobject_t> objects;
-  r = store->collection_list(cid, objects);
+  r = store->collection_list_impl(cid, ghobject_t(), ghobject_t::get_max(), INT_MAX, 0, &objects, 0);
   ASSERT_EQ(r, 0);
   ASSERT_EQ(objects.size(), num_objects);
   for (vector<ghobject_t>::iterator i = objects.begin();
@@ -1717,7 +1717,7 @@ void colsplittest(
   }
 
   objects.clear();
-  r = store->collection_list(tid, objects);
+  r = store->collection_list_impl(tid, ghobject_t(), ghobject_t::get_max(), INT_MAX, 0, &objects, 0);
   ASSERT_EQ(r, 0);
   ASSERT_EQ(objects.size(), num_objects);
   for (vector<ghobject_t>::iterator i = objects.begin();
@@ -1925,7 +1925,7 @@ TEST_P(StoreTest, BigRGWObjectName) {
 
   {
     vector<ghobject_t> objects;
-    r = store->collection_list(cid, objects);
+    r = store->collection_list_impl(cid, ghobject_t(), ghobject_t::get_max(), INT_MAX, 0, &objects, 0);
     ASSERT_EQ(r, 0);
     ASSERT_EQ(objects.size(), 1u);
     ASSERT_EQ(objects[0], oid2);
index 7cebec76e1a97f4fb296098ad8b0780e15bac984..ea1d24f3766c6a35dc5e87ff79f6e53cf8ca1b88 100644 (file)
@@ -51,7 +51,7 @@ TEST(FlatIndex, collection) {
   const std::string object_name(10, 'A');
   ghobject_t hoid(hobject_t(object_t(object_name), key, CEPH_NOSNAP, hash, pool, ""));
   vector<ghobject_t> ls;
-  ASSERT_THROW(index.collection_list_partial(hoid, 0, 0, 0, &ls, &hoid), FailedAssertion);
+  ASSERT_THROW(index.collection_list_partial(hoid, ghobject_t::get_max(), 0, 0, &ls, &hoid), FailedAssertion);
 }
 
 TEST(FlatIndex, created_unlink) {
index 49b592adb53ed5c1b45c8140859f1f272dc3fd76..60ea6130685e83fa13e9781c49dab1bc6015817d 100644 (file)
@@ -78,7 +78,6 @@ protected:
   virtual int _collection_list_partial(
                                       const ghobject_t &start,
                                       const ghobject_t &end,
-                                      int min_count,
                                       int max_count,
                                       vector<ghobject_t> *ls,
                                       ghobject_t *next