mirror of
https://github.com/fluencelabs/redis
synced 2025-03-30 22:31:03 +00:00
Module cluster flags: add hooks for NO_REDIRECTION flag.
This commit is contained in:
parent
744fe7f348
commit
c202ba2b35
@ -1589,6 +1589,12 @@ void clusterUpdateSlotsConfigWith(clusterNode *sender, uint64_t senderConfigEpoc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* After updating the slots configuration, don't do any actual change
|
||||||
|
* in the state of the server if a module disabled Redis Cluster
|
||||||
|
* keys redirections. */
|
||||||
|
if (server.cluster_module_flags & CLUSTER_MODULE_FLAG_NO_REDIRECTION)
|
||||||
|
return;
|
||||||
|
|
||||||
/* If at least one slot was reassigned from a node to another node
|
/* If at least one slot was reassigned from a node to another node
|
||||||
* with a greater configEpoch, it is possible that:
|
* with a greater configEpoch, it is possible that:
|
||||||
* 1) We are a master left without slots. This means that we were
|
* 1) We are a master left without slots. This means that we were
|
||||||
@ -5435,6 +5441,10 @@ clusterNode *getNodeByQuery(client *c, struct redisCommand *cmd, robj **argv, in
|
|||||||
multiCmd mc;
|
multiCmd mc;
|
||||||
int i, slot = 0, migrating_slot = 0, importing_slot = 0, missing_keys = 0;
|
int i, slot = 0, migrating_slot = 0, importing_slot = 0, missing_keys = 0;
|
||||||
|
|
||||||
|
/* Allow any key to be set if a module disabled cluster redirections. */
|
||||||
|
if (server.cluster_module_flags & CLUSTER_MODULE_FLAG_NO_REDIRECTION)
|
||||||
|
return myself;
|
||||||
|
|
||||||
/* Set error code optimistically for the base case. */
|
/* Set error code optimistically for the base case. */
|
||||||
if (error_code) *error_code = CLUSTER_REDIR_NONE;
|
if (error_code) *error_code = CLUSTER_REDIR_NONE;
|
||||||
|
|
||||||
|
@ -103,9 +103,9 @@ typedef struct clusterLink {
|
|||||||
/* Flags that a module can set in order to prevent certain Redis Cluster
|
/* Flags that a module can set in order to prevent certain Redis Cluster
|
||||||
* features to be enabled. Useful when implementing a different distributed
|
* features to be enabled. Useful when implementing a different distributed
|
||||||
* system on top of Redis Cluster message bus, using modules. */
|
* system on top of Redis Cluster message bus, using modules. */
|
||||||
#define MODULE_CLUSTER_FLAG_NONE 0
|
#define CLUSTER_MODULE_FLAG_NONE 0
|
||||||
#define MODULE_CLUSTER_FLAG_NO_FAILOVER (1<<1)
|
#define CLUSTER_MODULE_FLAG_NO_FAILOVER (1<<1)
|
||||||
#define MODULE_CLUSTER_FLAG_NO_REDIRECTION (1<<2)
|
#define CLUSTER_MODULE_FLAG_NO_REDIRECTION (1<<2)
|
||||||
|
|
||||||
/* This structure represent elements of node->fail_reports. */
|
/* This structure represent elements of node->fail_reports. */
|
||||||
typedef struct clusterNodeFailReport {
|
typedef struct clusterNodeFailReport {
|
||||||
|
@ -1621,7 +1621,7 @@ void initServerConfig(void) {
|
|||||||
server.cluster_announce_ip = CONFIG_DEFAULT_CLUSTER_ANNOUNCE_IP;
|
server.cluster_announce_ip = CONFIG_DEFAULT_CLUSTER_ANNOUNCE_IP;
|
||||||
server.cluster_announce_port = CONFIG_DEFAULT_CLUSTER_ANNOUNCE_PORT;
|
server.cluster_announce_port = CONFIG_DEFAULT_CLUSTER_ANNOUNCE_PORT;
|
||||||
server.cluster_announce_bus_port = CONFIG_DEFAULT_CLUSTER_ANNOUNCE_BUS_PORT;
|
server.cluster_announce_bus_port = CONFIG_DEFAULT_CLUSTER_ANNOUNCE_BUS_PORT;
|
||||||
server.cluster_module_flags = MODULE_CLUSTER_FLAG_NONE;
|
server.cluster_module_flags = CLUSTER_MODULE_FLAG_NONE;
|
||||||
server.migrate_cached_sockets = dictCreate(&migrateCacheDictType,NULL);
|
server.migrate_cached_sockets = dictCreate(&migrateCacheDictType,NULL);
|
||||||
server.next_client_id = 1; /* Client IDs, start from 1 .*/
|
server.next_client_id = 1; /* Client IDs, start from 1 .*/
|
||||||
server.loading_process_events_interval_bytes = (1024*1024*2);
|
server.loading_process_events_interval_bytes = (1024*1024*2);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user