New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement _bulk_get aka _bulk_revs #3424
Comments
It's debatable, though, whether we actually want to implement a As a first pass, though, we can simply update |
+1 |
@daleharvey On the CouchDB side (COUCHDB-2310), there definitely seems to be an "intent to ship" in both 1.x and 2.x. So how do you feel about adding |
I am not so sure about this, if couchdb do add it then we probably have to for compat, but I think we would be able to spec and implement stream before this bulkrevs is ever released and replication-stream is a much more desirable end goal, going from what we have now to adding bulkDocs / bulkRevs (+detection) to adding Streaming + detection doesnt seem ideal |
So you think we should just jump directly to the replication-stream stuff? |
I'm finding that a middleware layer that performs the replication-stream stuff works fairly well. Have some hacky code working for express-pouchdb but need to clean it up before committing. Personally I'd like to see Pouch implement this without replication-stream functionality as soon as couch has it. |
_bulk_revs (a more efficient API that can replace the 1-at-a-time On Mon, Feb 9, 2015, at 08:50 AM, Robert Keizer wrote:
Links: |
Hrm, I thought If couch implements it then we should, but in terms of focus for replication improvements I think -stream is the best thing to focus on, it is going to be very hard to implement any of these new changes well since they will be implemented at different times across different platforms, I think its worth focussing on what gets us the best bang for buck |
Maybe it does. The thing I found irritating was that none of the proposed or existing bulk APIs supported ALL of the parameters allowed in a GET request, they are arbitrarily different making them harder to learn. |
Related to pouchdb/express-pouchdb#196 and apache/couchdb-chttpd#33 This adds a `bulkGet()` function to all PouchDB objects, which in the case of local databases runs a shim that simply collates a bunch of `get()` requests. This logic is in `bulk-get-shim.js`. In the case of the http adapter, the client checks if the server responds to `_bulk_get` with a 40x error. If no error is returned, then the server is assumed to implement `_bulk_get` and that API is used. Else the shim is used. I have tested this against CouchDB 1.6 and PouchDB Server (82b297e) with 100% success in both. Also manual testing showed that the `_bulk_get` API was used for PouchDB Server but not CouchDB. Three cheers for bulk replication!
Related to pouchdb/express-pouchdb#196 and apache/couchdb-chttpd#33 This adds a `bulkGet()` function to all PouchDB objects, which in the case of local databases runs a shim that simply collates a bunch of `get()` requests. This logic is in `bulk-get-shim.js`. In the case of the http adapter, the client checks if the server responds to `_bulk_get` with a 40x error. If no error is returned, then the server is assumed to implement `_bulk_get` and that API is used. Else the shim is used. I have tested this against CouchDB 1.6 and PouchDB Server (82b297e) with 100% success in both. Also manual testing showed that the `_bulk_get` API was used for PouchDB Server but not CouchDB. Three cheers for bulk replication!
Related to pouchdb/express-pouchdb#196 and apache/couchdb-chttpd#33 This adds a `bulkGet()` function to all PouchDB objects, which in the case of local databases runs a shim that simply collates a bunch of `get()` requests. This logic is in `bulk-get-shim.js`. In the case of the http adapter, the client checks if the server responds to `_bulk_get` with a 40x error. If no error is returned, then the server is assumed to implement `_bulk_get` and that API is used. Else the shim is used. I have tested this against CouchDB 1.6 and PouchDB Server (82b297e) with 100% success in both. Also manual testing showed that the `_bulk_get` API was used for PouchDB Server but not CouchDB. Three cheers for bulk replication!
@nolanlawson when testing against the CouchDB implementation, our attachment tests are failing. Looking specifically at suite2 test.attachments.js- local:http / Attachments replicate back and forth, I see the following requests around the failure: without _bulk_get:
returns
with _bulk_get:
returns
so the core information around the attachment looks the same. However, when this is processed at
without _bulk_get:
with bulk_get:
Note that when using _bulk_get, the attachment remains as a stub and the digest is different (but matches what was returned from the server in both cases). |
I think the problem is simply that we don't call fetchAttachments for attachment stubs returned by _bulk_get |
/_bulk_get requires that revs=true / attachments=true are specified as query parameters rather than in the document body.
/_bulk_get requires that revs=true / attachments=true are specified as query parameters rather than in the document body.
_bulk_get will be released in pouchdb 5.0.0 and available in the next release of pouchdb server |
this is merged now |
:-) |
So this means PouchDB will attempt to use _bulk_get for replication now? |
yep - if the endpoint is there, it will use it. |
which current couchDB version will work with _bulk_get ? |
CouchDB 2.0+ (unreleased) and PouchDB Server 1.0.0. Cloudant soon. |
Thank you @nolanlawson |
@nolanlawson @daleharvey At the risk of sounding like a hopeless fan boy this is super cool! Thank you!!!! BTW, as a side note today we did a demo using PouchDB with memdown on top of node.ch on top of Windows IoT on top of a Raspberry PI 2. It worked super well! So my thanks only increases! |
@yaronyg woop woop! :) |
Counterpart to pouchdb/express-pouchdb#196.
The text was updated successfully, but these errors were encountered: