Skip to content

Commit 030d45e

Browse files
committed
Fix typos and tests in couch_replicator
1 parent 308817d commit 030d45e

13 files changed

Lines changed: 27 additions & 29 deletions

src/couch_replicator/src/couch_replicator_doc_processor.erl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ process_updated({DbName, _DocId} = Id, JsonRepDoc, Owner = true) ->
167167
% Parsing replication doc (but not calculating the id) could throw an
168168
% exception which would indicate this document is malformed. This exception
169169
% should propagate to db_change function and will be recorded as permanent
170-
% failure in the document. User will have to update the documet to fix the
170+
% failure in the document. User will have to update the document to fix the
171171
% problem.
172172
Rep0 = couch_replicator_parse:parse_rep_doc_without_id(JsonRepDoc),
173173
Rep = Rep0#rep{db_name = DbName, start_time = os:timestamp()},
@@ -675,8 +675,8 @@ start_scanner(#st{mdb_changes_pid = undefined} = St) ->
675675

676676
start_delay_msec() ->
677677
DefaultSec = ?DEFAULT_START_DELAY_MSEC div 1000,
678-
% We're using a compatiblity config setting (cluster_start_period) to avoid
679-
% introducting a new config value.
678+
% We're using a compatibility config setting (cluster_start_period) to avoid
679+
% introducing a new config value.
680680
MSec = 1000 * config:get_integer("replicator", "cluster_start_period", DefaultSec),
681681
max(MSec, ?MIN_START_DELAY_MSEC).
682682

src/couch_replicator/src/couch_replicator_doc_processor_worker.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ t_ignore_if_doc_deleted(_) ->
230230
?assertEqual(ignore, maybe_start_replication(Id, Rep, make_ref())),
231231
?assertNot(added_job()).
232232

233-
% Should not add job if by the time worker got to fetchign the filter
233+
% Should not add job if by the time worker got to fetch the filter
234234
% and building a replication id, another worker was spawned.
235235
t_ignore_if_worker_ref_does_not_match(_) ->
236236
Id = {?DB, ?DOC1},

src/couch_replicator/src/couch_replicator_docs.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ delete_old_rep_ddoc(RepDb, DDocId) ->
137137
ok.
138138

139139
% Update a #rep{} record with a replication_id. Calculating the id might involve
140-
% fetching a filter from the source db, and so it could fail intermetently.
140+
% fetching a filter from the source db, and so it could fail intermittently.
141141
% In case of a failure to fetch the filter this function will throw a
142142
% `{filter_fetch_error, Reason} exception.
143143
update_rep_id(Rep) ->

src/couch_replicator/src/couch_replicator_filters.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ parse(Options) ->
6060

6161
% Fetches body of filter function from source database. Guaranteed to either
6262
% return {ok, Body} or an {error, Reason}. Also assume this function might
63-
% block due to network / socket issues for an undeterminted amount of time.
63+
% block due to network / socket issues for an undetermined amount of time.
6464
-spec fetch(binary(), binary(), binary()) ->
6565
{ok, {[_]}} | {error, binary()}.
6666
fetch(DDocName, FilterName, Source) ->

src/couch_replicator/src/couch_replicator_parse.erl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ default_options() ->
6363
% database. If failure or parsing of filter docs fails, parse_doc throws a
6464
% {filter_fetch_error, Error} exception. This exception should be considered
6565
% transient in respect to the contents of the document itself, since it depends
66-
% on netowrk availability of the source db and other factors.
66+
% on network availability of the source db and other factors.
6767
-spec parse_rep_doc({[_]}) -> #rep{}.
6868
parse_rep_doc(RepDoc) ->
6969
{ok, Rep} =
@@ -167,7 +167,7 @@ parse_proxy_settings(Props) when is_list(Props) ->
167167
end.
168168

169169
% Update a #rep{} record with a replication_id. Calculating the id might involve
170-
% fetching a filter from the source db, and so it could fail intermetently.
170+
% fetching a filter from the source db, and so it could fail intermittently.
171171
% In case of a failure to fetch the filter this function will throw a
172172
% `{filter_fetch_error, Reason} exception.
173173
update_rep_id(Rep) ->

src/couch_replicator/src/couch_replicator_rate_limiter.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
%
2323
% The algorithm referenced above estimates a rate, whereas the implemented
2424
% algorithm uses an interval (in milliseconds). It preserves the original
25-
% semantics, that is the failure part is multplicative and the success part is
25+
% semantics, that is the failure part is multiplicative and the success part is
2626
% additive. The relationship between rate and interval is: rate = 1000 /
2727
% interval.
2828
%

src/couch_replicator/src/couch_replicator_rate_limiter_tables.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
% in effect (also configurable).
2121
%
2222
% This module is also in charge of calculating ownership of replications based
23-
% on where their _repicator db documents shards live.
23+
% on where their _replicator db documents shards live.
2424

2525
-module(couch_replicator_rate_limiter_tables).
2626

src/couch_replicator/src/couch_replicator_scheduler.erl

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373

7474
% Worker children get a default 5 second shutdown timeout, so pick a value just
7575
% a bit less than that: 4.5 seconds. In couch_replicator_sup our scheduler
76-
% worker doesn't specify the timeout, so it up picks ups the OTP default of 5
76+
% worker doesn't specify the timeout, so it picks up the OTP default of 5
7777
% seconds https://www.erlang.org/doc/system/sup_princ.html#child-specification
7878
%
7979
-define(TERMINATE_SHUTDOWN_TIME, 4500).
@@ -173,9 +173,9 @@ job_proxy_url(_Endpoint) ->
173173
null.
174174

175175
% Health threshold is the minimum amount of time an unhealthy job should run
176-
% crashing before it is considered to be healthy again. HealtThreashold should
176+
% crashing before it is considered to be healthy again. Health threshold should
177177
% not be 0 as jobs could start and immediately crash, and it shouldn't be
178-
% infinity, since then consecutive crashes would accumulate forever even if
178+
% infinity, since then consecutive crashes would accumulate forever even if
179179
% job is back to normal.
180180
-spec health_threshold() -> non_neg_integer().
181181
health_threshold() ->
@@ -522,7 +522,7 @@ pending_fold(Job, {Set, Now, Count, HealthThreshold}) ->
522522

523523
% Replace Job in the accumulator if it has a higher priority (lower priority
524524
% value) than the lowest priority there. Job priority is indexed by
525-
% {FairSharePiority, LastStarted} tuples. If the FairSharePriority is the same
525+
% {FairSharePriority, LastStarted} tuples. If the FairSharePriority is the same
526526
% then last started timestamp is used to pick. The goal is to keep up to Count
527527
% oldest jobs during the iteration. For example, if there are jobs with these
528528
% priorities accumulated so far [5, 7, 11], and the priority of current job is
@@ -594,14 +594,13 @@ not_recently_crashed(#job{history = History}, Now, HealthThreshold) ->
594594
% and running successfully without crashing for a period of time. That period
595595
% of time is the HealthThreshold.
596596
%
597-
598597
-spec consecutive_crashes(history(), non_neg_integer()) -> non_neg_integer().
599598
consecutive_crashes(History, HealthThreshold) when is_list(History) ->
600599
consecutive_crashes(History, HealthThreshold, 0).
601600

602601
-spec consecutive_crashes(history(), non_neg_integer(), non_neg_integer()) ->
603602
non_neg_integer().
604-
consecutive_crashes([], _HealthThreashold, Count) ->
603+
consecutive_crashes([], _HealthThreshold, Count) ->
605604
Count;
606605
consecutive_crashes(
607606
[{{crashed, _}, CrashT}, {_, PrevT} = PrevEvent | Rest],
@@ -795,7 +794,7 @@ rotate_jobs(State, ChurnSoFar) ->
795794
if
796795
SlotsAvailable >= 0 ->
797796
% If there is are enough SlotsAvailable reduce StopCount to avoid
798-
% unnesessarily stopping jobs. `stop_jobs/3` ignores 0 or negative
797+
% unnecessarily stopping jobs. `stop_jobs/3` ignores 0 or negative
799798
% values so we don't worry about that here.
800799
StopCount = lists:min([Pending - SlotsAvailable, Running, Churn]),
801800
stop_jobs(StopCount, true, State),
@@ -930,7 +929,7 @@ optimize_int_option({Key, Val}, #rep{options = Options} = Rep) ->
930929
% Updater is a separate process. It receives `update_stats` messages and
931930
% updates scheduler stats from the scheduler jobs table. Updates are
932931
% performed no more frequently than once per ?STATS_UPDATE_WAIT milliseconds.
933-
932+
%
934933
update_running_jobs_stats(StatsPid) when is_pid(StatsPid) ->
935934
StatsPid ! update_stats,
936935
ok.

src/couch_replicator/src/couch_replicator_scheduler_job.erl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ stop(Pid) when is_pid(Pid) ->
110110
% In the rare case the job is already stopping as we try to stop it, it
111111
% won't return ok but exit the calling process, usually the scheduler, so
112112
% we guard against that. See:
113-
% www.erlang.org/doc/apps/stdlib/gen_server.html#stop/3
113+
% https://www.erlang.org/doc/apps/stdlib/gen_server.html#stop/3
114114
catch gen_server:stop(Pid, shutdown, ?STOP_TIMEOUT_MSEC),
115115
exit(Pid, kill),
116116
receive
@@ -189,7 +189,7 @@ do_init(#rep{options = Options, id = {BaseId, Ext}, user_ctx = UserCtx} = Rep) -
189189
% Restarting a temporary supervised child implies that the original arguments
190190
% (#rep{} record) specified in the MFA component of the supervisor
191191
% child spec will always be used whenever the child is restarted.
192-
% This implies the same replication performance tunning parameters will
192+
% This implies the same replication performance tuning parameters will
193193
% always be used. The solution is to delete the child spec (see
194194
% cancel_replication/1) and then start the replication again, but this is
195195
% unfortunately not immune to race conditions.

src/couch_replicator/src/couch_replicator_share.erl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
% 3) Jobs which run longer accumulate more charges and get assigned a
4040
% higher priority value and get to wait longer to run.
4141
%
42-
% In order to prevent job starvation, all job priorities are periodicaly
42+
% In order to prevent job starvation, all job priorities are periodically
4343
% decayed (decreased). This effectively moves all the jobs towards the front of
4444
% the run queue. So, in effect, there are two competing processes: one
4545
% uniformly moves all jobs to the front, and the other throws them back in
@@ -86,7 +86,7 @@
8686
% priority 0, and would render this algorithm useless. The default value of
8787
% 0.98 is picked such that if a job ran for one scheduler cycle, then didn't
8888
% get to run for 7 hours, it would still have priority > 0. 7 hours was picked
89-
% as it was close enought to 8 hours which is the default maximum error backoff
89+
% as it was close enough to 8 hours which is the default maximum error backoff
9090
% interval.
9191
%
9292
% Example calculation:
@@ -215,7 +215,7 @@ decay_priorities() ->
215215
% is missing we assume it is 0
216216
clear_zero(?PRIORITIES).
217217

218-
% This is the main part of the alrgorithm. In [1] it is described in the
218+
% This is the main part of the algorithm. In [1] it is described in the
219219
% "Priority Adjustment" section.
220220
%
221221
update_priority(#job{} = Job) ->

0 commit comments

Comments
 (0)