List:Internals« Previous MessageNext Message »
From:Patrick Galbraith Date:September 9 2005 11:23pm
Subject:bk commit into 5.0 tree (patg:1.1958) BUG#9056
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.1958 05/09/10 01:22:51 patg@stripped +2 -0
  BUG #9056, patch 3
  - Call check_if_ignore_table only once
  - Turn --delayed_insert back on

  mysql-test/r/mysqldump.result
    1.64 05/09/10 01:22:39 patg@stripped +0 -2
    New Result file

  client/mysqldump.c
    1.198 05/09/10 01:22:39 patg@stripped +76 -72
    BUG #7815
    - only call check_if_ignore_table once
    - Added variables table_supports_delayed_inserts and skip_data_dump
      both of which are set in check_if_ignore_table
    - Moved call to check_if_ignore_table out of dump_table to before 
      get_table_structure. This is needed because get_table_structure appends
      conditionaly whether we need to append a 'DELAY' or not if a table
      supports delayed inserts.
    - skip_data_dump is set if the table is not one that we dump, and this 
      is used to conditionally call dump_data and append the insert text to
      insert_pat

# 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.bug9056

--- 1.197/client/mysqldump.c	2005-09-08 19:44:59 +02:00
+++ 1.198/client/mysqldump.c	2005-09-10 01:22:39 +02:00
@@ -87,7 +87,9 @@
 		opt_single_transaction=0, opt_comments= 0, opt_compact= 0,
 		opt_hex_blob=0, opt_order_by_primary=0, opt_ignore=0,
                 opt_complete_insert= 0, opt_drop_database= 0,
-                opt_dump_triggers= 0, opt_routines=0;
+                opt_dump_triggers= 0, opt_routines=0,
+                table_supports_delayed_inserts, skip_data_dump=0;
+
 static ulong opt_max_allowed_packet, opt_net_buffer_length;
 static MYSQL mysql_connection,*sock=0;
 static my_bool insert_pat_inited=0;
@@ -209,9 +211,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,
@@ -720,25 +720,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;
 }
@@ -1318,8 +1299,9 @@
   else
     dynstr_set(&insert_pat, "");
 
-  insert_option= ((opt_delayed && opt_ignore) ? " DELAYED IGNORE " : 
-                  opt_delayed ? " DELAYED " :
+  insert_option= ((opt_delayed && opt_ignore &&
+                   table_supports_delayed_inserts) ? " DELAYED IGNORE " : 
+                  (opt_delayed && table_supports_delayed_inserts) ? " DELAYED " :
                   opt_ignore ? " IGNORE " : "");
 
   if (verbose)
@@ -1485,32 +1467,35 @@
       DBUG_RETURN(0);
     }
 
-    dynstr_append_mem(&insert_pat, "INSERT ", 7);
-    dynstr_append(&insert_pat, insert_option);
-    dynstr_append_mem(&insert_pat, "INTO ", 5);
-    dynstr_append(&insert_pat, opt_quoted_table);
-    if (opt_complete_insert)
+    if (! skip_data_dump)
     {
-      dynstr_append_mem(&insert_pat, " (", 2);
-    }
-    else
-    {
-      dynstr_append_mem(&insert_pat, " VALUES ", 8);
-      if (!extended_insert)
-        dynstr_append_mem(&insert_pat, "(", 1);
-    }
+      dynstr_append_mem(&insert_pat, "INSERT ", 7);
+      dynstr_append(&insert_pat, insert_option);
+      dynstr_append_mem(&insert_pat, "INTO ", 5);
+      dynstr_append(&insert_pat, opt_quoted_table);
+      if (opt_complete_insert)
+      {
+        dynstr_append_mem(&insert_pat, " (", 2);
+      }
+      else
+      {
+        dynstr_append_mem(&insert_pat, " VALUES ", 8);
+        if (!extended_insert)
+          dynstr_append_mem(&insert_pat, "(", 1);
+      }
 
-    while ((row=mysql_fetch_row(tableRes)))
-    {
-      if (init)
+      while ((row=mysql_fetch_row(tableRes)))
       {
+        if (init)
+        {
+          if (opt_complete_insert)
+            dynstr_append_mem(&insert_pat, ", ", 2);
+        }
+        init=1;
         if (opt_complete_insert)
-          dynstr_append_mem(&insert_pat, ", ", 2);
+          dynstr_append(&insert_pat,
+                        quote_name(row[SHOW_FIELDNAME], name_buff, 0));
       }
-      init=1;
-      if (opt_complete_insert)
-        dynstr_append(&insert_pat,
-                      quote_name(row[SHOW_FIELDNAME], name_buff, 0));
     }
     numFields = (uint) mysql_num_rows(tableRes);
     mysql_free_result(tableRes);
@@ -1558,19 +1543,22 @@
       check_io(sql_file);
     }
 
-    dynstr_append_mem(&insert_pat, "INSERT ", 7);
-    dynstr_append(&insert_pat, insert_option);
-    dynstr_append_mem(&insert_pat, "INTO ", 5);
-    dynstr_append(&insert_pat, result_table);
-    if (opt_complete_insert)
-    {
-      dynstr_append_mem(&insert_pat, " (", 2);
-    }
-    else
+    if (!skip_data_dump)
     {
-      dynstr_append_mem(&insert_pat, " VALUES ", 8);
-      if (!extended_insert)
-        dynstr_append_mem(&insert_pat, "(", 1);
+      dynstr_append_mem(&insert_pat, "INSERT ", 7);
+      dynstr_append(&insert_pat, insert_option);
+      dynstr_append_mem(&insert_pat, "INTO ", 5);
+      dynstr_append(&insert_pat, result_table);
+      if (opt_complete_insert)
+      {
+        dynstr_append_mem(&insert_pat, " (", 2);
+      }
+      else
+      {
+        dynstr_append_mem(&insert_pat, " VALUES ", 8);
+        if (!extended_insert)
+          dynstr_append_mem(&insert_pat, "(", 1);
+      }
     }
 
     while ((row=mysql_fetch_row(tableRes)))
@@ -1583,11 +1571,11 @@
 	  fputs(",\n",sql_file);
 	  check_io(sql_file);
 	}
-        if (opt_complete_insert)
+        if (opt_complete_insert && !skip_data_dump)
           dynstr_append_mem(&insert_pat, ", ", 2);
       }
       init=1;
-      if (opt_complete_insert)
+      if (opt_complete_insert && !skip_data_dump)
         dynstr_append(&insert_pat,
                       quote_name(row[SHOW_FIELDNAME], name_buff, 0));
       if (!tFlag)
@@ -1750,7 +1738,7 @@
       check_io(sql_file);
     }
   }
-  if (opt_complete_insert)
+  if (opt_complete_insert && !skip_data_dump)
   {
     dynstr_append_mem(&insert_pat, ") VALUES ", 9);
     if (!extended_insert)
@@ -1843,7 +1831,6 @@
   MYSQL_FIELD	*field;
   MYSQL_ROW	row;
   ulong		rownr, row_break, total_length, init_length;
-  const char    *table_type;
   int error= 0;
 
   /* Check --no-data flag */
@@ -1869,15 +1856,6 @@
   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)))
-  {
-    if (verbose)
-      fprintf(stderr,
-	      "-- Skipping data for table '%s' because it's of type %s\n",
-	      table, table_type);
-    return;
-  }
 
   if (verbose)
     fprintf(stderr, "-- Sending SELECT query...\n");
@@ -2443,6 +2421,7 @@
 static int dump_all_tables_in_db(char *database)
 {
   char *table;
+  const char *table_type;
   uint numrows;
   char table_buff[NAME_LEN*2+3];
 
@@ -2481,8 +2460,15 @@
     char *end= strmov(afterdot, table);
     if (include_table(hash_key, end - hash_key))
     {
+      /* Check table type */
+      if ((table_type= check_if_ignore_table(table)))
+        if (verbose)
+          fprintf(stderr,
+                  "-- Skipping data for table '%s' because it's of type %s\n",
+                  table, table_type);
       numrows = get_table_structure(table, database);
-      dump_table(numrows,table);
+      if (! skip_data_dump)
+        dump_table(numrows,table);
       my_free(order_by, MYF(MY_ALLOW_ZERO_PTR));
       order_by= 0;
     }
@@ -2929,9 +2915,27 @@
       result= "VIEW";
   else
   {
+    if (opt_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], "MyISAM") ||
+          !strcmp(row[1], "ISAM") ||
+          !strcmp(row[1], "ARCHIVE") ||
+          !strcmp(row[1], "HEAP") ||
+          !strcmp(row[1],"MEMORY"))
+        table_supports_delayed_inserts= 1;
+      else
+        table_supports_delayed_inserts= 0;
+    }
     if (strcmp(row[1], (result= "MRG_MyISAM")) &&
         strcmp(row[1], (result= "MRG_ISAM")))
       result= 0;
+    else
+      skip_data_dump= 1;
   }
   mysql_free_result(res);
   return result;

--- 1.63/mysql-test/r/mysqldump.result	2005-09-08 19:45:00 +02:00
+++ 1.64/mysql-test/r/mysqldump.result	2005-09-10 01:22:39 +02:00
@@ -612,9 +612,7 @@
 
 
 /*!40000 ALTER TABLE `t1` DISABLE KEYS */;
-LOCK TABLES `t1` WRITE;
 INSERT  IGNORE INTO `t1` VALUES (1),(2),(3),(4),(5),(6);
-UNLOCK TABLES;
 /*!40000 ALTER TABLE `t1` ENABLE KEYS */;
 
 /*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
Thread
bk commit into 5.0 tree (patg:1.1958) BUG#9056Patrick Galbraith10 Sep