basho / riak_core

Distributed systems infrastructure used by Riak.
Apache License 2.0
1.23k stars 391 forks source link

riak_repl stats :: double conversion to local time [JIRA: RIAK-2124] #773

Open cipy opened 9 years ago

cipy commented 9 years ago

Hi,

There's a double conversion to local time which impacts how json stats are displayed via the http rest api https://github.com/basho/riak_repl/blob/develop/src/riak_repl_wm_stats.erl#L184

Thanks,

martincox commented 6 years ago

Is this actually double converted? What behaviour is being observed? (Long shot on a 2+YO ticket, I know).

I dug this up because there's an issue with displaying stats during clocks going forward for DST. The timestamp passed through to here is derived from riak_core_util:moment/0, and is ultimately converted to a datetime with calendar:gregorian_seconds_to_datetime/1, which yields a UTC datetime. the httpd_util:rfc1123/1 function expects a local datetime and throws a fit that leads to repl stats being dead for an hour.

The fix is trivial though, it just needs wrapping in calendar:universal_time_to_local_time/1. I'll create a PR for it when I get a few mins.