aports/main/nginx/nchan~dont-fail-redis-cluster-before-consensus.patch
Jakub Jirutka f3dbbda9f6 main/nginx: backport bugfixes for multiple third-party modules
The most important are bugfixes for http-shibboleth (segfault)
and http-lua (probably segfault too).
2023-05-26 14:23:20 +00:00

50 lines
2.1 KiB
Diff

Patch-Source: https://github.com/slact/nchan/commit/ed27e02adcac66ce73f5db387596fa063362ac6e
--
From ed27e02adcac66ce73f5db387596fa063362ac6e Mon Sep 17 00:00:00 2001
From: Fabio Urquiza <fabiorush@gmail.com>
Date: Wed, 1 Feb 2023 14:48:47 +0000
Subject: [PATCH] Don't fail redis cluster nodes before consensus is reached
diff --git a/src/store/redis/redis_nodeset.c b/src/store/redis/redis_nodeset.c
index 39fdd396..2c4646c4 100644
--- a/src/store/redis/redis_nodeset.c
+++ b/src/store/redis/redis_nodeset.c
@@ -1052,6 +1052,9 @@ static void nodeset_cluster_check_event_callback(redisAsyncContext *ac, void *re
for(i=0; i<n; i++) {
l = &lines[i];
+ if(l->maybe_failed) {
+ nodeset_log_warning(ns, "Ignoring 'fail?' state reported by %V:%d for node %V", &node->connect_params.hostname, node->connect_params.port, &l->address);
+ }
if(l->failed && nodeset_node_remove_failed(ns, &l->id)) {
failed_nodes++;
continue;
diff --git a/src/store/redis/redis_nodeset_parser.c b/src/store/redis/redis_nodeset_parser.c
index 7ce0037b..e3052dc2 100644
--- a/src/store/redis/redis_nodeset_parser.c
+++ b/src/store/redis/redis_nodeset_parser.c
@@ -132,7 +132,10 @@ static char *nodeset_parser_scan_cluster_nodes_line(const char *line, cluster_no
l->slot_ranges_count = 0;
l->master = 0;
}
- l->failed = nchan_ngx_str_substr((&l->flags), "fail");
+ l->maybe_failed = nchan_ngx_str_substr((&l->flags), "fail?");
+ if(!l->maybe_failed)
+ l->failed = nchan_ngx_str_substr((&l->flags), "fail");
+
l->self = nchan_ngx_str_substr((&l->flags), "myself");
l->noaddr = nchan_ngx_str_substr((&l->flags), "noaddr");
l->handshake = nchan_ngx_str_substr((&l->flags), "handshake");
diff --git a/src/store/redis/redis_nodeset_parser.h b/src/store/redis/redis_nodeset_parser.h
index 5d564b62..a14ae146 100644
--- a/src/store/redis/redis_nodeset_parser.h
+++ b/src/store/redis/redis_nodeset_parser.h
@@ -28,6 +28,7 @@ typedef struct {
unsigned master:1;
unsigned noaddr:1;
unsigned failed:1;
+ unsigned maybe_failed:1;
unsigned handshake:1;
unsigned self:1;
} cluster_nodes_line_t;