diff options
author | Salvatore Sanfilippo <antirez@gmail.com> | 2018-08-26 16:31:24 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-26 16:31:24 +0200 |
commit | 19880ab85166165e65a9e2713d244bb31c7573f5 (patch) | |
tree | 0418e063d3a241f697ea40a2e246b45c083f0c4c | |
parent | 80e16956529ba0999cfe30a171693c8f3d3a4098 (diff) | |
parent | 9a65f9cd3e09468c0178782bfac0fe1c8f445a20 (diff) | |
download | redis-19880ab85166165e65a9e2713d244bb31c7573f5.tar.gz |
Merge pull request #5248 from soloestoy/rewrite-brpoplpush
rewrite BRPOPLPUSH as RPOPLPUSH to propagate
-rw-r--r-- | src/blocked.c | 4 | ||||
-rw-r--r-- | src/server.c | 1 | ||||
-rw-r--r-- | src/server.h | 2 | ||||
-rw-r--r-- | src/t_list.c | 3 |
4 files changed, 7 insertions, 3 deletions
diff --git a/src/blocked.c b/src/blocked.c index 4a667501f..35c33d1cc 100644 --- a/src/blocked.c +++ b/src/blocked.c @@ -269,7 +269,7 @@ void handleClientsBlockedOnKeys(void) { robj *dstkey = receiver->bpop.target; int where = (receiver->lastcmd && receiver->lastcmd->proc == blpopCommand) ? - LIST_HEAD : LIST_TAIL; + LIST_HEAD : LIST_TAIL; robj *value = listTypePop(o,where); if (value) { @@ -285,7 +285,7 @@ void handleClientsBlockedOnKeys(void) { { /* If we failed serving the client we need * to also undo the POP operation. */ - listTypePush(o,value,where); + listTypePush(o,value,where); } if (dstkey) decrRefCount(dstkey); diff --git a/src/server.c b/src/server.c index b537ee04a..cd88d3c2f 100644 --- a/src/server.c +++ b/src/server.c @@ -1491,6 +1491,7 @@ void createSharedObjects(void) { shared.rpop = createStringObject("RPOP",4); shared.lpop = createStringObject("LPOP",4); shared.lpush = createStringObject("LPUSH",5); + shared.rpoplpush = createStringObject("RPOPLPUSH",9); shared.zpopmin = createStringObject("ZPOPMIN",7); shared.zpopmax = createStringObject("ZPOPMAX",7); for (j = 0; j < OBJ_SHARED_INTEGERS; j++) { diff --git a/src/server.h b/src/server.h index ce127b587..2e1f7c9ce 100644 --- a/src/server.h +++ b/src/server.h @@ -782,7 +782,7 @@ struct sharedObjectsStruct { *masterdownerr, *roslaveerr, *execaborterr, *noautherr, *noreplicaserr, *busykeyerr, *oomerr, *plus, *messagebulk, *pmessagebulk, *subscribebulk, *unsubscribebulk, *psubscribebulk, *punsubscribebulk, *del, *unlink, - *rpop, *lpop, *lpush, *zpopmin, *zpopmax, *emptyscan, + *rpop, *lpop, *lpush, *rpoplpush, *zpopmin, *zpopmax, *emptyscan, *select[PROTO_SHARED_SELECT_CMDS], *integers[OBJ_SHARED_INTEGERS], *mbulkhdr[OBJ_SHARED_BULKHDR_LEN], /* "*<value>\r\n" */ diff --git a/src/t_list.c b/src/t_list.c index 1414ff31a..987392e6e 100644 --- a/src/t_list.c +++ b/src/t_list.c @@ -596,6 +596,9 @@ void rpoplpushCommand(client *c) { signalModifiedKey(c->db,touchedkey); decrRefCount(touchedkey); server.dirty++; + if (c->lastcmd->proc == brpoplpushCommand) { + rewriteClientCommandVector(c,3,shared.rpoplpush,c->argv[1],c->argv[2]); + } } } |