backfill_target(-1),
backfill_reserved(0),
backfill_reserving(0),
- flushed(false),
+ flushes_in_progress(0),
pg_stats_publish_lock("PG::pg_stats_publish_lock"),
pg_stats_publish_valid(false),
osr(osd->osr_registry.lookup_or_create(p, (stringify(p)))),
FlushStateRef flush_trigger(
new FlushState(this, get_osdmap()->get_epoch()));
t->nop();
- assert(!flushed);
+ flushes_in_progress++;
on_applied->push_back(new ContainerContext<FlushStateRef>(flush_trigger));
on_safe->push_back(new ContainerContext<FlushStateRef>(flush_trigger));
}
{
context< RecoveryMachine >().log_enter(state_name);
PG *pg = context< RecoveryMachine >().pg;
- pg->flushed = false;
+ pg->flushes_in_progress = 0;
pg->set_last_peering_reset();
}
{
PG *pg = context< RecoveryMachine >().pg;
context< RecoveryMachine >().log_enter(state_name);
- if (context< RecoveryMachine >().pg->flushed)
+ if (context< RecoveryMachine >().pg->flushes_in_progress == 0)
post_event(Activate(pg->get_osdmap()->get_epoch()));
}
if (can_discard_request(op)) {
return;
}
- if (!flushed) {
- dout(20) << " !flushed, waiting for active on " << op << dendl;
+ if (flushes_in_progress > 0) {
+ dout(20) << flushes_in_progress
+ << " flushes_in_progress pending "
+ << "waiting for active on " << op << dendl;
waiting_for_active.push_back(op);
return;
}
void ReplicatedPG::on_flushed()
{
- pair<hobject_t, ObjectContextRef> i;
- while (object_contexts.get_next(i.first, &i)) {
- derr << "on_flushed: object " << i.first << " obc still alive" << dendl;
+ assert(flushes_in_progress > 0);
+ flushes_in_progress--;
+ if (flushes_in_progress == 0) {
+ requeue_ops(waiting_for_active);
+ }
+ if (!is_active() || !is_primary()) {
+ pair<hobject_t, ObjectContextRef> i;
+ while (object_contexts.get_next(i.first, &i)) {
+ derr << "on_flushed: object " << i.first << " obc still alive" << dendl;
+ }
+ assert(object_contexts.empty());
}
- assert(object_contexts.empty());
pgbackend->on_flushed();
- flushed = true;
- requeue_ops(pg->waiting_for_active);
}
void ReplicatedPG::on_removal(ObjectStore::Transaction *t)