]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: allow radosgw-admin to list bucket w --allow-unordered 28096/head
authorJ. Eric Ivancich <ivancich@redhat.com>
Wed, 8 May 2019 18:47:04 +0000 (14:47 -0400)
committerJ. Eric Ivancich <ivancich@redhat.com>
Tue, 14 May 2019 20:06:02 +0000 (16:06 -0400)
Presently the `radosgw-admin bucket list --bucket=<bucket>` lists the
objects in lexical order. This can be an expensive operation since
objects are not stored in bucket index shards in order and a selection
sort process is done across all bucket index shards.

By allowing the user to add the "--allow-unordered" command-line flag,
a more efficient bucket listing is enabled. This is particularly
important for buckets with a large number of objects.

Signed-off-by: J. Eric Ivancich <ivancich@redhat.com>
(cherry picked from commit 12452c4a91ee56c10d3dcf970dd2b0dd5aeb2401)

doc/man/8/radosgw-admin.rst
src/rgw/rgw_admin.cc
src/test/cli/radosgw-admin/help.t

index 9135a5e05a7450c2379429fc7a95f18424c5479e..e0778455fdc52c5eaf43608ab108bd26b99eb2ed 100644 (file)
@@ -75,7 +75,10 @@ which are as follows:
   Remove access key.
 
 :command:`bucket list`
-  List all buckets.
+  List buckets, or, if bucket specified with --bucket=<bucket>,
+  list its objects. If bucket specified adding --allow-unordered
+  removes ordering requirement, possibly generating results more
+  quickly in buckets with large number of objects.
 
 :command:`bucket limit check`
   Show bucket sharding stats.
index fca87dd8f345f443f4c8d6d08754a720b6f08d99..551311831c2b54073a0c2f549c68c6a93710af78 100644 (file)
@@ -79,7 +79,8 @@ void usage()
   cout << "  subuser rm                 remove subuser\n";
   cout << "  key create                 create access key\n";
   cout << "  key rm                     remove access key\n";
-  cout << "  bucket list                list buckets\n";
+  cout << "  bucket list                list buckets (specify --allow-unordered for\n";
+  cout << "                             faster, unsorted listing)\n";
   cout << "  bucket limit check         show bucket sharding stats\n";
   cout << "  bucket link                link bucket to specified user\n";
   cout << "  bucket unlink              unlink bucket from specified user\n";
@@ -2781,6 +2782,7 @@ int main(int argc, const char **argv)
   bool have_max_objects = false;
   bool have_max_size = false;
   int include_all = false;
+  int allow_unordered = false;
 
   int sync_stats = false;
   int reset_stats = false;
@@ -3027,6 +3029,8 @@ int main(int argc, const char **argv)
       // do nothing
     } else if (ceph_argparse_binary_flag(args, i, &include_all, NULL, "--include-all", (char*)NULL)) {
      // do nothing
+    } else if (ceph_argparse_binary_flag(args, i, &allow_unordered, NULL, "--allow-unordered", (char*)NULL)) {
+     // do nothing
     } else if (ceph_argparse_binary_flag(args, i, &extra_info, NULL, "--extra-info", (char*)NULL)) {
      // do nothing
     } else if (ceph_argparse_binary_flag(args, i, &bypass_gc, NULL, "--bypass-gc", (char*)NULL)) {
@@ -5412,6 +5416,7 @@ int main(int argc, const char **argv)
       list_op.params.ns = ns;
       list_op.params.enforce_ns = false;
       list_op.params.list_versions = true;
+      list_op.params.allow_unordered = bool(allow_unordered);
 
       do {
         ret = list_op.list_objects(max_entries - count, &result, &common_prefixes, &truncated);
index 912c500c54b3390616fee0fae045034d4ed68df1..eb9260bfee31b0b9ae47fde09440b13710dbdb16 100644 (file)
@@ -17,7 +17,8 @@
     subuser rm                 remove subuser
     key create                 create access key
     key rm                     remove access key
-    bucket list                list buckets
+    bucket list                list buckets (specify --allow-unordered for
+                               faster, unsorted listing)
     bucket limit check         show bucket sharding stats
     bucket link                link bucket to specified user
     bucket unlink              unlink bucket from specified user