You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by va...@apache.org on 2020/02/18 17:02:49 UTC

[couchdb] branch handle-1009-errors-in-jobs-pending-call created (now 2871b52)

This is an automated email from the ASF dual-hosted git repository.

vatamane pushed a change to branch handle-1009-errors-in-jobs-pending-call
in repository https://gitbox.apache.org/repos/asf/couchdb.git.


      at 2871b52  Handle spurious 1009 (future_version) errors in couch_jobs pending

This branch includes the following new commits:

     new 2871b52  Handle spurious 1009 (future_version) errors in couch_jobs pending

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[couchdb] 01/01: Handle spurious 1009 (future_version) errors in couch_jobs pending

Posted by va...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

vatamane pushed a commit to branch handle-1009-errors-in-jobs-pending-call
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 2871b5214f1ee5a3f6bbde983dabd88b5460900e
Author: Nick Vatamaniuc <va...@apache.org>
AuthorDate: Tue Feb 18 11:53:42 2020 -0500

    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.
---
 src/couch_jobs/src/couch_jobs.erl              | 5 +++++
 src/couch_jobs/src/couch_jobs_type_monitor.erl | 2 +-
 src/fabric/include/fabric2.hrl                 | 1 +
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/couch_jobs/src/couch_jobs.erl b/src/couch_jobs/src/couch_jobs.erl
index d469ed4..c134f5a 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 562a866..04ad60a 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 b1bd306..f526d7b 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).