Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
MDEV-18702 mysqldump: add variable 'max-statement-time'
With a global non-default max-statement-time of a time interval that exceed the query time mysqldump queries when doing a backup. To solve both, add a max-statement-time option, defaulting to 0 (unlimited time). Also like mariabackup, set the session wait_timeout=DEFAULT (28800). The time/processing between mysqldump times isn't expected to get that close ever, but let's adopt the standard of mariabackup as no-one has challenged it has having a detrimental effect. Reviewer and test case author Daniel Black
- Loading branch information
1 parent
5ac528a
commit 53c4e4d
Showing
4 changed files
with
141 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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,71 @@ | ||
| # | ||
| # MDEV-18702 mysqldump should use max_statement_time=0 and/or allow setting one | ||
| # | ||
| CREATE DATABASE test1; | ||
| USE test1; | ||
| CREATE TABLE t1 (i INT); | ||
| INSERT INTO t1 VALUES (0); | ||
| LOCK TABLE t1 WRITE; | ||
| timeout without t1 contents expected | ||
|
|
||
| /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; | ||
| /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; | ||
| /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; | ||
| /*!40101 SET NAMES utf8mb4 */; | ||
| /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; | ||
| /*!40103 SET TIME_ZONE='+00:00' */; | ||
| /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; | ||
| /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; | ||
| /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; | ||
| /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; | ||
| DROP TABLE IF EXISTS `t1`; | ||
| /*!40101 SET @saved_cs_client = @@character_set_client */; | ||
| /*!40101 SET character_set_client = utf8 */; | ||
| CREATE TABLE `t1` ( | ||
| `i` int(11) DEFAULT NULL | ||
| ) ENGINE=MyISAM DEFAULT CHARSET=latin1; | ||
| /*!40101 SET character_set_client = @saved_cs_client */; | ||
|
|
||
| SET @save_max_statement_time=@@max_statement_time; | ||
| SET GLOBAL max_statement_time=0.1; | ||
| UNLOCK TABLES;; | ||
| This would be a race condition otherwise, but default max_statement_time=0 makes it succeed | ||
|
|
||
| /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; | ||
| /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; | ||
| /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; | ||
| /*!40101 SET NAMES utf8mb4 */; | ||
| /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; | ||
| /*!40103 SET TIME_ZONE='+00:00' */; | ||
| /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; | ||
| /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; | ||
| /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; | ||
| /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; | ||
| DROP TABLE IF EXISTS `t1`; | ||
| /*!40101 SET @saved_cs_client = @@character_set_client */; | ||
| /*!40101 SET character_set_client = utf8 */; | ||
| CREATE TABLE `t1` ( | ||
| `i` int(11) DEFAULT NULL | ||
| ) ENGINE=MyISAM DEFAULT CHARSET=latin1; | ||
| /*!40101 SET character_set_client = @saved_cs_client */; | ||
|
|
||
| LOCK TABLES `t1` WRITE; | ||
| /*!40000 ALTER TABLE `t1` DISABLE KEYS */; | ||
| INSERT INTO `t1` VALUES (0); | ||
| /*!40000 ALTER TABLE `t1` ENABLE KEYS */; | ||
| UNLOCK TABLES; | ||
| /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; | ||
|
|
||
| /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; | ||
| /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; | ||
| /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; | ||
| /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; | ||
| /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; | ||
| /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; | ||
| /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; | ||
|
|
||
| SET GLOBAL max_statement_time=@save_max_statement_time; | ||
| DROP DATABASE test1; | ||
| # | ||
| # End of 10.3 test | ||
| # |
This file contains 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,26 @@ | ||
|
|
||
|
|
||
| --echo # | ||
| --echo # MDEV-18702 mysqldump should use max_statement_time=0 and/or allow setting one | ||
| --echo # | ||
|
|
||
| CREATE DATABASE test1; | ||
| USE test1; | ||
| CREATE TABLE t1 (i INT); | ||
| INSERT INTO t1 VALUES (0); | ||
| LOCK TABLE t1 WRITE; | ||
| --echo timeout without t1 contents expected | ||
| --error 2 | ||
| --exec $MYSQL_DUMP --max-statement-time=1 --skip-lock-tables --skip-comments test1 t1 | ||
| SET @save_max_statement_time=@@max_statement_time; | ||
| SET GLOBAL max_statement_time=0.1; | ||
| --send UNLOCK TABLES; | ||
| --echo This would be a race condition otherwise, but default max_statement_time=0 makes it succeed | ||
| --exec $MYSQL_DUMP --skip-lock-tables --skip-comments test1 t1 | ||
| --reap | ||
| SET GLOBAL max_statement_time=@save_max_statement_time; | ||
| DROP DATABASE test1; | ||
|
|
||
| --echo # | ||
| --echo # End of 10.3 test | ||
| --echo # |