]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osdc/Objecter: restart listing this PG if sort order changes
authorSage Weil <sage@redhat.com>
Mon, 10 Aug 2015 14:14:03 +0000 (10:14 -0400)
committerSage Weil <sage@redhat.com>
Mon, 17 Aug 2015 14:30:32 +0000 (10:30 -0400)
If the cluster sort order changes mid-way through our listing, our
cursor within this pg is meaningless and we need to restart at the
beginning of the PG.

Signed-off-by: Sage Weil <sage@redhat.com>
src/osdc/Objecter.cc
src/osdc/Objecter.h

index bc509cc7ab299778d83cb05bf2accefc5b595272..b6a757702654c8fb62634e73df603124dace951c 100644 (file)
@@ -3167,8 +3167,14 @@ void Objecter::list_nobjects(NListContext *list_context, Context *onfinish)
 
   if (list_context->starting_pg_num == 0) {     // there can't be zero pgs!
     list_context->starting_pg_num = pg_num;
+    list_context->sort_bitwise = osdmap->test_flag(CEPH_OSDMAP_SORTBITWISE);
     ldout(cct, 20) << pg_num << " placement groups" << dendl;
   }
+  if (list_context->sort_bitwise != osdmap->test_flag(CEPH_OSDMAP_SORTBITWISE)) {
+    ldout(cct, 10) << " hobject sort order changed, restarting this pg" << dendl;
+    list_context->cookie = collection_list_handle_t();
+    list_context->sort_bitwise = osdmap->test_flag(CEPH_OSDMAP_SORTBITWISE);
+  }
   if (list_context->starting_pg_num != pg_num) {
     // start reading from the beginning; the pgs have changed
     ldout(cct, 10) << " pg_num changed; restarting with " << pg_num << dendl;
@@ -3306,8 +3312,14 @@ void Objecter::list_objects(ListContext *list_context, Context *onfinish)
 
   if (list_context->starting_pg_num == 0) {     // there can't be zero pgs!
     list_context->starting_pg_num = pg_num;
+    list_context->sort_bitwise = osdmap->test_flag(CEPH_OSDMAP_SORTBITWISE);
     ldout(cct, 20) << pg_num << " placement groups" << dendl;
   }
+  if (list_context->sort_bitwise != osdmap->test_flag(CEPH_OSDMAP_SORTBITWISE)) {
+    ldout(cct, 10) << " hobject sort order changed, restarting this pg" << dendl;
+    list_context->cookie = collection_list_handle_t();
+    list_context->sort_bitwise = osdmap->test_flag(CEPH_OSDMAP_SORTBITWISE);
+  }
   if (list_context->starting_pg_num != pg_num) {
     // start reading from the beginning; the pgs have changed
     ldout(cct, 10) << " pg_num changed; restarting with " << pg_num << dendl;
index d3c0effe90a289abab073ba1dc65527b6e5549f4..5e7d884ccaf50fe45176e86f064923758feca574 100644 (file)
@@ -1317,6 +1317,7 @@ public:
     int starting_pg_num;
     bool at_end_of_pool;
     bool at_end_of_pg;
+    bool sort_bitwise;
 
     int64_t pool_id;
     int pool_snap_seq;
@@ -1339,6 +1340,7 @@ public:
     NListContext() : current_pg(0), current_pg_epoch(0), starting_pg_num(0),
                    at_end_of_pool(false),
                    at_end_of_pg(false),
+                   sort_bitwise(false),
                    pool_id(0),
                    pool_snap_seq(0),
                     max_entries(0),
@@ -1382,6 +1384,7 @@ public:
     int starting_pg_num;
     bool at_end_of_pool;
     bool at_end_of_pg;
+    bool sort_bitwise;
 
     int64_t pool_id;
     int pool_snap_seq;
@@ -1404,6 +1407,7 @@ public:
     ListContext() : current_pg(0), current_pg_epoch(0), starting_pg_num(0),
                    at_end_of_pool(false),
                    at_end_of_pg(false),
+                   sort_bitwise(false),
                    pool_id(0),
                    pool_snap_seq(0),
                     max_entries(0),