Inconsistent PG intervalstyle setting on Production
The intervalstyle
setting on one or more PG nodes are configured incorrectly.
10.times { puts ActiveRecord::Base.connection.execute("show intervalstyle").to_a }
{"IntervalStyle"=>"iso_8601"}
{"IntervalStyle"=>"iso_8601"}
{"IntervalStyle"=>"iso_8601"}
{"IntervalStyle"=>"iso_8601"}
{"IntervalStyle"=>"iso_8601"}
{"IntervalStyle"=>"iso_8601"}
{"IntervalStyle"=>"iso_8601"}
{"IntervalStyle"=>"iso_8601"}
{"IntervalStyle"=>"postgres"}
{"IntervalStyle"=>"iso_8601"}
The postgres
interval style cannot be parsed by Rails, so queries that are calculating interval will cause application level errors.
Example:
SELECT closed_at - created_at from issues limit 1;
Currently, only one feature is affected: MR analytics. The top chart sometimes won't load: https://gitlab.com/gitlab-org/gitlab/-/analytics/merge_request_analytics
The issue could be fixed on the application layer however, there is a risk where devs may introduce new queries. This could easily blow up in production.