Eliminate multiple compiler warnings
We now only support OTP 20+, with 19 at a stretch. erlang:now/0
was deprecated in OTP 18, so we can now suppress these warnings:
```
/home/joant/couchdb/src/dreyfus/src/dreyfus_index_updater.erl:62: Warning: erlang:now/0: Deprecated BIF. See the "Time and Time Correction in Erlang" chapter of the ERTS User's Guide for more information.
/home/joant/couchdb/src/dreyfus/src/dreyfus_index_updater.erl:83: Warning: erlang:now/0: Deprecated BIF. See the "Time and Time Correction in Erlang" chapter of the ERTS User's Guide for more information.
```
Also, some unused variables were removed:
```
/home/joant/couchdb/src/couch/src/couch_bt_engine.erl:997: Warning: variable 'NewSeq' is unused
/home/joant/couchdb/src/mem3/src/mem3_rep.erl:752: Warning: variable 'TMap' is unused
/home/joant/couchdb/src/dreyfus/src/dreyfus_httpd.erl:76: Warning: variable 'LimitValue' is unused
/home/joant/couchdb/src/dreyfus/src/dreyfus_util.erl:345: Warning: variable 'Db' is unused
```
PRs to follow in ets_lru, hyper, ibrowse to track the rest of `erlang:now/0`
deprecations.
diff --git a/src/couch/src/couch_bt_engine.erl b/src/couch/src/couch_bt_engine.erl
index b659719..48e751a 100644
--- a/src/couch/src/couch_bt_engine.erl
+++ b/src/couch/src/couch_bt_engine.erl
@@ -994,7 +994,7 @@
_ ->
{ok, PurgedIdsRevs} = couch_file:pread_term(Fd, Ptr),
- {Infos, NewSeq} = lists:foldl(fun({Id, Revs}, {InfoAcc, PSeq}) ->
+ {Infos, _} = lists:foldl(fun({Id, Revs}, {InfoAcc, PSeq}) ->
Info = {PSeq, couch_uuids:random(), Id, Revs},
{[Info | InfoAcc], PSeq + 1}
end, {[], PurgeSeq}, PurgedIdsRevs),
diff --git a/src/dreyfus/src/dreyfus_httpd.erl b/src/dreyfus/src/dreyfus_httpd.erl
index 5c9db80..e985163 100644
--- a/src/dreyfus/src/dreyfus_httpd.erl
+++ b/src/dreyfus/src/dreyfus_httpd.erl
@@ -73,8 +73,6 @@
end;
_ ->
% ensure limit in group query >0
- LimitValue = parse_positive_int_param("limit", QueryArgs#index_query_args.limit,
- "max_limit", "200"),
UseNewApi = Grouping#grouping.new_api,
case dreyfus_fabric_group1:go(DbName, DDoc, IndexName, QueryArgs) of
{ok, []} ->
diff --git a/src/dreyfus/src/dreyfus_index_updater.erl b/src/dreyfus/src/dreyfus_index_updater.erl
index 3720cb6..87edef0 100644
--- a/src/dreyfus/src/dreyfus_index_updater.erl
+++ b/src/dreyfus/src/dreyfus_index_updater.erl
@@ -59,7 +59,7 @@
true = proc_prompt(Proc, [<<"add_fun">>, Index#index.def]),
EnumFun = fun ?MODULE:load_docs/2,
[Changes] = couch_task_status:get([changes_done]),
- Acc0 = {Changes, IndexPid, Db, Proc, TotalChanges, now(), ExcludeIdRevs},
+ Acc0 = {Changes, IndexPid, Db, Proc, TotalChanges, erlang:timestamp(), ExcludeIdRevs},
{ok, _} = couch_db:fold_changes(Db, CurSeq, EnumFun, Acc0, []),
ok = clouseau_rpc:commit(IndexPid, NewCurSeq)
after
@@ -80,7 +80,7 @@
false -> update_or_delete_index(IndexPid, Db, DI, Proc)
end,
%% Force a commit every minute
- case timer:now_diff(Now = now(), LastCommitTime) >= 60000000 of
+ case timer:now_diff(Now = erlang:timestamp(), LastCommitTime) >= 60000000 of
true ->
ok = clouseau_rpc:commit(IndexPid, Seq),
{ok, {I+1, IndexPid, Db, Proc, Total, Now, ExcludeIdRevs}};
diff --git a/src/dreyfus/src/dreyfus_util.erl b/src/dreyfus/src/dreyfus_util.erl
index 6832299..0a83e87 100644
--- a/src/dreyfus/src/dreyfus_util.erl
+++ b/src/dreyfus/src/dreyfus_util.erl
@@ -342,7 +342,7 @@
false -> undefined
end.
-get_local_purge_doc_body(Db, LocalDocId, PurgeSeq, Index) ->
+get_local_purge_doc_body(_, LocalDocId, PurgeSeq, Index) ->
#index{
name = IdxName,
ddoc_id = DDocId,
diff --git a/src/mem3/src/mem3_rep.erl b/src/mem3/src/mem3_rep.erl
index 4b75846..7fa0fc0 100644
--- a/src/mem3/src/mem3_rep.erl
+++ b/src/mem3/src/mem3_rep.erl
@@ -749,7 +749,6 @@
Shards0 = mem3:shards(mem3:dbname(SrcName)),
Shards1 = [S || S <- Shards0, not shard_eq(S, Src)],
Shards2 = [S || S <- Shards1, check_overlap(SrcRange, TgtNode, S)],
- TMap = maps:from_list([{R, S} || #shard{range = R} = S <- Shards2]),
case [{R, S} || #shard{range = R} = S <- Shards2] of
[] ->
% If target map is empty, create a target map with just