Github user davisp commented on a diff in the pull request:

    https://github.com/apache/couchdb-couch/pull/22#discussion_r21720818
  
    --- Diff: src/couch_db_updater.erl ---
    @@ -1061,22 +1075,22 @@ copy_docs(Db, #db{fd = DestFd} = NewDb, MixedInfos, 
Retry) ->
                         },
                         atts = AttSizes
                     },
    -                {NewLeaf, add_sizes(leaf, NewLeaf, SizesAcc)};
    -            (_Rev, _Leaf, branch, SizesAcc) ->
    -                {?REV_MISSING, SizesAcc}
    -        end, {0, 0, []}, Info#full_doc_info.rev_tree),
    +                {NewLeaf, {add_sizes(leaf, NewLeaf, SizesAcc), 
NewProcessed}};
    +            (_Rev, _Leaf, branch, {SizesAcc, Processed}) ->
    +                {?REV_MISSING, {SizesAcc, Processed}}
    +        end, {{0, 0, []}, Acc}, Info#full_doc_info.rev_tree),
             {FinalAS, FinalES, FinalAtts} = FinalAcc,
             TotalAttSize = lists:foldl(fun({_, S}, A) -> S + A end, 0, 
FinalAtts),
             NewActiveSize = FinalAS + TotalAttSize,
    --- End diff --
    
    This calculation has to change now that you're de-duplicating attachments. 
You'll have to surface the actual bytes written in copy_doc_attachments into 
sizes accumulator so that you're only counting bytes that were actually 
written. Otherwise with heavily duplicated attachments we'll end up skewing the 
size calculations leaving us with the possibility of having an active size 
greather than file size which is obviously impossible.


---
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.
---

Reply via email to