mirror of
https://github.com/fluencelabs/redis
synced 2025-06-15 02:01:21 +00:00
Add module API for AvoidReplicaTraffic
This is useful to tell redis and modules to try to avoid doing things that may increment the replication offset, and should be used when draining a master and waiting for replicas to be in perfect sync before a failover.
This commit is contained in:
@ -1880,6 +1880,14 @@ int RM_GetContextFlags(RedisModuleCtx *ctx) {
|
||||
return flags;
|
||||
}
|
||||
|
||||
/* Returns true when the module should avoid actions that cause traffic to replicas.
|
||||
* This is required during manual failover when waiting for the replica
|
||||
* to be in perfect sync with the master. Modules doing background operations
|
||||
* which are not a result of user traffic should check this flag periodically. */
|
||||
int RM_AvoidReplicaTraffic() {
|
||||
return clientsArePaused();
|
||||
}
|
||||
|
||||
/* Change the currently selected DB. Returns an error if the id
|
||||
* is out of range.
|
||||
*
|
||||
@ -7392,6 +7400,7 @@ void moduleRegisterCoreAPI(void) {
|
||||
REGISTER_API(KeyAtPos);
|
||||
REGISTER_API(GetClientId);
|
||||
REGISTER_API(GetContextFlags);
|
||||
REGISTER_API(AvoidReplicaTraffic);
|
||||
REGISTER_API(PoolAlloc);
|
||||
REGISTER_API(CreateDataType);
|
||||
REGISTER_API(ModuleTypeSetValue);
|
||||
|
Reference in New Issue
Block a user