From 2e03356f81f5dfb29ddc591b933b3cb2efdc6fba Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Mon, 9 Dec 2019 10:56:02 -0600 Subject: [PATCH] osd/OSDMap: rename old calc_pg_role -> calc_pg_role_broken Also primary_changed -> primary_changed_broken. Logged this issue with https://tracker.ceph.com/issues/43213 Signed-off-by: Sage Weil --- src/osd/OSDMap.cc | 11 +++++++---- src/osd/OSDMap.h | 4 ++-- src/osdc/Objecter.cc | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/osd/OSDMap.cc b/src/osd/OSDMap.cc index 263d6fa7cc97e..68788240a2f07 100644 --- a/src/osd/OSDMap.cc +++ b/src/osd/OSDMap.cc @@ -2639,8 +2639,11 @@ void OSDMap::_pg_to_up_acting_osds( *acting_primary = _acting_primary; } -int OSDMap::calc_pg_role(int osd, const vector& acting, int nrep) +int OSDMap::calc_pg_role_broken(int osd, const vector& acting, int nrep) { + // This implementation is broken for EC PGs since the osd may appear + // multiple times in the acting set. See + // https://tracker.ceph.com/issues/43213 if (!nrep) nrep = acting.size(); for (int i=0; i& acting) return -1; } -bool OSDMap::primary_changed( +bool OSDMap::primary_changed_broken( int oldprimary, const vector &oldacting, int newprimary, @@ -2678,8 +2681,8 @@ bool OSDMap::primary_changed( return true; // was empty, now not, or vice versa if (oldprimary != newprimary) return true; // primary changed - if (calc_pg_role(oldprimary, oldacting) != - calc_pg_role(newprimary, newacting)) + if (calc_pg_role_broken(oldprimary, oldacting) != + calc_pg_role_broken(newprimary, newacting)) return true; return false; // same primary (tho replicas may have changed) } diff --git a/src/osd/OSDMap.h b/src/osd/OSDMap.h index ba546f37eb4b9..db45f811ae82a 100644 --- a/src/osd/OSDMap.h +++ b/src/osd/OSDMap.h @@ -1388,9 +1388,9 @@ public: } - static int calc_pg_role(int osd, const std::vector& acting, int nrep=0); + static int calc_pg_role_broken(int osd, const std::vector& acting, int nrep=0); static int calc_pg_role(pg_shard_t who, const std::vector& acting); - static bool primary_changed( + static bool primary_changed_broken( int oldprimary, const std::vector &oldacting, int newprimary, diff --git a/src/osdc/Objecter.cc b/src/osdc/Objecter.cc index 6665957ddb3e1..d1da49bfffb85 100644 --- a/src/osdc/Objecter.cc +++ b/src/osdc/Objecter.cc @@ -2640,7 +2640,7 @@ bool Objecter::is_pg_changed( const vector& newacting, bool any_change) { - if (OSDMap::primary_changed( + if (OSDMap::primary_changed_broken( // https://tracker.ceph.com/issues/43213 oldprimary, oldacting, newprimary, -- 2.47.3