Skip to content

Commit a98eb3d

Browse files
author
andytill
committed
Allow all nodes in the cluster to be check the server_fullsyncs because the stat only gets incremented on the node that executed the fullsync.
1 parent ccf76df commit a98eb3d

File tree

2 files changed

+24
-15
lines changed

2 files changed

+24
-15
lines changed

tests/repl_util.erl

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,8 @@ get_fs_coord_status_item(Node, SinkName, ItemName) ->
226226
ClusterProps = proplists:get_value(SinkName, FS_CoordProps),
227227
proplists:get_value(ItemName, ClusterProps).
228228

229+
230+
229231
start_and_wait_until_fullsync_complete(Node) ->
230232
start_and_wait_until_fullsync_complete(Node, undefined).
231233

@@ -235,7 +237,9 @@ start_and_wait_until_fullsync_complete(Node, Cluster) ->
235237
start_and_wait_until_fullsync_complete(Node, Cluster, NotifyPid) ->
236238
start_and_wait_until_fullsync_complete(Node, Cluster, NotifyPid, 20).
237239

238-
start_and_wait_until_fullsync_complete(Node, Cluster, NotifyPid, Retries) ->
240+
start_and_wait_until_fullsync_complete(Node, Cluster, NotifyPid, Retries) when is_atom(Node) ->
241+
start_and_wait_until_fullsync_complete([Node], Cluster, NotifyPid, Retries);
242+
start_and_wait_until_fullsync_complete([Node|_] = Nodes, Cluster, NotifyPid, Retries) ->
239243
Status0 = rpc:call(Node, riak_repl_console, status, [quiet]),
240244
Count0 = proplists:get_value(server_fullsyncs, Status0),
241245
Count = fullsync_count(Count0, Status0, Cluster),
@@ -252,7 +256,7 @@ start_and_wait_until_fullsync_complete(Node, Cluster, NotifyPid, Retries) ->
252256
%% Send message to process and notify fullsync has began.
253257
fullsync_notify(NotifyPid),
254258

255-
case rt:wait_until(make_fullsync_wait_fun(Node, Count), 100, 1000) of
259+
case rt:wait_until(make_fullsync_wait_fun(Nodes, Count), 100, 1000) of
256260
ok ->
257261
ok;
258262
_ when Retries > 0 ->
@@ -281,19 +285,24 @@ fullsync_notify(NotifyPid) when is_pid(NotifyPid) ->
281285
fullsync_notify(_) ->
282286
ok.
283287

284-
make_fullsync_wait_fun(Node, Count) ->
288+
make_fullsync_wait_fun(Cluster, Count) when is_list(Cluster) ->
285289
fun() ->
286-
Status = rpc:call(Node, riak_repl_console, status, [quiet]),
287-
case Status of
288-
{badrpc, _} ->
289-
false;
290+
make_fullsync_wait_fun2(Cluster, Count)
291+
end.
292+
293+
make_fullsync_wait_fun2([], _) ->
294+
false;
295+
make_fullsync_wait_fun2([Node|Tail], Count) when is_atom(Node) ->
296+
Status = rpc:call(Node, riak_repl_console, status, [quiet]),
297+
case Status of
298+
{badrpc, _} ->
299+
false;
300+
_ ->
301+
case proplists:get_value(server_fullsyncs, Status) of
302+
C when C >= Count ->
303+
true;
290304
_ ->
291-
case proplists:get_value(server_fullsyncs, Status) of
292-
C when C >= Count ->
293-
true;
294-
_ ->
295-
false
296-
end
305+
make_fullsync_wait_fun2(Tail, Count)
297306
end
298307
end.
299308

tests/ts_cluster_replication.erl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ full_sync_replication_test([AFirst|_]=ANodes, [BFirst|_]=BNodes, LeaderA, PortB,
207207
lager:info("Starting and waiting for fullsync"),
208208
connect_clusters(ANodes, BNodes, LeaderA, PortB),
209209
start_mdc(ANodes, LeaderA, "B", true),
210-
repl_util:start_and_wait_until_fullsync_complete(hd(ANodes), "B"),
210+
repl_util:start_and_wait_until_fullsync_complete(ANodes, "B"),
211211

212212
lager:info("Verifying first 100 keys present on 2nd cluster (non-w1c)"),
213213
?assertEqual(100, kv_num_objects_present(BNode, 1, 100, KVBucket)),
@@ -221,7 +221,7 @@ full_sync_replication_test([AFirst|_]=ANodes, [BFirst|_]=BNodes, LeaderA, PortB,
221221
timer:sleep(500),
222222
lager:info("Verifying record is no longer on Cluster A"),
223223
?assertEqual(0, ts_num_records_present(AFirst, 23, 23, Table)),
224-
repl_util:start_and_wait_until_fullsync_complete(hd(ANodes), "B"),
224+
repl_util:start_and_wait_until_fullsync_complete(ANodes, "B"),
225225
lager:info("Verifying record is no longer on Cluster B"),
226226
?assertEqual(0, ts_num_records_present(BFirst, 23, 23, Table)),
227227

0 commit comments

Comments
 (0)