You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2020/01/13 18:03:24 UTC

[GitHub] [couchdb] wohali opened a new pull request #2445: Eliminate multiple compiler warnings

wohali opened a new pull request #2445: Eliminate multiple compiler warnings
URL: https://github.com/apache/couchdb/pull/2445
 
 
   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.
   
   If someone else wants to tackle these, we sure could use it:
   
   ```
   /home/joant/couchdb/src/meck/src/meck_code_gen.erl:198: Warning: erlang:get_stacktrace/0: deprecated; use the new try/catch syntax for retrieving the stack backtrace
   /home/joant/couchdb/src/triq/src/triq.erl:181: Warning: erlang:get_stacktrace/0: deprecated; use the new try/catch syntax for retrieving the stack backtrace
   /home/joant/couchdb/src/chttpd/src/chttpd.erl:279: Warning: erlang:get_stacktrace/0: deprecated; use the new try/catch syntax for retrieving the stack backtrace
   /home/joant/couchdb/src/chttpd/src/chttpd.erl:354: Warning: erlang:get_stacktrace/0: deprecated; use the new try/catch syntax for retrieving the stack backtrace
   /home/joant/couchdb/src/chttpd/src/chttpd_stats.erl:54: Warning: erlang:get_stacktrace/0: deprecated; use the new try/catch syntax for retrieving the stack backtrace
   /home/joant/couchdb/src/couch/src/couch_httpd.erl:366: Warning: erlang:get_stacktrace/0: deprecated; use the new try/catch syntax for retrieving the stack backtrace
   /home/joant/couchdb/src/couch/src/couch_httpd.erl:371: Warning: erlang:get_stacktrace/0: deprecated; use the new try/catch syntax for retrieving the stack backtrace
   /home/joant/couchdb/src/couch/src/couch_httpd.erl:376: Warning: erlang:get_stacktrace/0: deprecated; use the new try/catch syntax for retrieving the stack backtrace
   /home/joant/couchdb/src/couch/src/couch_httpd.erl:381: Warning: erlang:get_stacktrace/0: deprecated; use the new try/catch syntax for retrieving the stack backtrace
   /home/joant/couchdb/src/couch/src/couch_proc_manager.erl:312: Warning: erlang:get_stacktrace/0: deprecated; use the new try/catch syntax for retrieving the stack backtrace
   /home/joant/couchdb/src/couch_replicator/src/couch_replicator_scheduler_job.erl:319: Warning: erlang:get_stacktrace/0: deprecated; use the new try/catch syntax for retrieving the stack backtrace
   /home/joant/couchdb/src/ddoc_cache/src/ddoc_cache_entry.erl:301: Warning: erlang:get_stacktrace/0: deprecated; use the new try/catch syntax for retrieving the stack backtrace
   /home/joant/couchdb/src/fabric/src/fabric_view_all_docs.erl:300: Warning: erlang:get_stacktrace/0: deprecated; use the new try/catch syntax for retrieving the stack backtrace
   /home/joant/couchdb/src/fabric/src/fabric_rpc.erl:600: Warning: erlang:get_stacktrace/0: deprecated; use the new try/catch syntax for retrieving the stack backtrace
   /home/joant/couchdb/src/mango/src/mango_util.erl:142: Warning: erlang:get_stacktrace/0: deprecated; use the new try/catch syntax for retrieving the stack backtrace
   /home/joant/couchdb/src/mango/src/mango_util.erl:146: Warning: erlang:get_stacktrace/0: deprecated; use the new try/catch syntax for retrieving the stack backtrace
   /home/joant/couchdb/src/mango/src/mango_util.erl:150: Warning: erlang:get_stacktrace/0: deprecated; use the new try/catch syntax for retrieving the stack backtrace
   /home/joant/couchdb/src/mango/src/mango_httpd.erl:43: Warning: erlang:get_stacktrace/0: deprecated; use the new try/catch syntax for retrieving the stack backtrace
   /home/joant/couchdb/src/rexi/src/rexi_server.erl:165: Warning: erlang:get_stacktrace/0: deprecated; use the new try/catch syntax for retrieving the stack backtrace
   /home/joant/couchdb/src/smoosh/src/smoosh_server.erl:251: Warning: erlang:get_stacktrace/0: deprecated; use the new try/catch syntax for retrieving the stack backtrace
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [couchdb] wohali commented on issue #2445: Eliminate multiple compiler warnings

Posted by GitBox <gi...@apache.org>.
wohali commented on issue #2445: Eliminate multiple compiler warnings
URL: https://github.com/apache/couchdb/pull/2445#issuecomment-573793792
 
 
   The deprecations may be better fixed by going to `erlang:monotonic_time(TimeUnit)` or `erlang:unique_integer([monotonic])`, not sure.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [couchdb] nickva commented on issue #2445: Eliminate multiple compiler warnings

Posted by GitBox <gi...@apache.org>.
nickva commented on issue #2445: Eliminate multiple compiler warnings
URL: https://github.com/apache/couchdb/pull/2445#issuecomment-573827525
 
 
   @wohali 
   
   (Re: monotonic)
   
   Good idea to call it out! Yeah in general `erlang:timestamp/0` isn't a 1-to-1 replacement , as `now/0` returns strictly monotonic timestamps. In this case however we are operating at minute level intervals and even if previous timestamp is greater than the current one, `timer:now_diff/2` will just return a negative value and eventually should catch up, instead of say crashing

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [couchdb] nickva commented on a change in pull request #2445: Eliminate multiple compiler warnings

Posted by GitBox <gi...@apache.org>.
nickva commented on a change in pull request #2445: Eliminate multiple compiler warnings
URL: https://github.com/apache/couchdb/pull/2445#discussion_r365981834
 
 

 ##########
 File path: src/dreyfus/src/dreyfus_index_updater.erl
 ##########
 @@ -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
 
 Review comment:
   Just quick note that in general `erlang:timestamp/0` isn't always a 1-to-1 replacement , as `now/0` returns strictly monotonic timestamps. In this case however we are operating at minute level intervals and even if previous timestamp is greater than the current one, `timer:now_diff/2` will just return a negative value and eventually should catch up, instead of say crashing

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [couchdb] davisp merged pull request #2445: Eliminate multiple compiler warnings

Posted by GitBox <gi...@apache.org>.
davisp merged pull request #2445: Eliminate multiple compiler warnings
URL: https://github.com/apache/couchdb/pull/2445
 
 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [couchdb] nickva commented on a change in pull request #2445: Eliminate multiple compiler warnings

Posted by GitBox <gi...@apache.org>.
nickva commented on a change in pull request #2445: Eliminate multiple compiler warnings
URL: https://github.com/apache/couchdb/pull/2445#discussion_r365981834
 
 

 ##########
 File path: src/dreyfus/src/dreyfus_index_updater.erl
 ##########
 @@ -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
 
 Review comment:
   Just quick note that in general `erlang:timestamp/0` isn't always a 1-to-1 replacement , as `now/0` returns strictly monotonic timestamps. In this case however we are operating at minute level intervals and even if previous timestamp is greater than the current one, `timer:now_diff/2` will just return a negative value and eventually should catch up, instead of say crashing

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [couchdb] davisp commented on issue #2445: Eliminate multiple compiler warnings

Posted by GitBox <gi...@apache.org>.
davisp commented on issue #2445: Eliminate multiple compiler warnings
URL: https://github.com/apache/couchdb/pull/2445#issuecomment-573904007
 
 
   Went ahead and merged when Jenkins came back green so that 2446 doesn't land and force another rebuild.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services