Add appropriate comment

This commit is contained in:
Moti Cohen 2025-05-12 13:05:47 +03:00
parent 7e4a9ea07f
commit 6cf906e3ad
1 changed files with 4 additions and 1 deletions

View File

@ -946,7 +946,10 @@ void spopWithCountCommand(client *c) {
} }
setTypeReleaseIterator(si); setTypeReleaseIterator(si);
/* Assign the new set as the key value (Also update KEYSIZES histogram) */ /* Update key size histogram "explicitly" and not indirectly by dbReplaceValue()
* since function dbReplaceValue() assumes the entire set is being replaced,
* but here we're building the new set from the existing one. As a result,
* the size of the old set has already changed by the time we reach this point. */
updateKeysizesHist(c->db, getKeySlot(c->argv[1]->ptr), OBJ_SET, size, size-count); updateKeysizesHist(c->db, getKeySlot(c->argv[1]->ptr), OBJ_SET, size, size-count);
dbReplaceValue(c->db,c->argv[1],newset, 0); dbReplaceValue(c->db,c->argv[1],newset, 0);
} }