* 3) Prefer current primary
*/
map<pg_shard_t, pg_info_t>::const_iterator PG::find_best_info(
- const map<pg_shard_t, pg_info_t> &infos) const
+ const map<pg_shard_t, pg_info_t> &infos, bool *history_les_bound) const
{
+ assert(history_les_bound);
/* See doc/dev/osd_internals/last_epoch_started.rst before attempting
* to make changes to this process. Also, make sure to update it
* when you find bugs! */
++i) {
if (!cct->_conf->osd_find_best_info_ignore_history_les &&
max_last_epoch_started_found < i->second.history.last_epoch_started) {
+ *history_les_bound = true;
max_last_epoch_started_found = i->second.history.last_epoch_started;
}
if (!i->second.is_incomplete() &&
* calculate the desired acting, and request a change with the monitor
* if it differs from the current acting.
*/
-bool PG::choose_acting(pg_shard_t &auth_log_shard_id)
+bool PG::choose_acting(pg_shard_t &auth_log_shard_id, bool *history_les_bound)
{
map<pg_shard_t, pg_info_t> all_info(peer_info.begin(), peer_info.end());
all_info[pg_whoami] = info;
}
map<pg_shard_t, pg_info_t>::const_iterator auth_log_shard =
- find_best_info(all_info);
+ find_best_info(all_info, history_les_bound);
if (auth_log_shard == all_info.end()) {
if (up != acting) {
complete_infos.insert(*i);
}
map<pg_shard_t, pg_info_t>::const_iterator i = find_best_info(
- complete_infos);
+ complete_infos,
+ history_les_bound);
if (i != complete_infos.end()) {
auth_log_shard = all_info.find(i->first);
}
/*---------Peering--------*/
PG::RecoveryState::Peering::Peering(my_context ctx)
: my_base(ctx),
- NamedState(context< RecoveryMachine >().pg->cct, "Started/Primary/Peering")
+ NamedState(context< RecoveryMachine >().pg->cct, "Started/Primary/Peering"),
+ history_les_bound(false)
{
context< RecoveryMachine >().log_enter(state_name);
}
q.f->close_section();
+ if (history_les_bound) {
+ q.f->open_array_section("peering_blocked_by_detail");
+ q.f->open_object_section("item");
+ q.f->dump_string("detail","peering_blocked_by_history_les_bound");
+ q.f->close_section();
+ q.f->close_section();
+ }
+
q.f->close_section();
return forward_event();
}
pg->state_clear(PG_STATE_DEGRADED);
// adjust acting set? (e.g. because backfill completed...)
- if (pg->acting != pg->up && !pg->choose_acting(auth_log_shard))
+ bool history_les_bound = false;
+ if (pg->acting != pg->up && !pg->choose_acting(auth_log_shard,
+ &history_les_bound))
assert(pg->want_acting.size());
if (context< Active >().all_replicas_activated)
PG *pg = context< RecoveryMachine >().pg;
// adjust acting?
- if (!pg->choose_acting(auth_log_shard)) {
+ if (!pg->choose_acting(auth_log_shard,
+ &context< Peering >().history_les_bound)) {
if (!pg->want_acting.empty()) {
post_event(NeedActingChange());
} else {
void trim_write_ahead();
map<pg_shard_t, pg_info_t>::const_iterator find_best_info(
- const map<pg_shard_t, pg_info_t> &infos) const;
+ const map<pg_shard_t, pg_info_t> &infos,
+ bool *history_les_bound) const;
static void calc_ec_acting(
map<pg_shard_t, pg_info_t>::const_iterator auth_log_shard,
unsigned size,
set<pg_shard_t> *acting_backfill,
pg_shard_t *want_primary,
ostream &ss);
- bool choose_acting(pg_shard_t &auth_log_shard);
+ bool choose_acting(pg_shard_t &auth_log_shard,
+ bool *history_les_bound);
void build_might_have_unfound();
void replay_queued_ops();
void activate(
struct Peering : boost::statechart::state< Peering, Primary, GetInfo >, NamedState {
std::unique_ptr< PriorSet > prior_set;
+ bool history_les_bound; //< need osd_find_best_info_ignore_history_les
explicit Peering(my_context ctx);
void exit();