couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vatam...@apache.org
Subject [couchdb] branch 63012-scheduler updated: [fixup] comments in doc_processor
Date Mon, 10 Apr 2017 18:20:36 GMT
This is an automated email from the ASF dual-hosted git repository.

vatamane pushed a commit to branch 63012-scheduler
in repository https://gitbox.apache.org/repos/asf/couchdb.git

The following commit(s) were added to refs/heads/63012-scheduler by this push:
       new  fa94532   [fixup] comments in doc_processor
fa94532 is described below

commit fa945327dd5e716612bdd442c7af172113ea8dae
Author: Nick Vatamaniuc <vatamane@apache.org>
AuthorDate: Mon Apr 10 14:20:31 2017 -0400

    [fixup] comments in doc_processor
---
 .../src/couch_replicator_doc_processor.erl              | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/couch_replicator/src/couch_replicator_doc_processor.erl b/src/couch_replicator/src/couch_replicator_doc_processor.erl
index 8b19836..75ccb26 100644
--- a/src/couch_replicator/src/couch_replicator_doc_processor.erl
+++ b/src/couch_replicator/src/couch_replicator_doc_processor.erl
@@ -172,8 +172,8 @@ process_updated({DbName, _DocId} = Id, JsonRepDoc) ->
     % Parsing replication doc (but not calculating the id) could throw an
     % exception which would indicate this document is malformed. This exception
     % should propagate to db_change function and will be recorded as permanent
-    % failure in the document. User will have to delete and re-create the
-    % document to fix the problem.
+    % failure in the document. User will have to update the documet to fix the
+    % problem.
     Rep0 = couch_replicator_docs:parse_rep_doc_without_id(JsonRepDoc),
     Rep = Rep0#rep{db_name = DbName, start_time = os:timestamp()},
     Filter = case couch_replicator_filters:parse(Rep#rep.options) of
@@ -351,8 +351,8 @@ worker_returned(Ref, Id, {ok, RepId}) ->
                 Row0#rdoc{rid = RepId, info = couch_util:to_binary(Msg)};
             #rdoc{rid = nil} ->
                 % Calculated new replication id for non-filtered replication.
-                % Remove replication doc body, after this we won't needed any
-                % more.
+                % Remove replication doc body, after this we won't need it
+                % anymore.
                 Row0#rdoc{rep=nil, rid=RepId, info=nil}
         end,
         true = ets:insert(?MODULE, NewRow),
@@ -418,12 +418,21 @@ maybe_update_doc_triggered(Rep, RepId) ->
 -spec error_backoff(non_neg_integer()) -> seconds().
 error_backoff(ErrCnt) ->
     Exp = min(ErrCnt, ?ERROR_MAX_BACKOFF_EXPONENT),
+    % ErrCnt is the exponent here. The reason 64 is used is to start at
+    % 64 (about a minute) max range. Then first backoff would be 30 sec
+    % on average. Then 1 minute and so on.
     random:uniform(64 bsl Exp).
 
 
 -spec filter_backoff() -> seconds().
 filter_backoff() ->
     Total = ets:info(?MODULE, size),
+    % This value scaled by the number of replications. If the are a lot of
+    % them wait is longer, but not more than a day (?TS_DAY_SEC). If there
+    % are just few, wait is shorter, starting at about 30 seconds. `2 *` is
+    % used since the expected wait would then be 0.5 * Range so it is easier
+    % to see the average wait. `1 +` is used because random:uniform only
+    % accepts > 0 values and crashes otherwise.
     Range = 1 + min(2 * (Total / 10), ?TS_DAY_SEC),
     60 + random:uniform(round(Range)).
 

-- 
To stop receiving notification emails like this one, please contact
['"commits@couchdb.apache.org" <commits@couchdb.apache.org>'].

Mime
View raw message