You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by rnewson <gi...@git.apache.org> on 2017/03/09 18:05:35 UTC

[GitHub] couchdb-couch-replicator pull request #62: Don't scan empty replicator datab...

GitHub user rnewson opened a pull request:

    https://github.com/apache/couchdb-couch-replicator/pull/62

    Don't scan empty replicator databases

    Every account gets a _replicator database created by default, the
    burden of scanning them all is considerable.
    
    Don't start a changes reader if the database is empty (excluding the
    injected _design/replicator design document)
    
    BugzID: 84311

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/cloudant/couchdb-couch-replicator 84311-skip-empty-replicator-dbs

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/couchdb-couch-replicator/pull/62.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #62
    
----
commit 57e176219cbe10f73480ec187d166df8d3206002
Author: Robert Newson <rn...@apache.org>
Date:   2017-03-09T18:03:14Z

    Don't scan empty replicator databases
    
    Every account gets a _replicator database created by default, the
    burden of scanning them all is considerable.
    
    Don't start a changes reader if the database is empty (excluding the
    injected _design/replicator design document)
    
    BugzID: 84311

----


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-couch-replicator pull request #62: Don't scan empty replicator datab...

Posted by eiri <gi...@git.apache.org>.
Github user eiri commented on a diff in the pull request:

    https://github.com/apache/couchdb-couch-replicator/pull/62#discussion_r105246600
  
    --- 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 --
    
    for educational purposes, is this more efficient than `couch_btree:lookup(Db#db.id_tree, [<<"_design/_replicator">>])` ?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-couch-replicator pull request #62: Don't scan empty replicator datab...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/couchdb-couch-replicator/pull/62


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-couch-replicator issue #62: Don't scan empty replicator databases

Posted by nickva <gi...@git.apache.org>.
Github user nickva commented on the issue:

    https://github.com/apache/couchdb-couch-replicator/pull/62
  
    +1
    
    Tested it seems to work well.
    
    Log shows
    ```
    ignoring empty shards/80000000-9fffffff/blah/_replicator.1489084820
    ```



---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-couch-replicator pull request #62: Don't scan empty replicator datab...

Posted by eiri <gi...@git.apache.org>.
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---