Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FLINK-37306][tests] Fix MySQLSourceITCase failure in non-UTC timezone #3917

Merged

Conversation

yuxiqian
Copy link
Contributor

@yuxiqian yuxiqian commented Feb 12, 2025

This closes FLINK-37306.

The failing test cases were introduced in #3298 and #3876 (and more), but has not been exposed until we decided to run CI test cases in random timezones (#3650).

MySQLSourceITCase#testSourceMetrics

MySQL docker container runs in UTC timezone by default, but MySQLSourceITCase#testSourceMetrics didn't specify serverTimeZone option explicitly like other test cases. As a result, running test cases in non-UTC timezone will fail with the following error:

org.apache.flink.table.api.ValidationException: The MySQL server has a timezone offset (0 seconds ahead of UTC) which does not match the configured timezone GMT+XX:XX. Specify the right server-time-zone to avoid inconsistencies for time-related fields.

MySqlTimezoneITCase, MysqlDebeziumTimeConverterITCase, and SpecificStartingOffsetITCase

These cases need to run MySQL container in specific timezones, so they all have a method called buildMySqlConfigWithTimezone to create MySQL container with the same timezone as JVM.

However, JVM timezone (fetched via ZoneId.systemDefault()) returns UTC-offset timezone in GMT+04:30 format, while MySQL configuration file requires it in +04:30 format. This would block the container from starting up.

MySqlMultipleTablesRenamingITCase

This test case uses the same time-zone initialization code as MySqlTimezoneITCase. Removed these codes and stick to UTC considering this case is not time-zone sensitive.

@yuxiqian yuxiqian marked this pull request as draft February 12, 2025 01:48
@yuxiqian yuxiqian force-pushed the hotfix/mysql-ci-error-in-non-utc-timezone branch from 9da5114 to 79e601d Compare February 12, 2025 02:09
@yuxiqian yuxiqian force-pushed the hotfix/mysql-ci-error-in-non-utc-timezone branch from 79e601d to d6c09a6 Compare February 12, 2025 02:24
@yuxiqian yuxiqian marked this pull request as ready for review February 12, 2025 03:42
@yuxiqian
Copy link
Contributor Author

@leonardBang @lvyanquan PTAL

@leonardBang
Copy link
Contributor

https://issues.apache.org/jira/browse/FLINK-37306 Could you link to this ticket ?

@yuxiqian yuxiqian changed the title [hotfix][tests] Fix MySQLSourceITCase failure in non-UTC timezone [FLINK-37306][tests] Fix MySQLSourceITCase failure in non-UTC timezone Feb 12, 2025
Copy link
Contributor

@leonardBang leonardBang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@leonardBang leonardBang merged commit 858371c into apache:master Feb 18, 2025
24 of 26 checks passed
SML0127 pushed a commit to SML0127/flink-cdc-connectors that referenced this pull request Feb 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants