summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2018-08-01 18:53:06 +0200
committerantirez <antirez@gmail.com>2018-08-01 18:53:09 +0200
commit12ff0c0d79ce673a5e83c8cbff1cdbf773baf800 (patch)
treebc4d4589c01838c7ca84f9d7cd71cb29df16e5a5
parente3e94ec35cce5acf80d429241b4bbc3fedfa8276 (diff)
downloadredis-12ff0c0d79ce673a5e83c8cbff1cdbf773baf800.tar.gz
Explain what's the point of zslUpdateScore() in top comment.
-rw-r--r--src/t_zset.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/t_zset.c b/src/t_zset.c
index 91fe01d76..16ec715e8 100644
--- a/src/t_zset.c
+++ b/src/t_zset.c
@@ -249,6 +249,11 @@ int zslDelete(zskiplist *zsl, double score, sds ele, zskiplistNode **node) {
* This function does not update the score in the hash table side, the
* caller should take care of it.
*
+ * Note that this function attempts to just update the node, in case after
+ * the score update, the node would be exactly at the same position.
+ * Otherwise the skiplist is modified by removing and re-adding a new
+ * element, which is more costly.
+ *
* The function returns the updated element skiplist node pointer. */
zskiplistNode *zslUpdateScore(zskiplist *zsl, double curscore, sds ele, double newscore) {
zskiplistNode *update[ZSKIPLIST_MAXLEVEL], *x;