From 3ca3b8a8d8efd00d9ebe010d53024f9f41c34f2f Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Tue, 16 Jan 2024 23:49:21 +0300 Subject: [PATCH] Fix recheck_pgs bug introduced in 1.4.0 --- mon/mon.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/mon/mon.js b/mon/mon.js index 56e6a573..0e852c30 100644 --- a/mon/mon.js +++ b/mon/mon.js @@ -1414,7 +1414,14 @@ class Mon } if (changed) { - await this.save_pg_config(new_config_pgs); + const ok = await this.save_pg_config(new_config_pgs); + if (ok) + console.log('PG configuration successfully changed'); + else + { + console.log('Someone changed PG configuration while we also tried to change it. Retrying in '+this.config.mon_change_timeout+' ms'); + this.schedule_recheck(); + } } } this.recheck_pgs_active = false; @@ -1495,6 +1502,11 @@ class Mon this.save_new_pgs_txn(new_config_pgs, etcd_request, pool_id, up_osds, osd_tree, real_prev_pgs, pool_res.pgs, pg_history); } new_config_pgs.hash = tree_hash; + return await this.save_pg_config(new_config_pgs, etcd_request); + } + + async save_pg_config(new_config_pgs, etcd_request = { compare: [], success: [] }) + { etcd_request.compare.push( { key: b64(this.etcd_prefix+'/mon/master'), target: 'LEASE', lease: ''+this.etcd_lease_id }, { key: b64(this.etcd_prefix+'/config/pgs'), target: 'MOD', mod_revision: ''+this.etcd_watch_revision, result: 'LESS' },