mirror of
https://github.com/ceph/ceph
synced 2025-02-24 11:37:37 +00:00
osd: handle event notify/info/log from Initial
We shouldn't post a creation event and jump into peering/stray based on pg creation when we are about to process more information or else we will send out unnecessary queries. Instead, handle those from Initial and jump to the appropriate state. Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
This commit is contained in:
parent
b5cb4c5e97
commit
1fbefb32f9
@ -1174,15 +1174,6 @@ PG *OSD::get_or_create_pg(const PG::Info& info, epoch_t epoch, int from, int& cr
|
||||
// kick any waiters
|
||||
wake_pg_waiters(pg->info.pgid);
|
||||
|
||||
map<int, map<pg_t, PG::Query> > query_map;
|
||||
map<int, MOSDPGInfo*> info_map;
|
||||
map<int, vector<PG::Info> > notify_list;
|
||||
PG::RecoveryCtx rctx(&query_map, &info_map, ¬ify_list,
|
||||
&((*pfin)->contexts), *pt);
|
||||
pg->handle_create(&rctx);
|
||||
do_queries(query_map);
|
||||
do_infos(info_map);
|
||||
do_notifies(notify_list);
|
||||
} else {
|
||||
// already had it. did the mapping change?
|
||||
pg = _lookup_lock_pg(info.pgid);
|
||||
|
@ -293,6 +293,7 @@ void PG::proc_replica_log(ObjectStore::Transaction& t, Info &oinfo, Log &olog, M
|
||||
|
||||
void PG::proc_replica_info(int from, Info &oinfo)
|
||||
{
|
||||
dout(10) << "proc_replica_info osd" << from << " " << oinfo << dendl;
|
||||
assert(is_primary());
|
||||
peer_info[from] = oinfo;
|
||||
might_have_unfound.insert(from);
|
||||
@ -3725,6 +3726,29 @@ PG::RecoveryState::Initial::Initial(my_context ctx) : my_base(ctx) {
|
||||
context< RecoveryMachine >().log_enter(state_name);
|
||||
}
|
||||
|
||||
boost::statechart::result
|
||||
PG::RecoveryState::Initial::react(const MNotifyRec& notify) {
|
||||
PG *pg = context< RecoveryMachine >().pg;
|
||||
pg->proc_replica_info(notify.from, notify.info);
|
||||
return transit< Primary >();
|
||||
}
|
||||
|
||||
boost::statechart::result
|
||||
PG::RecoveryState::Initial::react(const MInfoRec& i) {
|
||||
PG *pg = context< RecoveryMachine >().pg;
|
||||
assert(!pg->is_primary());
|
||||
post_event(i);
|
||||
return transit< Stray >();
|
||||
}
|
||||
|
||||
boost::statechart::result
|
||||
PG::RecoveryState::Initial::react(const MLogRec& i) {
|
||||
PG *pg = context< RecoveryMachine >().pg;
|
||||
assert(!pg->is_primary());
|
||||
post_event(i);
|
||||
return transit< Stray >();
|
||||
}
|
||||
|
||||
void PG::RecoveryState::Initial::exit() {
|
||||
context< RecoveryMachine >().log_exit(state_name, enter_time);
|
||||
}
|
||||
|
@ -991,11 +991,18 @@ public:
|
||||
typedef boost::mpl::list <
|
||||
boost::statechart::transition< Initialize, Started >,
|
||||
boost::statechart::transition< Load, Reset >,
|
||||
boost::statechart::custom_reaction< MNotifyRec >,
|
||||
boost::statechart::custom_reaction< MInfoRec >,
|
||||
boost::statechart::custom_reaction< MLogRec >,
|
||||
boost::statechart::transition< boost::statechart::event_base, Crashed >
|
||||
> reactions;
|
||||
|
||||
Initial(my_context ctx);
|
||||
void exit();
|
||||
|
||||
boost::statechart::result react(const MNotifyRec&);
|
||||
boost::statechart::result react(const MInfoRec&);
|
||||
boost::statechart::result react(const MLogRec&);
|
||||
};
|
||||
|
||||
struct Reset :
|
||||
@ -1117,6 +1124,7 @@ public:
|
||||
struct Stray : boost::statechart::state< Stray, Started >, NamedState {
|
||||
bool backlog_requested;
|
||||
map<int, Query> pending_queries;
|
||||
|
||||
typedef boost::mpl::list <
|
||||
boost::statechart::custom_reaction< MQuery >,
|
||||
boost::statechart::custom_reaction< MLogRec >,
|
||||
@ -1141,6 +1149,7 @@ public:
|
||||
struct GetInfo :
|
||||
boost::statechart::state< GetInfo, Peering >, NamedState {
|
||||
set<int> peer_info_requested;
|
||||
|
||||
typedef boost::mpl::list <
|
||||
boost::statechart::transition< GotInfo, GetLog >,
|
||||
boost::statechart::custom_reaction< MNotifyRec >
|
||||
|
Loading…
Reference in New Issue
Block a user