]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fix list buckets limit
authorYehuda Sadeh <yehuda@inktank.com>
Fri, 26 Apr 2013 05:22:35 +0000 (22:22 -0700)
committerYehuda Sadeh <yehuda@inktank.com>
Fri, 26 Apr 2013 19:10:14 +0000 (12:10 -0700)
There was an issue when limit was being set, we didn't
break from the iterating loop if limit was reached. Also,
S3 does not enforce any limit, so keep that behavior.

Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
src/rgw/rgw_op.cc
src/rgw/rgw_rest_s3.h

index 4e9553940f6069413087cad9de5ad3a6b7ee7842..39e32047c1eefc5d68fea92353a32fb26e41efc0 100644 (file)
@@ -661,7 +661,12 @@ void RGWListBuckets::execute()
 
   do {
     RGWUserBuckets buckets;
-    uint64_t read_count = min(limit - total_count, max_buckets);
+    uint64_t read_count;
+    if (limit > 0)
+      read_count = min(limit - total_count, max_buckets);
+    else
+      read_count = max_buckets;
+
     ret = rgw_read_user_buckets(store, s->user.user_id, buckets,
                                 marker, read_count, should_get_stats());
 
@@ -680,7 +685,7 @@ void RGWListBuckets::execute()
 
     total_count += m.size();
 
-    done = (m.size() < read_count || total_count == limit);
+    done = (m.size() < read_count || (limit > 0 && total_count == limit));
 
     if (m.size()) {
       send_response_data(buckets);
index bf97c1a29932e6af0dfcd93a55d9db93a9452b53..ea8e5edc2cbb05f3886a00909bb2c564f6401251 100644 (file)
@@ -25,7 +25,10 @@ public:
   RGWListBuckets_ObjStore_S3() {}
   ~RGWListBuckets_ObjStore_S3() {}
 
-  int get_params() { return 0; }
+  int get_params() {
+    limit = 0; /* no limit */
+    return 0;
+  }
   virtual void send_response_begin(bool has_buckets);
   virtual void send_response_data(RGWUserBuckets& buckets);
   virtual void send_response_end();