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 2023/10/23 17:40:04 UTC

[couchdb] 01/01: Wait for compacted indexes to flip.

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

vatamane pushed a commit to branch wait-for-indexes-to-flip-after-compaction
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 8c4929c8a11b79a5ea69b49ab03d95330bc64d60
Author: Nick Vatamaniuc <va...@gmail.com>
AuthorDate: Mon Oct 23 13:34:12 2023 -0400

    Wait for compacted indexes to flip.
    
    Noticed on a few production instances, we run a potentially long compaction,
    and when done, the call to commit the compacted state times out after 5
    seconds. That, in turn, triggers are a `compaction_failed` call, which also may
    timeout and the whole thing crashes.
    
    Since we have the ioq scheduler running and we're doing disk IO, compaction
    swap may be delayed in the background, and take longer than 5 seconds. Opt to
    wait however long it takes or crash for some other reason. gen_server calls
    already auto-monitor and check for called process's exits.
---
 src/couch_index/src/couch_index_compactor.erl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/couch_index/src/couch_index_compactor.erl b/src/couch_index/src/couch_index_compactor.erl
index 8b592d140..ac066648d 100644
--- a/src/couch_index/src/couch_index_compactor.erl
+++ b/src/couch_index/src/couch_index_compactor.erl
@@ -112,7 +112,7 @@ compact(Idx, Mod, IdxState, Opts) ->
         Mod:compact(Db, IdxState, Opts)
     end),
     ok = Mod:commit(NewIdxState),
-    case gen_server:call(Idx, {compacted, NewIdxState}) of
+    case gen_server:call(Idx, {compacted, NewIdxState}, infinity) of
         recompact ->
             couch_log:info("Compaction restarting for db: ~s idx: ~s", Args),
             compact(Idx, Mod, NewIdxState, [recompact]);