From e7d42f9500bf5f32da5b43380c6e7a86b2cb7ce7 Mon Sep 17 00:00:00 2001 From: Ulf Wiger Date: Thu, 5 Oct 2023 13:53:13 +0200 Subject: [PATCH] Add retry for bleed-through check --- test/mnesia_rocksdb_SUITE.erl | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/test/mnesia_rocksdb_SUITE.erl b/test/mnesia_rocksdb_SUITE.erl index 3927646..d0fa050 100644 --- a/test/mnesia_rocksdb_SUITE.erl +++ b/test/mnesia_rocksdb_SUITE.erl @@ -440,7 +440,10 @@ mrdb_two_procs_tx_inner_restart_(Config) -> go_ahead_other(0, P2), % Let P2 commit, then await DOWN (normal) await_other_down(P2, MRef2, ?LINE), PostA = mrdb:read(R, a), % now we should see writes from both P1 - PostB = mrdb:read(R, b); % ... and P2 + %% On OTP 23, the following step might fail due to timing, even + %% though the trace output looks as expected. Possibly some quirk + %% with leakage propagation time in rocksdb. Let's retry to be sure. + ok = try_until(PostB, fun() -> mrdb:read(R, b) end); % ... and P2 {1, 1} -> PostA = mrdb:read(R, a), PostB = mrdb:read(R, b), @@ -460,6 +463,19 @@ mrdb_two_procs_tx_inner_restart_(Config) -> delete_tabs(Created), ok. +try_until(Result, F) -> + try_until(Result, F, 10). + +try_until(Result, F, N) when N > 0 -> + case F() of + Result -> + ok; + _ -> + receive after 100 -> ok end, + try_until(Result, F, N-1) + end; +try_until(Result, F, _) -> + error({badmatch, {Result, F}}). % %% For testing purposes, we use side-effects inside the transactions @@ -633,6 +649,7 @@ dbg_tr_opts() -> , {mrdb_mutex_serializer, do, 2, x} , {?MODULE, wait_for_other, 2, x} , {?MODULE, go_ahead_other, 1, x} + , {?MODULE, try_until, 3, x} , {mrdb, activity, x} ], tr_opts())). tr_patterns(Mod, Ps, #{patterns := Pats} = Opts) ->