Merge pull request #28771 from athanatos/sjust/wip-schedule-event-on-commit

crimson/osd/pg: start_operation for read_state, schedule_event_on_commit

Reviewed-by: Yingxin Cheng <yingxincheng@gmail.com>
Reviewed-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
Kefu Chai 2019-06-28 12:14:19 +08:00 committed by GitHub
commit 4987bea98c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 12 deletions

View File

@ -221,13 +221,15 @@ seastar::future<> PG::read_state(ceph::os::FuturizedStore* store)
else
peering_state.set_role(-1);
PeeringCtx rctx;
PeeringState::Initialize evt;
peering_state.handle_event(evt, &rctx);
peering_state.write_if_dirty(rctx.transaction);
store->do_transaction(
coll_ref,
std::move(rctx.transaction));
epoch_t epoch = peering_state.get_osdmap()->get_epoch();
shard_services.start_operation<LocalPeeringEvent>(
this,
shard_services,
pg_whoami,
pgid,
epoch,
epoch,
PeeringState::Initialize());
return seastar::now();
});

View File

@ -205,11 +205,15 @@ public:
ObjectStore::Transaction &t,
PGPeeringEventRef on_commit) final {
t.register_on_commit(
new LambdaContext([this, on_commit](){
PeeringCtx rctx;
do_peering_event(*on_commit, rctx);
shard_services.dispatch_context(std::move(rctx));
}));
new LambdaContext(
[this, on_commit=std::move(on_commit)] {
shard_services.start_operation<LocalPeeringEvent>(
this,
shard_services,
pg_whoami,
pgid,
std::move(*on_commit));
}));
}
void update_heartbeat_peers(set<int> peers) final {