List:Commits« Previous MessageNext Message »
From:Ingo Struewing Date:November 7 2008 10:18am
Subject:bzr commit into mysql-6.0-backup branch (ingo.struewing:2727) Bug#40075
View as plain text  
#At file:///home2/mydev/bzrroot/mysql-6.0-bug40075/

 2727 Ingo Struewing	2008-11-07
      Bug#40075 - Non-descriptive error message when restoring
                  on Falcon with open transactions
      
      Not to be pushed. This is a demo patch. It shows, what could be changed
      to receive a better error message in this case.
      
      This patch reverts a couple of design decisions. It should not be pushed
      without approval from the architecture team. For more information see
      the bug report.
      
      As you can see, the changes do not always improve the error messages.
      In backup_views it became worse. Definitely.
      In ndb_single_user, it is arguable.
      In restore_obstacles it became better.
added:
  mysql-test/suite/backup/r/restore_obstacles.result
  mysql-test/suite/backup/t/restore_obstacles.test
modified:
  mysql-test/suite/backup/r/backup_views.result
  mysql-test/suite/backup/t/backup_views.test
  mysql-test/suite/ndb/r/ndb_single_user.result
  mysql-test/suite/ndb/t/ndb_single_user.test
  sql/backup/kernel.cc
  sql/handler.cc
  sql/si_objects.cc

per-file messages:
  mysql-test/suite/backup/r/backup_views.result
    Bug#40075 - Non-descriptive error message when restoring
                on Falcon with open transactions
    Result shows less informative error message due to the changes.
  mysql-test/suite/backup/r/restore_obstacles.result
    Bug#40075 - Non-descriptive error message when restoring
                on Falcon with open transactions
    Result shows more informative error message due to the changes.
  mysql-test/suite/backup/t/backup_views.test
    Bug#40075 - Non-descriptive error message when restoring
                on Falcon with open transactions
    Adjusted error code.
  mysql-test/suite/backup/t/restore_obstacles.test
    Bug#40075 - Non-descriptive error message when restoring
                on Falcon with open transactions
    New test case.
  mysql-test/suite/ndb/r/ndb_single_user.result
    Bug#40075 - Non-descriptive error message when restoring
                on Falcon with open transactions
    Result shows more or less informative error message due to the changes.
  mysql-test/suite/ndb/t/ndb_single_user.test
    Bug#40075 - Non-descriptive error message when restoring
                on Falcon with open transactions
    Adjusted error code.
  sql/backup/kernel.cc
    Bug#40075 - Non-descriptive error message when restoring
                on Falcon with open transactions
    Do not clear error messages from read_meta_data().
    Do not report an error to the user (do not push to warning stack)
    after a failed sobj->execute() if it had reported an error already,
    write it to error log only.
  sql/handler.cc
    Bug#40075 - Non-descriptive error message when restoring
                on Falcon with open transactions
    Reverted design decision, not to report any error in
    ha_delete_table(). Suppress only "no such table" errors.
  sql/si_objects.cc
    Bug#40075 - Non-descriptive error message when restoring
                on Falcon with open transactions
    Do not create a new object if dropping of the old one failed.
=== modified file 'mysql-test/suite/backup/r/backup_views.result'
--- a/mysql-test/suite/backup/r/backup_views.result	2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/r/backup_views.result	2008-11-07 10:18:07 +0000
@@ -277,10 +277,10 @@ DROP DATABASE bup_db2;
 Restore database.
 restore database with view dependency to other, non-existing db
 RESTORE FROM 'bup_objectview1.bak';
-ERROR HY000: Could not restore view `bup_db1`.`v5`. Please check the view definition for possible missing dependencies.
+ERROR 42S02: Table 'bup_db2.t2' doesn't exist
 DROP DATABASE bup_db1;
 RESTORE FROM 'bup_objectview2.bak';
-ERROR HY000: Could not restore view `bup_db2`.`student_details`. Please check the view definition for possible missing dependencies.
+ERROR 42S02: Table 'bup_db1.t3' doesn't exist
 DROP DATABASE bup_db2;
 RESTORE FROM 'bup_objectview.bak';
 backup_id

=== added file 'mysql-test/suite/backup/r/restore_obstacles.result'
--- a/mysql-test/suite/backup/r/restore_obstacles.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/backup/r/restore_obstacles.result	2008-11-07 10:18:07 +0000
@@ -0,0 +1,17 @@
+DROP TABLE IF EXISTS t1;
+#
+# Bug#40075 - Non-descriptive error message when restoring on Falcon
+#             with open transactions
+#
+CREATE TABLE t1 (c1 INT) ENGINE=Falcon;
+BACKUP DATABASE test TO 'test.bak';
+backup_id
+#
+SET @@autocommit=0;
+INSERT INTO t1 VALUES (0);
+RESTORE FROM 'test.bak';
+ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction
+SHOW WARNINGS;
+Level	Code	Message
+COMMIT;
+DROP TABLE t1;

=== modified file 'mysql-test/suite/backup/t/backup_views.test'
--- a/mysql-test/suite/backup/t/backup_views.test	2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/t/backup_views.test	2008-11-07 10:18:07 +0000
@@ -205,14 +205,14 @@ DROP DATABASE bup_db2;
 
 --echo restore database with view dependency to other, non-existing db
 
---error ER_BACKUP_CANT_RESTORE_VIEW
+--error ER_NO_SUCH_TABLE
 RESTORE FROM 'bup_objectview1.bak';
 
 # An incomplete bup_db1 was created by the failing restore operation.
 # Remove it before trying restore of bup_db2.
 DROP DATABASE bup_db1;
 
---error ER_BACKUP_CANT_RESTORE_VIEW
+--error ER_NO_SUCH_TABLE
 RESTORE FROM 'bup_objectview2.bak';
 
 # An incomplete bup_db2 was created by the failing restore operation.

=== added file 'mysql-test/suite/backup/t/restore_obstacles.test'
--- a/mysql-test/suite/backup/t/restore_obstacles.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/backup/t/restore_obstacles.test	2008-11-07 10:18:07 +0000
@@ -0,0 +1,34 @@
+#
+# Test restore obstacles. Problems that prevent restore from succeeding.
+#
+--source include/not_embedded.inc
+--source include/have_falcon.inc
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--error 0,1
+--remove_file $MYSQLTEST_VARDIR/master-data/test.bak
+--enable_warnings
+
+--echo #
+--echo # Bug#40075 - Non-descriptive error message when restoring on Falcon
+--echo #             with open transactions
+--echo #
+CREATE TABLE t1 (c1 INT) ENGINE=Falcon;
+--replace_column 1 #
+BACKUP DATABASE test TO 'test.bak';
+#
+SET @@autocommit=0;
+INSERT INTO t1 VALUES (0);
+#
+    --connect (con1,localhost,root,,)
+    --error ER_LOCK_OR_ACTIVE_TRANSACTION # ER_BACKUP_CANT_RESTORE_DB
+    RESTORE FROM 'test.bak';
+    SHOW WARNINGS;
+    --disconnect con1
+#
+--connection default
+COMMIT;
+DROP TABLE t1;
+--remove_file $MYSQLTEST_VARDIR/master-data/test.bak
+

=== modified file 'mysql-test/suite/ndb/r/ndb_single_user.result'
--- a/mysql-test/suite/ndb/r/ndb_single_user.result	2008-07-15 00:06:43 +0000
+++ b/mysql-test/suite/ndb/r/ndb_single_user.result	2008-11-07 10:18:07 +0000
@@ -86,7 +86,7 @@ delete from t1;
 insert into t1 select * from t2;
 create unique index new_index on t1 (b,c);
 drop table t1;
-ERROR 42S02: Unknown table 't1'
+ERROR HY000: Got error 299 'Operation not allowed or aborted due to single user mode' from NDBCLUSTER
 create index new_index_fail on t1 (c);
 ERROR HY000: Got error 299 'Operation not allowed or aborted due to single user mode' from NDBCLUSTER
 insert into t1 values (21,21,0),(22,22,0),(23,23,0),(24,24,0),(25,25,0),(26,26,0),(27,27,0),(28,28,0),(29,29,0),(210,210,0);

=== modified file 'mysql-test/suite/ndb/t/ndb_single_user.test'
--- a/mysql-test/suite/ndb/t/ndb_single_user.test	2007-07-14 17:35:43 +0000
+++ b/mysql-test/suite/ndb/t/ndb_single_user.test	2008-11-07 10:18:07 +0000
@@ -105,7 +105,7 @@ create unique index new_index on t1 (b,c
 
 # test some sql on other mysqld
 --connection server2
---error 1051
+--error ER_GET_ERRMSG
 drop table t1;
 --error 1296
 create index new_index_fail on t1 (c);

=== modified file 'sql/backup/kernel.cc'
--- a/sql/backup/kernel.cc	2008-10-30 20:02:15 +0000
+++ b/sql/backup/kernel.cc	2008-11-07 10:18:07 +0000
@@ -1227,8 +1227,6 @@ int Backup_restore_ctx::do_restore()
 
   if (read_meta_data(info, s))
   {
-    m_thd->main_da.reset_diagnostics_area();    // Never errors
-
     fatal_error(ER_BACKUP_READ_META);
     DBUG_RETURN(m_error);
   }
@@ -2021,6 +2019,13 @@ int bcat_create_item(st_bstream_image_he
 
   if (sobj->execute(thd))
   {
+    /*
+      If there is already an error reported on a lower level,
+      do not push the create error. If we have a new query_id here,
+      an attempt tp ush the error would first clear all ols errors.
+     */
+    if (thd->is_error() && (thd->query_id != thd->warn_id))
+      info->m_ctx.push_errors(FALSE);
     info->m_ctx.fatal_error(create_err, desc);
     return BSTREAM_ERROR;
   }

=== modified file 'sql/handler.cc'
--- a/sql/handler.cc	2008-10-20 19:13:22 +0000
+++ b/sql/handler.cc	2008-11-07 10:18:07 +0000
@@ -1902,14 +1902,9 @@ int ha_delete_table(THD *thd, handlerton
     DBUG_RETURN(ENOENT);
 
   path= get_canonical_filename(file, path, tmp_path);
-  if ((error= file->ha_delete_table(path)) && generate_warning)
+  error= file->ha_delete_table(path);
+  if (error)
   {
-    /*
-      Because file->print_error() use my_error() to generate the error message
-      we use an internal error handler to intercept it and store the text
-      in a temporary buffer. Later the message will be presented to user
-      as a warning.
-    */
     Ha_delete_table_error_handler ha_delete_table_error_handler;
 
     /* Fill up strucutures that print_error may need */
@@ -1923,17 +1918,29 @@ int ha_delete_table(THD *thd, handlerton
 
     file->change_table_ptr(&dummy_table, &dummy_share);
 
-    thd->push_internal_handler(&ha_delete_table_error_handler);
-    file->print_error(error, 0);
-
-    thd->pop_internal_handler();
+    if ((error != HA_ERR_NO_SUCH_TABLE) && (error != ENOENT))
+    {
+      file->print_error(error, MYF(0));
+    }
+    else if (generate_warning)
+    {
+      /*
+        Because file->print_error() use my_error() to generate the error
+        message we use an internal error handler to intercept it and
+        store the text in a temporary buffer. Later the message will be
+        presented to user as a warning.
+      */
+      thd->push_internal_handler(&ha_delete_table_error_handler);
+      file->print_error(error, MYF(0));
+      thd->pop_internal_handler();
 
-    /*
-      XXX: should we convert *all* errors to warnings here?
-      What if the error is fatal?
-    */
-    push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, error,
-                ha_delete_table_error_handler.buff);
+      /*
+        XXX: should we convert *all* errors to warnings here?
+        What if the error is fatal?
+      */
+      push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN, error,
+                   ha_delete_table_error_handler.buff);
+    }
   }
   delete file;
   DBUG_RETURN(error);

=== modified file 'sql/si_objects.cc'
--- a/sql/si_objects.cc	2008-10-30 12:29:54 +0000
+++ b/sql/si_objects.cc	2008-11-07 10:18:07 +0000
@@ -2091,8 +2091,12 @@ bool DatabaseObj::materialize(uint seria
 bool DatabaseObj::do_execute(THD *thd)
 {
   DBUG_ENTER("DatabaseObj::execute()");
-  drop(thd);
-  DBUG_RETURN(silent_exec(thd, &m_create_stmt));
+  /*
+    Before creating a new object, we drop the old one.
+    This code assumes that drop() does not report an error,
+    if the object did not exist before.
+  */
+  DBUG_RETURN(drop(thd) || silent_exec(thd, &m_create_stmt));
 }
 
 /**

Thread
bzr commit into mysql-6.0-backup branch (ingo.struewing:2727) Bug#40075Ingo Struewing7 Nov