Commit 2a9c77a2 authored by Vitaly Arbuzov's avatar Vitaly Arbuzov
Browse files

Aof write SELECT outside of dict loop

parent 2ed31392
......@@ -2237,6 +2237,9 @@ int rewriteAppendOnlyFileRio(rio *aof) {
for (j = 0; j < server.dbnum; j++) {
char selectcmd[] = "*2\r\n$6\r\nSELECT\r\n";
/* SELECT the new DB */
if (rioWrite(aof, selectcmd, sizeof(selectcmd) - 1) == 0) goto werr;
if (rioWriteBulkLongLong(aof, j) == 0) goto werr;
redisDb *db = server.db + j;
dict *d;
dbIterator dbit;
......@@ -2244,11 +2247,6 @@ int rewriteAppendOnlyFileRio(rio *aof) {
while ((d = dbNextDict(&dbit))) {
if (dictSize(d) == 0) continue;
di = dictGetSafeIterator(d);
/* SELECT the new DB */
if (rioWrite(aof, selectcmd, sizeof(selectcmd) - 1) == 0) goto werr;
if (rioWriteBulkLongLong(aof, j) == 0) goto werr;
/* Iterate this DB writing every entry */
while ((de = dictNext(di)) != NULL) {
sds keystr;
......
......@@ -448,7 +448,7 @@ static int scriptVerifyClusterState(scriptRunCtx *run_ctx, client *c, client *or
* that weren't pre-declared. */
if (hashslot != -1) {
if (run_ctx->flags & SCRIPT_ALLOW_CROSS_SLOT) {
original_c->db->command_slot = -1; /* Clear command slot for multislot scripts because script may access keys from differen slots. */
original_c->db->command_slot = -1; /* Clear command slot for multislot scripts because script may access keys from different slots. */
} else {
if (original_c->slot == -1) {
original_c->slot = hashslot;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment