Reduce the number of CouchDB round trips when pushing changes

Bug #724845 reported by James Henstridge
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Bindwood
Won't Fix
Low
Unassigned

Bug Description

In the new synchroniser, we have a list of changed GUIDs. For each one, we:
 1. download the current version from CouchDB
 2. if the local item has been deleted, send a delete request to CouchDB.
 3. otherwise, update the document from local data and save it back to CouchDB if changed.

This leads to two round trips per changed item. We should be able to reduce this to two round trips total:

1. Retrieve the current version of all changed items:
    POST /bookmarks/_all_docs?include_docs=true
    ...
    {keys: [item1, item2, ...]}

2. Process each item, based on the documents we've downloaded, and form a list of updated/deleted documents.

3. Push all the changes back to CouchDB in bulk:
    POST /bookmarks/_bulk_docs
    ...
    {docs: [
      {_id: doc1, _rev: ..., ...},
      {_id: doc2, _rev: ..., _deleted: true },
      ...
    ]}

Will have to work out whether the above is possible with the couch.js interface we're using.

Changed in bindwood:
importance: Undecided → Low
Revision history for this message
James Henstridge (jamesh) wrote :

The couch.js API supports both of these operations:

db.allDocs({include_docs: true}, [record_id, ...])

db.bulkSave([doc1, doc2, ..])

Revision history for this message
Rick McBride (rmcbride) wrote :

WNF per ralsina

Changed in bindwood:
status: New → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.