From: Martin Hansson Date: October 29 2012 4:17pm Subject: bzr push into mysql-trunk branch (martin.hansson:4726 to 4727) List-Archive: http://lists.mysql.com/commits/145316 Message-Id: <20121029161707.440.24179.4727@localhost6.localdomain6> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 4727 Martin Hansson 2012-10-29 Worklog #6073: Remove INSERT DELAYED: mysqldump This patch removes the --delayed-insert flag and related functionality from mysqldump. We need to re-record mysqldump.test and mysqldump-max.test. modified: client/mysqldump.c mysql-test/r/mysqldump-max.result mysql-test/r/mysqldump.result mysql-test/t/mysqldump-max.test mysql-test/t/mysqldump.test 4726 Martin Hansson 2012-10-25 Worklog #6073: Remove INSERT DELAYED: Changes requested during code review of the fourth patch. modified: mysys/thr_lock.c === modified file 'client/mysqldump.c' --- a/client/mysqldump.c 2012-08-07 13:56:51 +0000 +++ b/client/mysqldump.c 2012-10-29 15:43:34 +0000 @@ -82,7 +82,6 @@ /* ignore table flags */ #define IGNORE_NONE 0x00 /* no ignore */ #define IGNORE_DATA 0x01 /* don't dump data for this table */ -#define IGNORE_INSERT_DELAYED 0x02 /* table doesn't support INSERT DELAYED */ /* general_log or slow_log tables under mysql database */ static inline my_bool general_log_or_slow_log_tables(const char *db, @@ -104,7 +103,7 @@ static my_bool verbose= 0, opt_no_creat quick= 1, extended_insert= 1, lock_tables=1,ignore_errors=0,flush_logs=0,flush_privileges=0, opt_drop=1,opt_keywords=0,opt_lock=1,opt_compress=0, - opt_delayed=0,create_options=1,opt_quoted=0,opt_databases=0, + create_options=1,opt_quoted=0,opt_databases=0, opt_alldbs=0,opt_create_db=0,opt_lock_all_tables=0, opt_set_charset=0, opt_dump_date=1, opt_autocommit=0,opt_disable_keys=1,opt_xml=0, @@ -287,9 +286,6 @@ static struct my_option my_long_options[ {"default-character-set", OPT_DEFAULT_CHARSET, "Set the default character set.", &default_charset, &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"delayed-insert", OPT_DELAYED, "Insert rows with INSERT DELAYED.", - &opt_delayed, &opt_delayed, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, - 0, 0}, {"delete-master-logs", OPT_DELETE_MASTER_LOGS, "Delete logs on master after backup. This automatically enables --master-data.", &opt_delete_master_logs, &opt_delete_master_logs, 0, @@ -947,8 +943,6 @@ static int get_options(int *argc, char * if (debug_check_flag) my_end_arg= MY_CHECK_ERROR; - if (opt_delayed) - opt_lock=0; /* Can't have lock with delayed */ if (!path && (enclosed || opt_enclosed || escaped || lines_terminated || fields_terminated)) { @@ -2461,7 +2455,7 @@ static uint dump_routines_for_db(char *d static uint get_table_structure(char *table, char *db, char *table_type, char *ignore_flag) { - my_bool init=0, delayed, write_data, complete_insert; + my_bool init=0, write_data, complete_insert; my_ulonglong num_fields; char *result_table, *opt_quoted_table; const char *insert_option; @@ -2486,14 +2480,6 @@ static uint get_table_structure(char *ta *ignore_flag= check_if_ignore_table(table, table_type); - delayed= opt_delayed; - if (delayed && (*ignore_flag & IGNORE_INSERT_DELAYED)) - { - delayed= 0; - verbose_msg("-- Warning: Unable to use delayed inserts for table '%s' " - "because it's of type %s\n", table, table_type); - } - complete_insert= 0; if ((write_data= !(*ignore_flag & IGNORE_DATA))) { @@ -2507,8 +2493,7 @@ static uint get_table_structure(char *ta dynstr_set_checked(&insert_pat, ""); } - insert_option= ((delayed && opt_ignore) ? " DELAYED IGNORE " : - delayed ? " DELAYED " : opt_ignore ? " IGNORE " : ""); + insert_option= (opt_ignore ? " IGNORE " : ""); verbose_msg("-- Retrieving table structure for table %s...\n", table); @@ -5053,12 +5038,11 @@ static void print_value(FILE *file, MYSQ /* SYNOPSIS - Check if we the table is one of the table types that should be ignored: - MRG_ISAM, MRG_MYISAM, if opt_delayed, if that table supports delayed inserts. + Check if the table is one of the table types that should be ignored: + MRG_ISAM, MRG_MYISAM. + If the table should be altogether ignored, it returns a TRUE, FALSE if it - should not be ignored. If the user has selected to use INSERT DELAYED, it - sets the value of the bool pointer supports_delayed_inserts to 0 if not - supported, 1 if it is supported. + should not be ignored. ARGS @@ -5107,26 +5091,9 @@ char check_if_ignore_table(const char *t strmake(table_type, "VIEW", NAME_LEN-1); else { - /* - If the table type matches any of these, we do support delayed inserts. - Note: we do not want to skip dumping this table if if is not one of - these types, but we do want to use delayed inserts in the dump if - the table type is _NOT_ one of these types - */ strmake(table_type, row[1], NAME_LEN-1); - if (opt_delayed) - { - if (strcmp(table_type,"MyISAM") && - strcmp(table_type,"ISAM") && - strcmp(table_type,"ARCHIVE") && - strcmp(table_type,"HEAP") && - strcmp(table_type,"MEMORY")) - result= IGNORE_INSERT_DELAYED; - } - /* - If these two types, we do want to skip dumping the table - */ + /* If these two types, we want to skip dumping the table. */ if (!opt_no_data && (!my_strcasecmp(&my_charset_latin1, table_type, "MRG_MyISAM") || !strcmp(table_type,"MRG_ISAM") || === modified file 'mysql-test/r/mysqldump-max.result' --- a/mysql-test/r/mysqldump-max.result 2010-10-25 09:20:53 +0000 +++ b/mysql-test/r/mysqldump-max.result 2012-10-29 15:43:34 +0000 @@ -101,9 +101,11 @@ CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; +LOCK TABLES `t1` WRITE; /*!40000 ALTER TABLE `t1` DISABLE KEYS */; -INSERT DELAYED IGNORE INTO `t1` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value'); +INSERT IGNORE INTO `t1` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value'); /*!40000 ALTER TABLE `t1` ENABLE KEYS */; +UNLOCK TABLES; DROP TABLE IF EXISTS `t2`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; @@ -113,9 +115,11 @@ CREATE TABLE `t2` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; +LOCK TABLES `t2` WRITE; /*!40000 ALTER TABLE `t2` DISABLE KEYS */; -INSERT DELAYED IGNORE INTO `t2` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value'); +INSERT IGNORE INTO `t2` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value'); /*!40000 ALTER TABLE `t2` ENABLE KEYS */; +UNLOCK TABLES; DROP TABLE IF EXISTS `t3`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; @@ -125,9 +129,11 @@ CREATE TABLE `t3` ( ) ENGINE=MEMORY DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; +LOCK TABLES `t3` WRITE; /*!40000 ALTER TABLE `t3` DISABLE KEYS */; -INSERT DELAYED IGNORE INTO `t3` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value'); +INSERT IGNORE INTO `t3` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value'); /*!40000 ALTER TABLE `t3` ENABLE KEYS */; +UNLOCK TABLES; DROP TABLE IF EXISTS `t4`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; @@ -137,9 +143,11 @@ CREATE TABLE `t4` ( ) ENGINE=MEMORY DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; +LOCK TABLES `t4` WRITE; /*!40000 ALTER TABLE `t4` DISABLE KEYS */; -INSERT DELAYED IGNORE INTO `t4` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value'); +INSERT IGNORE INTO `t4` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value'); /*!40000 ALTER TABLE `t4` ENABLE KEYS */; +UNLOCK TABLES; DROP TABLE IF EXISTS `t5`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; @@ -149,9 +157,11 @@ CREATE TABLE `t5` ( ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; +LOCK TABLES `t5` WRITE; /*!40000 ALTER TABLE `t5` DISABLE KEYS */; -INSERT DELAYED IGNORE INTO `t5` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value'); +INSERT IGNORE INTO `t5` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value'); /*!40000 ALTER TABLE `t5` ENABLE KEYS */; +UNLOCK TABLES; DROP TABLE IF EXISTS `t6`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; @@ -161,9 +171,11 @@ CREATE TABLE `t6` ( ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; +LOCK TABLES `t6` WRITE; /*!40000 ALTER TABLE `t6` DISABLE KEYS */; INSERT IGNORE INTO `t6` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value'); /*!40000 ALTER TABLE `t6` ENABLE KEYS */; +UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; @@ -198,9 +210,11 @@ CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; +LOCK TABLES `t1` WRITE; /*!40000 ALTER TABLE `t1` DISABLE KEYS */; -INSERT DELAYED INTO `t1` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value'); +INSERT INTO `t1` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value'); /*!40000 ALTER TABLE `t1` ENABLE KEYS */; +UNLOCK TABLES; DROP TABLE IF EXISTS `t2`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; @@ -210,9 +224,11 @@ CREATE TABLE `t2` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; +LOCK TABLES `t2` WRITE; /*!40000 ALTER TABLE `t2` DISABLE KEYS */; -INSERT DELAYED INTO `t2` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value'); +INSERT INTO `t2` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value'); /*!40000 ALTER TABLE `t2` ENABLE KEYS */; +UNLOCK TABLES; DROP TABLE IF EXISTS `t3`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; @@ -222,9 +238,11 @@ CREATE TABLE `t3` ( ) ENGINE=MEMORY DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; +LOCK TABLES `t3` WRITE; /*!40000 ALTER TABLE `t3` DISABLE KEYS */; -INSERT DELAYED INTO `t3` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value'); +INSERT INTO `t3` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value'); /*!40000 ALTER TABLE `t3` ENABLE KEYS */; +UNLOCK TABLES; DROP TABLE IF EXISTS `t4`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; @@ -234,9 +252,11 @@ CREATE TABLE `t4` ( ) ENGINE=MEMORY DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; +LOCK TABLES `t4` WRITE; /*!40000 ALTER TABLE `t4` DISABLE KEYS */; -INSERT DELAYED INTO `t4` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value'); +INSERT INTO `t4` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value'); /*!40000 ALTER TABLE `t4` ENABLE KEYS */; +UNLOCK TABLES; DROP TABLE IF EXISTS `t5`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; @@ -246,9 +266,11 @@ CREATE TABLE `t5` ( ) ENGINE=ARCHIVE DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; +LOCK TABLES `t5` WRITE; /*!40000 ALTER TABLE `t5` DISABLE KEYS */; -INSERT DELAYED INTO `t5` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value'); +INSERT INTO `t5` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value'); /*!40000 ALTER TABLE `t5` ENABLE KEYS */; +UNLOCK TABLES; DROP TABLE IF EXISTS `t6`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; @@ -258,9 +280,11 @@ CREATE TABLE `t6` ( ) ENGINE=InnoDB DEFAULT CHARSET=latin1; /*!40101 SET character_set_client = @saved_cs_client */; +LOCK TABLES `t6` WRITE; /*!40000 ALTER TABLE `t6` DISABLE KEYS */; INSERT INTO `t6` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value'); /*!40000 ALTER TABLE `t6` ENABLE KEYS */; +UNLOCK TABLES; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; === modified file 'mysql-test/r/mysqldump.result' --- a/mysql-test/r/mysqldump.result 2012-08-27 13:41:18 +0000 +++ b/mysql-test/r/mysqldump.result 2012-10-29 15:43:34 +0000 @@ -750,38 +750,6 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; - -/*!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 */; -DROP TABLE IF EXISTS `t1`; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE `t1` ( - `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1; -/*!40101 SET character_set_client = @saved_cs_client */; - -/*!40000 ALTER TABLE `t1` DISABLE KEYS */; -INSERT DELAYED IGNORE INTO `t1` VALUES (1),(2),(3),(4),(5),(6); -/*!40000 ALTER TABLE `t1` ENABLE KEYS */; -/*!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 */; - DROP TABLE t1; # # Bug#10286 mysqldump -c crashes on table that has many fields with long === modified file 'mysql-test/t/mysqldump-max.test' --- a/mysql-test/t/mysqldump-max.test 2010-10-25 09:20:53 +0000 +++ b/mysql-test/t/mysqldump-max.test 2012-10-29 15:43:34 +0000 @@ -57,8 +57,8 @@ select * from t4; select * from t5; select * from t6; ---exec $MYSQL_DUMP --skip-comments --delayed-insert --insert-ignore --databases test ---exec $MYSQL_DUMP --skip-comments --delayed-insert --databases test +--exec $MYSQL_DUMP --skip-comments --insert-ignore --databases test +--exec $MYSQL_DUMP --skip-comments --databases test drop table t1; drop table t2; === modified file 'mysql-test/t/mysqldump.test' --- a/mysql-test/t/mysqldump.test 2012-08-27 13:39:48 +0000 +++ b/mysql-test/t/mysqldump.test 2012-10-29 15:43:34 +0000 @@ -214,7 +214,6 @@ CREATE TABLE t1 (a INT); INSERT INTO t1 VALUES (1),(2),(3); INSERT INTO t1 VALUES (4),(5),(6); --exec $MYSQL_DUMP --skip-comments --insert-ignore test t1 ---exec $MYSQL_DUMP --skip-comments --insert-ignore --delayed-insert test t1 DROP TABLE t1; --echo # No bundle (reason: useless for push emails).