Bug #104429 MTR uses wrong timezone
Submitted: 27 Jul 2021 14:55 Modified: 25 Aug 2021 8:36
Reporter: Satya Bodapati (OCA) Email Updates:
Status: Verified Impact on me:
None 
Category:Tools: MTR / mysql-test-run Severity:S3 (Non-critical)
Version:5.7.X, 8.0.X, 5.7.35, 8.0.26 OS:Any
Assigned to: CPU Architecture:Any

[27 Jul 2021 14:55] Satya Bodapati
Description:
When you use --log_timestamps=SYSTEM, we expect to see local time but with MTR, server always chooses hardcoded timezone "GMT-3:00". My local timezone is IST +5:30.

How to repeat:
./mtr --mem main.1st --start --mysqld=--log_timestamps=SYSTEM

check error log var/log/mysqld.1.err

URRENT_TEST: main.1st
2021-07-27T17:48:12.487947+03:00 0 [Warning] [MY-010099] [Server] Insecure configuration for --secure-file-priv: Data directory is accessible through --secure-file-priv. Consider choosing a different directory.
2021-07-27T17:48:12.487963+03:00 0 [Warning] [MY-010101] [Server] Insecure configuration for --secure-file-priv: Location is accessible to all OS users. Consider choosing a different directory.
2021-07-27T17:48:12.488022+03:00 0 [Note] [MY-010949] [Server] Basedir set to /home/satya/WORK/mysql-8.0/bld/.
2021-07-27T17:48:12.488037+03:00 0 [System] [MY-010116] [Server] /home/satya/WORK/mysql-8.0/bld/runtime_output_directory/mysqld (mysqld 8.0.24-debug) starting as process 705459
2021-07-27T17:48:12.490338+03:00 0 [Warning] [MY-013711] [Server] Manifest file '/home/satya/WORK/mysql-8.0/bld/runtime_output_directory/mysqld.my' is not read-only. For better security, please make sure that the file is read-only.
2021-07-27T17:48:12.512553+03:00 0 [Note] [MY-012366] [InnoDB] Using Linux native AIO
2021-07-27T17:48:12.512994+03:00 0 [Note] [MY-010747] [Server] Plugin 'FEDERATED' is disabled.
2021-07-27T17:48:12.516537+03:00 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2021-07-27T17:48:12.516637+03:00 1 [Note] [MY-013546] [InnoDB] Atomic write enabled
2021-07-27T17:48:12.516718+03:00 1 [Note] [MY-012932] [InnoDB] PUNCH HOLE support available
2021-07-27T17:48:12.516793+03:00 1 [Note] [MY-012937] [InnoDB] !!!!!!!! UNIV_DEBUG switched on !!!!!!!!!
2021-07-27T17:48:12.516867+03:00 1 [Note] [MY-012944] [InnoDB] Uses event mutexes
2021-07-27T17:48:12.516942+03:00 1 [Note] [MY-012945] [InnoDB] GCC builtin __atomic_thread_fence() is used for memory barrier

Suggested fix:
hardcoded value comes from mysql-test-run.pl

# Return timezone value of tinfo or default value
sub timezone {
  my ($tinfo) = @_;
  return $tinfo->{timezone} || "GMT-3";
}
[27 Jul 2021 15:39] MySQL Verification Team
Hello Satya,

Thank you for the report and feedback.

regards,
Umesh
[18 Aug 2021 16:23] Bjørn Munch
MTR unfortunately needs to hardcode a particular timezone in order to get consistent output from any queries that would include the current time in some form. So this code is necessary.

I tested changing it to something else in the lines you quoted and that caused 45 tests in the main suite (of 8.0) to fail due to result mismatch. The same would be expected if the timezone wasn't hardcoded.

There are historical reasons why Finnish DST was chosen rather than UTC.
[25 Aug 2021 8:36] Satya Bodapati
Bjorn,

There is some logic in MTR to skip the hardcoded timezone settings based on mysqld parameters passed.

Currently that logic doesn't recognize this parameter. It has two or three hardcoded options.