mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-22 08:08:53 -05:00
Cluster: new command flag forcing implicit ASKING.
Also using this new flag the RESTORE-ASKING command was implemented that will be used by MIGRATE.
This commit is contained in:
parent
9ec1b709f5
commit
ea7fc82a4a
@ -2007,7 +2007,7 @@ clusterNode *getNodeByQuery(redisClient *c, struct redisCommand *cmd, robj **arg
|
||||
* it is assigned to a different node, but only if the client
|
||||
* issued an ASKING command before. */
|
||||
if (server.cluster->importing_slots_from[slot] != NULL &&
|
||||
c->flags & REDIS_ASKING) {
|
||||
(c->flags & REDIS_ASKING || cmd->flags & REDIS_CMD_ASKING)) {
|
||||
return server.cluster->myself;
|
||||
}
|
||||
/* It's not a -ASK case. Base case: just return the right node. */
|
||||
|
@ -111,6 +111,8 @@ struct redisCommand *commandTable;
|
||||
* server this data. Normally no command is accepted in this condition
|
||||
* but just a few.
|
||||
* M: Do not automatically propagate the command on MONITOR.
|
||||
* k: Perform an implicit ASKING for this command, so the command will be
|
||||
* accepted in cluster mode if the slot is marked as 'importing'.
|
||||
*/
|
||||
struct redisCommand redisCommandTable[] = {
|
||||
{"get",getCommand,2,"r",0,NULL,1,1,1,0,0},
|
||||
@ -242,6 +244,7 @@ struct redisCommand redisCommandTable[] = {
|
||||
{"unwatch",unwatchCommand,1,"rs",0,NULL,0,0,0,0,0},
|
||||
{"cluster",clusterCommand,-2,"ar",0,NULL,0,0,0,0,0},
|
||||
{"restore",restoreCommand,-4,"awm",0,NULL,1,1,1,0,0},
|
||||
{"restore-asking",restoreCommand,-4,"awmk",0,NULL,1,1,1,0,0},
|
||||
{"migrate",migrateCommand,-6,"aw",0,NULL,0,0,0,0,0},
|
||||
{"asking",askingCommand,1,"r",0,NULL,0,0,0,0,0},
|
||||
{"dump",dumpCommand,2,"ar",0,NULL,1,1,1,0,0},
|
||||
@ -1453,6 +1456,7 @@ void populateCommandTable(void) {
|
||||
case 'l': c->flags |= REDIS_CMD_LOADING; break;
|
||||
case 't': c->flags |= REDIS_CMD_STALE; break;
|
||||
case 'M': c->flags |= REDIS_CMD_SKIP_MONITOR; break;
|
||||
case 'k': c->flags |= REDIS_CMD_ASKING; break;
|
||||
default: redisPanic("Unsupported command flag"); break;
|
||||
}
|
||||
f++;
|
||||
|
@ -122,6 +122,7 @@
|
||||
#define REDIS_CMD_LOADING 512 /* "l" flag */
|
||||
#define REDIS_CMD_STALE 1024 /* "t" flag */
|
||||
#define REDIS_CMD_SKIP_MONITOR 2048 /* "M" flag */
|
||||
#define REDIS_CMD_ASKING 4096 /* "k" flag */
|
||||
|
||||
/* Object types */
|
||||
#define REDIS_STRING 0
|
||||
|
Loading…
Reference in New Issue
Block a user