]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: make rgw_read_user_buckets() backward compatible. 4257/head
authorRadoslaw Zarzynski <rzarzynski@mirantis.com>
Tue, 31 Mar 2015 10:41:11 +0000 (12:41 +0200)
committerRadoslaw Zarzynski <rzarzynski@mirantis.com>
Mon, 20 Apr 2015 13:04:57 +0000 (15:04 +0200)
Fixes: #10683
Backport: hammer
Signed-off-by: Radoslaw Zarzynski <rzarzynski@mirantis.com>
src/rgw/rgw_bucket.cc
src/rgw/rgw_bucket.h
src/rgw/rgw_op.cc

index 5d2af38ea6fb1995cb68647913797402f2c5fca9..c3aab8e86aedd91cf5491148cdaa06b5043b41a9 100644 (file)
@@ -42,8 +42,13 @@ void rgw_get_buckets_obj(const string& user_id, string& buckets_obj_id)
  * Get all the buckets owned by a user and fill up an RGWUserBuckets with them.
  * Returns: 0 on success, -ERR# on failure.
  */
-int rgw_read_user_buckets(RGWRados *store, string user_id, RGWUserBuckets& buckets,
-                          const string& marker, uint64_t max, bool need_stats)
+int rgw_read_user_buckets(RGWRados * store,
+                          string user_id,
+                          RGWUserBuckets& buckets,
+                          const string& marker,
+                          uint64_t max,
+                          bool need_stats,
+                          uint64_t default_amount)
 {
   int ret;
   buckets.clear();
@@ -59,6 +64,10 @@ int rgw_read_user_buckets(RGWRados *store, string user_id, RGWUserBuckets& bucke
 
   uint64_t total = 0;
 
+  if (!max) {
+    max = default_amount;
+  }
+
   do {
     ret = store->cls_user_list_buckets(obj, m, max - total, entries, &m, &truncated);
     if (ret == -ENOENT)
index 830e096c9877750414946bd9b72c649e777ad031..222e152b10ffb8975ba471fb1920da688f86de74 100644 (file)
@@ -104,8 +104,13 @@ extern void rgw_bucket_init(RGWMetadataManager *mm);
  * Get all the buckets owned by a user and fill up an RGWUserBuckets with them.
  * Returns: 0 on success, -ERR# on failure.
  */
-extern int rgw_read_user_buckets(RGWRados *store, string user_id, RGWUserBuckets& buckets,
-                                 const string& marker, uint64_t max, bool need_stats);
+extern int rgw_read_user_buckets(RGWRados *store,
+                                 string user_id,
+                                 RGWUserBuckets& buckets,
+                                 const string& marker,
+                                 uint64_t max,
+                                 bool need_stats,
+                                 uint64_t default_amount = 1000);
 
 extern int rgw_link_bucket(RGWRados *store, string user_id, rgw_bucket& bucket, time_t creation_time, bool update_entrypoint = true);
 extern int rgw_unlink_bucket(RGWRados *store, string user_id, const string& bucket_name, bool update_entrypoint = true);
index 34335b4dd8f12d4d850db1b55ee998b82abd1353..d4cc7f00823cf518c086afc7316f543c66724fe7 100644 (file)
@@ -1002,7 +1002,7 @@ void RGWListBuckets::execute()
     read_count = min(limit - total_count, (uint64_t)max_buckets);
 
     ret = rgw_read_user_buckets(store, s->user.user_id, buckets,
-                                marker, read_count, should_get_stats());
+                                marker, read_count, should_get_stats(), 0);
 
     if (!started) {
       send_response_begin(buckets.count() > 0);