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

rnewson pushed a commit to branch always-allow-mem3-checkpoints
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit ee1de1485e48b8a009d561ce440baa565b1bcb20
Author: Robert Newson <[email protected]>
AuthorDate: Wed May 7 09:54:47 2025 +0100

    Always allow mem3_rep checkpoints
    
    Closes https://github.com/apache/couchdb/issues/5528
---
 src/couch/src/couch_db.erl | 3 ++-
 src/mem3/src/mem3_rep.erl  | 2 +-
 src/mem3/src/mem3_rpc.erl  | 2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/couch/src/couch_db.erl b/src/couch/src/couch_db.erl
index e33e695c0..5b1659ebe 100644
--- a/src/couch/src/couch_db.erl
+++ b/src/couch/src/couch_db.erl
@@ -1340,8 +1340,9 @@ update_docs(Db, Docs0, Options, ?REPLICATED_CHANGES) ->
     {ok, DocErrors};
 update_docs(Db, Docs0, Options, ?INTERACTIVE_EDIT) ->
     BlockInteractiveDatabaseWrites = 
couch_disk_monitor:block_interactive_database_writes(),
+    BypassWriteBlock = lists:member(bypass_write_block, Options),
     if
-        BlockInteractiveDatabaseWrites ->
+        BlockInteractiveDatabaseWrites andalso not BypassWriteBlock ->
             {ok, [{insufficient_storage, <<"database_dir is too full">>} || _ 
<- Docs0]};
         true ->
             update_docs_interactive(Db, Docs0, Options)
diff --git a/src/mem3/src/mem3_rep.erl b/src/mem3/src/mem3_rep.erl
index 3df07a9fd..a5822795a 100644
--- a/src/mem3/src/mem3_rep.erl
+++ b/src/mem3/src/mem3_rep.erl
@@ -737,7 +737,7 @@ update_locals(Target, Db, Seq) ->
         {<<"timestamp">>, list_to_binary(mem3_util:iso8601_timestamp())}
     ],
     NewBody = mem3_rpc:save_checkpoint(Node, Name, Id, Seq, NewEntry, History),
-    {ok, _} = couch_db:update_doc(Db, #doc{id = Id, body = NewBody}, []).
+    {ok, _} = couch_db:update_doc(Db, #doc{id = Id, body = NewBody}, 
[bypass_write_block]).
 
 purge_cp_body(#shard{} = Source, #shard{} = Target, PurgeSeq) ->
     {Mega, Secs, _} = os:timestamp(),
diff --git a/src/mem3/src/mem3_rpc.erl b/src/mem3/src/mem3_rpc.erl
index 70fc797da..ca9be9de6 100644
--- a/src/mem3/src/mem3_rpc.erl
+++ b/src/mem3/src/mem3_rpc.erl
@@ -147,7 +147,7 @@ save_checkpoint_rpc(DbName, Id, SourceSeq, NewEntry0, 
History0) ->
                 ]},
             Doc = #doc{id = Id, body = Body},
             rexi:reply(
-                try couch_db:update_doc(Db, Doc, []) of
+                try couch_db:update_doc(Db, Doc, [bypass_write_block]) of
                     {ok, _} ->
                         {ok, Body};
                     Else ->

Reply via email to