]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: remove pool_list(), can't list_objects() on system buckets
authorYehuda Sadeh <yehuda@hq.newdream.net>
Tue, 27 Mar 2012 21:12:55 +0000 (14:12 -0700)
committerYehuda Sadeh <yehuda@hq.newdream.net>
Tue, 27 Mar 2012 21:12:55 +0000 (14:12 -0700)
pool_list() was broken, replaced now with pool_iterate(). list_objects()
shouldn't be used any more with system buckets (raw pools), we can't
have it return sorted list of objects without reading the entire list.

Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net>
src/rgw/rgw_rados.cc
src/rgw/rgw_rados.h

index d4cfa493e8943a8b67a363d58c6ea735622e08bc..662471656bcf74086923a8ff7d3d6963ff65dc48 100644 (file)
@@ -712,19 +712,15 @@ int RGWRados::list_objects(rgw_bucket& bucket, int max, string& prefix, string&
   string cur_marker = marker;
   bool truncated;
 
+  if (bucket_is_system(bucket)) {
+    return -EINVAL;
+  }
   result.clear();
 
   do {
     std::map<string, RGWObjEnt> ent_map;
-    int r;
-
-    if (bucket_is_system(bucket)) {
-        r = pool_list(bucket, cur_marker, max - count, ent_map,
-                      &truncated, &cur_marker);
-    } else {
-        r = cls_bucket_list(bucket, cur_marker, prefix, max - count, ent_map,
+    int r = cls_bucket_list(bucket, cur_marker, prefix, max - count, ent_map,
                             &truncated, &cur_marker);
-    }
     if (r < 0)
       return r;
 
@@ -2653,51 +2649,6 @@ int RGWRados::distribute(bufferlist& bl)
   return r;
 }
 
-int RGWRados::pool_list(rgw_bucket& bucket, string start, uint32_t num, map<string, RGWObjEnt>& m,
-                       bool *is_truncated, string *last_entry)
-{
-  librados::IoCtx io_ctx;
-  int r = open_bucket_ctx(bucket, io_ctx);
-  if (r < 0)
-    return r;
-
-  librados::ObjectIterator iter = io_ctx.objects_begin();
-  if (!start.empty()) {
-    while (iter != io_ctx.objects_end()) {
-      const std::string& oid = iter->first;
-      ++iter;
-
-      if (oid.compare(start) == 0) {
-        break;
-      }
-    }
-  }
-  if (iter == io_ctx.objects_end())
-    return -ENOENT;
-
-  uint32_t i;
-
-  string oid;
-
-  for (i = 0; i < num && iter != io_ctx.objects_end(); ++i, ++iter) {
-    RGWObjEnt e;
-    oid = iter->first;
-
-    // fill it in with initial values; we may correct later
-    e.name = oid;
-    m[e.name] = e;
-    ldout(cct, 20) << "RGWRados::pool_list: got " << e.name << dendl;
-  }
-
-  if (m.size()) {
-    *last_entry = oid;
-  }
-  if (is_truncated)
-    *is_truncated = (iter != io_ctx.objects_end());
-
-  return m.size();
-}
-
 int RGWRados::pool_iterate_begin(rgw_bucket& bucket, RGWPoolIterCtx& ctx)
 {
   librados::IoCtx& io_ctx = ctx.io_ctx;
index c41461274b76c59c7dc67473344d36f05398a313..31604c0411605dcfd6154dd3aa6e11ef19142f40 100644 (file)
@@ -568,9 +568,6 @@ public:
     return (bucket.name[0] == '.');
   }
 
-  int pool_list(rgw_bucket& bucket, string start, uint32_t num, map<string, RGWObjEnt>& m,
-                bool *is_truncated, string *last_entry);
-
   int pool_iterate_begin(rgw_bucket& bucket, RGWPoolIterCtx& ctx);
   int pool_iterate(RGWPoolIterCtx& ctx, uint32_t num, vector<RGWObjEnt>& objs,
                    bool *is_truncated, RGWAccessListFilter *filter);