From 6f46080ecaf12ea9330af14f7f39358a88e87e08 Mon Sep 17 00:00:00 2001 From: Leo Ponomarev Date: Tue, 17 May 2022 15:32:43 -0400 Subject: [PATCH] cluster checks are now unconditional and have exponential backoff. previously they ran at a fixed interval only when there were no commands that could generate a MOVE/ASK error. That wasn't good enough for detecting newly added slaves --- src/nchan_commands.rb | 53 +++++++++--- src/nchan_config_commands.c | 65 ++++++++++++--- src/nchan_defs.h | 5 ++ src/nchan_setup.c | 25 ++++-- src/nchan_types.h | 2 +- src/store/redis/redis_nodeset.c | 143 ++++++++++++++++++-------------- src/store/redis/redis_nodeset.h | 4 +- src/store/redis/store.h | 1 - 8 files changed, 205 insertions(+), 93 deletions(-) diff --git a/src/nchan_commands.rb b/src/nchan_commands.rb index a6d6c05d9..fa9ebecec 100644 --- a/src/nchan_commands.rb +++ b/src/nchan_commands.rb @@ -593,15 +593,6 @@ default: "4m", info: "Send a keepalive command to redis to keep the Nchan redis clients from disconnecting. Set to 0 to disable." - nchan_redis_cluster_check_interval [:main, :srv, :upstream, :loc], - :ngx_conf_set_sec_slot, - [:loc_conf, :"redis.cluster_check_interval"], - - group: "storage", - tags: ['redis'], - default: "5s", - info: "Send a CLUSTER INFO command to each connected Redis node to see if the cluster config epoch has changed. Sent only when in Cluster mode and if any other command that may result in a MOVE error has not been sent in the configured time." - nchan_redis_load_scripts_unconditionally [:upstream], :ngx_conf_set_flag_slot, [:srv_conf, "redis.load_scripts_unconditionally"], @@ -677,7 +668,7 @@ default: "0.5 (increase delay by 50% each try)", info: "Add an exponentially increasing delay to Redis connection retries. `Delay[n] = (Delay[n-1] + jitter) * (nchan_redis_reconnect_delay_backoff + 1)`." - nchan_redis_reconnect_delay_max [:upstream], + nchan_redis_reconnect_delay_max [:upstream], :ngx_conf_set_msec_slot, [:srv_conf, :"redis.reconnect_delay.max"], @@ -687,6 +678,48 @@ value: "