}
}
+void OSD::discard_context(PG::RecoveryCtx& ctx)
+{
+ delete ctx.notify_list;
+ delete ctx.query_map;
+ delete ctx.info_map;
+ delete ctx.transaction;
+}
+
+
/** do_notifies
* Send an MOSDPGNotify to a primary, with a list of PGs that I have
* content for, and they are primary for.
advance_pg(curmap->get_epoch(), pg, handle, &rctx);
}
pg->do_peering_event(evt, &rctx);
+ if (pg->is_deleted()) {
+ // do not dispatch rctx; the final _delete_some already did it.
+ discard_context(rctx);
+ pg->unlock();
+ return;
+ }
dispatch_context_transaction(rctx, pg, &handle);
need_up_thru = pg->get_need_up_thru();
same_interval_since = pg->get_same_interval_since();
ThreadPool::TPHandle *handle = NULL);
void dispatch_context_transaction(PG::RecoveryCtx &ctx, PG *pg,
ThreadPool::TPHandle *handle = NULL);
+ void discard_context(PG::RecoveryCtx &ctx);
void do_notifies(map<int,
vector<pair<pg_notify_t, PastIntervals> > >&
notify_list,
}
};
-void PG::_delete_some()
+void PG::_delete_some(ObjectStore::Transaction *t)
{
dout(10) << __func__ << dendl;
vector<ghobject_t> olist;
- ObjectStore::Transaction t;
int max = std::min(osd->store->get_ideal_list_max(),
(int)cct->_conf->osd_target_transaction_size);
ghobject_t next;
&next);
dout(20) << __func__ << " " << olist << dendl;
- OSDriver::OSTransaction _t(osdriver.get_transaction(&t));
+ OSDriver::OSTransaction _t(osdriver.get_transaction(t));
int64_t num = 0;
for (auto& oid : olist) {
if (oid.is_pgmeta()) {
if (r != 0 && r != -ENOENT) {
ceph_abort();
}
- t.remove(coll, oid);
+ t->remove(coll, oid);
++num;
}
epoch_t e = get_osdmap()->get_epoch();
if (num) {
dout(20) << __func__ << " deleting " << num << " objects" << dendl;
Context *fin = new C_DeleteMore(this, e);
- t.register_on_commit(fin);
- osd->store->queue_transaction(
- ch,
- std::move(t));
+ t->register_on_commit(fin);
} else {
dout(20) << __func__ << " finished" << dendl;
if (cct->_conf->osd_inject_failure_on_pg_removal) {
// final flush here to ensure completions drop refs. Of particular concern
// are the SnapMapper ContainerContexts.
{
- ObjectStore::Transaction t;
PGRef pgref(this);
- PGLog::clear_info_log(info.pgid, &t);
- t.remove_collection(coll);
- t.register_on_commit(new ContainerContext<PGRef>(pgref));
- t.register_on_applied(new ContainerContext<PGRef>(pgref));
- osd->store->queue_transaction(ch, std::move(t));
+ PGLog::clear_info_log(info.pgid, t);
+ t->remove_collection(coll);
+ t->register_on_commit(new ContainerContext<PGRef>(pgref));
+ t->register_on_applied(new ContainerContext<PGRef>(pgref));
+ osd->store->queue_transaction(ch, std::move(*t));
}
ch->flush();
const DeleteSome& evt)
{
PG *pg = context< RecoveryMachine >().pg;
- pg->_delete_some();
+ pg->_delete_some(context<RecoveryMachine>().get_cur_transaction());
return discard_event();
}