Repository: couchdb-setup Updated Branches: refs/heads/master 372dd8be0 -> ecb601b20
Create _global_changes database on cluster setup Project: http://git-wip-us.apache.org/repos/asf/couchdb-setup/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-setup/commit/ecb601b2 Tree: http://git-wip-us.apache.org/repos/asf/couchdb-setup/tree/ecb601b2 Diff: http://git-wip-us.apache.org/repos/asf/couchdb-setup/diff/ecb601b2 Branch: refs/heads/master Commit: ecb601b2004f33f396530a6ae974f2f0bff4d816 Parents: 372dd8b Author: Alexander Shorin <[email protected]> Authored: Sat Apr 18 22:41:39 2015 +0300 Committer: Alexander Shorin <[email protected]> Committed: Sat Apr 18 23:54:38 2015 +0300 ---------------------------------------------------------------------- src/setup.erl | 20 +++++++++++--------- test/t.sh | 2 ++ 2 files changed, 13 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-setup/blob/ecb601b2/src/setup.erl ---------------------------------------------------------------------- diff --git a/src/setup.erl b/src/setup.erl index 95b2a41..1943835 100644 --- a/src/setup.erl +++ b/src/setup.erl @@ -43,16 +43,20 @@ is_cluster_enabled() -> {_,[]} -> no; {_,_} -> ok end. + + +cluster_system_dbs() -> + ["_users", "_replicator", "_metadata", "_global_changes"]. has_cluster_system_dbs() -> - % GET /_users /_replicator /_metadata + has_cluster_system_dbs(cluster_system_dbs()). - case catch { - fabric:get_db_info("_users"), - fabric:get_db_info("_replicator"), - fabric:get_db_info("_metadata")} of - {{ok, _}, {ok, _}, {ok, _}} -> ok; +has_cluster_system_dbs([]) -> + ok; +has_cluster_system_dbs([Db|Dbs]) -> + case catch fabric:get_db_info(Db) of + {ok, _} -> has_cluster_system_dbs(Dbs); _ -> no end. @@ -115,9 +119,7 @@ finish_cluster() -> finish_cluster_int(ok) -> {error, cluster_finished}; finish_cluster_int(no) -> - % create clustered databases (_users, _replicator, _metadata) - Databases = ["_users", "_replicator", "_metadata"], - lists:foreach(fun fabric:create_db/1, Databases). + lists:foreach(fun fabric:create_db/1, cluster_system_dbs()). add_node(Options) -> http://git-wip-us.apache.org/repos/asf/couchdb-setup/blob/ecb601b2/test/t.sh ---------------------------------------------------------------------- diff --git a/test/t.sh b/test/t.sh index f6e0422..62abb61 100755 --- a/test/t.sh +++ b/test/t.sh @@ -49,10 +49,12 @@ curl a:[email protected]:15984/_cluster_setup -d '{"action":"finish_cluster"}' $HEADER curl a:[email protected]:15984/_users curl a:[email protected]:15984/_replicator curl a:[email protected]:15984/_metadata +curl a:[email protected]:15984/_global_changes # Show system dbs exist on node B curl a:[email protected]:25984/_users curl a:[email protected]:25984/_replicator curl a:[email protected]:25984/_metadata +curl a:[email protected]:25984/_global_changes echo "YAY ALL GOOD"
