Skip to content

Commit 1dbedbd

Browse files
authored
Merge pull request ceph#64863 from leonidc/cleanup_pending_map
nvmeofgw: cleanup pending map upon monitor restart Reviewed-by: Samuel Just <[email protected]>
2 parents 6bf1c92 + 924acd1 commit 1dbedbd

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/mon/NVMeofGwMon.cc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,21 @@ void NVMeofGwMon::init()
2929
dout(10) << "called " << dendl;
3030
}
3131

32+
void NVMeofGwMon::cleanup_pending_map()
33+
{
34+
dout(10) << "cleanup pending :" << pending_map << dendl;
35+
pending_map.created_gws.clear();
36+
pending_map.fsm_timers.clear();
37+
pending_map.gw_epoch.clear();
38+
pending_map.epoch = 0;
39+
}
40+
3241
void NVMeofGwMon::on_restart()
3342
{
3443
dout(10) << "called " << dendl;
3544
last_beacon.clear();
3645
last_tick = ceph::coarse_mono_clock::now();
46+
cleanup_pending_map();
3747
synchronize_last_beacon();
3848
}
3949

@@ -168,6 +178,11 @@ void NVMeofGwMon::restore_pending_map_info(NVMeofGwMap & tmp_map) {
168178
NvmeGwMonStates& gw_created_map = created_map_pair.second;
169179
for (auto& gw_created_pair: gw_created_map) {
170180
auto gw_id = gw_created_pair.first;
181+
auto& pending_gws_states = pending_map.created_gws[group_key];
182+
auto gw_state = pending_gws_states.find(gw_id);
183+
if (gw_state == pending_gws_states.end()) {
184+
continue;
185+
}
171186
if (gw_created_pair.second.allow_failovers_ts > now) {
172187
// restore not persistent information upon new epochs
173188
dout(10) << " restore skip-failovers timeout for gw " << gw_id << dendl;

src/mon/NVMeofGwMon.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ class NVMeofGwMon: public PaxosService,
9999
epoch_t get_ack_map_epoch(bool gw_created, const NvmeGroupKey& group_key);
100100
void recreate_gw_epoch();
101101
void restore_pending_map_info(NVMeofGwMap & tmp_map);
102+
void cleanup_pending_map();
102103
};
103104

104105
#endif /* MON_NVMEGWMONITOR_H_ */

0 commit comments

Comments
 (0)