summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Vatamaniuc <vatamane@apache.org>2020-02-18 11:53:42 -0500
committerNick Vatamaniuc <nickva@users.noreply.github.com>2020-02-18 13:03:22 -0500
commitb9b757c2802f7fe2e96eec8aedbda10cf2453236 (patch)
tree62e671cd2448230561f0540279b48e2f34ba9ff5
parent951cfd173c347d153274a3d0b133cc657cb1b7bb (diff)
downloadcouchdb-b9b757c2802f7fe2e96eec8aedbda10cf2453236.tar.gz
Handle spurious 1009 (future_version) errors in couch_jobs pending
We already handle them in couch_jobs_type_monitor so let's do it in `couch_jobs:wait_pending` as well. Recent fixes in FDB 6.2 didn't completely fix the issue and ther are still spurious 1009 errors dumped in the logs. They seem to be benign as far as couch_jobs operation goes as type monitor code already showed, so let's not pollute the logs with them.
-rw-r--r--src/couch_jobs/src/couch_jobs.erl5
-rw-r--r--src/couch_jobs/src/couch_jobs_type_monitor.erl2
-rw-r--r--src/fabric/include/fabric2.hrl1
3 files changed, 7 insertions, 1 deletions
diff --git a/src/couch_jobs/src/couch_jobs.erl b/src/couch_jobs/src/couch_jobs.erl
index d469ed41a..c134f5ac5 100644
--- a/src/couch_jobs/src/couch_jobs.erl
+++ b/src/couch_jobs/src/couch_jobs.erl
@@ -296,6 +296,8 @@ accept_loop(Type, NoSched, MaxSchedTime, Timeout) ->
case wait_pending(PendingWatch, MaxSchedTime, Timeout) of
{error, not_found} ->
{error, not_found};
+ retry ->
+ accept_loop(Type, NoSched, MaxSchedTime, Timeout);
ok ->
accept_loop(Type, NoSched, MaxSchedTime, Timeout)
end
@@ -318,6 +320,9 @@ wait_pending(PendingWatch, MaxSTime, UserTimeout) ->
erlfdb:wait(PendingWatch, [{timeout, Timeout}]),
ok
catch
+ error:{erlfdb_error, ?FUTURE_VERSION} ->
+ erlfdb:cancel(PendingWatch, [flush]),
+ retry;
error:{timeout, _} ->
erlfdb:cancel(PendingWatch, [flush]),
{error, not_found}
diff --git a/src/couch_jobs/src/couch_jobs_type_monitor.erl b/src/couch_jobs/src/couch_jobs_type_monitor.erl
index 562a866da..04ad60acc 100644
--- a/src/couch_jobs/src/couch_jobs_type_monitor.erl
+++ b/src/couch_jobs/src/couch_jobs_type_monitor.erl
@@ -55,7 +55,7 @@ loop(#st{vs = VS, timeout = Timeout} = St) ->
try
erlfdb:wait(Watch, [{timeout, Timeout}])
catch
- error:{erlfdb_error, 1009} ->
+ error:{erlfdb_error, ?FUTURE_VERSION} ->
erlfdb:cancel(Watch, [flush]),
ok;
error:{timeout, _} ->
diff --git a/src/fabric/include/fabric2.hrl b/src/fabric/include/fabric2.hrl
index b1bd30629..f526d7b34 100644
--- a/src/fabric/include/fabric2.hrl
+++ b/src/fabric/include/fabric2.hrl
@@ -66,6 +66,7 @@
% Let's keep these in ascending order
-define(TRANSACTION_TOO_OLD, 1007).
+-define(FUTURE_VERSION, 1009).
-define(COMMIT_UNKNOWN_RESULT, 1021).