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

vatamane pushed a commit to branch 
fix-replicator-http-check-for-transient-replications
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit fab3e62b1e399ceea496d2da091b60a2222a19f8
Author: Nick Vatamaniuc <[email protected]>
AuthorDate: Thu Sep 14 12:58:13 2023 -0400

    Fix badrecord error when replicator is logging http usage
    
    Previously when transient replication jobs were canceled their `#rep` 
record's
    source and target fields would be `undefined`. That was accounted for in the
    http usage logger when it's enabled and resulted in a badrecord 500 error.
    
    Fix: https://github.com/apache/couchdb/issues/4760
---
 src/couch_replicator/src/couch_replicator_utils.erl | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/couch_replicator/src/couch_replicator_utils.erl 
b/src/couch_replicator/src/couch_replicator_utils.erl
index d790acb0d..b5906f2ab 100644
--- a/src/couch_replicator/src/couch_replicator_utils.erl
+++ b/src/couch_replicator/src/couch_replicator_utils.erl
@@ -281,6 +281,10 @@ seq_encode(Seq) ->
     ?JSON_ENCODE(Seq).
 
 %% Log uses of http protocol
+valid_endpoint_protocols_log(#rep{source = undefined, target = undefined}) ->
+    % When we cancel continuous transient replications (with a POST to 
_replicate)
+    % source and target will be undefined
+    ok;
 valid_endpoint_protocols_log(#rep{} = Rep) ->
     VerifyEnabled = config:get_boolean("replicator", 
"valid_endpoint_protocols_log", false),
     case VerifyEnabled of

Reply via email to