-
-
Notifications
You must be signed in to change notification settings - Fork 2k
MDEV-39008 FederatedX: set time_zone on connection change #4791
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
Open
PeterKoletzki
wants to merge
7
commits into
MariaDB:10.11
Choose a base branch
from
PeterKoletzki:bb-10.11-MDEV-39008-federatedx-timestamp-timezone
base: 10.11
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+116
−4
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
5618d5e
MDEV-39008 FederatedX: set time_zone on connection change
PeterSecusmart a360c32
Update timezone_after_reconnect.result, timezone_after_reconnect.test…
PeterSecusmart bab23f5
MDEV-39008 FederatedX: set time_zone on connection change
PeterSecusmart 792aa53
Update timezone_after_reconnect.result, timezone_after_reconnect.test…
PeterSecusmart a915328
Merge branch 'bb-10.11-MDEV-39008-federatedx-timestamp-timezone' of g…
PeterSecusmart 1d68faa
Update timezone_after_reconnect.result and timezone_after_reconnect.test
PeterKoletzki b363e43
Update suite.pm and timezone_after_reconnect.test
PeterKoletzki File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
mysql-test/suite/federated/timezone_after_reconnect.result
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| connect master,127.0.0.1,root,,test,$MASTER_MYPORT,; | ||
| connect slave,127.0.0.1,root,,test,$SLAVE_MYPORT,; | ||
| connection master; | ||
| CREATE DATABASE federated; | ||
| connection slave; | ||
| CREATE DATABASE federated; | ||
| connection slave; | ||
| set time_zone='+00:00'; | ||
| create table federated.t1 (id int primary key, ts timestamp); | ||
| insert into federated.t1 values (1, '2020-06-15 12:00:00'); | ||
| connection master; | ||
| create table t1 engine=federated connection='mysql://root@127.0.0.1:SLAVE_PORT/federated/t1'; | ||
| select * from t1; | ||
| id ts | ||
| 1 2020-06-15 12:00:00 | ||
| connection slave; | ||
| # restart | ||
| connection master; | ||
| select * from t1; | ||
| select * from t1; | ||
| id ts | ||
| 1 2020-06-15 12:00:00 | ||
| connection master; | ||
| drop table t1; | ||
| connection slave; | ||
| drop table federated.t1; | ||
| set time_zone=default; | ||
| connection master; | ||
| DROP TABLE IF EXISTS federated.t1; | ||
| DROP DATABASE IF EXISTS federated; | ||
| connection slave; | ||
| DROP TABLE IF EXISTS federated.t1; | ||
| DROP DATABASE IF EXISTS federated; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| # MDEV-39008: After remote server restart (or connection change), FederatedX must | ||
| # set time_zone again so TIMESTAMP values remain correct. | ||
| # | ||
| # Note: This test triggers the reconnect path (restart_mysqld). With it, server | ||
| # shutdown can report "Warning: Memory not freed: N"; see suite.pm suppression | ||
| # and maintainer note there (fix leak vs. keep/change pm). | ||
| # | ||
| # 1) Create table on backend with TIMESTAMP, insert row | ||
| # 2) Federated table on master, SELECT (establishes connection, sets time_zone) | ||
| # 3) Restart backend server | ||
| # 4) SELECT again via federated (reconnect; time_zone must be set again) | ||
| # 5) Verify we get the same timestamp (no TZ shift) | ||
|
|
||
| source have_federatedx.inc; | ||
| source include/federated.inc; | ||
|
|
||
| connection slave; | ||
| set time_zone='+00:00'; | ||
| create table federated.t1 (id int primary key, ts timestamp); | ||
| insert into federated.t1 values (1, '2020-06-15 12:00:00'); | ||
|
|
||
| connection master; | ||
| replace_result $SLAVE_MYPORT SLAVE_PORT; | ||
| eval create table t1 engine=federated connection='mysql://root@127.0.0.1:$SLAVE_MYPORT/federated/t1'; | ||
|
|
||
| # First read: establishes connection, sets time_zone='+00:00' | ||
| select * from t1; | ||
|
|
||
| # Restart backend so next query may hit stale connection (ER_NET_READ_ERROR) or reconnect | ||
| connection slave; | ||
| source include/restart_mysqld.inc; | ||
|
|
||
| # First query after restart may fail (ER_NET_READ_ERROR) or succeed; accept both. Do not compare output. | ||
| connection master; | ||
| --disable_result_log | ||
| --error 0,ER_NET_READ_ERROR | ||
| select * from t1; | ||
| --enable_result_log | ||
|
|
||
| # Second query: (re)connect and time_zone set again (MDEV-39008 fix). Same timestamp. | ||
| select * from t1; | ||
|
|
||
| # Verify correct timestamp (no TZ shift) | ||
| connection master; | ||
| drop table t1; | ||
| connection slave; | ||
| drop table federated.t1; | ||
| set time_zone=default; | ||
| source include/federated_cleanup.inc; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.