diff options
author | Yehuda Sadeh <yehuda@inktank.com> | 2013-04-25 22:22:35 -0700 |
---|---|---|
committer | Yehuda Sadeh <yehuda@inktank.com> | 2013-04-26 12:10:14 -0700 |
commit | a8b1bfa1ccbb66d73b7b97ecc714c6c24effd7c4 (patch) | |
tree | 714bf2d31f4f7274ebc5f779ee5f92ccdcab9a06 | |
parent | f2df87625cbc0f08d3e4ab4619f2ef642d9bdad8 (diff) | |
download | ceph-a8b1bfa1ccbb66d73b7b97ecc714c6c24effd7c4.tar.gz |
rgw: fix list buckets limit
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>
-rw-r--r-- | src/rgw/rgw_op.cc | 9 | ||||
-rw-r--r-- | src/rgw/rgw_rest_s3.h | 5 |
2 files changed, 11 insertions, 3 deletions
diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index 4e9553940f6..39e32047c1e 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -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); diff --git a/src/rgw/rgw_rest_s3.h b/src/rgw/rgw_rest_s3.h index bf97c1a2993..ea8e5edc2cb 100644 --- a/src/rgw/rgw_rest_s3.h +++ b/src/rgw/rgw_rest_s3.h @@ -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(); |