Skip to content

Commit 790be2d

Browse files
authored
Merge pull request ceph#61091 from leonidc/wip-leonidc_publish_rebalance_index
nvmeofgw* : fix publishing rebalance index
2 parents 4b6a1eb + ceb62c0 commit 790be2d

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

src/mon/NVMeofGwMon.cc

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,6 @@ void NVMeofGwMon::on_shutdown()
6666

6767
void NVMeofGwMon::tick()
6868
{
69-
if (++tick_ratio == 10) {
70-
global_rebalance_index++;
71-
dout(20) << "rebalance index " << global_rebalance_index << dendl;
72-
tick_ratio = 0;
73-
}
7469
if (!is_active() || !mon.is_leader()) {
7570
dout(10) << "NVMeofGwMon leader : " << mon.is_leader()
7671
<< "active : " << is_active() << dendl;
@@ -329,8 +324,9 @@ bool NVMeofGwMon::preprocess_command(MonOpRequestRef op)
329324
if (HAVE_FEATURE(mon.get_quorum_con_features(), NVMEOFHA)) {
330325
f->dump_string("features", "LB");
331326
if (map.created_gws[group_key].size()) {
332-
uint32_t index = (global_rebalance_index %
333-
map.created_gws[group_key].size()) + 1;
327+
time_t seconds_since_1970 = time(NULL);
328+
uint32_t index = ((seconds_since_1970/60) %
329+
map.created_gws[group_key].size()) + 1;
334330
f->dump_unsigned("rebalance_ana_group", index);
335331
}
336332
}

src/mon/NVMeofGwMon.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,6 @@ class NVMeofGwMon: public PaxosService,
8383
void check_sub(Subscription *sub);
8484

8585
private:
86-
// used for calculate pool & group GW responsible for rebalance
87-
uint32_t global_rebalance_index = 1;
88-
uint8_t tick_ratio = 0;
8986
void synchronize_last_beacon();
9087
void process_gw_down(const NvmeGwId &gw_id,
9188
const NvmeGroupKey& group_key, bool &propose_pending,

0 commit comments

Comments
 (0)