couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnew...@apache.org
Subject [2/5] couch-replicator commit: updated refs/heads/pu to 4965655
Date Thu, 01 May 2014 11:40:45 GMT
Simplify _replicator DB check

This version simply checks that the DB in question has a name that ends
in /_replicator (or is just _replicator).  It allows for the possibility
that foo/_replicator is treated as a _replicator DB.

BugzID: 23315

Conflicts:
	src/couch_replicator_manager.erl


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

Branch: refs/heads/pu
Commit: abd3d9d9aad01dac2937b5c17c9e9e71b39a30c1
Parents: afb00a3
Author: Adam Kocoloski <adam@cloudant.com>
Authored: Tue Oct 15 17:23:45 2013 -0400
Committer: Robert Newson <rnewson@apache.org>
Committed: Tue Apr 29 16:24:27 2014 +0100

----------------------------------------------------------------------
 src/couch_replicator_manager.erl | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/abd3d9d9/src/couch_replicator_manager.erl
----------------------------------------------------------------------
diff --git a/src/couch_replicator_manager.erl b/src/couch_replicator_manager.erl
index b8a7447..99cf786 100644
--- a/src/couch_replicator_manager.erl
+++ b/src/couch_replicator_manager.erl
@@ -868,13 +868,14 @@ scan_all_dbs(Server) when is_pid(Server) ->
     couch_db:close(Db).
 
 is_replicator_db_fun() ->
-    {ok, RegExp} = re:compile("^([a-z][a-z0-9\\_\\$()\\+\\-\\/]*/)?_replicator$"),
-    fun
-        (<<"shards/", _/binary>>=DbName) ->
-            match =:= re:run(mem3:dbname(DbName), RegExp, [{capture,none}]);
-        (DbName) ->
-            LocalRepDb = ?l2b(config:get("replicator", "db", "_replicator")),
-            DbName == LocalRepDb
+    fun(Name) ->
+        DbName = mem3:dbname(Name),
+        case lists:last(binary:split(DbName, <<"/">>, [global])) of
+            <<"_replicator">> ->
+                true;
+            _ ->
+                false
+        end
     end.
 
 get_json_value(Key, Props) ->


Mime
View raw message