We send PG state updates to the monitor while creating a PG before the
actual creation and been finalized and persisted. Because those updates
do not include the CREATING bit, the mon will remove the pgid from it's
creating set. If the OSD(s) crash before persisting that PG creation, the
PG will never get created.
Fix this by leaving the CREATING bit set on the primary as long as
last_epoch_started==0. That is, until we successfully peer for the very
first time. Only then do we clear the bit and tell the monitor it's duty
is complete.
Fixes: #8001
Signed-off-by: Sage Weil <sage@inktank.com>
// info.last_epoch_started is set during activate()
info.history.last_epoch_started = info.last_epoch_started;
+ state_clear(PG_STATE_CREATING);
share_pg_info();
publish_stats_to_osd();
reg_next_scrub();
+ // set CREATING bit until we have peered for the first time.
+ if (is_primary() && info.history.last_epoch_started == 0)
+ state_set(PG_STATE_CREATING);
+ else
+ state_clear(PG_STATE_CREATING);
+
// did acting, up, primary|acker change?
if (!lastmap) {
dout(10) << " no lastmap" << dendl;