List:Internals« Previous MessageNext Message »
From:Patrick Galbraith Date:September 8 2005 9:34pm
Subject:bk commit into 5.0 tree (patg:1.1952) BUG#7815
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of patg. When patg does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.1952 05/09/08 23:33:50 patg@stripped +3 -0
  BUG #7815. This is a new patch that includes the changes from Serg's review
  also added a new mysqldump-max test.

  client/mysqldump.c
    1.196 05/09/08 23:33:34 patg@stripped +39 -33
    BUG #7815 Re-enabled delayed inserts in mysqldump.
    - Use of check_if_ignore_table to see if a table is of the type that allows 
      delayed inserts
    - added flag to check_if_ignore table to toggle checking of tables that s
      support delayed inserts

  mysql-test/r/mysqldump-max.result
    1.1 05/09/08 22:53:28 patg@stripped +229 -0

  mysql-test/r/mysqldump-max.result
    1.0 05/09/08 22:53:28 patg@stripped +0 -0
    BitKeeper file /Users/patg/mysql-build/mysql-5.0.bug7815/mysql-test/r/mysqldump-max.result

  mysql-test/t/mysqldump-max.test
    1.1 05/09/08 22:53:19 patg@stripped +61 -0

  mysql-test/t/mysqldump-max.test
    1.0 05/09/08 22:53:19 patg@stripped +0 -0
    BitKeeper file /Users/patg/mysql-build/mysql-5.0.bug7815/mysql-test/t/mysqldump-max.test

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	patg
# Host:	radha.local
# Root:	/Users/patg/mysql-build/mysql-5.0.bug7815

--- 1.195/client/mysqldump.c	2005-08-26 14:45:19 +02:00
+++ 1.196/client/mysqldump.c	2005-09-08 23:33:34 +02:00
@@ -209,9 +209,7 @@
   {"default-character-set", OPT_DEFAULT_CHARSET,
    "Set the default character set.", (gptr*) &default_charset,
    (gptr*) &default_charset, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
-  {"delayed-insert", OPT_DELAYED, "Insert rows with INSERT DELAYED; "
-   "currently ignored because of http://bugs.mysql.com/bug.php?id=7815 "
-   "but will be re-enabled later",
+  {"delayed-insert", OPT_DELAYED, "Insert rows with INSERT DELAYED; ",
    (gptr*) &opt_delayed, (gptr*) &opt_delayed, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0,
    0, 0},
   {"delete-master-logs", OPT_DELETE_MASTER_LOGS,
@@ -408,7 +406,8 @@
 static int dump_databases(char **);
 static int dump_all_databases();
 static char *quote_name(const char *name, char *buff, my_bool force);
-static const char *check_if_ignore_table(const char *table_name);
+static const char *check_if_ignore_table(const char *table_name,
+                                         bool check_if_supports_delayed);
 static char *primary_key_fields(const char *table_name);
 static my_bool get_view_structure(char *table, char* db);
 static my_bool dump_all_views_in_db(char *database);
@@ -717,25 +716,6 @@
       }
       break;
     }
-#ifndef REMOVE_THIS_CODE_WHEN_FIX_BUG_7815
-  case (int) OPT_DELAYED:
-    /*
-      Because of http://bugs.mysql.com/bug.php?id=7815, we disable
-      --delayed-insert; when the bug gets fixed by checking the storage engine
-      (using the table definition cache) before printing INSERT DELAYED, we
-      can correct the option's description and re-enable it again (scheduled
-      for later 5.0 or 5.1 versions).
-      It's ok to do the if() below as get_one_option is called after
-      opt_delayed is set.
-    */
-    if (opt_delayed)
-    {
-      fprintf(stderr, "Warning: ignoring --delayed-insert (as explained "
-	      "in the output of 'mysqldump --help').\n");
-      opt_delayed= 0;
-    }
-    break;
-#endif
   }
   return 0;
 }
@@ -1193,7 +1173,7 @@
   my_bool    init=0;
   uint       numFields;
   char	     *result_table, *opt_quoted_table;
-  const char *insert_option;
+  const char *insert_option, *table_type;
   char	     name_buff[NAME_LEN+3],table_buff[NAME_LEN*2+3];
   char	     table_buff2[NAME_LEN*2+3];
   char       query_buff[512];
@@ -1209,9 +1189,15 @@
   else
     dynstr_set(&insert_pat, "");
 
-  insert_option= ((opt_delayed && opt_ignore) ? " DELAYED IGNORE " : 
-                  opt_delayed ? " DELAYED " :
-                  opt_ignore ? " IGNORE " : "");
+  if (opt_delayed)
+  {
+    if ((table_type= check_if_ignore_table(table,1)))
+      insert_option= (opt_ignore) ? "IGNORE " : "";
+    else
+      insert_option= (opt_ignore) ? "DELAYED IGNORE " : "DELAYED ";
+  }
+  else
+    insert_option= (opt_ignore) ? "IGNORE " : "";
 
   if (verbose)
     fprintf(stderr, "-- Retrieving table structure for table %s...\n", table);
@@ -1760,8 +1746,8 @@
   result_table= quote_name(table,table_buff, 1);
   opt_quoted_table= quote_name(table, table_buff2, 0);
 
-  /* Check table type */
-  if ((table_type= check_if_ignore_table(table)))
+  /* Check table type , not checking if supports delayed (the 0) */
+  if ((table_type= check_if_ignore_table(table, 0)))
   {
     if (verbose)
       fprintf(stderr,
@@ -2763,6 +2749,8 @@
   SYNOPSIS
     check_if_ignore_table()
     table_name			Table name to check
+    check_if_supports_delayed   Boolean flag to toggle if we're checking if the
+                                type supports delayed inserts
 
   GLOBAL VARIABLES
     sock			MySQL socket
@@ -2773,7 +2761,8 @@
     #	Type of table (that should be skipped)
 */
 
-static const char *check_if_ignore_table(const char *table_name)
+static const char *check_if_ignore_table(const char *table_name,
+                                         bool check_if_supports_delayed)
 {
   char buff[FN_REFLEN+80], show_name_buff[FN_REFLEN];
   MYSQL_RES *res;
@@ -2807,9 +2796,26 @@
       result= "VIEW";
   else
   {
-    if (strcmp(row[1], (result= "MRG_MyISAM")) &&
-        strcmp(row[1], (result= "MRG_ISAM")))
-      result= 0;
+    if (check_if_supports_delayed)
+    {
+      /*
+        if the table is any of these types, then it
+        supports INSERT DELAYED. I'm using an _inclusive_
+        list since it is shorter.
+      */
+      if (!strcmp(row[1], (result= "MyISAM")) ||
+          !strcmp(row[1], (result= "ISAM")) ||
+          !strcmp(row[1], (result= "ARCHIVE")) ||
+          !strcmp(row[1], (result= "HEAP")) ||
+          !strcmp(row[1], (result= "MEMORY")))
+        result= 0;
+    }
+    else
+    {
+      if (strcmp(row[1], (result= "MRG_MyISAM")) &&
+          strcmp(row[1], (result= "MRG_ISAM")))
+        result= 0;
+    }
   }
   mysql_free_result(res);
   return result;
--- New file ---
+++ mysql-test/r/mysqldump-max.result	05/09/08 22:53:28
drop table if exists mytable;
Warnings:
Note	1051	Unknown table 'mytable'
drop table if exists memtable;
Warnings:
Note	1051	Unknown table 'memtable'
drop table if exists archtable;
Warnings:
Note	1051	Unknown table 'archtable'
drop table if exists heaptable;
Warnings:
Note	1051	Unknown table 'heaptable'
drop table if exists innotable;
Warnings:
Note	1051	Unknown table 'innotable'
create table mytable (id int(8), name varchar(32));
create table memtable (id int(8), name varchar(32)) ENGINE="MEMORY";
create table heaptable (id int(8), name varchar(32)) ENGINE="HEAP";
create table archtable (id int(8), name varchar(32)) ENGINE="ARCHIVE";
create table innotable (id int(8), name varchar(32)) ENGINE="InnoDB";
insert into mytable values (1, 'first value');
insert into mytable values (2, 'first value');
insert into mytable values (3, 'first value');
insert into mytable values (4, 'first value');
insert into mytable values (5, 'first value');
insert into memtable values (1, 'first value');
insert into memtable values (2, 'first value');
insert into memtable values (3, 'first value');
insert into memtable values (4, 'first value');
insert into memtable values (5, 'first value');
insert into heaptable values (1, 'first value');
insert into heaptable values (2, 'first value');
insert into heaptable values (3, 'first value');
insert into heaptable values (4, 'first value');
insert into heaptable values (5, 'first value');
insert into archtable values (1, 'first value');
insert into archtable values (2, 'first value');
insert into archtable values (3, 'first value');
insert into archtable values (4, 'first value');
insert into archtable values (5, 'first value');
insert into innotable values (1, 'first value');
insert into innotable values (2, 'first value');
insert into innotable values (3, 'first value');
insert into innotable values (4, 'first value');
insert into innotable values (5, 'first value');
select * from mytable;
id	name
1	first value
2	first value
3	first value
4	first value
5	first value
select * from memtable;
id	name
1	first value
2	first value
3	first value
4	first value
5	first value
select * from heaptable;
id	name
1	first value
2	first value
3	first value
4	first value
5	first value
select * from archtable;
id	name
1	first value
2	first value
3	first value
4	first value
5	first value
select * from innotable;
id	name
1	first value
2	first value
3	first value
4	first value
5	first value

/*!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 */;
/*!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 */;

CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 */;

USE `test`;
DROP TABLE IF EXISTS `archtable`;
CREATE TABLE `archtable` (
  `id` int(8) default NULL,
  `name` varchar(32) default NULL
) ENGINE=ARCHIVE DEFAULT CHARSET=latin1;


/*!40000 ALTER TABLE `archtable` DISABLE KEYS */;
INSERT DELAYED IGNORE INTO `archtable` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `archtable` ENABLE KEYS */;
DROP TABLE IF EXISTS `heaptable`;
CREATE TABLE `heaptable` (
  `id` int(8) default NULL,
  `name` varchar(32) default NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1;


/*!40000 ALTER TABLE `heaptable` DISABLE KEYS */;
INSERT DELAYED IGNORE INTO `heaptable` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `heaptable` ENABLE KEYS */;
DROP TABLE IF EXISTS `innotable`;
CREATE TABLE `innotable` (
  `id` int(8) default NULL,
  `name` varchar(32) default NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;


/*!40000 ALTER TABLE `innotable` DISABLE KEYS */;
INSERT IGNORE INTO `innotable` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `innotable` ENABLE KEYS */;
DROP TABLE IF EXISTS `memtable`;
CREATE TABLE `memtable` (
  `id` int(8) default NULL,
  `name` varchar(32) default NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1;


/*!40000 ALTER TABLE `memtable` DISABLE KEYS */;
INSERT DELAYED IGNORE INTO `memtable` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `memtable` ENABLE KEYS */;
DROP TABLE IF EXISTS `mytable`;
CREATE TABLE `mytable` (
  `id` int(8) default NULL,
  `name` varchar(32) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;


/*!40000 ALTER TABLE `mytable` DISABLE KEYS */;
INSERT DELAYED IGNORE INTO `mytable` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `mytable` ENABLE KEYS */;

/*!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 */;


/*!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 */;
/*!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 */;

CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test` /*!40100 DEFAULT CHARACTER SET latin1 */;

USE `test`;
DROP TABLE IF EXISTS `archtable`;
CREATE TABLE `archtable` (
  `id` int(8) default NULL,
  `name` varchar(32) default NULL
) ENGINE=ARCHIVE DEFAULT CHARSET=latin1;


/*!40000 ALTER TABLE `archtable` DISABLE KEYS */;
INSERT DELAYED INTO `archtable` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `archtable` ENABLE KEYS */;
DROP TABLE IF EXISTS `heaptable`;
CREATE TABLE `heaptable` (
  `id` int(8) default NULL,
  `name` varchar(32) default NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1;


/*!40000 ALTER TABLE `heaptable` DISABLE KEYS */;
INSERT DELAYED INTO `heaptable` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `heaptable` ENABLE KEYS */;
DROP TABLE IF EXISTS `innotable`;
CREATE TABLE `innotable` (
  `id` int(8) default NULL,
  `name` varchar(32) default NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;


/*!40000 ALTER TABLE `innotable` DISABLE KEYS */;
INSERT INTO `innotable` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `innotable` ENABLE KEYS */;
DROP TABLE IF EXISTS `memtable`;
CREATE TABLE `memtable` (
  `id` int(8) default NULL,
  `name` varchar(32) default NULL
) ENGINE=MEMORY DEFAULT CHARSET=latin1;


/*!40000 ALTER TABLE `memtable` DISABLE KEYS */;
INSERT DELAYED INTO `memtable` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `memtable` ENABLE KEYS */;
DROP TABLE IF EXISTS `mytable`;
CREATE TABLE `mytable` (
  `id` int(8) default NULL,
  `name` varchar(32) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;


/*!40000 ALTER TABLE `mytable` DISABLE KEYS */;
INSERT DELAYED INTO `mytable` VALUES (1,'first value'),(2,'first value'),(3,'first value'),(4,'first value'),(5,'first value');
/*!40000 ALTER TABLE `mytable` ENABLE KEYS */;

/*!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 mytable;
drop table archtable;
drop table memtable;
drop table heaptable;
drop table innotable;

--- New file ---
+++ mysql-test/t/mysqldump-max.test	05/09/08 22:53:19
# Embedded server doesn't support external clients
--source include/not_embedded.inc
--source include/have_innodb.inc
--source include/have_archive.inc

drop table if exists mytable; 
drop table if exists memtable; 
drop table if exists archtable; 
drop table if exists heaptable; 
drop table if exists innotable; 

create table mytable (id int(8), name varchar(32));
create table memtable (id int(8), name varchar(32)) ENGINE="MEMORY";
create table heaptable (id int(8), name varchar(32)) ENGINE="HEAP";
create table archtable (id int(8), name varchar(32)) ENGINE="ARCHIVE";
create table innotable (id int(8), name varchar(32)) ENGINE="InnoDB";

insert into mytable values (1, 'first value');
insert into mytable values (2, 'first value');
insert into mytable values (3, 'first value');
insert into mytable values (4, 'first value');
insert into mytable values (5, 'first value');

insert into memtable values (1, 'first value');
insert into memtable values (2, 'first value');
insert into memtable values (3, 'first value');
insert into memtable values (4, 'first value');
insert into memtable values (5, 'first value');

insert into heaptable values (1, 'first value');
insert into heaptable values (2, 'first value');
insert into heaptable values (3, 'first value');
insert into heaptable values (4, 'first value');
insert into heaptable values (5, 'first value');

insert into archtable values (1, 'first value');
insert into archtable values (2, 'first value');
insert into archtable values (3, 'first value');
insert into archtable values (4, 'first value');
insert into archtable values (5, 'first value');

insert into innotable values (1, 'first value');
insert into innotable values (2, 'first value');
insert into innotable values (3, 'first value');
insert into innotable values (4, 'first value');
insert into innotable values (5, 'first value');

select * from mytable;
select * from memtable;
select * from heaptable;
select * from archtable;
select * from innotable;

--exec $MYSQL_DUMP --skip-comments --delayed-insert --insert-ignore --databases test
--exec $MYSQL_DUMP --skip-comments --delayed-insert --databases test

drop table mytable;
drop table archtable;
drop table memtable;
drop table heaptable;
drop table innotable;

Thread
bk commit into 5.0 tree (patg:1.1952) BUG#7815Patrick Galbraith8 Sep