Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 4A6BA200C70 for ; Tue, 4 Apr 2017 23:17:37 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 49387160BA5; Tue, 4 Apr 2017 21:17:37 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 0E7A9160BAA for ; Tue, 4 Apr 2017 23:17:35 +0200 (CEST) Received: (qmail 88060 invoked by uid 500); 4 Apr 2017 21:17:35 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 87728 invoked by uid 99); 4 Apr 2017 21:17:34 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 04 Apr 2017 21:17:34 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id A6920DFBA9; Tue, 4 Apr 2017 21:17:34 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: davisp@apache.org To: commits@couchdb.apache.org Date: Tue, 04 Apr 2017 21:17:43 -0000 Message-Id: <1d77a8b847124742b5aa7e87c45ede20@git.apache.org> In-Reply-To: <4ad9154b5a8f4331b57a15b89ff4cb4b@git.apache.org> References: <4ad9154b5a8f4331b57a15b89ff4cb4b@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [10/19] couch-replicator commit: updated refs/heads/COUCHDB-3288-remove-public-db-record to a8ac02d archived-at: Tue, 04 Apr 2017 21:17:37 -0000 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/COUCHDB-3288-remove-public-db-record Commit: 50dcd7d7c5f7ce003e8e2fc84646c1aa9931ebaa Parents: 7a2b2b6 Author: Nick Vatamaniuc Authored: Thu Mar 2 19:12:47 2017 -0500 Committer: Nick Vatamaniuc 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]