11diff --git a/src/config.c b/src/config.c
2- index d0158b2c4..f788aef6f 100644
2+ index fcbaee7e9..5c58b971f 100644
33--- a/src/config.c
44+++ b/src/config.c
5- @@ -2588 ,6 +2588 ,25 @@ static int updateExtendedRedisCompat(const char **err) {
5+ @@ -2641 ,6 +2641 ,25 @@ static int updateExtendedRedisCompat(const char **err) {
66 return 1;
77 }
88
@@ -28,16 +28,16 @@ index d0158b2c4..f788aef6f 100644
2828 static int updateSighandlerEnabled(const char **err) {
2929 UNUSED(err);
3030 if (server.crashlog_enabled)
31- @@ -3241,6 +3260,7 @@ standardConfig static_configs[] = {
32- createBoolConfig("hide-user-data-from-log", NULL, MODIFIABLE_CONFIG, server.hide_user_data_from_log, 1, NULL, NULL),
31+ @@ -3312,6 +3331,7 @@ standardConfig static_configs[] = {
3332 createBoolConfig("lua-enable-insecure-api", "lua-enable-deprecated-api", MODIFIABLE_CONFIG | HIDDEN_CONFIG | PROTECTED_CONFIG, server.lua_enable_insecure_api, 0, NULL, updateLuaEnableInsecureApi),
3433 createBoolConfig("import-mode", NULL, DEBUG_CONFIG | MODIFIABLE_CONFIG, server.import_mode, 0, NULL, NULL),
34+ createBoolConfig("io-threads-always-active", NULL, MODIFIABLE_CONFIG | HIDDEN_CONFIG, server.io_threads_always_active, 0, NULL, NULL),
3535+ createBoolConfig("repl-paused", NULL, MODIFIABLE_CONFIG, server.repl_paused, 0, NULL, updateReplPaused),
3636
3737 /* String Configs */
3838 createStringConfig("aclfile", NULL, IMMUTABLE_CONFIG, ALLOW_EMPTY_STRING, server.acl_filename, "", NULL, NULL),
3939diff --git a/src/replication.c b/src/replication.c
40- index 82ee9450f..25726c542 100644
40+ index 13cbc4183..c30560b3d 100644
4141--- a/src/replication.c
4242+++ b/src/replication.c
4343@@ -59,7 +59,6 @@ void replicationResurrectProvisionalPrimary(void);
@@ -48,7 +48,7 @@ index 82ee9450f..25726c542 100644
4848 void replicationSteadyStateInit(void);
4949 void dualChannelSetupMainConnForPsync(connection *conn);
5050 void dualChannelSyncHandleRdbLoadCompletion(void);
51- @@ -1069 ,7 +1068 ,7 @@ void syncCommand(client *c) {
51+ @@ -1115 ,7 +1114 ,7 @@ void syncCommand(client *c) {
5252
5353 /* Refuse SYNC requests if we are a replica but the link with our primary
5454 * is not ok... */
@@ -57,7 +57,7 @@ index 82ee9450f..25726c542 100644
5757 addReplyError(c, "-NOMASTERLINK Can't SYNC while not connected with my master");
5858 return;
5959 }
60- @@ -5150 ,7 +5149 ,7 @@ void replicationCron(void) {
60+ @@ -5284 ,7 +5283 ,7 @@ void replicationCron(void) {
6161 }
6262
6363 /* Check if we should connect to a PRIMARY */
@@ -67,80 +67,26 @@ index 82ee9450f..25726c542 100644
6767 connectWithPrimary();
6868 }
6969diff --git a/src/server.h b/src/server.h
70- index 25f01a31e..95d31758e 100644
70+ index 351b1e43c..c8e03be25 100644
7171--- a/src/server.h
7272+++ b/src/server.h
73- @@ -2117 ,6 +2117 ,7 @@ struct valkeyServer {
73+ @@ -2205 ,6 +2205 ,7 @@ struct valkeyServer {
7474 /* Synchronous replication. */
7575 list *clients_waiting_acks; /* Clients waiting in WAIT or WAITAOF. */
7676 int get_ack_from_replicas; /* If true we send REPLCONF GETACK. */
7777+ int repl_paused; /* If true we don't try to connect to master */
7878 /* Limits */
7979 unsigned int maxclients; /* Max number of simultaneous clients */
8080 unsigned long long maxmemory; /* Max number of memory bytes to use */
81- @@ -3116 ,6 +3117 ,8 @@ void updateFailoverStatus(void);
81+ @@ -3240 ,6 +3241 ,8 @@ void updateFailoverStatus(void);
8282 void abortFailover(const char *err);
8383 const char *getFailoverStateString(void);
8484 sds getReplicaPortString(void);
8585+ int cancelReplicationHandshake(int reconnect);
8686+ int replicaIsInHandshakeState(void);
8787 int sendCurrentOffsetToReplica(client *replica);
88+ int replicaRdbVersion(client *replica);
8889 void addRdbReplicaToPsyncWait(client *replica);
89- void initClientReplicationData(client *c);
90- diff --git a/tests/cluster/tests/99-yandex-cloud-patches.tcl b/tests/cluster/tests/99-yandex-cloud-patches.tcl
91- new file mode 100644
92- index 000000000..6d0c1007b
93- --- /dev/null
94- +++ b/tests/cluster/tests/99-yandex-cloud-patches.tcl
95- @@ -0,0 +1,48 @@
96- + # Test Yandex Cloud patches on cluster
97- +
98- + source "../tests/includes/init-tests.tcl"
99- +
100- + proc kill_clustered_redis {id} {
101- + set pid [get_instance_attrib redis $id pid]
102- +
103- + stop_instance $pid
104- + set_instance_attrib redis $id pid -1
105- + set_instance_attrib redis $id link you_tried_to_talk_with_killed_instance
106- +
107- + # Remove the PID from the list of pids to kill at exit.
108- + set ::pids [lsearch -all -inline -not -exact $::pids $pid]
109- + }
110- +
111- + test "Create a 2 node cluster (1 master and 1 replica)" {
112- + create_cluster 1 1
113- + }
114- +
115- + test "Cluster is up" {
116- + assert_cluster_state ok
117- + }
118- +
119- + test "Instance #1 synced with the master" {
120- + wait_for_condition 1000 50 {
121- + [RI 1 master_link_status] eq {up}
122- + } else {
123- + fail "Instance #1 master link status is not up"
124- + }
125- + }
126- +
127- + test "Replication pause on instance #1 works" {
128- + assert {[R 1 config set repl-paused yes] eq {OK}}
129- + wait_for_condition 1000 50 {
130- + [RI 1 master_link_status] eq {down}
131- + } else {
132- + fail "Instance #1 master link status is not down"
133- + }
134- + }
135- +
136- + test "Replication resume on instance #1 works" {
137- + assert {[R 1 config set repl-paused no] eq {OK}}
138- + wait_for_condition 1000 50 {
139- + [RI 1 master_link_status] eq {up}
140- + } else {
141- + fail "Instance #1 master link status is not up"
142- + }
143- + }
14490diff --git a/tests/integration/yandex-cloud-patches.tcl b/tests/integration/yandex-cloud-patches.tcl
14591new file mode 100644
14692index 000000000..a2c9bb949
@@ -203,6 +149,49 @@ index 000000000..a2c9bb949
203149+ }
204150+ }
205151+ }
206- - -
207- 2.51.1
208-
152+ diff --git a/tests/unit/cluster/99-yandex-cloud-patches.tcl b/tests/unit/cluster/99-yandex-cloud-patches.tcl
153+ new file mode 100644
154+ index 000000000..ca4d2f5ec
155+ --- /dev/null
156+ +++ b/tests/unit/cluster/99-yandex-cloud-patches.tcl
157+ @@ -0,0 +1,40 @@
158+ + # Test Yandex Cloud patches on cluster
159+ +
160+ + start_cluster 1 2 {tags {external:skip cluster}} {
161+ +
162+ + test "Cluster is up" {
163+ + wait_for_cluster_state ok
164+ + }
165+ +
166+ + test "Instance 0 is master and 1 is replica" {
167+ + assert {[s 0 role] eq {master}}
168+ + assert {[s -1 role] eq {slave}}
169+ + }
170+ +
171+ + test "Instance 1 synced with the master" {
172+ + wait_for_condition 1000 50 {
173+ + [s -1 master_link_status] eq {up}
174+ + } else {
175+ + fail "Instance 1 master link status is not up"
176+ + }
177+ + }
178+ +
179+ + test "Replication pause on instance 1 works" {
180+ + assert {[R 1 config set repl-paused yes] eq {OK}}
181+ + wait_for_condition 1000 50 {
182+ + [s -1 master_link_status] eq {down}
183+ + } else {
184+ + fail "Instance 1 master link status is not down"
185+ + }
186+ + }
187+ +
188+ + test "Replication resume on instance 1 works" {
189+ + assert {[R 1 config set repl-paused no] eq {OK}}
190+ + wait_for_condition 1000 50 {
191+ + [s -1 master_link_status] eq {up}
192+ + } else {
193+ + fail "Instance 1 master link status is not up"
194+ + }
195+ + }
196+ +
197+ + }
0 commit comments