Github user eiri commented on a diff in the pull request:
https://github.com/apache/couchdb-couch-replicator/pull/62#discussion_r105249451
--- Diff: src/couch_replicator_manager.erl ---
@@ -1005,6 +1013,38 @@ 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) ->
--- End diff --
ah, yes, it is, lookup would have to walk the whole tree
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---