1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-10 01:18:15 +03:00

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>
This commit is contained in:
Martin Schwenke 2020-05-14 20:25:22 +10:00 committed by Amitay Isaacs
parent f9f60c2a60
commit 1ab39b3270

View File

@ -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;
}