diff options
author | Nick Vatamaniuc <vatamane@apache.org> | 2017-09-28 15:17:10 -0400 |
---|---|---|
committer | Nick Vatamaniuc <nickva@users.noreply.github.com> | 2017-09-28 15:58:47 -0400 |
commit | b756b77f414707b6ead79e0595702786cfef1c39 (patch) | |
tree | 81f028bc6193aea8be5b749128f06f196eb123b0 | |
parent | 2684561e38378ee084d25ce09634c6ef783ea5ac (diff) | |
download | couchdb-b756b77f414707b6ead79e0595702786cfef1c39.tar.gz |
Replace replication start multi-line log statement
Use a shorter and more informative single line string:
```
Starting replication f9a503bf456a4779fd07901a6dbdb501+continuous+create_target (http://adm:*****@127.0.0.1:15984/a/ -> http://adm:*****@127.0.0.1:15984/bar/) from doc _replicator:my_rep2 worker_procesess:4 worker_batch_size:500 session_id:b4df2a53e33fb6441d82a584a8888f85
```
For replication from _replicate endpoint, doc info is skipped and it is clearly
indicated a `_replicate` replication:
```
Starting replication aa0aa3244d7886842189980108178651+continuous+create_target (http://adm:*****@localhost:15984/a/ -> http://adm:*****@localhost:15984/t/) from _replicate endpoint worker_procesess:4 worker_batch_size:500 session_id:6fee11dafc3d8efa6497c67ecadac35d
```
Also remove redundant `starting new replication...` log.
-rw-r--r-- | src/couch_replicator/src/couch_replicator_scheduler_job.erl | 47 |
1 files changed, 26 insertions, 21 deletions
diff --git a/src/couch_replicator/src/couch_replicator_scheduler_job.erl b/src/couch_replicator/src/couch_replicator_scheduler_job.erl index bc7438757..e7ce576f4 100644 --- a/src/couch_replicator/src/couch_replicator_scheduler_job.erl +++ b/src/couch_replicator/src/couch_replicator_scheduler_job.erl @@ -95,8 +95,6 @@ start_link(#rep{id = {BaseId, Ext}, source = Src, target = Tgt} = Rep) -> case gen_server:start_link(ServerName, ?MODULE, Rep, []) of {ok, Pid} -> - couch_log:notice("starting new replication `~s` at ~p (`~s` -> `~s`)", - [RepChildId, Pid, Source, Target]), {ok, Pid}; {error, Reason} -> couch_log:warning("failed to start replication `~s` (`~s` -> `~s`)", @@ -184,24 +182,7 @@ do_init(#rep{options = Options, id = {BaseId, Ext}, user_ctx=UserCtx} = Rep) -> % cancel_replication/1) and then start the replication again, but this is % unfortunately not immune to race conditions. - couch_log:notice("Replication `~p` is using:~n" - "~c~p worker processes~n" - "~ca worker batch size of ~p~n" - "~c~p HTTP connections~n" - "~ca connection timeout of ~p milliseconds~n" - "~c~p retries per request~n" - "~csocket options are: ~s~s", - [BaseId ++ Ext, $\t, NumWorkers, $\t, BatchSize, $\t, - MaxConns, $\t, get_value(connection_timeout, Options), - $\t, get_value(retries, Options), - $\t, io_lib:format("~p", [get_value(socket_options, Options)]), - case StartSeq of - ?LOWEST_SEQ -> - ""; - _ -> - io_lib:format("~n~csource start sequence ~p", [$\t, StartSeq]) - end]), - + log_replication_start(State), couch_log:debug("Worker pids are: ~p", [Workers]), doc_update_triggered(Rep), @@ -465,7 +446,6 @@ format_status(_Opt, [_PDict, State]) -> #rep{ id = RepId, options = Options, - type = Type, doc_id = DocId, db_name = DbName } = RepDetails, @@ -1043,6 +1023,31 @@ replication_start_error(Error) -> Error. +log_replication_start(#rep_state{rep_details = Rep} = RepState) -> + #rep{ + id = {BaseId, Ext}, + doc_id = DocId, + db_name = DbName, + options = Options + } = Rep, + Id = BaseId ++ Ext, + Workers = get_value(worker_processes, Options), + BatchSize = get_value(worker_batch_size, Options), + #rep_state{ + source_name = Source, % credentials already stripped + target_name = Target, % credentials already stripped + session_id = Sid + } = RepState, + From = case DbName of + ShardName when is_binary(ShardName) -> + io_lib:format("from doc ~s:~s", [mem3:dbname(ShardName), DocId]); + _ -> + "from _replicate endpoint" + end, + Msg = "Starting replication ~s (~s -> ~s) ~s worker_procesess:~p" + " worker_batch_size:~p session_id:~s", + couch_log:notice(Msg, [Id, Source, Target, From, Workers, BatchSize, Sid]). + -ifdef(TEST). |