Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 59842200C36 for ; Fri, 10 Mar 2017 17:18:47 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 581B1160B82; Fri, 10 Mar 2017 16:18:47 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id A31E3160B69 for ; Fri, 10 Mar 2017 17:18:46 +0100 (CET) Received: (qmail 45656 invoked by uid 500); 10 Mar 2017 16:18:45 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 45639 invoked by uid 99); 10 Mar 2017 16:18:45 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 10 Mar 2017 16:18:45 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id BE326DFD9E; Fri, 10 Mar 2017 16:18:45 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: vatamane@apache.org To: commits@couchdb.apache.org Date: Fri, 10 Mar 2017 16:18:45 -0000 Message-Id: <7a778e78a29c430b96006c1252342f27@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/2] couch-replicator commit: updated refs/heads/master to d00b981 archived-at: Fri, 10 Mar 2017 16:18:47 -0000 Repository: couchdb-couch-replicator Updated Branches: refs/heads/master 46aa27fa6 -> d00b98144 Revert "Don't scan empty replicator databases" This reverts commit 46aa27fa674a4c1e590aeecd76123e4f91d78fd5. 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/f63efa78 Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/tree/f63efa78 Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/diff/f63efa78 Branch: refs/heads/master Commit: f63efa786fec5cc40e6c6193470399da99385abf Parents: 46aa27f Author: Nick Vatamaniuc Authored: Fri Mar 10 01:13:28 2017 -0500 Committer: Nick Vatamaniuc Committed: Fri Mar 10 01:13:28 2017 -0500 ---------------------------------------------------------------------- src/couch_replicator_manager.erl | 46 +++-------------------------------- 1 file changed, 3 insertions(+), 43 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/f63efa78/src/couch_replicator_manager.erl ---------------------------------------------------------------------- diff --git a/src/couch_replicator_manager.erl b/src/couch_replicator_manager.erl index 9f17087..2bcad69 100644 --- a/src/couch_replicator_manager.erl +++ b/src/couch_replicator_manager.erl @@ -266,17 +266,9 @@ handle_cast({resume_scan, DbName}, State) -> end, true = ets:insert(?DB_TO_SEQ, {DbName, Since, false}), ensure_rep_ddoc_exists(DbName), - case has_replication_docs(DbName) of - false -> - %% the database is empty save for the rep_ddoc, - %% don't bother scanning it. - couch_log:debug("ignoring empty ~s", [DbName]), - Pids; - true -> - Pid = start_changes_reader(DbName, Since, State#state.epoch), - couch_log:debug("Scanning ~s from update_seq ~p", [DbName, Since]), - [{DbName, Pid} | Pids] - end + Pid = start_changes_reader(DbName, Since, State#state.epoch), + couch_log:debug("Scanning ~s from update_seq ~p", [DbName, Since]), + [{DbName, Pid} | Pids] end, {noreply, State#state{rep_start_pids = NewPids}}; @@ -1013,38 +1005,6 @@ get_json_value(Key, Props, Default) when is_binary(Key) -> end. -has_replication_docs(DbName) -> - {ok, Db} = couch_db:open(DbName, []), - try - case couch_db:get_doc_count(Db) of - {ok, 0} -> - false; - {ok, 1} -> - case first_doc_id(Db) of - <<"_design/_replicator">> -> - false; - _Else -> - true - end; - _Else -> - true - end - after - couch_db:close(Db) - end. - - -first_doc_id(#db{} = Db) -> - Fun = fun - (#full_doc_info{deleted = true}, _Reds, Acc) -> - {ok, Acc}; - (FDI, _Reds, _Acc) -> - {stop, FDI#full_doc_info.id} - end, - {ok, _, Id} = couch_btree:fold(Db#db.id_tree, Fun, nil, []), - Id. - - -ifdef(TEST). -include_lib("couch/include/couch_eunit.hrl").