diff options
author | Robert Newson <rnewson@apache.org> | 2018-08-30 18:25:47 +0100 |
---|---|---|
committer | Robert Newson <rnewson@apache.org> | 2018-08-30 18:25:47 +0100 |
commit | cba1a903041cf57e19944f88a64e6d4ef5a60cb0 (patch) | |
tree | 0896cff4489f719a5ee3c4c19e074e6fc1a4bb46 | |
parent | b2b6988e65af7273ddd8b9223b2236c3d182c779 (diff) | |
download | couchdb-create-shards-if-missing.tar.gz |
Create shard files if missingcreate-shards-if-missing
If, when a database is created, it was not possible to create any of
the shard files, the database cannot be used. All requests return a
"No DB shards could be opened." error.
This commit changes fabric_util:get_db/2 to create the shard file if
missing. This is correct as that function has already called
mem3:shards(DbName) which only returns shards if the database exists.
-rw-r--r-- | src/fabric/src/fabric_util.erl | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/fabric/src/fabric_util.erl b/src/fabric/src/fabric_util.erl index dd4b80da6..e622c6aa0 100644 --- a/src/fabric/src/fabric_util.erl +++ b/src/fabric/src/fabric_util.erl @@ -179,7 +179,7 @@ get_db(DbName, Options) -> Nodes = [node()|erlang:nodes()], Live = [S || #shard{node = N} = S <- Shards, lists:member(N, Nodes)], Factor = list_to_integer(config:get("fabric", "shard_timeout_factor", "2")), - get_shard(Live, Options, 100, Factor). + get_shard(Live, [{create_if_missing, true} | Options], 100, Factor). get_shard([], _Opts, _Timeout, _Factor) -> erlang:error({internal_server_error, "No DB shards could be opened."}); |