couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Klo <>
Subject Re: replication using an update handler?
Date Thu, 22 Dec 2011 01:19:21 GMT
The problem is, I 'technically' don't have access to add a filter function on the Source server
- it could be owned by someone else.  So I must do my filtering at the target server.

What I've discovered is that in all the documentation out there in the wiki/blogs/listservs
- they're all missing some "extremely critical" documentation for validate_doc_update.  What
I've determined so far via laborious trial and error is:

A. To reject due to authentication, you must throw an error object:
	{ unauthorized: "Your message stating authentication error" }

	This will kill the replication process completely.

B. To just blindly cause replication to stop due to an error:
	{ error: "Your message describing the error" }

C. To only reject the new document being validated, and CONTINUE validating other docs, throw:
	{ forbidden: "Your message why you're forbidding the object from your db" }

There might be other errors that could be thrown, but I got no idea what they are, and NONE
of the above is really documented anywhere - only hinted at in a few places.
Now if I can find my username for the wiki - I'll try and update it!

Jim Klo
Senior Software Engineer
Center for Software Engineering
SRI International

On Dec 21, 2011, at 4:41 PM, Rogutės Sparnuotos wrote:

> Jim Klo (2011-12-21 16:15):
>> Okay, I think I finally figured out how to get the validate_doc_update function to
>> Now the question is... I only want to replicate some of the docs.  Regardless of
whether I return true or false  all docs seem to replicate. Here's a link to the validate
>> My log shows nothing but thousands of lines like this:
>> [Wed, 21 Dec 2011 23:51:15 GMT] [info] [<0.16027.7>] OS Process #Port<0.22580>
Log :: validating for alignment.
>> [Wed, 21 Dec 2011 23:51:15 GMT] [info] [<0.16027.7>] OS Process #Port<0.22580>
Log :: 26120f9dccbe452abae585889988ff71-distributable is NOT being replicated.
>> and none showing that it is replicating, however afaik, it's replicating everything,
as my empty db, now has thousands of docs that shouldn't be there.
>> The docs for the validate_doc_update seems to indicate to throw an error instead
of returning true or false; however doing that causes replication to fail.
>> What might I be doing wrong?
> You want
> And then throw an error in validate_doc_update, so that unfiltered
> replication fails.
> -- 
> --  Rogutės Sparnuotos

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message