You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by mi...@apache.org on 2014/09/16 19:50:01 UTC
[1/2] mem3 commit: updated refs/heads/wip-cleanup-mem3_rebalance to
27cd2a4
Repository: couchdb-mem3
Updated Branches:
refs/heads/wip-cleanup-mem3_rebalance [created] 27cd2a420
Make mem3_rebalance work with Apache CouchDB
This commit updates mem3_rebalance to work with Apache CouchDB.
- Return node shortname and hostname instead of node number and
cluster name if node doesn't match the dbcore regex when
printing.
- Return the full dbname as one string.
BugzID: 34238
Project: http://git-wip-us.apache.org/repos/asf/couchdb-mem3/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-mem3/commit/27cd2a42
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-mem3/tree/27cd2a42
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-mem3/diff/27cd2a42
Branch: refs/heads/wip-cleanup-mem3_rebalance
Commit: 27cd2a4202f4f868e98b2940e51eb3790be1d92e
Parents: 81d4efa
Author: Mike Wallace <mi...@googlemail.com>
Authored: Fri Sep 5 18:08:14 2014 +0100
Committer: Mike Wallace <mi...@apache.org>
Committed: Mon Sep 15 14:50:48 2014 +0100
----------------------------------------------------------------------
src/mem3_rebalance.erl | 44 ++++++++++++++++++++++++++++++--------------
1 file changed, 30 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-mem3/blob/27cd2a42/src/mem3_rebalance.erl
----------------------------------------------------------------------
diff --git a/src/mem3_rebalance.erl b/src/mem3_rebalance.erl
index 2111e69..c9ca4c8 100644
--- a/src/mem3_rebalance.erl
+++ b/src/mem3_rebalance.erl
@@ -475,30 +475,46 @@ view_cb({row, Row}, Acc) ->
view_cb(complete, Acc) ->
{ok, lists:reverse(Acc)}.
-print({Op, Shard, TargetNode} = Operation) ->
- {match, [SourceId, Cluster]} = re:run(
- atom_to_list(Shard#shard.node),
- "dbcore@db(?<node>[0-9]+)\.(?<cluster>[a-z0-9]+)\.cloudant.net",
+get_node_and_host(NodeName) ->
+ re:run(
+ atom_to_list(NodeName),
+ "(?<node>[a-zA-Z0-9]+)@(?<host>[0-9]+\.[a-z0-9]+\..*)",
[{capture, all_but_first, binary}]
- ),
- {match, [TargetId, Cluster]} = re:run(
- atom_to_list(TargetNode),
+ ).
+
+get_id_and_cluster(NodeName) ->
+ re:run(
+ atom_to_list(NodeName),
"dbcore@db(?<node>[0-9]+)\.(?<cluster>[a-z0-9]+)\.cloudant.net",
[{capture, all_but_first, binary}]
- ),
- {match, [Range, Account, DbName]} = re:run(
+ ).
+
+print({Op, Shard, TargetNode} = Operation) ->
+ {match, [SourceId, Cluster]} = case get_id_and_cluster(Shard#shard.node) of
+ {match, _}=Match ->
+ Match;
+ _ ->
+ get_node_and_host(Shard#shard.node)
+ end,
+ {match, [TargetId, Cluster]} = case get_id_and_cluster(TargetNode) of
+ {match, _}=Match1 ->
+ Match1;
+ _ ->
+ get_node_and_host(TargetNode)
+ end,
+ {match, [Range, DbName]} = re:run(
Shard#shard.name,
- "shards/(?<range>[0-9a-f\-]+)/(?<account>.+)/(?<dbname>[a-z\\_][a-z0-9\\_\\$()\\+\\-\\/]+)\.[0-9]{8}",
+ "shards/(?<range>[0-9a-f\-]+)/(?<dbname>[a-z\\_][a-z0-9\\_\\$()\\+\\-\\/]+)\.[0-9]{8}",
[{capture, all_but_first, binary}]
),
OpName = case Op of move -> move2; _ -> Op end,
case get(fd) of
undefined ->
- io:format("clou shard ~s ~s ~s ~s ~s ~s ~s~n", [OpName,
- Cluster, Account, DbName, Range, SourceId, TargetId]);
+ io:format("clou shard ~s ~s ~s ~s ~s ~s~n", [OpName,
+ Cluster, DbName, Range, SourceId, TargetId]);
FD ->
- io:format(FD, "clou shard ~s ~s ~s ~s ~s ~s ~s~n", [OpName,
- Cluster, Account, DbName, Range, SourceId, TargetId])
+ io:format(FD, "clou shard ~s ~s ~s ~s ~s ~s~n", [OpName,
+ Cluster, DbName, Range, SourceId, TargetId])
end,
Operation;
[2/2] mem3 commit: updated refs/heads/wip-cleanup-mem3_rebalance to
27cd2a4
Posted by mi...@apache.org.
Fix arguments in call to couch_mrview:query_view/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/81d4efae
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-mem3/tree/81d4efae
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-mem3/diff/81d4efae
Branch: refs/heads/wip-cleanup-mem3_rebalance
Commit: 81d4efaeccb3ebfdc395244706ebe2e9bd5f7c73
Parents: be49046
Author: Mike Wallace <mi...@apache.org>
Authored: Mon Sep 15 14:49:47 2014 +0100
Committer: Mike Wallace <mi...@apache.org>
Committed: Mon Sep 15 14:50:48 2014 +0100
----------------------------------------------------------------------
src/mem3_rebalance.erl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-mem3/blob/81d4efae/src/mem3_rebalance.erl
----------------------------------------------------------------------
diff --git a/src/mem3_rebalance.erl b/src/mem3_rebalance.erl
index 1c1ed64..2111e69 100644
--- a/src/mem3_rebalance.erl
+++ b/src/mem3_rebalance.erl
@@ -462,7 +462,7 @@ shard_count_view() ->
Fold = fun view_cb/2,
Args = [{group_level, exact}],
{ok, Map} = couch_mrview:query_view(
- Db, DDocId, <<"count_by_node">>, Fold, [], Args),
+ Db, DDocId, <<"count_by_node">>, Args, Fold, []),
erlang:put(shard_count_by_node, {os:timestamp(), Map}),
Map.