From: Sage Weil Date: Mon, 10 Aug 2015 14:14:03 +0000 (-0400) Subject: osdc/Objecter: restart listing this PG if sort order changes X-Git-Tag: v9.1.0~346^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3540fb9fe0a580d0bddf5b87e0554d3ec20787bc;p=ceph.git osdc/Objecter: restart listing this PG if sort order changes 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 --- diff --git a/src/osdc/Objecter.cc b/src/osdc/Objecter.cc index bc509cc7ab299..b6a757702654c 100644 --- a/src/osdc/Objecter.cc +++ b/src/osdc/Objecter.cc @@ -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; diff --git a/src/osdc/Objecter.h b/src/osdc/Objecter.h index d3c0effe90a28..5e7d884ccaf50 100644 --- a/src/osdc/Objecter.h +++ b/src/osdc/Objecter.h @@ -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),