}
return false;
}
- // make sure we respect the stretch cluster rules -- and
- // didn't break them with earlier choices!
- const pg_pool_t& pg_pool = pool.info;
- if (pg_pool.is_stretch_pool()) {
- stringstream ss;
- if (!pg_pool.stretch_set_can_peer(want, *get_osdmap(), &ss)) {
- psdout(5) << "peering blocked by stretch_can_peer: " << ss.str() << dendl;
- return false;
- }
- }
if (request_pg_temp_change_only)
return true;
if (is_primary()) {
// only update primary last_epoch_started if we will go active
- if (acting.size() >= pool.info.min_size) {
+ if ((acting.size() >= pool.info.min_size) &&
+ pool.info.stretch_set_can_peer(acting, *get_osdmap(), NULL)) {
ceph_assert(cct->_conf->osd_find_best_info_ignore_history_les ||
info.last_epoch_started <= activation_epoch);
info.last_epoch_started = activation_epoch;
state_set(PG_STATE_ACTIVATING);
pl->on_activate(std::move(to_trim));
}
- if (acting.size() >= pool.info.min_size) {
+ if ((acting.size() >= pool.info.min_size) &&
+ pool.info.stretch_set_can_peer(acting, *get_osdmap(), NULL)) {
PGLog::LogEntryHandlerRef rollbacker{pl->get_log_handler(t)};
pg_log.roll_forward(rollbacker.get());
}
pl->set_not_ready_to_merge_source(pgid);
}
}
- } else if (ps->acting.size() < ps->pool.info.min_size) {
+ } else if ((ps->acting.size() < ps->pool.info.min_size) ||
+ !ps->pool.info.stretch_set_can_peer(ps->acting,
+ *ps->get_osdmap(), NULL)) {
ps->state_set(PG_STATE_PEERED);
} else {
ps->state_set(PG_STATE_ACTIVE);
{}, /* lease */
ps->get_lease_ack());
- if (ps->acting.size() >= ps->pool.info.min_size) {
+ if ((ps->acting.size() >= ps->pool.info.min_size) &&
+ ps->pool.info.stretch_set_can_peer(ps->acting,
+ *ps->get_osdmap(), NULL)) {
ps->state_set(PG_STATE_ACTIVE);
} else {
ps->state_set(PG_STATE_PEERED);