diff options
author | Martin Schwenke <martin@meltin.net> | 2020-05-14 20:25:22 +1000 |
---|---|---|
committer | Amitay Isaacs <amitay@samba.org> | 2020-05-22 06:41:44 +0000 |
commit | 1ab39b3270ea34a1953e79d63f3f6d9e04983898 (patch) | |
tree | adb962d363b8eccdd3d2437300bab17e51616318 /ctdb | |
parent | f9f60c2a60464e8773663848572ec9ec08be0ee5 (diff) | |
download | samba-1ab39b3270ea34a1953e79d63f3f6d9e04983898.tar.gz |
ctdb-daemon: Fix bug in slot 0 comparison optimisation
This is only valid if all slots are in use.
Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
Diffstat (limited to 'ctdb')
-rw-r--r-- | ctdb/server/ctdb_call.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/ctdb/server/ctdb_call.c b/ctdb/server/ctdb_call.c index 4a894217ce8..e33bb07fe82 100644 --- a/ctdb/server/ctdb_call.c +++ b/ctdb/server/ctdb_call.c @@ -827,8 +827,13 @@ ctdb_update_db_stat_hot_keys(struct ctdb_db_context *ctdb_db, TDB_DATA key, unsigned int i, id; char *keystr; - /* smallest value is always at index 0 */ - if (count <= ctdb_db->hot_keys[0].count) { + /* + * If all slots are being used then only need to compare + * against the count in the 0th slot, since it contains the + * smallest count. + */ + if (ctdb_db->statistics.num_hot_keys == MAX_HOT_KEYS && + count <= ctdb_db->hot_keys[0].count) { return; } |