-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Fix fractional timeout values used with WAIT_FOR_EXECUTED_GTID_SET #230
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
Conversation
The casting logic here resulted in the timeout double to be cast into a ulonglong before the multiplication happened. This resulted in all timeouts being rounded down to whole seconds. The behavior is visible with statements like the following: mysql> SELECT WAIT_FOR_EXECUTED_GTID_SET('16d22a8b-e803-11e8-b46f-003d70c354d2:9067', 0.1); +------------------------------------------------------------------------------+ | WAIT_FOR_EXECUTED_GTID_SET('16d22a8b-e803-11e8-b46f-003d70c354d2:9067', 0.1) | +------------------------------------------------------------------------------+ | 1 | +------------------------------------------------------------------------------+ 1 row in set (0.00 sec) mysql> SELECT WAIT_FOR_EXECUTED_GTID_SET('16d22a8b-e803-11e8-b46f-003d70c354d2:9067', 0.5); +------------------------------------------------------------------------------+ | WAIT_FOR_EXECUTED_GTID_SET('16d22a8b-e803-11e8-b46f-003d70c354d2:9067', 0.5) | +------------------------------------------------------------------------------+ | 1 | +------------------------------------------------------------------------------+ 1 row in set (0.00 sec) mysql> SELECT WAIT_FOR_EXECUTED_GTID_SET('16d22a8b-e803-11e8-b46f-003d70c354d2:9067', 1.0); +------------------------------------------------------------------------------+ | WAIT_FOR_EXECUTED_GTID_SET('16d22a8b-e803-11e8-b46f-003d70c354d2:9067', 1.0) | +------------------------------------------------------------------------------+ | 1 | +------------------------------------------------------------------------------+ 1 row in set (1.00 sec) mysql> SELECT WAIT_FOR_EXECUTED_GTID_SET('16d22a8b-e803-11e8-b46f-003d70c354d2:9067', 1.5); +------------------------------------------------------------------------------+ | WAIT_FOR_EXECUTED_GTID_SET('16d22a8b-e803-11e8-b46f-003d70c354d2:9067', 1.5) | +------------------------------------------------------------------------------+ | 1 | +------------------------------------------------------------------------------+ 1 row in set (1.00 sec) The query execution time here shows the problem. Everything between 0.0 and 1.0 is rounted to a wait time of 0.0 seconds. When using a value in a 1.0 to 2.0 window, it rounds down to 1 seconds as visible in the query execution time. After this change it works as expected, again visible in the query execution time: mysql> SELECT WAIT_FOR_EXECUTED_GTID_SET('f9702b80-e826-11e8-b833-f64268411190:4', 1.0); +---------------------------------------------------------------------------+ | WAIT_FOR_EXECUTED_GTID_SET('f9702b80-e826-11e8-b833-f64268411190:4', 1.0) | +---------------------------------------------------------------------------+ | 1 | +---------------------------------------------------------------------------+ 1 row in set (1.01 sec) mysql> SELECT WAIT_FOR_EXECUTED_GTID_SET('f9702b80-e826-11e8-b833-f64268411190:4', 0.5); +---------------------------------------------------------------------------+ | WAIT_FOR_EXECUTED_GTID_SET('f9702b80-e826-11e8-b833-f64268411190:4', 0.5) | +---------------------------------------------------------------------------+ | 1 | +---------------------------------------------------------------------------+ 1 row in set (0.50 sec) mysql> SELECT WAIT_FOR_EXECUTED_GTID_SET('f9702b80-e826-11e8-b833-f64268411190:4', 0.1); +---------------------------------------------------------------------------+ | WAIT_FOR_EXECUTED_GTID_SET('f9702b80-e826-11e8-b833-f64268411190:4', 0.1) | +---------------------------------------------------------------------------+ | 1 | +---------------------------------------------------------------------------+ 1 row in set (0.10 sec)
We were hoping, seeing that this is a simple fix to an existing implementation, that this could find its way into the next [edit: 5.7] GA release. 🙇 |
Also ideally this can also be backported to 5.7 (and perhaps even 5.6 where applicable) as well, so we don't have to upgrade everything to 8 before getting the benefits from this fix. |
Looks like this was also partially identified in https://bugs.mysql.com/bug.php?id=83537, but not resolved correctly for fractional timeouts. |
Hi, thank you for submitting this pull request. In order to consider your code we need you to sign the Oracle Contribution Agreement (OCA). Please review the details and follow the instructions at http://www.oracle.com/technetwork/community/oca-486395.html |
Hi, there was no response to our request to sign an OCA or confirm the code is submitted under the terms of the OCA. As such this request will be closed. |
I have signed and submitted the OCA on November 26 but have never heard anything back on that. |
Oracle people, can you please look into this? |
@dbussink @shlomi-noach looking into what happened to the OCA - reopening the request |
Hi, thank you for submitting this pull request. In order to consider your code we need you to sign the Oracle Contribution Agreement (OCA). Please review the details and follow the instructions at http://www.oracle.com/technetwork/community/oca-486395.html |
Please ignore last OCA request from the bot |
Hi, there was no response to our request to sign an OCA or confirm the code is submitted under the terms of the OCA. As such this request will be closed. |
Oh please! |
I hate bots ;-) |
Ummm... last I heard we were waiting on Oracle legal... |
@shlomi-noach email me - omer.barnir@oracle.com - we can discuss there |
Hi, thank you for submitting this pull request. In order to consider your code we need you to sign the Oracle Contribution Agreement (OCA). Please review the details and follow the instructions at http://www.oracle.com/technetwork/community/oca-486395.html |
Hi all, it took a while bit from what I have heard the OCA should be set up at this point. |
Hi, thank you for your contribution. Please confirm this code is submitted under the terms of the OCA (Oracle's Contribution Agreement) you have previously signed by cutting and pasting the following text as a comment: |
I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it. |
Hi, thank you for your contribution. Your code has been assigned to an internal queue. Please follow |
The casting logic here resulted in the timeout
double
to be cast into aulonglong
before the multiplication happened. This resulted in all timeouts being rounded down to whole seconds.The behavior is visible with statements like the following:
The query execution time here shows the problem. Everything between 0.0 and 1.0 is rounted to a wait time of 0.0 seconds. When using a value in a 1.0 to 2.0 window, it rounds down to 1 seconds as visible in the query execution time.
After this change it works as expected, again visible in the query execution time: