You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by va...@apache.org on 2017/03/03 15:50:21 UTC

[1/2] couch-replicator commit: updated refs/heads/master to 50a88ba

Repository: couchdb-couch-replicator
Updated Branches:
  refs/heads/master 7a2b2b68b -> 50a88baaf


Make sure to log db as well as doc in replicator logs.

COUCHDB-3316


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/commit/50dcd7d7
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/tree/50dcd7d7
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/diff/50dcd7d7

Branch: refs/heads/master
Commit: 50dcd7d7c5f7ce003e8e2fc84646c1aa9931ebaa
Parents: 7a2b2b6
Author: Nick Vatamaniuc <va...@apache.org>
Authored: Thu Mar 2 19:12:47 2017 -0500
Committer: Nick Vatamaniuc <va...@apache.org>
Committed: Thu Mar 2 19:12:47 2017 -0500

----------------------------------------------------------------------
 src/couch_replicator_manager.erl | 55 ++++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/50dcd7d7/src/couch_replicator_manager.erl
----------------------------------------------------------------------
diff --git a/src/couch_replicator_manager.erl b/src/couch_replicator_manager.erl
index c9c0a68..2bcad69 100644
--- a/src/couch_replicator_manager.erl
+++ b/src/couch_replicator_manager.erl
@@ -93,8 +93,8 @@ replication_started(#rep{id = {BaseId, _} = RepId}) ->
             {<<"_replication_id">>, ?l2b(BaseId)},
             {<<"_replication_stats">>, undefined}]),
         ok = gen_server:call(?MODULE, {rep_started, RepId}, infinity),
-        couch_log:notice("Document `~s` triggered replication `~s`",
-            [DocId, pp_rep_id(RepId)])
+        couch_log:notice("Document `~s` from `~s` triggered replication `~s`",
+            [DocId, DbName, pp_rep_id(RepId)])
     end.
 
 
@@ -108,8 +108,8 @@ replication_completed(#rep{id = RepId}, Stats) ->
             {<<"_replication_state_reason">>, undefined},
             {<<"_replication_stats">>, {Stats}}]),
         ok = gen_server:call(?MODULE, {rep_complete, RepId}, infinity),
-        couch_log:notice("Replication `~s` finished (triggered by document `~s`)",
-            [pp_rep_id(RepId), DocId])
+        couch_log:notice("Replication `~s` finished (triggered by document `~s`"
+            " from `~s`)", [pp_rep_id(RepId), DocId, DbName])
     end.
 
 
@@ -117,10 +117,10 @@ replication_usurped(#rep{id = RepId}, By) ->
     case rep_state(RepId) of
     nil ->
         ok;
-    #rep_state{rep = #rep{doc_id = DocId}} ->
+    #rep_state{rep = #rep{db_name = DbName, doc_id = DocId}} ->
         ok = gen_server:call(?MODULE, {rep_complete, RepId}, infinity),
-        couch_log:notice("Replication `~s` usurped by ~s (triggered by document `~s`)",
-            [pp_rep_id(RepId), By, DocId])
+        couch_log:notice("Replication `~s` usurped by ~s (triggered by document"
+            " `~s` from `~s`)", [pp_rep_id(RepId), By, DocId, DbName])
     end.
 
 
@@ -461,10 +461,11 @@ process_update(State, DbName, {Change}) ->
         rep_doc_deleted(DbName, DocId),
         State;
     {Owner, false} when Owner /= node() ->
-        couch_log:notice("Not starting '~s' as owner is ~s.", [DocId, Owner]),
+        couch_log:notice("Not starting '~s' from '~s' as owner is ~s.",
+            [DocId, DbName, Owner]),
         State;
     {_Owner, false} ->
-        couch_log:notice("Maybe starting '~s' as I'm the owner", [DocId]),
+        couch_log:notice("Maybe starting '~s' from '~s' as I'm the owner", [DocId, DbName]),
         case get_json_value(<<"_replication_state">>, RepProps) of
         undefined ->
             maybe_start_replication(State, DbName, DocId, JsonRepDoc);
@@ -497,8 +498,8 @@ rep_db_update_error(Error, DbName, DocId) ->
     _ ->
         Reason = to_binary(Error)
     end,
-    couch_log:error("Replication manager, error processing document `~s`: ~s",
-        [DocId, Reason]),
+    couch_log:error("Replication manager, error processing document `~s`"
+        " from `~s`: ~s", [DocId, DbName, Reason]),
     update_rep_doc(DbName, DocId, [{<<"_replication_state">>, <<"error">>},
                            {<<"_replication_state_reason">>, Reason}]).
 
@@ -528,8 +529,8 @@ maybe_start_replication(State, DbName, DocId, RepDoc) ->
         },
         true = ets:insert(?REP_TO_STATE, {RepId, RepState}),
         true = ets:insert(?DOC_TO_REP, {{DbName, DocId}, RepId}),
-        couch_log:notice("Attempting to start replication `~s` (document `~s`).",
-            [pp_rep_id(RepId), DocId]),
+        couch_log:notice("Attempting to start replication `~s` (document `~s`"
+            " from `~s`).", [pp_rep_id(RepId), DocId, DbName]),
         StartDelaySecs = erlang:max(0,
             config:get_integer("replicator", "start_delay", 10)),
         StartSplaySecs = erlang:max(1,
@@ -544,13 +545,15 @@ maybe_start_replication(State, DbName, DocId, RepDoc) ->
     #rep_state{rep = #rep{doc_id = DocId}} ->
         State;
     #rep_state{starting = false, rep = #rep{db_name = DbName, doc_id = OtherDocId}} ->
-        couch_log:notice("The replication specified by the document `~s` was already"
-            " triggered by the document `~s`", [DocId, OtherDocId]),
+        couch_log:notice("The replication specified by the document `~s` from"
+            " `~s` was already triggered by the document `~s`",
+            [DocId, DbName, OtherDocId]),
         maybe_tag_rep_doc(DbName, DocId, RepDoc, ?l2b(BaseId)),
         State;
     #rep_state{starting = true, rep = #rep{db_name = DbName, doc_id = OtherDocId}} ->
-        couch_log:notice("The replication specified by the document `~s` is already"
-            " being triggered by the document `~s`", [DocId, OtherDocId]),
+        couch_log:notice("The replication specified by the document `~s` from"
+            " `~s` is already being triggered by the document `~s`",
+            [DocId, DbName, OtherDocId]),
         maybe_tag_rep_doc(DbName, DocId, RepDoc, ?l2b(BaseId)),
         State
     end.
@@ -618,8 +621,8 @@ rep_doc_deleted(DbName, DocId) ->
         couch_replicator:cancel_replication(RepId),
         true = ets:delete(?REP_TO_STATE, RepId),
         true = ets:delete(?DOC_TO_REP, {DbName, DocId}),
-        couch_log:notice("Stopped replication `~s` because replication document `~s`"
-            " was deleted", [pp_rep_id(RepId), DocId]);
+        couch_log:notice("Stopped replication `~s` because replication document"
+            " `~s` from `~s` was deleted", [pp_rep_id(RepId), DocId, DbName]);
     [] ->
         ok
     end.
@@ -641,20 +644,20 @@ maybe_retry_replication(#rep_state{retries_left = 0} = RepState, Error, State) -
     couch_replicator:cancel_replication(RepId),
     true = ets:delete(?REP_TO_STATE, RepId),
     true = ets:delete(?DOC_TO_REP, {DbName, DocId}),
-    couch_log:error("Error in replication `~s` (triggered by document `~s`): ~s"
-        "~nReached maximum retry attempts (~p).",
-        [pp_rep_id(RepId), DocId, to_binary(error_reason(Error)), MaxRetries]),
+    couch_log:error("Error in replication `~s` (triggered by document `~s` from"
+        " `~s` ): ~s~nReached maximum retry attempts (~p).", [pp_rep_id(RepId),
+        DocId, DbName, to_binary(error_reason(Error)), MaxRetries]),
     State;
 
 maybe_retry_replication(RepState, Error, State) ->
     #rep_state{
-        rep = #rep{id = RepId, doc_id = DocId} = Rep
+        rep = #rep{id = RepId, doc_id = DocId, db_name = DbName} = Rep
     } = RepState,
     #rep_state{wait = Wait} = NewRepState = state_after_error(RepState),
     true = ets:insert(?REP_TO_STATE, {RepId, NewRepState}),
-    couch_log:error("Error in replication `~s` (triggered by document `~s`): ~s"
-        "~nRestarting replication in ~p seconds.",
-        [pp_rep_id(RepId), DocId, to_binary(error_reason(Error)), Wait]),
+    couch_log:error("Error in replication `~s` (triggered by document `~s` from"
+        " `~s` ): ~s~nRestarting replication in ~p seconds.", [pp_rep_id(RepId),
+        DocId, DbName, to_binary(error_reason(Error)), Wait]),
     Pid = spawn_link(?MODULE, start_replication, [Rep, Wait]),
     State#state{
         rep_start_pids = [{rep_start, Pid} | State#state.rep_start_pids]


[2/2] couch-replicator commit: updated refs/heads/master to 50a88ba

Posted by va...@apache.org.
Merge remote-tracking branch 'cloudant/couchdb-3316'

Closes #59


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/commit/50a88baa
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/tree/50a88baa
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/diff/50a88baa

Branch: refs/heads/master
Commit: 50a88baafc10c4cf34bce5a54d59e15ca15ea60a
Parents: 7a2b2b6 50dcd7d
Author: Nick Vatamaniuc <va...@apache.org>
Authored: Fri Mar 3 10:49:54 2017 -0500
Committer: Nick Vatamaniuc <va...@apache.org>
Committed: Fri Mar 3 10:49:54 2017 -0500

----------------------------------------------------------------------
 src/couch_replicator_manager.erl | 55 ++++++++++++++++++-----------------
 1 file changed, 29 insertions(+), 26 deletions(-)
----------------------------------------------------------------------