From a5e27de5afd6bcf41cbd447b891dbe9e8081617d Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 7 Aug 2015 16:27:43 -0400 Subject: [PATCH] osd: refuse to boot if SORTBITWISE not set but backend cannot sort nibblewise This prevenents OSDs with new backends from starting if the cluster is still using the legacy sort order. Signed-off-by: Sage Weil --- src/os/FileStore.h | 4 ++++ src/os/ObjectStore.h | 4 ++++ src/osd/OSD.cc | 3 +++ 3 files changed, 11 insertions(+) diff --git a/src/os/FileStore.h b/src/os/FileStore.h index 744bdbd23f070..9a52f0b344e9a 100644 --- a/src/os/FileStore.h +++ b/src/os/FileStore.h @@ -460,6 +460,10 @@ public: */ bool get_allow_sharded_objects(); + bool can_sort_nibblewise() { + return true; // i support legacy sort order + } + void collect_metadata(map *pm); int statfs(struct statfs *buf); diff --git a/src/os/ObjectStore.h b/src/os/ObjectStore.h index 7dc94094920ee..9651a697b7872 100644 --- a/src/os/ObjectStore.h +++ b/src/os/ObjectStore.h @@ -1768,6 +1768,10 @@ public: virtual void set_allow_sharded_objects() = 0; virtual bool get_allow_sharded_objects() = 0; + virtual bool can_sort_nibblewise() { + return false; // assume a backend cannot, unless it says otherwise + } + virtual int statfs(struct statfs *buf) = 0; virtual void collect_metadata(map *pm) { } diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 1cf9c838d1420..b7c2730abf045 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -4447,6 +4447,9 @@ void OSD::_maybe_boot(epoch_t oldest, epoch_t newest) // if our map within recent history, try to add ourselves to the osdmap. if (osdmap->test_flag(CEPH_OSDMAP_NOUP)) { dout(5) << "osdmap NOUP flag is set, waiting for it to clear" << dendl; + } else if (!osdmap->test_flag(CEPH_OSDMAP_SORTBITWISE) && + !store->can_sort_nibblewise()) { + dout(1) << "osdmap SORTBITWISE flag is NOT set but our backend does not support nibblewise sort" << dendl; } else if (is_waiting_for_healthy() || !_is_healthy()) { // if we are not healthy, do not mark ourselves up (yet) dout(1) << "not healthy; waiting to boot" << dendl; -- 2.39.5