You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Robert Hailey <co...@osndok.com> on 2011/12/21 22:33:09 UTC

Failure on source commit: {error,undefined}

Greetings,

I hope that someone might be able to shed some light on what I thought would be a simple couchdb proxy experiment, which seems to be stuck at this error message:

[error] [<0.166.0>] Replication `5e97f59236654e969f9e53af1fb63791` (`http://192.168.1.12/rep_poc_14/` -> `current_marketplace`) failed: {checkpoint_commit_failure,<<"Failure on source commit: {error,undefined}">>}

The overall theory (at present) is a simple one which I'm sure I read about somewhere: "allow only GET requests for a read-only filter", although in practice I've noticed that replication requires at least one POST too (_ensure_full_commit), so I've made an account for that as well.

I was able to get it working with couchdb v1.1.1 (when replicating to v1.1.1), but when I try to use "couchbase" (for convenience on mobile devices) I get the above error. I'm pretty sure it's hung up on the ensure_full_commit (or thereabout), and the best lead I have atm is: https://issues.apache.org/jira/browse/COUCHDB-1080 , and what appears to be a dropped 'reason' (the "undefined" field; ???).

The couchbase version I'm using is labeled:

> Android-Couchbase : Version 2.0, Ektorp : Version 1.2.2 <

So to any gracious and knowledgeable enough to help the ignorant, I have a few questions:

(1) Is there already a project that does this proxy/filtering, I noticed "Lounge" but it seems like there was a smaller one,
(2) How can I determine what version of couchdb corresponds to couchbase-2.0? (1.2.2 is not released !!!)
(3) Does the Android-Couchbase source on github really reflect the binaries? (I could not find couchdb source in them)
(4) Is there a better (or alternate-but-easy) means of using couchdb on android rather than couchbase? preferrably one with easily accessible source & couchdb version associations...?
(5) Is it even an expected use-case to connect a couchbase to a couchdb (which is to say, am I doing something crazy to begin with?).

Thanks for your time. At the moment I'm wishing erlang was as easy to read & compile as C... :-)

--
Robert Hailey



Re: Failure on source commit: {error,undefined}

Posted by Filipe David Manana <fd...@apache.org>.
On Friday, December 23, 2011, Robert Hailey <co...@osndok.com> wrote:
>
> On 2011/12/21 (Dec), at 3:52 PM, Marty Schoch wrote:
>
>> Hi Robert,
>
> Hey Marty, thanks for you reply.
>
>> If your issue only affects Couchbase Mobile, you may get better
>> support discussing the issues here:
>>
>> https://groups.google.com/forum/#!forum/mobile-couchbase
>
> I've isolated it to couchdb, and am positive it will (or would have)
effected future releases too; the complicating factor is that couchbase
uses pre-release versions of couchdb.
>
>> 2.  If you access the root URL of the Couchbase Mobile you should see
>> a response like:
>>
>> {
>> "couchdb": "Welcome",
>> "version": "1.2.0a-7b47329-git"
>> }
>
> I tried doing this, but I think couchbase is substituting it's own
version number here; with ios I get:
>
> {
>        "couchdb":"Welcome",
>        "version":"2.0.0-beta"
> }
>
> Which to me is non-sensical, because there are no tags resembling "2.0.0"
in couchdb, and not very helpful (because there is no hash like in your
example)...
>
>> 3.  Couchbase Mobile is completely open source.  The binaries we ship
>> are built from the source on github.  Some of the confusion may be
>> that Couchbase Mobile includes more than just CouchDB.
>
> I think that is much of the confusion, along with unfamiliarity with the
build system in use.
>
>> 4.  At the moment I'm not aware of any other implementations.
>
> I've found some references to others doing what I am:
>
>
http://stackoverflow.com/questions/8309521/using-couchdb-pull-replication-from-a-read-only-server
>
http://mail-archives.apache.org/mod_mbox/couchdb-user/201106.mbox/%3C4DFFB8BD.2010508%40gmail.com%3E
>
http://thanksmister.com/2009/03/28/http-status-201-causing-flex-2032-error-in-ie-only/
>
> And.... after several hours of reading erlang how-tos & trying to
"decode" two functions, I found my error.
>
> In:
>
> src/couch_replicator/src/couch_replicator_api_wrap.erl (about line 126)
>
> ensure_full_commit(#httpdb{} = Db) ->
>    send_req(
>        Db,
>        [{method, post}, {path, "_ensure_full_commit"},
>            {headers, [{"Content-Type", "application/json"}]}],
>        fun(201, _, {Props}) ->
>            {ok, get_value(<<"instance_start_time">>, Props)};
>        (_, _, {Props}) ->
>            {error, get_value(<<"error">>, Props)}
>        end);
>
> I found that the couchdb source expects a 201 http status, whereas the
docs I was following indicate a 200 status:
>
>
http://www.couchbase.org/sites/default/files/uploads/all/documentation/couchbase-api-db.html#couchbase-api-db_db-ensure-full-commit_post

The documentation is wrong, the success response code is 201 for
_ensure_full_commit
>
> So (if I understand the symptom of the "terrible error message") the
'undefined' was coming from a helper-function trying to extract a
non-existant error message (because it was successful, but did not match
the 201 code).
>
> I'm not sure what (if any) change needs to occur, but "undefined" is a
poor error message IMO. :)

Normally error responses have a json top level property named "error". I
don't recall seeing many for _ensure_full_commit. If it's easy for you to
reproduce it, can you tell what the server is sending by using a sniffer?

Thanks

>
> --
> Robert Hailey
>
>

-- 
Filipe David Manana,

"Reasonable men adapt themselves to the world.
 Unreasonable men adapt the world to themselves.
 That's why all progress depends on unreasonable men."

Re: Failure on source commit: {error,undefined}

Posted by Robert Hailey <co...@osndok.com>.
On 2011/12/21 (Dec), at 3:52 PM, Marty Schoch wrote:

> Hi Robert,

Hey Marty, thanks for you reply.

> If your issue only affects Couchbase Mobile, you may get better
> support discussing the issues here:
> 
> https://groups.google.com/forum/#!forum/mobile-couchbase

I've isolated it to couchdb, and am positive it will (or would have) effected future releases too; the complicating factor is that couchbase uses pre-release versions of couchdb.

> 2.  If you access the root URL of the Couchbase Mobile you should see
> a response like:
> 
> {
> "couchdb": "Welcome",
> "version": "1.2.0a-7b47329-git"
> }

I tried doing this, but I think couchbase is substituting it's own version number here; with ios I get:

{
	"couchdb":"Welcome",
	"version":"2.0.0-beta"
}

Which to me is non-sensical, because there are no tags resembling "2.0.0" in couchdb, and not very helpful (because there is no hash like in your example)...

> 3.  Couchbase Mobile is completely open source.  The binaries we ship
> are built from the source on github.  Some of the confusion may be
> that Couchbase Mobile includes more than just CouchDB.

I think that is much of the confusion, along with unfamiliarity with the build system in use.

> 4.  At the moment I'm not aware of any other implementations.

I've found some references to others doing what I am:

http://stackoverflow.com/questions/8309521/using-couchdb-pull-replication-from-a-read-only-server
http://mail-archives.apache.org/mod_mbox/couchdb-user/201106.mbox/%3C4DFFB8BD.2010508%40gmail.com%3E
http://thanksmister.com/2009/03/28/http-status-201-causing-flex-2032-error-in-ie-only/

And.... after several hours of reading erlang how-tos & trying to "decode" two functions, I found my error.

In:

src/couch_replicator/src/couch_replicator_api_wrap.erl (about line 126)

ensure_full_commit(#httpdb{} = Db) ->
    send_req(
        Db,
        [{method, post}, {path, "_ensure_full_commit"},
            {headers, [{"Content-Type", "application/json"}]}],
        fun(201, _, {Props}) ->
            {ok, get_value(<<"instance_start_time">>, Props)};
        (_, _, {Props}) ->
            {error, get_value(<<"error">>, Props)}
        end);

I found that the couchdb source expects a 201 http status, whereas the docs I was following indicate a 200 status:

http://www.couchbase.org/sites/default/files/uploads/all/documentation/couchbase-api-db.html#couchbase-api-db_db-ensure-full-commit_post

So (if I understand the symptom of the "terrible error message") the 'undefined' was coming from a helper-function trying to extract a non-existant error message (because it was successful, but did not match the 201 code).

I'm not sure what (if any) change needs to occur, but "undefined" is a poor error message IMO. :)

--
Robert Hailey


Re: Failure on source commit: {error,undefined}

Posted by Marty Schoch <ma...@gmail.com>.
Hi Robert,

If your issue only affects Couchbase Mobile, you may get better
support discussing the issues here:

https://groups.google.com/forum/#!forum/mobile-couchbase

1.  I'm not exactly clear what kind of proxy/filtering you're trying
to accomplish
2.  If you access the root URL of the Couchbase Mobile you should see
a response like:

{
"couchdb": "Welcome",
"version": "1.2.0a-7b47329-git"
}

This includes a git hash of the particular revision it was built with.
 In this case, that hash corresponds to:

https://github.com/couchbaselabs/couchdb/commit/7b473293e9f3cd2b0d307a8ff9d95c4b8129789b

3.  Couchbase Mobile is completely open source.  The binaries we ship
are built from the source on github.  Some of the confusion may be
that Couchbase Mobile includes more than just CouchDB.  This is
largely because the mobile platforms demand that we build our own
erlang vm, spidermonkey javascript engine, etc.  Because we need to
manage multiple source trees, we use the repo tool to pull everything
together.  The repo manifest for Couchbase Mobile for Android is here:
 https://github.com/couchbaselabs/Android-Couchbase-manifest  If you
take a look at that, it has pointers to all the subprojects.

4.  At the moment I'm not aware of any other implementations.

5.  Yes, Couchbase Mobile should sync with CouchDB.  This is something
we test pretty regularly.

Regarding the particular replication issue you face, it would help if
you could run "adb logcat" and share the contents on a site like
pastebin.  This should provide a much more detailed view of the
problem.

marty

On Wed, Dec 21, 2011 at 4:33 PM, Robert Hailey <co...@osndok.com> wrote:
>
> Greetings,
>
> I hope that someone might be able to shed some light on what I thought would be a simple couchdb proxy experiment, which seems to be stuck at this error message:
>
> [error] [<0.166.0>] Replication `5e97f59236654e969f9e53af1fb63791` (`http://192.168.1.12/rep_poc_14/` -> `current_marketplace`) failed: {checkpoint_commit_failure,<<"Failure on source commit: {error,undefined}">>}
>
> The overall theory (at present) is a simple one which I'm sure I read about somewhere: "allow only GET requests for a read-only filter", although in practice I've noticed that replication requires at least one POST too (_ensure_full_commit), so I've made an account for that as well.
>
> I was able to get it working with couchdb v1.1.1 (when replicating to v1.1.1), but when I try to use "couchbase" (for convenience on mobile devices) I get the above error. I'm pretty sure it's hung up on the ensure_full_commit (or thereabout), and the best lead I have atm is: https://issues.apache.org/jira/browse/COUCHDB-1080 , and what appears to be a dropped 'reason' (the "undefined" field; ???).
>
> The couchbase version I'm using is labeled:
>
>> Android-Couchbase : Version 2.0, Ektorp : Version 1.2.2 <
>
> So to any gracious and knowledgeable enough to help the ignorant, I have a few questions:
>
> (1) Is there already a project that does this proxy/filtering, I noticed "Lounge" but it seems like there was a smaller one,
> (2) How can I determine what version of couchdb corresponds to couchbase-2.0? (1.2.2 is not released !!!)
> (3) Does the Android-Couchbase source on github really reflect the binaries? (I could not find couchdb source in them)
> (4) Is there a better (or alternate-but-easy) means of using couchdb on android rather than couchbase? preferrably one with easily accessible source & couchdb version associations...?
> (5) Is it even an expected use-case to connect a couchbase to a couchdb (which is to say, am I doing something crazy to begin with?).
>
> Thanks for your time. At the moment I'm wishing erlang was as easy to read & compile as C... :-)
>
> --
> Robert Hailey
>
>