MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Oystein Grovlen Date:October 9 2009 1:04pm
Subject:bzr commit into mysql-6.0-backup branch (oystein.grovlen:2880) Bug#39105
View as plain text  
#At file:///export/home/tmp/oysteing/mysql/mysql-6.0-backup-39105/ based on revid:rafal.somla@stripped

 2880 Oystein Grovlen	2009-10-09
      Bug#39105 Assertion in sql_class.cc when backing up invalid merge table
        (Updated to head of backup branch)
            
      Assertion no longer happens after new version of object service API
      was introduced, but error message could be improved so users are
      informed about what is actually wrong.  (That base tables are
      missing.)
            
      More information is made available by having the service interface
      copy its warnings to the THD error stack.  Main error message is still
      the same, but more information is now found on the error stack.
     @ mysql-test/suite/backup/r/backup_nodata_driver.result
        Updated result file
     @ mysql-test/suite/backup/r/backup_security.result
        Change gives one additional, and more informative error message
     @ mysql-test/suite/backup/t/backup_nodata_driver.test
        Add test case for Bug#39105
     @ mysql-test/suite/backup_engines/r/backup_interruption.result
        Updated result file to reflect changes to error reporting caused by this file.
     @ sql/si_objects.cc
        More information about errors are made available by having the service interface
        copy its warnings to the THD error stack.  Main error message is still the same, 
        but more information is now found on the error stack.

    modified:
      mysql-test/suite/backup/r/backup_nodata_driver.result
      mysql-test/suite/backup/r/backup_security.result
      mysql-test/suite/backup/t/backup_nodata_driver.test
      mysql-test/suite/backup_engines/r/backup_interruption.result
      sql/si_objects.cc
=== modified file 'mysql-test/suite/backup/r/backup_nodata_driver.result'

=== modified file 'mysql-test/suite/backup/r/backup_nodata_driver.result'
--- a/mysql-test/suite/backup/r/backup_nodata_driver.result	2009-07-09 06:48:18 +0000
+++ b/mysql-test/suite/backup/r/backup_nodata_driver.result	2009-10-09 13:03:56 +0000
@@ -308,6 +308,25 @@
 SELECT * FROM bup_nodata.e1;
 Period	Vapor_period
 #
+# Test backup of MERGE table whose base tables do not exist. (Bug#39105)
+#
+USE test;
+DROP DATABASE bup_nodata;
+CREATE DATABASE bup_nodata;
+# Create MERGE table where underlying tables t1, t2, does not exist.
+CREATE TABLE bup_nodata.total(A INT NOT NULL AUTO_INCREMENT, MESSAGE CHAR(20), 
+INDEX(A))
+ENGINE=MERGE UNION=(t1,t2) INSERT_METHOD=LAST;
+# Try to back up table.  Should get error.
+BACKUP DATABASE bup_nodata TO 'bup_notables.bak';
+ERROR HY000: Failed to obtain metadata for table `bup_nodata`.`total`
+SHOW WARNINGS;
+Level	Code	Message
+Error	#	Table 'test.t1' doesn't exist
+Error	#	Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
+Error	#	Failed to obtain metadata for table `bup_nodata`.`total`
+Warning	#	Operation aborted
+#
 # Check that restore fails if the backup image contains
 # a table in a storage engine that is not available (BUG#39379).
 #

=== modified file 'mysql-test/suite/backup/r/backup_security.result'
--- a/mysql-test/suite/backup/r/backup_security.result	2009-09-10 14:06:46 +0000
+++ b/mysql-test/suite/backup/r/backup_security.result	2009-10-09 13:03:56 +0000
@@ -342,6 +342,7 @@
 ERROR HY000: Failed to obtain metadata for view `backup_test`.`v1`
 SHOW ERRORS;
 Level	Code	Message
+Error	#	SHOW VIEW command denied to user 'bup_select_priv'@'localhost' for table 'v1'
 Error	#	Failed to obtain metadata for view `backup_test`.`v1`
 #
 # Connect as root and add privileges.

=== modified file 'mysql-test/suite/backup/t/backup_nodata_driver.test'
--- a/mysql-test/suite/backup/t/backup_nodata_driver.test	2009-07-09 06:48:18 +0000
+++ b/mysql-test/suite/backup/t/backup_nodata_driver.test	2009-10-09 13:03:56 +0000
@@ -240,6 +240,27 @@
 SELECT * FROM bup_nodata.e1;
 
 --echo #
+--echo # Test backup of MERGE table whose base tables do not exist. (Bug#39105)
+--echo #
+
+# At on point in time the server would crash in the following test
+# if a USE statement was included.
+USE test;
+DROP DATABASE bup_nodata;
+CREATE DATABASE bup_nodata;
+
+--echo # Create MERGE table where underlying tables t1, t2, does not exist.
+CREATE TABLE bup_nodata.total(A INT NOT NULL AUTO_INCREMENT, MESSAGE CHAR(20), 
+                              INDEX(A))
+  ENGINE=MERGE UNION=(t1,t2) INSERT_METHOD=LAST;
+
+--echo # Try to back up table.  Should get error.
+--error ER_BACKUP_GET_META_TABLE
+BACKUP DATABASE bup_nodata TO 'bup_notables.bak';
+--replace_column 2 #
+SHOW WARNINGS;
+
+--echo #
 --echo # Check that restore fails if the backup image contains
 --echo # a table in a storage engine that is not available (BUG#39379).
 --echo #
@@ -261,5 +282,3 @@
 
 remove_file $MYSQLD_BACKUPDIR/bup_data.bak;
 remove_file $MYSQLD_BACKUPDIR/bup_nodata.bak;
-
-

=== modified file 'mysql-test/suite/backup_engines/r/backup_interruption.result'
--- a/mysql-test/suite/backup_engines/r/backup_interruption.result	2009-05-07 01:44:37 +0000
+++ b/mysql-test/suite/backup_engines/r/backup_interruption.result	2009-10-09 13:03:56 +0000
@@ -195,6 +195,9 @@
 SHOW WARNINGS;
 Level	Code	Message
 Error	<error-code>	Query execution was interrupted
+Error	<error-code>	Query execution was interrupted
+Error	<error-code>	Query execution was interrupted
+Error	<error-code>	Query execution was interrupted
 Warning	<error-code>	Operation aborted
 #
 # Examine backup logs.
@@ -410,6 +413,9 @@
 SHOW WARNINGS;
 Level	Code	Message
 Error	<error-code>	Query execution was interrupted
+Error	<error-code>	Query execution was interrupted
+Error	<error-code>	Query execution was interrupted
+Error	<error-code>	Query execution was interrupted
 Warning	<error-code>	Operation aborted
 #
 # Examine backup logs.

=== modified file 'sql/si_objects.cc'
--- a/sql/si_objects.cc	2009-10-09 09:55:50 +0000
+++ b/sql/si_objects.cc	2009-10-09 13:03:56 +0000
@@ -187,7 +187,8 @@
 
   @param[in]  thd         Thread context.
   @param[in]  query       SQL query to be executed.
-  @param[out] ed_result   A place to store result and warnings.
+  @param[in]  get_warnings    If true, copy warnings to the error stack
+  @param[out] ed_connection   A place to store result and warnings.
 
   @return Error status.
     @retval TRUE on error.
@@ -196,7 +197,7 @@
 
 bool
 run_service_interface_sql(THD *thd, Ed_connection *ed_connection,
-                          const LEX_STRING *query)
+                          const LEX_STRING *query, bool get_warnings)
 {
   Si_session_context session_context;
 
@@ -210,6 +211,11 @@
 
   bool rc= ed_connection->execute_direct(*query);
 
+  if (get_warnings) {
+    /* Push warnings on the THD error stack. */
+    thd->warning_info->append_warnings(thd, ed_connection->get_warn_list());
+  }
+
   session_context.restore_si_ctx(thd);
 
   DBUG_RETURN(rc);
@@ -1266,7 +1272,7 @@
   Ed_result_set *ed_result_set;
   Iterator *it;
 
-  if (run_service_interface_sql(thd, &ed_connection, query))
+  if (run_service_interface_sql(thd, &ed_connection, query, TRUE))
     /* Query failed with an error */
     return NULL;
   else if(ed_connection.get_warn_count())
@@ -1740,7 +1746,8 @@
     s_stream <<
       "SHOW CREATE DATABASE `" << get_name() << "`";
 
-    if (run_service_interface_sql(thd, &ed_connection, s_stream.lex_string()) ||
+    if (run_service_interface_sql(thd, &ed_connection, 
+				  s_stream.lex_string(), TRUE) ||
         ed_connection.get_warn_count())
     {
       /*
@@ -1890,7 +1897,8 @@
   s_stream <<
     "SHOW CREATE TABLE `" << &m_db_name << "`.`" << &m_id << "`";
 
-  if (run_service_interface_sql(thd, &ed_connection, s_stream.lex_string()) ||
+  if (run_service_interface_sql(thd, &ed_connection, 
+				s_stream.lex_string(), TRUE) ||
       ed_connection.get_warn_count())
   {
     /*
@@ -1945,7 +1953,8 @@
     "SHOW CREATE VIEW `" << view->get_db_name() << "`."
     "`" << view->get_name() << "`";
 
-  if (run_service_interface_sql(thd, &ed_connection, s_stream.lex_string()) ||
+  if (run_service_interface_sql(thd, &ed_connection, 
+				s_stream.lex_string(), TRUE) ||
       ed_connection.get_warn_count())
   {
     /*
@@ -2055,7 +2064,8 @@
     "SHOW CREATE " << get_type_name() <<
     " `" << &m_db_name << "`.`" << &m_id << "`";
 
-  if (run_service_interface_sql(thd, &ed_connection, s_stream.lex_string()))
+  if (run_service_interface_sql(thd, &ed_connection, 
+				s_stream.lex_string(), TRUE))
     /* Query failed with an error */
     DBUG_RETURN(TRUE);
   else if(ed_connection.get_warn_count())
@@ -2451,8 +2461,8 @@
 
   // Execute SELECT.
 
-  if (run_service_interface_sql(thd, &ed_connection, s_stream.lex_string()) ||
-      ed_connection.get_warn_count())
+  if (run_service_interface_sql(thd, &ed_connection, s_stream.lex_string(), 
+				TRUE) || ed_connection.get_warn_count())
     return NULL;
 
   // Fetch result.
@@ -2528,7 +2538,8 @@
     "WHERE LCASE(schema_name) != 'mysql' AND " <<
     "LCASE(schema_name) != 'information_schema'";
 
-  if (run_service_interface_sql(thd, &ed_connection, s_stream.lex_string()))
+  if (run_service_interface_sql(thd, &ed_connection,
+				s_stream.lex_string(), TRUE))
     /* Query failed with an error */
     return NULL;
   else if(ed_connection.get_warn_count())
@@ -2584,7 +2595,8 @@
     "FROM INFORMATION_SCHEMA.EVENTS "
     "WHERE event_schema COLLATE utf8_bin = '" << db_name << "'";
 
-  if (run_service_interface_sql(thd, &ed_connection, s_stream.lex_string()))
+  if (run_service_interface_sql(thd, &ed_connection, 
+				s_stream.lex_string(), TRUE))
     /* Query failed with an error */
     return NULL;
   else if(ed_connection.get_warn_count())
@@ -2925,7 +2937,9 @@
   s_stream << "SHOW CREATE DATABASE `" << db_name << "`";
 
   Ed_connection ed_connection(thd);
-  rc= run_service_interface_sql(thd, &ed_connection, s_stream.lex_string());
+  rc= run_service_interface_sql(thd, 
+				&ed_connection, s_stream.lex_string(), 
+				FALSE);
 
   /* We're not interested in warnings/errors here. */
 
@@ -2950,7 +2964,8 @@
     "WHERE grantee = \"" << grant_obj->get_user_name() << "\"";
 
 
-  if (run_service_interface_sql(thd, &ed_connection, s_stream.lex_string()) ||
+  if (run_service_interface_sql(thd, &ed_connection, 
+				s_stream.lex_string(), TRUE) ||
       ed_connection.get_warn_count())
   {
     /* Should be no warnings. */
@@ -2993,7 +3008,8 @@
     "t1.tablespace_name = '" << ts_name << "'";
 
 
-  if (run_service_interface_sql(thd, &ed_connection, s_stream.lex_string()) ||
+  if (run_service_interface_sql(thd, &ed_connection, 
+				s_stream.lex_string(), TRUE) ||
       ed_connection.get_warn_count())
   {
     /* Should be no warnings. */
@@ -3061,7 +3077,8 @@
     "t3.table_name = '" << table_name << "'";
 
 
-  if (run_service_interface_sql(thd, &ed_connection, s_stream.lex_string()) ||
+  if (run_service_interface_sql(thd, &ed_connection, 
+				s_stream.lex_string(), TRUE) ||
       ed_connection.get_warn_count())
   {
     /* Should be no warnings. */
@@ -3419,7 +3436,7 @@
                                 "FROM INFORMATION_SCHEMA.PROCESSLIST"
                                 "WHERE LCASE(command) = LCASE('Binlog Dump')");
 
-  if (run_service_interface_sql(thd, &ed_connection, &sql_text) ||
+  if (run_service_interface_sql(thd, &ed_connection, &sql_text, TRUE) ||
       ed_connection.get_warn_count())
   {
     /* Should be no warnings. */


Attachment: [text/bzr-bundle] bzr/oystein.grovlen@sun.com-20091009130356-dxa7demdwm0yn21j.bundle
Thread
bzr commit into mysql-6.0-backup branch (oystein.grovlen:2880) Bug#39105Oystein Grovlen9 Oct