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:50 UTC

[1/3] mem3 commit: updated refs/heads/master to ee36909

Repository: couchdb-mem3
Updated Branches:
  refs/heads/master 7f59504f0 -> ee36909f0


Rename "shard_db" option to "shards_db" and "node_db" one to "nodes_db"

COUCHDB-2628


Project: http://git-wip-us.apache.org/repos/asf/couchdb-mem3/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-mem3/commit/c6855902
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-mem3/tree/c6855902
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-mem3/diff/c6855902

Branch: refs/heads/master
Commit: c685590243164e6812559ad1bf9d4517f46ab2cd
Parents: 7f59504
Author: Alexander Shorin <kx...@apache.org>
Authored: Thu Feb 26 21:18:30 2015 +0300
Committer: Alexander Shorin <kx...@apache.org>
Committed: Thu Feb 26 21:56:45 2015 +0300

----------------------------------------------------------------------
 src/mem3.erl        | 2 +-
 src/mem3_nodes.erl  | 4 ++--
 src/mem3_shards.erl | 4 ++--
 src/mem3_sync.erl   | 4 ++--
 src/mem3_util.erl   | 6 +++---
 5 files changed, 10 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-mem3/blob/c6855902/src/mem3.erl
----------------------------------------------------------------------
diff --git a/src/mem3.erl b/src/mem3.erl
index 5b7f640..bbf8ecd 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", "shard_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/c6855902/src/mem3_nodes.erl
----------------------------------------------------------------------
diff --git a/src/mem3_nodes.erl b/src/mem3_nodes.erl
index 75d336f..00addc4 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", "node_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", "node_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/c6855902/src/mem3_shards.erl
----------------------------------------------------------------------
diff --git a/src/mem3_shards.erl b/src/mem3_shards.erl
index 6d67770..e8ae3b2 100644
--- a/src/mem3_shards.erl
+++ b/src/mem3_shards.erl
@@ -131,7 +131,7 @@ set_max_size(Size) when is_integer(Size), Size > 0 ->
 handle_config_change("mem3", "shard_cache_size", SizeList, _, _) ->
     Size = list_to_integer(SizeList),
     {ok, gen_server:call(?MODULE, {set_max_size, Size}, infinity)};
-handle_config_change("mem3", "shard_db", _DbName, _, _) ->
+handle_config_change("mem3", "shards_db", _DbName, _, _) ->
     {ok, gen_server:call(?MODULE, shard_db_changed, infinity)};
 handle_config_change(_, _, _, _, _) ->
     {ok, nil}.
@@ -264,7 +264,7 @@ changes_callback(timeout, _) ->
     ok.
 
 load_shards_from_disk(DbName) when is_binary(DbName) ->
-    X = ?l2b(config:get("mem3", "shard_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/c6855902/src/mem3_sync.erl
----------------------------------------------------------------------
diff --git a/src/mem3_sync.erl b/src/mem3_sync.erl
index 1e5b505..fab4303 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", "node_db", "nodes")).
+    ?l2b(config:get("mem3", "nodes_db", "nodes")).
 
 shards_db() ->
-    ?l2b(config:get("mem3", "shard_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/c6855902/src/mem3_util.erl
----------------------------------------------------------------------
diff --git a/src/mem3_util.erl b/src/mem3_util.erl
index e19bf33..3937742 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", "shard_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", "shard_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", "shard_db", "dbs")),
+    DbName = ?l2b(config:get("mem3", "shards_db", "dbs")),
     delete_db_doc(DbName, DocId, true).
 
 delete_db_doc(DbName, DocId, ShouldMutate) ->


[3/3] mem3 commit: updated refs/heads/master to ee36909

Posted by kx...@apache.org.
Merge remote-tracking branch 'kxepal/rename-system-databases'

This closes #6


Project: http://git-wip-us.apache.org/repos/asf/couchdb-mem3/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-mem3/commit/ee36909f
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-mem3/tree/ee36909f
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-mem3/diff/ee36909f

Branch: refs/heads/master
Commit: ee36909f0e3064e02301637c5273c1cbd1eea786
Parents: 7f59504 6e3254e
Author: Alexander Shorin <kx...@apache.org>
Authored: Thu Feb 26 23:27:20 2015 +0300
Committer: Alexander Shorin <kx...@apache.org>
Committed: Thu Feb 26 23:27:20 2015 +0300

----------------------------------------------------------------------
 src/mem3.erl        |  2 +-
 src/mem3_nodes.erl  |  4 ++--
 src/mem3_shards.erl | 10 +++++-----
 src/mem3_sync.erl   |  4 ++--
 src/mem3_util.erl   |  6 +++---
 5 files changed, 13 insertions(+), 13 deletions(-)
----------------------------------------------------------------------



[2/3] mem3 commit: updated refs/heads/master to ee36909

Posted by kx...@apache.org.
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) ->