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/05/21 22:48:38 UTC

[couchdb] 01/01: Improve load handling in couch_jobs and couch_views

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

vatamane pushed a commit to branch improve-couch-views-load-handling
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 27690bf2259b8a212614fdfb60fc3b08502c70d1
Author: Nick Vatamaniuc <va...@apache.org>
AuthorDate: Thu May 21 18:40:55 2020 -0400

    Improve load handling in couch_jobs and couch_views
    
    Increase couch_views job timeout by 20 seconds. This will set a larger jitter
    when multiple nodes concurrently check and re-equeue jobs. It would reduce the
    chance of them bumping into each other and conflicting.
    
    If they do conflict in activity monitor, catch the error and emit an error log.
    We gain some more robustness under load for a longer timeout for jobs with
    workers that have suddenly died getting re-enqueued.
---
 src/couch_jobs/src/couch_jobs_activity_monitor.erl | 9 ++++++++-
 src/couch_views/src/couch_views_jobs.erl           | 2 +-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/couch_jobs/src/couch_jobs_activity_monitor.erl b/src/couch_jobs/src/couch_jobs_activity_monitor.erl
index ef82e6b..6f50d96 100644
--- a/src/couch_jobs/src/couch_jobs_activity_monitor.erl
+++ b/src/couch_jobs/src/couch_jobs_activity_monitor.erl
@@ -65,7 +65,14 @@ handle_cast(Msg, St) ->
 
 
 handle_info(check_activity, St) ->
-    St1 = check_activity(St),
+    St1 = try
+        check_activity(St)
+    catch
+        {error, {erlfdb_error, 1020}} ->
+            LogMsg = "~p : type:~p got 1020 error, possibly from overload",
+            couch_log:error(LogMsg, [?MODULE, St#st.type]),
+            St
+    end,
     St2 = schedule_check(St1),
     {noreply, St2};
 
diff --git a/src/couch_views/src/couch_views_jobs.erl b/src/couch_views/src/couch_views_jobs.erl
index 909e923..a9ca168 100644
--- a/src/couch_views/src/couch_views_jobs.erl
+++ b/src/couch_views/src/couch_views_jobs.erl
@@ -31,7 +31,7 @@
 
 
 set_timeout() ->
-    couch_jobs:set_type_timeout(?INDEX_JOB_TYPE, 6).
+    couch_jobs:set_type_timeout(?INDEX_JOB_TYPE, 26).
 
 
 build_view(TxDb, Mrst, UpdateSeq) ->