Github user iilyak commented on a diff in the pull request:

    
https://github.com/apache/couchdb-couch-replicator/pull/52#discussion_r97556211
  
    --- Diff: src/couch_replicator_manager.erl ---
    @@ -931,24 +931,34 @@ strip_credentials({Props}) ->
         {lists:keydelete(<<"oauth">>, 1, Props)}.
     
     scan_all_dbs(Server) when is_pid(Server) ->
    -    Root = config:get("couchdb", "database_dir", "."),
    -    NormRoot = couch_util:normpath(Root),
    -    filelib:fold_files(Root, "_replicator(\\.[0-9]{10,})?.couch$", true,
    -        fun(Filename, Acc) ->
    -       % shamelessly stolen from couch_server.erl
    -            NormFilename = couch_util:normpath(Filename),
    -            case NormFilename -- NormRoot of
    -                [$/ | RelativeFilename] -> ok;
    -                RelativeFilename -> ok
    -            end,
    -            DbName = ?l2b(filename:rootname(RelativeFilename, ".couch")),
    -            Jitter = jitter(Acc),
    -            spawn_link(fun() ->
    -                timer:sleep(Jitter),
    -                gen_server:cast(Server, {resume_scan, DbName})
    -            end),
    -       Acc + 1
    -   end, 1).
    +    {ok, Db} = mem3_util:ensure_exists(
    +        config:get("mem3", "shard_db", "dbs")),
    +    ChangesFun = couch_changes:handle_changes(#changes_args{}, nil, Db, 
nil),
    +    ChangesFun(fun({change, {Change}, _}, _) ->
    +        DbName = couch_util:get_value(<<"id">>, Change),
    +        case DbName of <<"_design/", _/binary>> -> ok; _Else ->
    +            case couch_replicator_utils:is_deleted(Change) of
    +            true ->
    +                ok;
    +            false ->
    +                [gen_server:cast(Server, {resume_scan, ShardName})
    --- End diff --
    
    I stopped here for a bit because original code calls resume_scan for the 
DbName and not ShardName. However we don't use fabric here and open shards 
directly. It looks good to me. 


---
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.
---

Reply via email to