You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2020/11/16 20:43:05 UTC

[couchdb] 01/01: Remove incorrect MD5 check

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

rnewson pushed a commit to branch couch_att_erroneous_md5_mismatch
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit efcac236086fd81dfd2390783d401e1667c851d0
Author: Robert Newson <rn...@apache.org>
AuthorDate: Mon Nov 16 20:38:28 2020 +0000

    Remove incorrect MD5 check
    
    If an attachment was stored uncompressed but later is replicated
    internally to a node that wants to compress it (based on
    content-type), couchdb compares the uncompressed md5 with the
    compressed md5 and fails. This breaks eventual consistency between
    replicas.
    
    This PR removes the unnecessary MD5 check that is, in these specific
    circumstances, always called with mismatched arguments.
---
 src/couch/src/couch_att.erl | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/src/couch/src/couch_att.erl b/src/couch/src/couch_att.erl
index a24de21..8a3d6b1 100644
--- a/src/couch/src/couch_att.erl
+++ b/src/couch/src/couch_att.erl
@@ -593,13 +593,9 @@ flush_data(Db, {stream, StreamEngine}, Att) ->
             % Already written
             Att;
         false ->
-            NewAtt = couch_db:with_stream(Db, Att, fun(OutputStream) ->
+            couch_db:with_stream(Db, Att, fun(OutputStream) ->
                 couch_stream:copy(StreamEngine, OutputStream)
-            end),
-            InMd5 = fetch(md5, Att),
-            OutMd5 = fetch(md5, NewAtt),
-            couch_util:check_md5(OutMd5, InMd5),
-            NewAtt
+            end)
     end.