Skip to content

Commit

Permalink
rename variable
Browse files Browse the repository at this point in the history
  • Loading branch information
soloestoy committed Nov 28, 2023
1 parent 8ddd32a commit 465c0a3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/evict.c
Original file line number Diff line number Diff line change
Expand Up @@ -591,16 +591,16 @@ int performEvictions(void) {
DB_MAIN : DB_EXPIRES);

while (bestkey == NULL) {
unsigned long total_keys = 0, keys;
unsigned long total_keys = 0, current_db_keys;

/* We don't want to make local-db choices when expiring keys,
* so to start populate the eviction pool sampling keys from
* every DB. */
for (i = 0; i < server.dbnum; i++) {
db = server.db+i;
if ((keys = dbSize(db, keyType)) == 0) continue;
if ((current_db_keys = dbSize(db, keyType)) == 0) continue;

total_keys += keys;
total_keys += current_db_keys;
unsigned long sampled_keys = 0;
do {
int slot = getFairRandomSlot(db, keyType);
Expand All @@ -614,7 +614,7 @@ int performEvictions(void) {
*
* To avoid the situation where the number of keys in a single slot
* in cluster mode is too low to meet the sampling requirements. */
} while (keys > (unsigned long) server.maxmemory_samples*10 &&
} while (current_db_keys > (unsigned long) server.maxmemory_samples*10 &&
sampled_keys < (unsigned long) server.maxmemory_samples);
}
if (!total_keys) break; /* No keys to evict. */
Expand Down

0 comments on commit 465c0a3

Please sign in to comment.