summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Vatamaniuc <vatamane@apache.org>2019-10-10 11:48:57 -0400
committerNick Vatamaniuc <nickva@users.noreply.github.com>2019-10-10 15:05:26 -0400
commit28edf6afc7b45cb2af50342b846e4345bdb67045 (patch)
tree6a3be5bf9b32f11ec0a77c3aadcc4eb7a55184fa
parente5b590617c839b4005dc7cbcdefc6e97caec4558 (diff)
downloadcouchdb-28edf6afc7b45cb2af50342b846e4345bdb67045.tar.gz
Stop creating node local _replicator db
We don't support "local" replications in 3.x so there is not need to waste resources creating this db on every node, and then continuously listening for replication doc updates from it.
-rw-r--r--src/couch_replicator/README.md8
-rw-r--r--src/couch_replicator/src/couch_replicator.erl9
-rw-r--r--src/couch_replicator/src/couch_replicator_docs.erl15
-rw-r--r--src/couch_replicator/src/couch_replicator_sup.erl9
4 files changed, 0 insertions, 41 deletions
diff --git a/src/couch_replicator/README.md b/src/couch_replicator/README.md
index 9822f27bd..6a2a5cfdd 100644
--- a/src/couch_replicator/README.md
+++ b/src/couch_replicator/README.md
@@ -278,14 +278,6 @@ A description of each child:
of replications running, having each one checking their filter often is
not a good idea.
- * `couch_replicator`: This is an unusual but useful pattern. This child is not
- an actual process but a one-time call to the
- `couch_replicator:ensure_rep_db_exists/0` function, executed by the
- supervisor in the correct order (and monitored for crashes). This ensures
- the local replicator db exists, then returns `ignore`. This pattern is
- useful for doing setup-like things at the top level and in the correct order
- regarding the rest of the children in the supervisor.
-
* `couch_replicator_db_changes`: This process specializes and configures
`couch_multidb_changes` so that it looks for `_replicator` suffixed shards
and makes sure to restart it when node membership changes.
diff --git a/src/couch_replicator/src/couch_replicator.erl b/src/couch_replicator/src/couch_replicator.erl
index 9c7e318b6..f3cd56489 100644
--- a/src/couch_replicator/src/couch_replicator.erl
+++ b/src/couch_replicator/src/couch_replicator.erl
@@ -14,7 +14,6 @@
-export([
replicate/2,
- ensure_rep_db_exists/0,
replication_states/0,
job/1,
doc/3,
@@ -79,14 +78,6 @@ replicate(PostBody, Ctx) ->
end.
-% This is called from supervisor. Must respect supervisor protocol so
-% it returns `ignore`.
--spec ensure_rep_db_exists() -> ignore.
-ensure_rep_db_exists() ->
- {ok, _Db} = couch_replicator_docs:ensure_rep_db_exists(),
- ignore.
-
-
-spec do_replication_loop(#rep{}) ->
{ok, {continuous, binary()}} | {ok, tuple()} | {error, any()}.
do_replication_loop(#rep{id = {BaseId, Ext} = Id, options = Options} = Rep) ->
diff --git a/src/couch_replicator/src/couch_replicator_docs.erl b/src/couch_replicator/src/couch_replicator_docs.erl
index e23344122..d097a16c1 100644
--- a/src/couch_replicator/src/couch_replicator_docs.erl
+++ b/src/couch_replicator/src/couch_replicator_docs.erl
@@ -20,7 +20,6 @@
parse_rep_doc_without_id/2,
before_doc_update/3,
after_doc_read/2,
- ensure_rep_db_exists/0,
ensure_rep_ddoc_exists/1,
ensure_cluster_rep_ddoc_exists/1,
remove_state_fields/2,
@@ -121,20 +120,6 @@ update_error(#rep{db_name = DbName, doc_id = DocId, id = RepId}, Error) ->
ok.
--spec ensure_rep_db_exists() -> {ok, Db::any()}.
-ensure_rep_db_exists() ->
- Db = case couch_db:open_int(?REP_DB_NAME, [?CTX, sys_db,
- nologifmissing]) of
- {ok, Db0} ->
- Db0;
- _Error ->
- {ok, Db0} = couch_db:create(?REP_DB_NAME, [?CTX, sys_db]),
- Db0
- end,
- ok = ensure_rep_ddoc_exists(?REP_DB_NAME),
- {ok, Db}.
-
-
-spec ensure_rep_ddoc_exists(binary()) -> ok.
ensure_rep_ddoc_exists(RepDb) ->
case mem3:belongs(RepDb, ?REP_DESIGN_DOC) of
diff --git a/src/couch_replicator/src/couch_replicator_sup.erl b/src/couch_replicator/src/couch_replicator_sup.erl
index 5475e8f37..cd4512c54 100644
--- a/src/couch_replicator/src/couch_replicator_sup.erl
+++ b/src/couch_replicator/src/couch_replicator_sup.erl
@@ -62,15 +62,6 @@ init(_Args) ->
brutal_kill,
worker,
[couch_replicator_doc_processor]},
- {couch_replicator,
- % This is a simple function call which does not create a process
- % but returns `ignore`. It is used to make sure each node
- % has a local `_replicator` database.
- {couch_replicator, ensure_rep_db_exists, []},
- transient,
- brutal_kill,
- worker,
- [couch_replicator]},
{couch_replicator_db_changes,
{couch_replicator_db_changes, start_link, []},
permanent,