You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by va...@apache.org on 2016/10/14 19:18:27 UTC
couch-replicator commit: updated refs/heads/couchdb-3199 to 48996b1
Repository: couchdb-couch-replicator
Updated Branches:
refs/heads/couchdb-3199 [created] 48996b108
Let "error" replication document updates bypass the VDU function.
This is necessary in the case where an software upgrade happens with
a more restrictive VDU function. Replicator db might end up having documents
which would not pass validation anymore, leading to a replicator manager
crash when it updates the document with an "error" state.
So in case of an "error" state allow malformed document so the user can
see the error.
COUCHDB-3199
Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/commit/48996b10
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/tree/48996b10
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/diff/48996b10
Branch: refs/heads/couchdb-3199
Commit: 48996b108c458421c8a73097be152769bdc3fc48
Parents: cb41bac
Author: Nick Vatamaniuc <va...@apache.org>
Authored: Fri Oct 14 15:13:47 2016 -0400
Committer: Nick Vatamaniuc <va...@apache.org>
Committed: Fri Oct 14 15:13:47 2016 -0400
----------------------------------------------------------------------
src/couch_replicator_js_functions.hrl | 8 ++++++++
1 file changed, 8 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/48996b10/src/couch_replicator_js_functions.hrl
----------------------------------------------------------------------
diff --git a/src/couch_replicator_js_functions.hrl b/src/couch_replicator_js_functions.hrl
index f3f7ab6..eba1973 100644
--- a/src/couch_replicator_js_functions.hrl
+++ b/src/couch_replicator_js_functions.hrl
@@ -53,6 +53,14 @@
var isReplicator = (userCtx.roles.indexOf('_replicator') >= 0);
var isAdmin = (userCtx.roles.indexOf('_admin') >= 0);
+ if (newDoc._replication_state === 'error') {
+ // Skip validation in case when we update the document with the
+ // failed state. In this case it might be malformed. However,
+ // replicator will not pay attention to failed documents so this
+ // is safe.
+ return;
+ }
+
if (oldDoc && !newDoc._deleted && !isReplicator &&
(oldDoc._replication_state === 'triggered')) {
reportError('Only the replicator can edit replication documents ' +