These were awkward and unnecessary.
Signed-off-by: Sage Weil <sage@redhat.com>
PG::RecoveryCtx OSD::create_context()
{
ObjectStore::Transaction *t = new ObjectStore::Transaction;
- C_Contexts *on_applied = new C_Contexts(cct);
- C_Contexts *on_safe = new C_Contexts(cct);
map<int, map<spg_t,pg_query_t> > *query_map =
new map<int, map<spg_t, pg_query_t> >;
map<int,vector<pair<pg_notify_t, PastIntervals> > > *notify_list =
new map<int, vector<pair<pg_notify_t, PastIntervals> > >;
map<int,vector<pair<pg_notify_t, PastIntervals> > > *info_map =
new map<int,vector<pair<pg_notify_t, PastIntervals> > >;
- PG::RecoveryCtx rctx(query_map, info_map, notify_list,
- on_applied, on_safe, t);
+ PG::RecoveryCtx rctx(query_map, info_map, notify_list, t);
return rctx;
}
ThreadPool::TPHandle *handle)
{
if (!ctx.transaction->empty()) {
- if (ctx.on_applied)
- ctx.transaction->register_on_applied(ctx.on_applied);
- if (ctx.on_safe)
- ctx.transaction->register_on_commit(ctx.on_safe);
int tr = store->queue_transaction(
pg->ch,
std::move(*ctx.transaction), TrackedOpRef(), handle);
assert(tr == 0);
delete (ctx.transaction);
ctx.transaction = new ObjectStore::Transaction;
- ctx.on_applied = new C_Contexts(cct);
- ctx.on_safe = new C_Contexts(cct);
}
}
delete ctx.notify_list;
delete ctx.query_map;
delete ctx.info_map;
- if ((ctx.on_applied->empty() &&
- ctx.on_safe->empty() &&
- ctx.transaction->empty()) || !pg) {
+ if (ctx.transaction->empty() || !pg) {
delete ctx.transaction;
- delete ctx.on_applied;
- delete ctx.on_safe;
} else {
- if (ctx.on_applied)
- ctx.transaction->register_on_applied(ctx.on_applied);
- if (ctx.on_safe)
- ctx.transaction->register_on_commit(ctx.on_safe);
int tr = store->queue_transaction(
pg->ch,
std::move(*ctx.transaction), TrackedOpRef(),
set_role(-1);
}
- PG::RecoveryCtx rctx(0, 0, 0, 0, 0, new ObjectStore::Transaction);
+ PG::RecoveryCtx rctx(0, 0, 0, new ObjectStore::Transaction);
handle_initialize(&rctx);
// note: we don't activate here because we know the OSD will advance maps
// during boot.
pg->deleting = true;
ObjectStore::Transaction* t = context<RecoveryMachine>().get_cur_transaction();
pg->on_removal(t);
- RecoveryCtx *rctx = context<RecoveryMachine>().get_recovery_ctx();
- Context *fin = new C_DeleteMore(pg, pg->get_osdmap()->get_epoch());
- rctx->transaction->register_on_commit(fin);
+ t->register_on_commit(new C_DeleteMore(pg, pg->get_osdmap()->get_epoch()));
}
boost::statechart::result PG::RecoveryState::Deleting::react(
map<int, map<spg_t, pg_query_t> > *query_map;
map<int, vector<pair<pg_notify_t, PastIntervals> > > *info_map;
map<int, vector<pair<pg_notify_t, PastIntervals> > > *notify_list;
- C_Contexts *on_applied;
- C_Contexts *on_safe;
ObjectStore::Transaction *transaction;
ThreadPool::TPHandle* handle;
RecoveryCtx(map<int, map<spg_t, pg_query_t> > *query_map,
vector<pair<pg_notify_t, PastIntervals> > > *info_map,
map<int,
vector<pair<pg_notify_t, PastIntervals> > > *notify_list,
- C_Contexts *on_applied,
- C_Contexts *on_safe,
ObjectStore::Transaction *transaction)
: query_map(query_map), info_map(info_map),
notify_list(notify_list),
- on_applied(on_applied),
- on_safe(on_safe),
transaction(transaction),
handle(NULL) {}
: query_map(&(buf.query_map)),
info_map(&(buf.info_map)),
notify_list(&(buf.notify_list)),
- on_applied(rctx.on_applied),
- on_safe(rctx.on_safe),
transaction(rctx.transaction),
handle(rctx.handle) {}