couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vatam...@apache.org
Subject couch-replicator commit: updated refs/heads/master to 48996b1
Date Fri, 14 Oct 2016 19:25:25 GMT
Repository: couchdb-couch-replicator
Updated Branches:
  refs/heads/master cb41bacb2 -> 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/master
Commit: 48996b108c458421c8a73097be152769bdc3fc48
Parents: cb41bac
Author: Nick Vatamaniuc <vatamane@apache.org>
Authored: Fri Oct 14 15:13:47 2016 -0400
Committer: Nick Vatamaniuc <vatamane@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 ' +


Mime
View raw message