"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/multi.c" between
redis-6.2.4.tar.gz and redis-6.2.5.tar.gz

About: redis is an advanced key-value store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets and sorted sets.

multi.c  (redis-6.2.4):multi.c  (redis-6.2.5)
skipping to change at line 171 skipping to change at line 171
robj **orig_argv; robj **orig_argv;
int orig_argc; int orig_argc;
struct redisCommand *orig_cmd; struct redisCommand *orig_cmd;
int was_master = server.masterhost == NULL; int was_master = server.masterhost == NULL;
if (!(c->flags & CLIENT_MULTI)) { if (!(c->flags & CLIENT_MULTI)) {
addReplyError(c,"EXEC without MULTI"); addReplyError(c,"EXEC without MULTI");
return; return;
} }
/* EXEC with expired watched key is disallowed*/
if (isWatchedKeyExpired(c)) {
c->flags |= (CLIENT_DIRTY_CAS);
}
/* Check if we need to abort the EXEC because: /* Check if we need to abort the EXEC because:
* 1) Some WATCHed key was touched. * 1) Some WATCHed key was touched.
* 2) There was a previous error while queueing commands. * 2) There was a previous error while queueing commands.
* A failed EXEC in the first case returns a multi bulk nil object * A failed EXEC in the first case returns a multi bulk nil object
* (technically it is not an error but a special behavior), while * (technically it is not an error but a special behavior), while
* in the second an EXECABORT error is returned. */ * in the second an EXECABORT error is returned. */
if (c->flags & (CLIENT_DIRTY_CAS|CLIENT_DIRTY_EXEC)) { if (c->flags & (CLIENT_DIRTY_CAS|CLIENT_DIRTY_EXEC)) {
addReply(c, c->flags & CLIENT_DIRTY_EXEC ? shared.execaborterr : addReply(c, c->flags & CLIENT_DIRTY_EXEC ? shared.execaborterr :
shared.nullarray[c->resp]); shared.nullarray[c->resp]);
discardTransaction(c); discardTransaction(c);
skipping to change at line 345 skipping to change at line 350
/* Kill the entry at all if this was the only client */ /* Kill the entry at all if this was the only client */
if (listLength(clients) == 0) if (listLength(clients) == 0)
dictDelete(wk->db->watched_keys, wk->key); dictDelete(wk->db->watched_keys, wk->key);
/* Remove this watched key from the client->watched list */ /* Remove this watched key from the client->watched list */
listDelNode(c->watched_keys,ln); listDelNode(c->watched_keys,ln);
decrRefCount(wk->key); decrRefCount(wk->key);
zfree(wk); zfree(wk);
} }
} }
/* iterates over the watched_keys list and
* look for an expired key . */
int isWatchedKeyExpired(client *c) {
listIter li;
listNode *ln;
watchedKey *wk;
if (listLength(c->watched_keys) == 0) return 0;
listRewind(c->watched_keys,&li);
while ((ln = listNext(&li))) {
wk = listNodeValue(ln);
if (keyIsExpired(wk->db, wk->key)) return 1;
}
return 0;
}
/* "Touch" a key, so that if this key is being WATCHed by some client the /* "Touch" a key, so that if this key is being WATCHed by some client the
* next EXEC will fail. */ * next EXEC will fail. */
void touchWatchedKey(redisDb *db, robj *key) { void touchWatchedKey(redisDb *db, robj *key) {
list *clients; list *clients;
listIter li; listIter li;
listNode *ln; listNode *ln;
if (dictSize(db->watched_keys) == 0) return; if (dictSize(db->watched_keys) == 0) return;
clients = dictFetchValue(db->watched_keys, key); clients = dictFetchValue(db->watched_keys, key);
if (!clients) return; if (!clients) return;
 End of changes. 2 change blocks. 
0 lines changed or deleted 21 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)