Github user davisp commented on a diff in the pull request:
https://github.com/apache/couchdb-couch/pull/22#discussion_r21720537
--- Diff: src/couch_db_updater.erl ---
@@ -985,27 +985,18 @@ sync_header(Db, NewHeader) ->
waiting_delayed_commit=nil
}.
-copy_doc_attachments(#db{fd = SrcFd} = SrcDb, SrcSp, DestFd) ->
- {ok, {BodyData, BinInfos0}} = couch_db:read_doc(SrcDb, SrcSp),
- BinInfos = case BinInfos0 of
- _ when is_binary(BinInfos0) ->
- couch_compress:decompress(BinInfos0);
- _ when is_list(BinInfos0) ->
- % pre 1.2 file format
- BinInfos0
- end,
+copy_doc_attachments(#db{fd = SrcFd} = SrcDb, SrcSp, DestFd, Processed) ->
+ {BodyData, BinInfos} = read_doc_with_atts(SrcDb, SrcSp),
% copy the bin values
- NewBinInfos = lists:map(
- fun({Name, Type, BinSp, AttLen, RevPos, ExpectedMd5}) ->
+ {NewBinInfos, NewProcessed} = lists:mapfoldr(
--- End diff --
Why mapfoldr instead of mapfoldl?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---