Skip to content

Instantly share code, notes, and snippets.

@jchris
Created October 10, 2014 17:50
Show Gist options
  • Save jchris/975c462df95361f620f1 to your computer and use it in GitHub Desktop.
Save jchris/975c462df95361f620f1 to your computer and use it in GitHub Desktop.
notes on CouchDB storage

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment