diff options
author | Nick Vatamaniuc <vatamane@apache.org> | 2020-02-18 11:53:42 -0500 |
---|---|---|
committer | Paul J. Davis <paul.joseph.davis@gmail.com> | 2020-03-02 12:26:22 -0600 |
commit | e0bdb7ede9f62ca23729d21b24cc4b57d1be8a3c (patch) | |
tree | 48caa11172b358ec0fa869820fc348e63247414c | |
parent | 293d3d51779a786452d2c4fd9e72ca9db6224e62 (diff) | |
download | couchdb-e0bdb7ede9f62ca23729d21b24cc4b57d1be8a3c.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.erl | 5 | ||||
-rw-r--r-- | src/couch_jobs/src/couch_jobs_type_monitor.erl | 2 | ||||
-rw-r--r-- | src/fabric/include/fabric2.hrl | 1 |
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). |