Properly account for replication stats when splitting bulk docs batches

Previously if batch of bulk docs had to be bisected in order to fit a lower max
request size limit on the target, we only counted stats for the second batch.
So it was possibly we might have missed some `doc_write_failures` updates which
can be perceived as a data loss to the customer.

So we use the handy-dandy `sum_stats/2` function to sum the return stats from
both batches and return that.

Issue: https://github.com/apache/couchdb/issues/2414
1 file changed