Skip to content

Commit ca58745

Browse files
Merge pull request ceph#63883 from leonidc/fix_upgrade_gw_lost
nvmeofgw: fix sending acks during upgrade
2 parents 40b43b9 + 3042c36 commit ca58745

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

src/mon/NVMeofGwMap.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,11 @@ void NVMeofGwMap::set_addr_vect(const NvmeGwId &gw_id,
286286
void NVMeofGwMap::increment_gw_epoch(const NvmeGroupKey& group_key)
287287
{
288288
if (HAVE_FEATURE(mon->get_quorum_con_features(), NVMEOFHAMAP)) {
289+
if (gw_epoch.find(group_key) == gw_epoch.end()) {
290+
gw_epoch[group_key] = epoch;
291+
dout(4) << "recreated GW epoch of " << group_key
292+
<< " " << gw_epoch[group_key] << dendl;
293+
}
289294
gw_epoch[group_key] ++;
290295
dout(4) << "incremented epoch of " << group_key
291296
<< " " << gw_epoch[group_key] << dendl;

src/mon/NVMeofGwMon.cc

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@ version_t NVMeofGwMon::get_trim_to() const
158158
* function called during new paxos epochs
159159
* function called to restore in pending map all data that is not serialized
160160
* to paxos peons. Othervise it would be overriden in "pending_map = map"
161-
* currently "allow_failovers_ts" and "last_gw_down_ts" variables restored
161+
* currently "allow_failovers_ts", "last_gw_down_ts",
162+
* "last_gw_map_epoch_valid" variables are restored
162163
*/
163164
void NVMeofGwMon::restore_pending_map_info(NVMeofGwMap & tmp_map) {
164165
std::chrono::system_clock::time_point now = std::chrono::system_clock::now();
@@ -175,6 +176,8 @@ void NVMeofGwMon::restore_pending_map_info(NVMeofGwMap & tmp_map) {
175176
}
176177
pending_map.created_gws[group_key][gw_id].last_gw_down_ts =
177178
gw_created_pair.second.last_gw_down_ts;
179+
pending_map.created_gws[group_key][gw_id].last_gw_map_epoch_valid =
180+
gw_created_pair.second.last_gw_map_epoch_valid;
178181
}
179182
}
180183
}
@@ -804,12 +807,13 @@ bool NVMeofGwMon::prepare_beacon(MonOpRequestRef op)
804807
send_ack = true;
805808
if (apply_ack_logic) {
806809
dout(20) << "ack sent: beacon index "
807-
<< pending_map.created_gws[group_key][gw_id].beacon_index
808-
<< " gw " << gw_id <<dendl;
810+
<< pending_map.created_gws[group_key][gw_id].beacon_index
811+
<< " gw " << gw_id << " epoch-filter " << epoch_filter_enabled
812+
<< " propose " << propose << " gw-propose " << gw_propose << dendl;
809813
}
810814
}
811815
if (send_ack && ((!gw_propose && epoch_filter_enabled) ||
812-
(propose && !epoch_filter_enabled) ||
816+
(!propose && !epoch_filter_enabled) ||
813817
(avail == gw_availability_t::GW_CREATED)) ) {
814818
/* always send beacon ack to gw in Created state,
815819
* it should be temporary state

0 commit comments

Comments
 (0)