]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: allow radosgw-admin to list bucket w --allow-unordered 31220/head
authorJ. Eric Ivancich <ivancich@redhat.com>
Wed, 8 May 2019 18:47:04 +0000 (14:47 -0400)
committerNathan Cutler <ncutler@suse.com>
Tue, 29 Oct 2019 11:34:31 +0000 (12:34 +0100)
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 d9c5add4c9b1271d991bd97c57106d8abe49a087..2c4ac7e73de9a32c014f0cc3093cdf920d153c4a 100644 (file)
@@ -72,7 +72,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 link`
   Link bucket to specified user.
index 196b19ebf323d9d70058698eeda5b843a8fe22f2..04a8f121fc1f0be358eb5d77f3599486b81d9d43 100644 (file)
@@ -78,7 +78,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";
@@ -2669,6 +2670,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;
@@ -2915,6 +2917,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)) {
@@ -5262,6 +5266,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 eeb39a9dfe681cf995847da36834c89674472184..541b24967c7946eb3e1dbecc4231383c1d395c31 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