Revert "Don't scan empty replicator databases"
This reverts commit 46aa27fa674a4c1e590aeecd76123e4f91d78fd5.
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 @@
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 @@
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").