Delete extra /pool/stats/ keys for non-existing pools
This commit is contained in:
+12
-2
@@ -1608,7 +1608,7 @@ class Mon
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return inode_stats;
|
return { inode_stats, seen_pools };
|
||||||
}
|
}
|
||||||
|
|
||||||
serialize_bigints(obj)
|
serialize_bigints(obj)
|
||||||
@@ -1634,7 +1634,7 @@ class Mon
|
|||||||
const timestamp = Date.now();
|
const timestamp = Date.now();
|
||||||
const { object_counts, object_bytes } = this.sum_object_counts();
|
const { object_counts, object_bytes } = this.sum_object_counts();
|
||||||
let stats = this.sum_op_stats(timestamp, this.prev_stats);
|
let stats = this.sum_op_stats(timestamp, this.prev_stats);
|
||||||
let inode_stats = this.sum_inode_stats(
|
let { inode_stats, seen_pools } = this.sum_inode_stats(
|
||||||
this.prev_stats ? this.prev_stats.inode_stats : null,
|
this.prev_stats ? this.prev_stats.inode_stats : null,
|
||||||
timestamp, this.prev_stats ? this.prev_stats.timestamp : null
|
timestamp, this.prev_stats ? this.prev_stats.timestamp : null
|
||||||
);
|
);
|
||||||
@@ -1668,6 +1668,15 @@ class Mon
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (const pool_id in this.state.pool.stats)
|
for (const pool_id in this.state.pool.stats)
|
||||||
|
{
|
||||||
|
if (!seen_pools[pool_id])
|
||||||
|
{
|
||||||
|
txn.push({ requestDeleteRange: {
|
||||||
|
key: b64(this.etcd_prefix+'/pool/stats/'+pool_id),
|
||||||
|
} });
|
||||||
|
delete this.state.pool.stats[pool_id];
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
const pool_stats = { ...this.state.pool.stats[pool_id] };
|
const pool_stats = { ...this.state.pool.stats[pool_id] };
|
||||||
this.serialize_bigints(pool_stats);
|
this.serialize_bigints(pool_stats);
|
||||||
@@ -1676,6 +1685,7 @@ class Mon
|
|||||||
value: b64(JSON.stringify(pool_stats)),
|
value: b64(JSON.stringify(pool_stats)),
|
||||||
} });
|
} });
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (txn.length)
|
if (txn.length)
|
||||||
{
|
{
|
||||||
await this.etcd_call('/kv/txn', { success: txn }, this.config.etcd_mon_timeout, 0);
|
await this.etcd_call('/kv/txn', { success: txn }, this.config.etcd_mon_timeout, 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user