CouchDB storage bulk docs update flow based on this code.
- separate out the NonRep documents from the rest of the documents
- lookup up the old documents, if they exist.
- Merge the new docs into the revision trees (passed the current seq)
- this applies the seq number to the documents being written
- this also finds the obsolete seq nums we can drop
- update local docs (NonRep docs)
- they have their own by-id tree, no by-seq tree
- simpler revs
- write doc bodies (attachment were already written when?)
- write summary doc info (deleted, etc) to by-seq tree
- write full doc infos to by-id tree
- refresh validation function if we changed it
- commit data (headers and fsync)