From 0bdeb861f48b4bed269e80d9211c0ce854465a4a Mon Sep 17 00:00:00 2001 From: antirez Date: Tue, 24 Jul 2018 17:31:39 +0200 Subject: [PATCH] Example the magic +1 in migrateCommand(). Related to #5154. --- src/cluster.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/cluster.c b/src/cluster.c index 19688d59..8b76d9ad 100644 --- a/src/cluster.c +++ b/src/cluster.c @@ -5226,6 +5226,10 @@ try_again: int socket_error = 0; int del_idx = 1; /* Index of the key argument for the replicated DEL op. */ + /* Allocate the new argument vector that will replace the current command, + * to propagate the MIGRATE as a DEL command (if no COPY option was given). + * We allocate num_keys+1 because the additional argument is for "DEL" + * command name itself. */ if (!copy) newargv = zmalloc(sizeof(robj*)*(num_keys+1)); for (j = 0; j < num_keys-expired; j++) {