mirror of
http://github.com/valkey-io/valkey
synced 2024-11-22 09:17:20 +00:00
Make replica CLUSTER RESET flush async based on lazyfree-lazy-user-flush (#1190)
Currently, if the replica has a lot of data, CLUSTER RESET will block for a while and report the slowlog, and it seems that there is no harm in making it async so external components can be easier when monitoring it. Signed-off-by: Binbin <binloveplay1314@qq.com> Co-authored-by: Ping Xie <pingxie@outlook.com>
This commit is contained in:
parent
285064b114
commit
5d70ccd70e
@ -1230,7 +1230,7 @@ void clusterReset(int hard) {
|
|||||||
if (nodeIsReplica(myself)) {
|
if (nodeIsReplica(myself)) {
|
||||||
clusterSetNodeAsPrimary(myself);
|
clusterSetNodeAsPrimary(myself);
|
||||||
replicationUnsetPrimary();
|
replicationUnsetPrimary();
|
||||||
emptyData(-1, EMPTYDB_NO_FLAGS, NULL);
|
emptyData(-1, server.lazyfree_lazy_user_flush ? EMPTYDB_ASYNC : EMPTYDB_NO_FLAGS, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Close slots, reset manual failover state. */
|
/* Close slots, reset manual failover state. */
|
||||||
|
@ -1308,7 +1308,11 @@ lazyfree-lazy-user-del yes
|
|||||||
# deletion, which can be controlled by passing the [SYNC|ASYNC] flags into the
|
# deletion, which can be controlled by passing the [SYNC|ASYNC] flags into the
|
||||||
# commands. When neither flag is passed, this directive will be used to determine
|
# commands. When neither flag is passed, this directive will be used to determine
|
||||||
# if the data should be deleted asynchronously.
|
# if the data should be deleted asynchronously.
|
||||||
|
#
|
||||||
|
# When a replica performs a node reset via CLUSTER RESET, the entire
|
||||||
|
# database content is removed to allow the node to become an empty primary.
|
||||||
|
# This directive also determines whether the data should be deleted asynchronously.
|
||||||
|
#
|
||||||
# There are many problems with running flush synchronously. Even in single CPU
|
# There are many problems with running flush synchronously. Even in single CPU
|
||||||
# environments, the thread managers should balance between the freeing and
|
# environments, the thread managers should balance between the freeing and
|
||||||
# serving incoming requests. The default value is yes.
|
# serving incoming requests. The default value is yes.
|
||||||
|
Loading…
Reference in New Issue
Block a user