From 712f0da05c0a4739a416e0ac003050305de3a775 Mon Sep 17 00:00:00 2001 From: Josh Durgin Date: Mon, 3 Jul 2017 22:05:03 -0400 Subject: [PATCH] osd_types, Objecter: make recovery_deletes feature create a new interval This is needed to create a single place to regenerate the missing set - at the start of a new interval where support for recovery deletes changed. The missing set is otherwise not cleared, so it would need to be rebuilt in arbitrary places if e.g. an osd not supporting it went down and restarted with support, or if we used a feature flag command to trigger rebuilding the missing set. Signed-off-by: Josh Durgin --- src/osd/osd_types.cc | 7 ++++++- src/osd/osd_types.h | 3 +++ src/osdc/Objecter.cc | 4 ++++ src/osdc/Objecter.h | 1 + 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/osd/osd_types.cc b/src/osd/osd_types.cc index bbacdb38aa20..8913f12b9cd9 100644 --- a/src/osd/osd_types.cc +++ b/src/osd/osd_types.cc @@ -3396,6 +3396,8 @@ bool PastIntervals::is_new_interval( unsigned new_pg_num, bool old_sort_bitwise, bool new_sort_bitwise, + bool old_recovery_deletes, + bool new_recovery_deletes, pg_t pgid) { return old_acting_primary != new_acting_primary || new_acting != old_acting || @@ -3404,7 +3406,8 @@ bool PastIntervals::is_new_interval( old_min_size != new_min_size || old_size != new_size || pgid.is_split(old_pg_num, new_pg_num, 0) || - old_sort_bitwise != new_sort_bitwise; + old_sort_bitwise != new_sort_bitwise || + old_recovery_deletes != new_recovery_deletes; } bool PastIntervals::is_new_interval( @@ -3436,6 +3439,8 @@ bool PastIntervals::is_new_interval( osdmap->get_pg_num(pgid.pool()), lastmap->test_flag(CEPH_OSDMAP_SORTBITWISE), osdmap->test_flag(CEPH_OSDMAP_SORTBITWISE), + lastmap->test_flag(CEPH_OSDMAP_RECOVERY_DELETES), + osdmap->test_flag(CEPH_OSDMAP_RECOVERY_DELETES), pgid); } diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h index 87166584f248..6bc75e3dbded 100644 --- a/src/osd/osd_types.h +++ b/src/osd/osd_types.h @@ -2680,6 +2680,8 @@ public: unsigned new_pg_num, bool old_sort_bitwise, bool new_sort_bitwise, + bool old_recovery_deletes, + bool new_recovery_deletes, pg_t pgid ); @@ -2722,6 +2724,7 @@ public: PastIntervals *past_intervals, ///< [out] intervals ostream *out = 0 ///< [out] debug ostream ); + friend ostream& operator<<(ostream& out, const PastIntervals &i); template diff --git a/src/osdc/Objecter.cc b/src/osdc/Objecter.cc index fde68cd1ba60..fc870badd603 100644 --- a/src/osdc/Objecter.cc +++ b/src/osdc/Objecter.cc @@ -2821,6 +2821,7 @@ int Objecter::_calc_target(op_target_t *t, Connection *con, bool any_change) osdmap->pg_to_up_acting_osds(pgid, &up, &up_primary, &acting, &acting_primary); bool sort_bitwise = osdmap->test_flag(CEPH_OSDMAP_SORTBITWISE); + bool recovery_deletes = osdmap->test_flag(CEPH_OSDMAP_RECOVERY_DELETES); unsigned prev_seed = ceph_stable_mod(pgid.ps(), t->pg_num, t->pg_num_mask); pg_t prev_pgid(prev_seed, pgid.pool()); if (any_change && PastIntervals::is_new_interval( @@ -2840,6 +2841,8 @@ int Objecter::_calc_target(op_target_t *t, Connection *con, bool any_change) pg_num, t->sort_bitwise, sort_bitwise, + t->recovery_deletes, + recovery_deletes, prev_pgid)) { force_resend = true; } @@ -2874,6 +2877,7 @@ int Objecter::_calc_target(op_target_t *t, Connection *con, bool any_change) pg_t(ceph_stable_mod(pgid.ps(), t->pg_num, t->pg_num_mask), pgid.pool()), &t->actual_pgid); t->sort_bitwise = sort_bitwise; + t->recovery_deletes = recovery_deletes; ldout(cct, 10) << __func__ << " " << " raw pgid " << pgid << " -> actual " << t->actual_pgid << " acting " << acting diff --git a/src/osdc/Objecter.h b/src/osdc/Objecter.h index ee40e76a5307..edcee5b922d9 100644 --- a/src/osdc/Objecter.h +++ b/src/osdc/Objecter.h @@ -1277,6 +1277,7 @@ public: int size = -1; ///< the size of the pool when were were last mapped int min_size = -1; ///< the min size of the pool when were were last mapped bool sort_bitwise = false; ///< whether the hobject_t sort order is bitwise + bool recovery_deletes = false; ///< whether the deletes are performed during recovery instead of peering bool used_replica = false; bool paused = false; -- 2.47.3