You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by kx...@apache.org on 2015/02/26 21:31:51 UTC
[2/3] mem3 commit: updated refs/heads/master to ee36909
Add underscore prefix for nodes and dbs database names
That's how we name system databases and there should be no exceptions.
COUCHDB-2619
Project: http://git-wip-us.apache.org/repos/asf/couchdb-mem3/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-mem3/commit/6e3254e8
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-mem3/tree/6e3254e8
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-mem3/diff/6e3254e8
Branch: refs/heads/master
Commit: 6e3254e83c30aeebb941136fe88a9264d455d62c
Parents: c685590
Author: Alexander Shorin <kx...@apache.org>
Authored: Thu Feb 26 21:46:56 2015 +0300
Committer: Alexander Shorin <kx...@apache.org>
Committed: Thu Feb 26 21:56:51 2015 +0300
----------------------------------------------------------------------
src/mem3.erl | 2 +-
src/mem3_nodes.erl | 4 ++--
src/mem3_shards.erl | 8 ++++----
src/mem3_sync.erl | 4 ++--
src/mem3_util.erl | 6 +++---
5 files changed, 12 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-mem3/blob/6e3254e8/src/mem3.erl
----------------------------------------------------------------------
diff --git a/src/mem3.erl b/src/mem3.erl
index bbf8ecd..405d7e5 100644
--- a/src/mem3.erl
+++ b/src/mem3.erl
@@ -89,7 +89,7 @@ shards_int(DbName, Options) when is_list(DbName) ->
shards_int(DbName, Options) ->
Ordered = lists:member(ordered, Options),
ShardDbName =
- list_to_binary(config:get("mem3", "shards_db", "dbs")),
+ list_to_binary(config:get("mem3", "shards_db", "_dbs")),
case DbName of
ShardDbName when Ordered ->
%% shard_db is treated as a single sharded db to support calls to db_info
http://git-wip-us.apache.org/repos/asf/couchdb-mem3/blob/6e3254e8/src/mem3_nodes.erl
----------------------------------------------------------------------
diff --git a/src/mem3_nodes.erl b/src/mem3_nodes.erl
index 00addc4..f31891a 100644
--- a/src/mem3_nodes.erl
+++ b/src/mem3_nodes.erl
@@ -90,7 +90,7 @@ code_change(_OldVsn, #state{}=State, _Extra) ->
%% internal functions
initialize_nodelist() ->
- DbName = config:get("mem3", "nodes_db", "nodes"),
+ DbName = config:get("mem3", "nodes_db", "_nodes"),
{ok, Db} = mem3_util:ensure_exists(DbName),
{ok, _, Db} = couch_btree:fold(Db#db.id_tree, fun first_fold/3, Db, []),
% add self if not already present
@@ -115,7 +115,7 @@ first_fold(#full_doc_info{id=Id}=DocInfo, _, Db) ->
{ok, Db}.
listen_for_changes(Since) ->
- DbName = config:get("mem3", "nodes_db", "nodes"),
+ DbName = config:get("mem3", "nodes_db", "_nodes"),
{ok, Db} = mem3_util:ensure_exists(DbName),
Args = #changes_args{
feed = "continuous",
http://git-wip-us.apache.org/repos/asf/couchdb-mem3/blob/6e3254e8/src/mem3_shards.erl
----------------------------------------------------------------------
diff --git a/src/mem3_shards.erl b/src/mem3_shards.erl
index e8ae3b2..14aed34 100644
--- a/src/mem3_shards.erl
+++ b/src/mem3_shards.erl
@@ -114,7 +114,7 @@ local(DbName) ->
lists:filter(Pred, for_db(DbName)).
fold(Fun, Acc) ->
- DbName = config:get("mem3", "shards_db", "dbs"),
+ DbName = config:get("mem3", "shards_db", "_dbs"),
{ok, Db} = mem3_util:ensure_exists(DbName),
FAcc = {Db, Fun, Acc},
try
@@ -219,13 +219,13 @@ fold_fun(#doc_info{}=DI, _, {Db, UFun, UAcc}) ->
end.
get_update_seq() ->
- DbName = config:get("mem3", "shards_db", "dbs"),
+ DbName = config:get("mem3", "shards_db", "_dbs"),
{ok, Db} = mem3_util:ensure_exists(DbName),
couch_db:close(Db),
Db#db.update_seq.
listen_for_changes(Since) ->
- DbName = config:get("mem3", "shards_db", "dbs"),
+ DbName = config:get("mem3", "shards_db", "_dbs"),
{ok, Db} = mem3_util:ensure_exists(DbName),
Args = #changes_args{
feed = "continuous",
@@ -264,7 +264,7 @@ changes_callback(timeout, _) ->
ok.
load_shards_from_disk(DbName) when is_binary(DbName) ->
- X = ?l2b(config:get("mem3", "shards_db", "dbs")),
+ X = ?l2b(config:get("mem3", "shards_db", "_dbs")),
{ok, Db} = mem3_util:ensure_exists(X),
try
load_shards_from_db(Db, DbName)
http://git-wip-us.apache.org/repos/asf/couchdb-mem3/blob/6e3254e8/src/mem3_sync.erl
----------------------------------------------------------------------
diff --git a/src/mem3_sync.erl b/src/mem3_sync.erl
index fab4303..28a8261 100644
--- a/src/mem3_sync.erl
+++ b/src/mem3_sync.erl
@@ -345,10 +345,10 @@ local_dbs() ->
[nodes_db(), shards_db(), users_db()].
nodes_db() ->
- ?l2b(config:get("mem3", "nodes_db", "nodes")).
+ ?l2b(config:get("mem3", "nodes_db", "_nodes")).
shards_db() ->
- ?l2b(config:get("mem3", "shards_db", "dbs")).
+ ?l2b(config:get("mem3", "shards_db", "_dbs")).
users_db() ->
?l2b(config:get("couch_httpd_auth", "authentication_db", "_users")).
http://git-wip-us.apache.org/repos/asf/couchdb-mem3/blob/6e3254e8/src/mem3_util.erl
----------------------------------------------------------------------
diff --git a/src/mem3_util.erl b/src/mem3_util.erl
index 3937742..ea43473 100644
--- a/src/mem3_util.erl
+++ b/src/mem3_util.erl
@@ -77,12 +77,12 @@ attach_nodes([S | Rest], Acc, [Node | Nodes], UsedNodes) ->
attach_nodes(Rest, [S#shard{node=Node} | Acc], Nodes, [Node | UsedNodes]).
open_db_doc(DocId) ->
- DbName = ?l2b(config:get("mem3", "shards_db", "dbs")),
+ DbName = ?l2b(config:get("mem3", "shards_db", "_dbs")),
{ok, Db} = couch_db:open(DbName, []),
try couch_db:open_doc(Db, DocId, [ejson_body]) after couch_db:close(Db) end.
write_db_doc(Doc) ->
- DbName = ?l2b(config:get("mem3", "shards_db", "dbs")),
+ DbName = ?l2b(config:get("mem3", "shards_db", "_dbs")),
write_db_doc(DbName, Doc, true).
write_db_doc(DbName, #doc{id=Id, body=Body} = Doc, ShouldMutate) ->
@@ -108,7 +108,7 @@ write_db_doc(DbName, #doc{id=Id, body=Body} = Doc, ShouldMutate) ->
delete_db_doc(DocId) ->
gen_server:cast(mem3_shards, {cache_remove, DocId}),
- DbName = ?l2b(config:get("mem3", "shards_db", "dbs")),
+ DbName = ?l2b(config:get("mem3", "shards_db", "_dbs")),
delete_db_doc(DbName, DocId, true).
delete_db_doc(DbName, DocId, ShouldMutate) ->