Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new option innodb_stats_on_metadata to mysqldump
Summary: As title. Note the option takes effect only on innodb as default engine. Reviewed By: teng-li Differential Revision: D4590297 fbshipit-source-id: 11a4797
- Loading branch information
1 parent
25e1603
commit da207ee
Showing
6 changed files
with
174 additions
and
7 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,66 @@ | ||
DROP TABLE IF EXISTS table1; | ||
drop database if exists database1; | ||
SELECT @@global.default_storage_engine INTO @old_engine; | ||
SET GLOBAL default_storage_engine=InnoDB; | ||
CREATE DATABASE database1; | ||
USE database1; | ||
CREATE TABLE table1(a INT); | ||
INSERT INTO table1 VALUES (1); | ||
INSERT INTO table1 VALUES (2); | ||
INSERT INTO table1 VALUES (3); | ||
==== Running 'replace_regex' on Server/mysqldump Versions ==== | ||
==== mysqldump with --innodb-stats-on-metadata database1 ==== | ||
-- MYSQLDUMP VERSION | ||
-- | ||
-- Host: localhost Database: database1 | ||
-- ------------------------------------------------------ | ||
-- SERVER VERSION | ||
/*!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 utf8 */; | ||
/*!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 */; | ||
|
||
-- | ||
-- Table structure for table `table1` | ||
-- | ||
|
||
DROP TABLE IF EXISTS `table1`; | ||
/*!40101 SET @saved_cs_client = @@character_set_client */; | ||
/*!40101 SET character_set_client = utf8 */; | ||
CREATE TABLE `table1` ( | ||
`a` int(11) DEFAULT NULL | ||
) ENGINE=InnoDB DEFAULT CHARSET=latin1; | ||
/*!40101 SET character_set_client = @saved_cs_client */; | ||
|
||
-- | ||
-- Dumping data for table `table1` | ||
-- | ||
|
||
LOCK TABLES `table1` WRITE; | ||
/*!40000 ALTER TABLE `table1` DISABLE KEYS */; | ||
INSERT INTO `table1` VALUES (1),(2),(3); | ||
/*!40000 ALTER TABLE `table1` ENABLE KEYS */; | ||
UNLOCK TABLES; | ||
|
||
-- | ||
-- Rows found for table1: 3 | ||
-- | ||
/*!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 */; | ||
|
||
-- Dump completed | ||
drop database database1; | ||
SET GLOBAL default_storage_engine=@old_engine; |
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,31 @@ | ||
################################################################################ | ||
# Testing the mysqldump with --innodb-stats-on-metadata option | ||
################################################################################ | ||
|
||
--source include/have_innodb.inc | ||
|
||
--disable_warnings | ||
DROP TABLE IF EXISTS table1; | ||
drop database if exists database1; | ||
--enable_warnings | ||
|
||
SELECT @@global.default_storage_engine INTO @old_engine; | ||
SET GLOBAL default_storage_engine=InnoDB; | ||
|
||
CREATE DATABASE database1; | ||
USE database1; | ||
CREATE TABLE table1(a INT); | ||
|
||
INSERT INTO table1 VALUES (1); | ||
INSERT INTO table1 VALUES (2); | ||
INSERT INTO table1 VALUES (3); | ||
|
||
# Sanity test mysqldump when the option is used | ||
--echo ==== Running 'replace_regex' on Server/mysqldump Versions ==== | ||
--echo ==== mysqldump with --innodb-stats-on-metadata database1 ==== | ||
--replace_regex /-- Server version.*/-- SERVER VERSION/ /-- MySQL dump.*[)]/-- MYSQLDUMP VERSION/ | ||
--exec $MYSQL_DUMP --skip-dump-date --innodb-stats-on-metadata database1 | ||
|
||
drop database database1; | ||
|
||
SET GLOBAL default_storage_engine=@old_engine; |