Skip to content
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

Do not crash replicator on VDU function failure #1631

Merged

Conversation

@nickva
Copy link
Contributor

@nickva nickva commented Sep 28, 2018

Previously a user could insert a VDU function into one of the _replicator
databases such that it prevents the replicator application from updating
documents in that db. Replicator application would then crash and prevent
replications from running on the whole cluster.

To avoid crashing the replicator when saving documents, log the error
and return {ok, forbidden}. The return might seem odd but we are
asserting that forbidden is an OK value in this context and explicitly
handling it. This shape of the return also conforms to the expected
{ok, _Rev} result, noticing that _Rev is never actually used.

  • Code is written and works correctly;
  • Changes are covered by tests;
@nickva nickva force-pushed the cloudant:do_not_crash_replicator_on_vdu_failure branch from f8b8da0 to abe479d Oct 2, 2018
Previously a user could insert a VDU function into one of the _replicator
databases such that it prevents the replicator application from updating
documents in that db. Replicator application would then crash and prevent
replications from running on the whole cluster.

To avoid crashing the replicator when saving documents, log the error
and return `{ok, forbidden}`. The return might seem odd but we are
asserting that forbidden is an OK value in this context and explicitly
handling it. This shape of the return also conforms to the expected
`{ok, _Rev}` result, noticing that `_Rev` is never actually used.
@nickva nickva force-pushed the cloudant:do_not_crash_replicator_on_vdu_failure branch from abe479d to c55856b Oct 2, 2018
@jaydoane
Copy link
Contributor

@jaydoane jaydoane commented Oct 2, 2018

LGTM

$ make eunit skip_deps+=couch_epi apps=couch_replicator suites=couch_replicator_docs tests=update_replicator_doc_with_bad_vdu_test_
    Running test function(s):
      couch_replicator_docs:update_replicator_doc_with_bad_vdu_test_/0
======================== EUnit ========================
couch_replicator_docs:820: t_vdu_does_not_crash_on_save...[0.057 s] ok
=======================================================
  Test passed.
@nickva nickva merged commit 5ee8085 into apache:master Oct 2, 2018
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@nickva nickva deleted the cloudant:do_not_crash_replicator_on_vdu_failure branch Oct 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants