diff options
author | Nick Vatamaniuc <vatamane@gmail.com> | 2021-05-11 12:22:59 -0400 |
---|---|---|
committer | Nick Vatamaniuc <nickva@users.noreply.github.com> | 2021-05-11 13:57:57 -0400 |
commit | fe7ac3799484c3e484a94620ebb720f9b548cf4c (patch) | |
tree | eaacba7e91d88abd615e16cd013dcc8a37167e8b | |
parent | 96d3860daefdb65ceba472e99a7de1b0b7f591f6 (diff) | |
download | couchdb-fe7ac3799484c3e484a94620ebb720f9b548cf4c.tar.gz |
Handle disabled retries in restart_tx logic
During buggify runs we disable max tx retries by setting it to -1. That's FDB's
documented way to of doing it. However, when we re-use that setting to handle
restart_tx logic we don't account for -1, so we that's what this PR fixes.
-rw-r--r-- | src/fabric/src/fabric2_fdb.erl | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/fabric/src/fabric2_fdb.erl b/src/fabric/src/fabric2_fdb.erl index e86b03778..f3585e334 100644 --- a/src/fabric/src/fabric2_fdb.erl +++ b/src/fabric/src/fabric2_fdb.erl @@ -1879,11 +1879,13 @@ restart_fold(Tx, #fold_acc{} = Acc) -> ok = erlfdb:reset(Tx), + % During buggify test runs MaxRetries would be -1 MaxRetries = fabric2_server:get_retry_limit(), case {erase(?PDICT_FOLD_ACC_STATE), Acc#fold_acc.retries} of {#fold_acc{db = Db} = Acc1, _} -> Acc1#fold_acc{db = check_db_instance(Db), retries = 0}; - {undefined, Retries} when Retries < MaxRetries -> + {undefined, Retries} when Retries < MaxRetries orelse + MaxRetries =:= -1 -> Db = check_db_instance(Acc#fold_acc.db), Acc#fold_acc{db = Db, retries = Retries + 1}; {undefined, _} -> |