diff options
author | Joan Touzet <joant@atypical.net> | 2020-01-13 12:57:51 -0500 |
---|---|---|
committer | Paul J. Davis <paul.joseph.davis@gmail.com> | 2020-01-13 16:29:40 -0600 |
commit | de9c683fc7977c51e00e63687fb764b9cbe2c7e6 (patch) | |
tree | 4783c3ebba9fa82ea849660e076bd60eb03eaaaa | |
parent | efb374a6493c4220333a201b649649736ddcc528 (diff) | |
download | couchdb-de9c683fc7977c51e00e63687fb764b9cbe2c7e6.tar.gz |
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.
-rw-r--r-- | src/couch/src/couch_bt_engine.erl | 2 | ||||
-rw-r--r-- | src/dreyfus/src/dreyfus_httpd.erl | 2 | ||||
-rw-r--r-- | src/dreyfus/src/dreyfus_index_updater.erl | 4 | ||||
-rw-r--r-- | src/dreyfus/src/dreyfus_util.erl | 2 | ||||
-rw-r--r-- | src/mem3/src/mem3_rep.erl | 1 |
5 files changed, 4 insertions, 7 deletions
diff --git a/src/couch/src/couch_bt_engine.erl b/src/couch/src/couch_bt_engine.erl index b659719f5..48e751a82 100644 --- a/src/couch/src/couch_bt_engine.erl +++ b/src/couch/src/couch_bt_engine.erl @@ -994,7 +994,7 @@ upgrade_purge_info(Fd, Header) -> _ -> {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 5c9db80d1..e9851639b 100644 --- a/src/dreyfus/src/dreyfus_httpd.erl +++ b/src/dreyfus/src/dreyfus_httpd.erl @@ -73,8 +73,6 @@ handle_search_req(#httpd{method=Method, path_parts=[_, _, _, _, IndexName]}=Req 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 3720cb63c..87edef0ad 100644 --- a/src/dreyfus/src/dreyfus_index_updater.erl +++ b/src/dreyfus/src/dreyfus_index_updater.erl @@ -59,7 +59,7 @@ update(IndexPid, Index) -> 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 @@ load_docs(FDI, {I, IndexPid, Db, Proc, Total, LastCommitTime, ExcludeIdRevs}=Acc 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 6832299db..0a83e87bd 100644 --- a/src/dreyfus/src/dreyfus_util.erl +++ b/src/dreyfus/src/dreyfus_util.erl @@ -342,7 +342,7 @@ get_signature_from_idxdir(IdxDir) -> 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 4b75846ca..7fa0fc027 100644 --- a/src/mem3/src/mem3_rep.erl +++ b/src/mem3/src/mem3_rep.erl @@ -749,7 +749,6 @@ targets_map(#shard{name = <<"shards/", _/binary>> = SrcName} = Src, 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 |