List:Commits« Previous MessageNext Message »
From:Rafal Somla Date:July 10 2008 11:20am
Subject:bzr commit into mysql-6.0-backup branch (rsomla:2656)
View as plain text  
#At file:///ext/mysql/bzr/mysql-6.0-backup-merge-1/

 2656 Rafal Somla	2008-07-10 [merge]
      Auto merge.
modified:
  CMakeLists.txt*
  mysql-test/r/backup_no_be.result
  mysql-test/r/backup_progress.result
  mysql-test/r/debug_sync.result
  mysql-test/r/merge-sync.result
  mysql-test/r/myisamlog.result
  mysql-test/t/backup_no_be.test
  mysql-test/t/merge-sync.test
  mysql-test/t/myisamlog.test
  scripts/mysql_system_tables.sql
  sql/backup/backup_progress.cc
  sql/backup/backup_progress.h
  sql/backup/logger.h
  sql/sql_base.cc

=== modified file 'CMakeLists.txt' (properties changed: +x to -x)
--- a/CMakeLists.txt	2008-07-09 07:12:43 +0000
+++ b/CMakeLists.txt	2008-07-09 09:25:34 +0000
@@ -116,6 +116,8 @@ ENDIF(EXTRA_DEBUG)
 IF(ENABLED_DEBUG_SYNC)
   ADD_DEFINITIONS(-D ENABLED_DEBUG_SYNC)
 ENDIF(ENABLED_DEBUG_SYNC)
+SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC")
+SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC")
 
 IF(BACKUP_TEST)
   ADD_DEFINITIONS(-D BACKUP_TEST)

=== modified file 'mysql-test/r/backup_no_be.result'
--- a/mysql-test/r/backup_no_be.result	2008-07-09 07:12:43 +0000
+++ b/mysql-test/r/backup_no_be.result	2008-07-09 18:37:42 +0000
@@ -14,8 +14,8 @@ SHOW WARNINGS;
 Level	Code	Message
 SELECT max(backup_id) INTO @id FROM mysql.online_backup 
 WHERE command LIKE 'BACKUP DATABASE db1 %';
-SELECT engines FROM mysql.online_backup WHERE backup_id=@id;
-engines
+SELECT drivers FROM mysql.online_backup WHERE backup_id=@id;
+drivers
 MyISAM
 SET SESSION debug="d,backup_test_dummy_be_factory";
 SELECT @@debug;
@@ -29,8 +29,8 @@ Level	Code	Message
 Warning	#	Cannot create backup engine for storage engine MyISAM
 SELECT max(backup_id) INTO @id FROM mysql.online_backup 
 WHERE command LIKE 'BACKUP DATABASE db1 %';
-SELECT engines FROM mysql.online_backup WHERE backup_id=@id;
-engines
+SELECT drivers FROM mysql.online_backup WHERE backup_id=@id;
+drivers
 Default
 RESTORE FROM 'db1.bak';
 backup_id

=== modified file 'mysql-test/r/backup_progress.result'
--- a/mysql-test/r/backup_progress.result	2008-07-01 20:32:27 +0000
+++ b/mysql-test/r/backup_progress.result	2008-07-09 18:37:42 +0000
@@ -81,7 +81,7 @@ username	root
 backup_file	backup_progress_orig.bak
 user_comment	
 command	BACKUP DATABASE backup_progress to 'backup_progress_orig.bak'
-engines	MyISAM, Default, Snapshot
+drivers	MyISAM, Default, Snapshot
 SELECT obp.* FROM mysql.online_backup_progress AS obp JOIN backup_progress.t1_res AS t1
ON obp.backup_id = t1.id;
 backup_id	object	start_time	stop_time	total_bytes	progress	error_num	notes
 #	backup kernel	#	#	0	0	0	starting
@@ -138,7 +138,7 @@ username	root
 backup_file	backup_progress_orig.bak
 user_comment	
 command	RESTORE FROM 'backup_progress_orig.bak'
-engines	MyISAM, Default, Snapshot
+drivers	MyISAM, Default, Snapshot
 SELECT obp.* FROM mysql.online_backup_progress AS obp JOIN backup_progress.t1_res AS t1
ON obp.backup_id = t1.id;
 backup_id	object	start_time	stop_time	total_bytes	progress	error_num	notes
 #	backup kernel	#	#	0	0	0	starting

=== modified file 'mysql-test/r/debug_sync.result'
--- a/mysql-test/r/debug_sync.result	2008-07-01 20:32:27 +0000
+++ b/mysql-test/r/debug_sync.result	2008-07-09 14:27:18 +0000
@@ -137,7 +137,7 @@ Variable_name	Value
 debug_sync	ON - current signal: 'something'
 SET DEBUG_SYNC= 'now WAIT_FOR nothing TIMEOUT 0';
 Warnings:
-Warning	1718	debug sync point wait timed out
+Warning	1720	debug sync point wait timed out
 SET DEBUG_SYNC= 'now SIGNAL nothing';
 SHOW VARIABLES LIKE 'DEBUG_SYNC';
 Variable_name	Value

=== modified file 'mysql-test/r/merge-sync.result'
--- a/mysql-test/r/merge-sync.result	2008-06-26 15:52:25 +0000
+++ b/mysql-test/r/merge-sync.result	2008-07-09 14:27:18 +0000
@@ -38,48 +38,6 @@ connection con1
 connection default;
 SET DEBUG_SYNC= 'RESET';
 DROP TABLE t1, t2;
-CREATE TABLE t1 (c1 INT) ENGINE= MyISAM;
-LOCK TABLE t1 WRITE;
-connection con1
-SET DEBUG_SYNC= 'before_lock_tables_takes_lock
-                     SIGNAL opened WAIT_FOR flushed';
-SET DEBUG_SYNC= 'wait_for_lock SIGNAL locked EXECUTE 2';
-SET DEBUG_SYNC= 'before_open_table_wait_refresh SIGNAL locked';
-SET DEBUG_SYNC= 'after_insert SIGNAL locked';
-INSERT INTO t1 VALUES (1);
-connection default
-SET DEBUG_SYNC= 'now WAIT_FOR opened';
-SET DEBUG_SYNC= 'after_flush_unlock SIGNAL flushed';
-FLUSH TABLES;
-SET DEBUG_SYNC= 'now WAIT_FOR locked';
-SELECT * FROM t1;
-c1
-UNLOCK TABLES;
-connection con1
-connection default
-SET DEBUG_SYNC= 'RESET';
-DROP TABLE t1;
-CREATE TABLE t1 (c1 REAL) ENGINE=MyISAM;
-CREATE TABLE t2 (c1 REAL) ENGINE=MyISAM;
-INSERT INTO t1 VALUES(0.1);
-INSERT INTO t2 VALUES(0.2);
-CREATE TABLE t3 (c1 REAL) ENGINE=MRG_MYISAM UNION=(t1,t2);
-connection con1
-SET DEBUG_SYNC= 'before_acos_function
-                     SIGNAL select WAIT_FOR truncated';
-SELECT ACOS(c1) FROM t3;
-connection default
-SET DEBUG_SYNC= 'now WAIT_FOR select';
-SET DEBUG_SYNC= 'before_wait_locked_tname SIGNAL truncated';
-TRUNCATE TABLE t1;
-SET DEBUG_SYNC= 'now SIGNAL truncated';
-connection con1
-connection default
-SELECT ACOS(c1) FROM t3;
-ACOS(c1)
-1.369438406004566
-SET DEBUG_SYNC= 'RESET';
-DROP TABLE t1, t2, t3;
 CREATE TABLE t1 (c1 INT) ENGINE=MyISAM;
 CREATE TABLE m1 (c1 INT) ENGINE=MRG_MYISAM UNION=(t1) INSERT_METHOD=LAST;
 connection con1
@@ -97,47 +55,6 @@ c1
 2
 SET DEBUG_SYNC= 'RESET';
 DROP TABLE m1, t1;
-CREATE TABLE t1 (c1 INT) ENGINE=MyISAM;
-CREATE TABLE m1 (c1 INT) ENGINE=MRG_MYISAM UNION=(t1) INSERT_METHOD=LAST;
-connection con1
-SET DEBUG_SYNC= 'before_myisammrg_attach
-                     SIGNAL attach WAIT_FOR store_lock1';
-SET DEBUG_SYNC= 'before_myisammrg_store_lock
-                     SIGNAL store_lock2 WAIT_FOR flushed';
-INSERT INTO m1 VALUES (2);
-connection default;
-SET DEBUG_SYNC= 'now WAIT_FOR attach';
-SET DEBUG_SYNC= 'before_myisammrg_store_lock
-                 SIGNAL store_lock1 WAIT_FOR store_lock2';
-SET DEBUG_SYNC= 'after_flush_unlock SIGNAL flushed';
-FLUSH TABLE m1;
-connection con1
-connection default;
-SELECT * FROM m1;
-c1
-2
-SET DEBUG_SYNC= 'RESET';
-DROP TABLE m1, t1;
-CREATE TABLE t1 (c1 INT) ENGINE= MyISAM;
-LOCK TABLE t1 WRITE;
-connection con1
-SET DEBUG_SYNC= 'mysql_lock_retry HIT_LIMIT 1';
-SET DEBUG_SYNC= 'before_lock_tables_takes_lock
-                     SIGNAL opened WAIT_FOR flushed';
-SET DEBUG_SYNC= 'after_insert SIGNAL locked';
-SET DEBUG_SYNC= 'wait_for_lock SIGNAL locked EXECUTE 2';
-SET DEBUG_SYNC= 'before_open_table_wait_refresh SIGNAL locked';
-INSERT INTO t1 VALUES (1);
-connection default;
-SET DEBUG_SYNC= 'now WAIT_FOR opened';
-SET DEBUG_SYNC= 'after_flush_unlock SIGNAL flushed EXECUTE 2';
-FLUSH TABLES;
-SET DEBUG_SYNC= 'now WAIT_FOR locked';
-UNLOCK TABLES;
-connection con1
-connection default;
-SET DEBUG_SYNC= 'RESET';
-DROP TABLE t1;
 CREATE TABLE t1 (c1 INT) ENGINE= MyISAM;
 LOCK TABLE t1 WRITE;
 connection con1

=== modified file 'mysql-test/r/myisamlog.result'
--- a/mysql-test/r/myisamlog.result	2008-05-09 10:27:23 +0000
+++ b/mysql-test/r/myisamlog.result	2008-07-09 14:27:18 +0000
@@ -19,9 +19,9 @@ write                       4         0 
 update                      1         0              0
 delete                      1         0              0
 close                       8         0              0
-extra                      72         0              0
+extra                       #         0              0
 lock                       48         0              0
-Total             150         0                0
+Total               #         0                0
 select * from t1;
 a	b
 flush table t1;
@@ -34,9 +34,9 @@ write                       4         0 
 update                      1         0              0
 delete                      1         0              0
 close                       9         0              0
-extra                      75         0              0
+extra                       #         0              0
 lock                       50         0              0
-Total             157         0                0
+Total               #         0                0
 select * from t1;
 a	b
 1	life

=== modified file 'mysql-test/t/backup_no_be.test'
--- a/mysql-test/t/backup_no_be.test	2008-07-09 07:12:43 +0000
+++ b/mysql-test/t/backup_no_be.test	2008-07-09 18:37:42 +0000
@@ -51,7 +51,7 @@ WHERE command LIKE 'BACKUP DATABASE db1 
 # native backup for MyISAM. But when it is added, the SELECT below should list native 
 # MYISAM engine.
 
-SELECT engines FROM mysql.online_backup WHERE backup_id=@id;
+SELECT drivers FROM mysql.online_backup WHERE backup_id=@id;
 
 # Now see what happens when injected code is activated and MyISAM uses the dummy
 # factory function.
@@ -79,7 +79,7 @@ SHOW WARNINGS;
 SELECT max(backup_id) INTO @id FROM mysql.online_backup 
 WHERE command LIKE 'BACKUP DATABASE db1 %';
 
-SELECT engines FROM mysql.online_backup WHERE backup_id=@id;
+SELECT drivers FROM mysql.online_backup WHERE backup_id=@id;
 
 # check that we can restore from the created image.
 

=== modified file 'mysql-test/t/merge-sync.test'
--- a/mysql-test/t/merge-sync.test	2008-06-26 15:52:25 +0000
+++ b/mysql-test/t/merge-sync.test	2008-07-09 14:27:18 +0000
@@ -148,92 +148,99 @@ DROP TABLE t1, t2;
 # In >= 5.0, when waiting after open_tables() one FLUSH is sufficient
 # to allow the INSERT to step in.
 #
-CREATE TABLE t1 (c1 INT) ENGINE= MyISAM;
-LOCK TABLE t1 WRITE;
-#
-    --echo connection con1
-    connect (con1,localhost,root,,);
-    # After open, wait for flush.
-    SET DEBUG_SYNC= 'before_lock_tables_takes_lock
-                     SIGNAL opened WAIT_FOR flushed';
-    # If bug is fixed, INSERT will go into wait_for_lock.
-    # Retain action after use. First used by general_log.
-    SET DEBUG_SYNC= 'wait_for_lock SIGNAL locked EXECUTE 2';
-    # Alternatively INSERT can wait for refresh in open_table().
-    SET DEBUG_SYNC= 'before_open_table_wait_refresh SIGNAL locked';
-    # If bug is not fixed, INSERT will succeed. Pretend locked.
-    SET DEBUG_SYNC= 'after_insert SIGNAL locked';
-    send INSERT INTO t1 VALUES (1);
-#
---echo connection default
-connection default;
-# Wait until INSERT opened the table.
-SET DEBUG_SYNC= 'now WAIT_FOR opened';
-#
-# Let INSERT exploit the gap when flush waits wthout lock
-# for other threads to close the tables.
-SET DEBUG_SYNC= 'after_flush_unlock SIGNAL flushed';
-FLUSH TABLES;
-#
-# Wait until INSERT is locked (bug fixed) or finished (bug not fixed).
-SET DEBUG_SYNC= 'now WAIT_FOR locked';
-#
-# This should give no result. But it will if the bug exists.
-SELECT * FROM t1;
-UNLOCK TABLES;
-#
-    --echo connection con1
-    connection con1;
-    reap;
-    disconnect con1;
-#
---echo connection default
-connection default;
-# Clear debug_sync signal.
-SET DEBUG_SYNC= 'RESET';
-DROP TABLE t1;
-#
-# Show that truncate of child table waits while parent table is used.
-CREATE TABLE t1 (c1 REAL) ENGINE=MyISAM;
-CREATE TABLE t2 (c1 REAL) ENGINE=MyISAM;
-INSERT INTO t1 VALUES(0.1);
-INSERT INTO t2 VALUES(0.2);
-CREATE TABLE t3 (c1 REAL) ENGINE=MRG_MYISAM UNION=(t1,t2);
-#
-    --echo connection con1
-    connect (con1,localhost,root,,);
-    # When reaching acos(), send 'select' and wait for truncated.
-    SET DEBUG_SYNC= 'before_acos_function
-                     SIGNAL select WAIT_FOR truncated';
-    send SELECT ACOS(c1) FROM t3;
-#
---echo connection default
-connection default;
-# Wait for con1 to reach acos().
-SET DEBUG_SYNC= 'now WAIT_FOR select';
-#
-# With bug fix present, TRUNCATE runs into wait_for_locked_table_names().
-SET DEBUG_SYNC= 'before_wait_locked_tname SIGNAL truncated';
-TRUNCATE TABLE t1;
-#
-# With bug fix not present, we need to signal after TRUNCATE.
-SET DEBUG_SYNC= 'now SIGNAL truncated';
-#
-    --echo connection con1
-    connection con1;
-    # In non-debug server, the order of select and truncate is undetermined.
-    # So we may have one or two rows here.
-    --disable_result_log
-    reap;
-    --enable_result_log
-    disconnect con1;
-#
---echo connection default
-connection default;
-SELECT ACOS(c1) FROM t3;
-# Clear debug_sync signal.
-SET DEBUG_SYNC= 'RESET';
-DROP TABLE t1, t2, t3;
+# This test does not work in 6.0 because the table locking scheme
+# changed a lot. The above problem cannot happen any more.
+# Some of the places where the sync points were placed, don't exist
+# any more.
+if (0)
+{
+  CREATE TABLE t1 (c1 INT) ENGINE= MyISAM;
+  LOCK TABLE t1 WRITE;
+  #
+      --echo connection con1
+      connect (con1,localhost,root,,);
+      # After open, wait for flush.
+      SET DEBUG_SYNC= 'before_lock_tables_takes_lock
+                       SIGNAL opened WAIT_FOR flushed';
+      # If bug is fixed, INSERT will go into wait_for_lock.
+      # Retain action after use. First used by general_log.
+      SET DEBUG_SYNC= 'wait_for_lock SIGNAL locked EXECUTE 2';
+      # Alternatively INSERT can wait for refresh in open_table().
+      SET DEBUG_SYNC= 'before_open_table_wait_refresh SIGNAL locked';
+      # If bug is not fixed, INSERT will succeed. Pretend locked.
+      SET DEBUG_SYNC= 'after_insert SIGNAL locked';
+      send INSERT INTO t1 VALUES (1);
+  #
+  --echo connection default
+  connection default;
+  # Wait until INSERT opened the table.
+  SET DEBUG_SYNC= 'now WAIT_FOR opened';
+  #
+  # Let INSERT exploit the gap when flush waits wthout lock
+  # for other threads to close the tables.
+  SET DEBUG_SYNC= 'after_flush_unlock SIGNAL flushed';
+  FLUSH TABLES;
+  #
+  # Wait until INSERT is locked (bug fixed) or finished (bug not fixed).
+  SET DEBUG_SYNC= 'now WAIT_FOR locked';
+  #
+  # This should give no result. But it will if the bug exists.
+  SELECT * FROM t1;
+  UNLOCK TABLES;
+  #
+      --echo connection con1
+      connection con1;
+      reap;
+      disconnect con1;
+  #
+  --echo connection default
+  connection default;
+  # Clear debug_sync signal.
+  SET DEBUG_SYNC= 'RESET';
+  DROP TABLE t1;
+  #
+  # Show that truncate of child table waits while parent table is used.
+  CREATE TABLE t1 (c1 REAL) ENGINE=MyISAM;
+  CREATE TABLE t2 (c1 REAL) ENGINE=MyISAM;
+  INSERT INTO t1 VALUES(0.1);
+  INSERT INTO t2 VALUES(0.2);
+  CREATE TABLE t3 (c1 REAL) ENGINE=MRG_MYISAM UNION=(t1,t2);
+  #
+      --echo connection con1
+      connect (con1,localhost,root,,);
+      # When reaching acos(), send 'select' and wait for truncated.
+      SET DEBUG_SYNC= 'before_acos_function
+                       SIGNAL select WAIT_FOR truncated';
+      send SELECT ACOS(c1) FROM t3;
+  #
+  --echo connection default
+  connection default;
+  # Wait for con1 to reach acos().
+  SET DEBUG_SYNC= 'now WAIT_FOR select';
+  #
+  # With bug fix present, TRUNCATE runs into wait_for_locked_table_names().
+  SET DEBUG_SYNC= 'before_wait_locked_tname SIGNAL truncated';
+  TRUNCATE TABLE t1;
+  #
+  # With bug fix not present, we need to signal after TRUNCATE.
+  SET DEBUG_SYNC= 'now SIGNAL truncated';
+  #
+      --echo connection con1
+      connection con1;
+      # In non-debug server, the order of select and truncate is undetermined.
+      # So we may have one or two rows here.
+      --disable_result_log
+      reap;
+      --enable_result_log
+      disconnect con1;
+  #
+  --echo connection default
+  connection default;
+  SELECT ACOS(c1) FROM t3;
+  # Clear debug_sync signal.
+  SET DEBUG_SYNC= 'RESET';
+  DROP TABLE t1, t2, t3;
+}
 
 #
 # In-depth test.
@@ -268,95 +275,110 @@ DROP TABLE m1, t1;
 # Bug#30273 - merge tables: Can't lock file (errno: 155)
 # Second test try to step in between lock_count() and store_lock().
 #
-CREATE TABLE t1 (c1 INT) ENGINE=MyISAM;
-CREATE TABLE m1 (c1 INT) ENGINE=MRG_MYISAM UNION=(t1) INSERT_METHOD=LAST;
-    --echo connection con1
-    connect (con1,localhost,root,,);
-    # When reaching attach_merge_children(), signal attach and
-    # wait for store_lock1 before attaching children.
-    # Then run through attach of children until store_lock().
-    # Signal store_lock2 and wait for flushed.
-    SET DEBUG_SYNC= 'before_myisammrg_attach
-                     SIGNAL attach WAIT_FOR store_lock1';
-    SET DEBUG_SYNC= 'before_myisammrg_store_lock
-                     SIGNAL store_lock2 WAIT_FOR flushed';
-    send INSERT INTO m1 VALUES (2);
---echo connection default;
-connection default;
-#
-# Wait for con1 to reach attach.
-SET DEBUG_SYNC= 'now WAIT_FOR attach';
-# Run until myisammrg store_lock(),
-# then signal store_lock1 and
-# wait for con1 to go through attach until store_lock() (store_lock2),
-# then flush and signal flushed.
-SET DEBUG_SYNC= 'before_myisammrg_store_lock
-                 SIGNAL store_lock1 WAIT_FOR store_lock2';
-SET DEBUG_SYNC= 'after_flush_unlock SIGNAL flushed';
-FLUSH TABLE m1;
 #
-    --echo connection con1
-    connection con1;
-    reap;
-    disconnect con1;
---echo connection default;
-connection default;
-SELECT * FROM m1;
-# Clear debug_sync signal.
-SET DEBUG_SYNC= 'RESET';
-DROP TABLE m1, t1;
+# This test does not work in 6.0 because FLUSH TABLE does not use
+# table locks to find old tables. hence it does not call lock_count()
+# nor store_lock().
+if (0)
+{
+  CREATE TABLE t1 (c1 INT) ENGINE=MyISAM;
+  CREATE TABLE m1 (c1 INT) ENGINE=MRG_MYISAM UNION=(t1) INSERT_METHOD=LAST;
+      --echo connection con1
+      connect (con1,localhost,root,,);
+      # When reaching attach_merge_children(), signal attach and
+      # wait for store_lock1 before attaching children.
+      # Then run through attach of children until store_lock().
+      # Signal store_lock2 and wait for flushed.
+      SET DEBUG_SYNC= 'before_myisammrg_attach
+                       SIGNAL attach WAIT_FOR store_lock1';
+      SET DEBUG_SYNC= 'before_myisammrg_store_lock
+                       SIGNAL store_lock2 WAIT_FOR flushed';
+      send INSERT INTO m1 VALUES (2);
+  --echo connection default;
+  connection default;
+  #
+  # Wait for con1 to reach attach.
+  SET DEBUG_SYNC= 'now WAIT_FOR attach';
+  # Run until myisammrg store_lock(),
+  # then signal store_lock1 and
+  # wait for con1 to go through attach until store_lock() (store_lock2),
+  # then flush and signal flushed.
+  SET DEBUG_SYNC= 'before_myisammrg_store_lock
+                   SIGNAL store_lock1 WAIT_FOR store_lock2';
+  SET DEBUG_SYNC= 'after_flush_unlock SIGNAL flushed';
+  FLUSH TABLE m1;
+  #
+      --echo connection con1
+      connection con1;
+      reap;
+      disconnect con1;
+  --echo connection default;
+  connection default;
+  SELECT * FROM m1;
+  # Clear debug_sync signal.
+  SET DEBUG_SYNC= 'RESET';
+  DROP TABLE m1, t1;
+}
 
 #
 # Coverage test for mysql_lock_retry hit limit.
 # Similar test as for Bug#26379, Problem #3.
 # But mysql_lock_retry hit limit set.
 #
-CREATE TABLE t1 (c1 INT) ENGINE= MyISAM;
-LOCK TABLE t1 WRITE;
-#
-    --echo connection con1
-    connect (con1,localhost,root,,);
-    SET DEBUG_SYNC= 'mysql_lock_retry HIT_LIMIT 1';
-    # After open, wait for flush.
-    SET DEBUG_SYNC= 'before_lock_tables_takes_lock
-                     SIGNAL opened WAIT_FOR flushed';
-    # If bug is not fixed, INSERT will succeed. Pretend locked.
-    SET DEBUG_SYNC= 'after_insert SIGNAL locked';
-    # If bug is fixed, INSERT will go into wait_for_lock.
-    # Retain action after use. First used by general_log.
-    SET DEBUG_SYNC= 'wait_for_lock SIGNAL locked EXECUTE 2';
-    # Alternatively INSERT can wait for refresh in open_table().
-    SET DEBUG_SYNC= 'before_open_table_wait_refresh SIGNAL locked';
-    send INSERT INTO t1 VALUES (1);
-#
---echo connection default;
-connection default;
-#
-# Wait until INSERT opened the table.
-SET DEBUG_SYNC= 'now WAIT_FOR opened';
-#
-# Let INSERT exploit the gap when flush waits wthout lock
-# for other threads to close the tables.
-SET DEBUG_SYNC= 'after_flush_unlock SIGNAL flushed EXECUTE 2';
-FLUSH TABLES;
-#
-# Wait until INSERT is locked (bug fixed) or finished (bug not fixed).
-SET DEBUG_SYNC= 'now WAIT_FOR locked';
-UNLOCK TABLES;
 #
-    --echo connection con1
-    connection con1;
-    # Succeeds if DEBUG_SYNC is disabled
-    --error 0, ER_DEBUG_SYNC_HIT_LIMIT
-    reap;
-    disconnect con1;
-#
---echo connection default;
-connection default;
-#
-# Clear debug_sync signal.
-SET DEBUG_SYNC= 'RESET';
-DROP TABLE t1;
+# This test does not work in 6.0 because the table locking scheme
+# changed a lot. The above problem cannot happen any more.
+# Some of the places where the sync points were placed, don't exist
+# any more.
+if (0)
+{
+  CREATE TABLE t1 (c1 INT) ENGINE= MyISAM;
+  LOCK TABLE t1 WRITE;
+  #
+      --echo connection con1
+      connect (con1,localhost,root,,);
+      SET DEBUG_SYNC= 'mysql_lock_retry HIT_LIMIT 1';
+      # After open, wait for flush.
+      SET DEBUG_SYNC= 'before_lock_tables_takes_lock
+                       SIGNAL opened WAIT_FOR flushed';
+      # If bug is not fixed, INSERT will succeed. Pretend locked.
+      SET DEBUG_SYNC= 'after_insert SIGNAL locked';
+      # If bug is fixed, INSERT will go into wait_for_lock.
+      # Retain action after use. First used by general_log.
+      SET DEBUG_SYNC= 'wait_for_lock SIGNAL locked EXECUTE 2';
+      # Alternatively INSERT can wait for refresh in open_table().
+      SET DEBUG_SYNC= 'before_open_table_wait_refresh SIGNAL locked';
+      send INSERT INTO t1 VALUES (1);
+  #
+  --echo connection default;
+  connection default;
+  #
+  # Wait until INSERT opened the table.
+  SET DEBUG_SYNC= 'now WAIT_FOR opened';
+  #
+  # Let INSERT exploit the gap when flush waits wthout lock
+  # for other threads to close the tables.
+  SET DEBUG_SYNC= 'after_flush_unlock SIGNAL flushed EXECUTE 2';
+  FLUSH TABLES;
+  #
+  # Wait until INSERT is locked (bug fixed) or finished (bug not fixed).
+  SET DEBUG_SYNC= 'now WAIT_FOR locked';
+  UNLOCK TABLES;
+  #
+      --echo connection con1
+      connection con1;
+      # Succeeds if DEBUG_SYNC is disabled
+      --error 0, ER_DEBUG_SYNC_HIT_LIMIT
+      reap;
+      disconnect con1;
+  #
+  --echo connection default;
+  connection default;
+  #
+  # Clear debug_sync signal.
+  SET DEBUG_SYNC= 'RESET';
+  DROP TABLE t1;
+}
 
 #
 # Coverage test for wait_for_lock.

=== modified file 'mysql-test/t/myisamlog.test'
--- a/mysql-test/t/myisamlog.test	2008-05-09 10:27:23 +0000
+++ b/mysql-test/t/myisamlog.test	2008-07-09 14:27:18 +0000
@@ -24,6 +24,7 @@ truncate table t1;
 flush table t1;
 
 # look at log
+--replace_regex /extra......................../extra                       #/
/Total................/Total               #/
 exec $MYISAMLOG $MYSQLTEST_VARDIR/master-data/myisam.log ;
 # should not have changed the table
 select * from t1;
@@ -31,6 +32,7 @@ flush table t1;
 
 # apply log to empty table
 --replace_result $MYSQLTEST_VARDIR VARDIR
+--replace_regex /extra......................../extra                       #/
/Total................/Total               #/
 exec $MYISAMLOG -F $MYSQLTEST_VARDIR/master-data -u
$MYSQLTEST_VARDIR/master-data/myisam.log ;
 
 # reopen the table and verify that content is back

=== modified file 'scripts/mysql_system_tables.sql'
--- a/scripts/mysql_system_tables.sql	2008-02-27 10:04:05 +0000
+++ b/scripts/mysql_system_tables.sql	2008-07-09 18:37:42 +0000
@@ -83,7 +83,7 @@ DROP PREPARE stmt;
 CREATE TABLE IF NOT EXISTS event ( db char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT
NULL default '', name char(64) CHARACTER SET utf8 NOT NULL default '', body longblob NOT
NULL, definer char(77) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '',
execute_at DATETIME default NULL, interval_value int(11) default NULL, interval_field
ENUM('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND')
default NULL, created TIMESTAMP NOT NULL, modified TIMESTAMP NOT NULL, last_executed
DATETIME default NULL, starts DATETIME default NULL, ends DATETIME default NULL, status
ENUM('ENABLED','DISABLED','SLAVESIDE_DISABLED') NOT NULL default 'ENABLED', on_completion
ENUM('DROP','PRESERVE') NOT NULL default 'DROP', sql_mode 
set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','!
 NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH')
DEFAULT '' NOT NULL, comment char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default
'', originator int(10) NOT NULL, time_zone char(64) CHARACTER SET latin1 NOT NULL DEFAULT
'SYSTEM', character_set_client char(32) collate utf8_bin, collation_connection char(32)
collate utf8_bin, db_collation char(32) collate utf8_bin, body_utf8 longblob, PRIMARY KEY
(db, name) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT 'Events';
 
 
-CREATE TABLE IF NOT EXISTS online_backup ( backup_id BIGINT UNSIGNED PRIMARY KEY
AUTO_INCREMENT COMMENT 'Surrogate key for (near) duplicate entries', process_id INT
UNSIGNED NOT NULL COMMENT 'The process id that operation ran as', binlog_pos INT UNSIGNED
DEFAULT 0 COMMENT 'The recorded binlog position of backup/restore', binlog_file CHAR(64)
COMMENT 'The recorded binlog filename at time of backup/restore', backup_state
ENUM('complete', 'starting', 'validity point', 'running', 'error', 'cancel') NOT NULL
COMMENT 'Status of current operation', operation ENUM('backup', 'restore') NOT NULL
COMMENT 'Type of operation', error_num INT NOT NULL DEFAULT 0 COMMENT 'The error from
this run 0 == none', num_objects INT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'The number of
objects in the backup', total_bytes BIGINT UNSIGNED COMMENT 'The size of the backup
repository in bytes', validity_point_time datetime COMMENT 'The time of the validity
point.', start_time datetime COMMENT 'The date/time !
 of start of operation', stop_time datetime COMMENT 'The date/time of end of operation',
host_or_server_name CHAR (30) COMMENT 'The server name where operation ran', username
CHAR (30) COMMENT 'The user name who ran the operation', backup_file CHAR (100) COMMENT
'The name of the file', user_comment VARCHAR (200) DEFAULT NULL COMMENT 'The comment from
user entered at command line', command VARCHAR (512) COMMENT 'The command used to issue
operation', engines VARCHAR (100) COMMENT 'The name of the storage engines used in the
operation') ENGINE=MYISAM;
+CREATE TABLE IF NOT EXISTS online_backup ( backup_id BIGINT UNSIGNED PRIMARY KEY
AUTO_INCREMENT COMMENT 'Surrogate key for (near) duplicate entries', process_id INT
UNSIGNED NOT NULL COMMENT 'The process id that operation ran as', binlog_pos INT UNSIGNED
DEFAULT 0 COMMENT 'The recorded binlog position of backup/restore', binlog_file CHAR(64)
COMMENT 'The recorded binlog filename at time of backup/restore', backup_state
ENUM('complete', 'starting', 'validity point', 'running', 'error', 'cancel') NOT NULL
COMMENT 'Status of current operation', operation ENUM('backup', 'restore') NOT NULL
COMMENT 'Type of operation', error_num INT NOT NULL DEFAULT 0 COMMENT 'The error from
this run 0 == none', num_objects INT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'The number of
objects in the backup', total_bytes BIGINT UNSIGNED COMMENT 'The size of the backup
repository in bytes', validity_point_time datetime COMMENT 'The time of the validity
point.', start_time datetime COMMENT 'The date/time !
 of start of operation', stop_time datetime COMMENT 'The date/time of end of operation',
host_or_server_name CHAR (30) COMMENT 'The server name where operation ran', username
CHAR (30) COMMENT 'The user name who ran the operation', backup_file CHAR (100) COMMENT
'The name of the file', user_comment VARCHAR (200) DEFAULT NULL COMMENT 'The comment from
user entered at command line', command VARCHAR (512) COMMENT 'The command used to issue
operation', drivers VARCHAR (100) COMMENT 'The name of the storage engine backup drivers
used in the operation') ENGINE=MYISAM;
 
 
 CREATE TABLE IF NOT EXISTS online_backup_progress ( backup_id BIGINT UNSIGNED NOT NULL
COMMENT 'Key for online_backup table entries', object CHAR (30) NOT NULL COMMENT 'The
object being operated on', start_time datetime COMMENT 'The date/time of start of
operation', stop_time datetime COMMENT 'The date/time of end of operation', total_bytes
BIGINT COMMENT 'The size of the object in bytes', progress BIGINT UNSIGNED COMMENT 'The
number of bytes processed', error_num INT NOT NULL DEFAULT 0 COMMENT 'The error from this
run 0 == none', notes CHAR(100) COMMENT 'Commentary from the backup engine')
ENGINE=MYISAM;

=== modified file 'sql/backup/backup_progress.cc'
--- a/sql/backup/backup_progress.cc	2008-07-09 07:12:43 +0000
+++ b/sql/backup/backup_progress.cc	2008-07-09 18:37:42 +0000
@@ -361,9 +361,9 @@ bool backup_history_log_update(THD *thd,
       }
       break;
     }    
-    case ET_OBH_FIELD_ENGINES:
+    case ET_OBH_FIELD_DRIVERS:
     {
-      String str;    // engines string
+      String str;    // drivers string
       str.length(0);
       table->field[fld]->val_str(&str);
       if (str.length() > 0)
@@ -815,9 +815,9 @@ int report_ob_vp_time(THD *thd,
 }
 
 /**
-   Update the engines string for the row that matches the backup_id.
+   Update the drivers string for the row that matches the backup_id.
 
-   This method updates the engines information for the backup operation
+   This method updates the drivers information for the backup operation
    identified by backup_id. This method appends to the those listed in the
    table for the backup_id.
 
@@ -828,15 +828,15 @@ int report_ob_vp_time(THD *thd,
    @retval 0  success
    @retval 1  failed to find row
   */
-int report_ob_engines(THD *thd,
+int report_ob_drivers(THD *thd,
                       ulonglong backup_id,
-                      const char *engine_name)
+                      const char *driver_name)
 {
   int ret= 0;  // return value
-  DBUG_ENTER("report_ob_engines()");
+  DBUG_ENTER("report_ob_drivers()");
 
-  ret= backup_history_log_update(thd, backup_id, ET_OBH_FIELD_ENGINES, 
-                                 0, 0, engine_name, 0);
+  ret= backup_history_log_update(thd, backup_id, ET_OBH_FIELD_DRIVERS, 
+                                 0, 0, driver_name, 0);
 
   DBUG_RETURN(ret);
 }

=== modified file 'sql/backup/backup_progress.h'
--- a/sql/backup/backup_progress.h	2008-03-21 09:05:40 +0000
+++ b/sql/backup/backup_progress.h	2008-07-09 18:37:42 +0000
@@ -44,7 +44,7 @@ enum enum_backup_history_table_field
   ET_OBH_FIELD_BACKUP_FILE,
   ET_OBH_FIELD_COMMENT,
   ET_OBH_FIELD_COMMAND,
-  ET_OBH_FIELD_ENGINES,
+  ET_OBH_FIELD_DRIVERS,
   ET_OBH_FIELD_COUNT /* a cool trick to count the number of fields :) */
 };
 
@@ -218,13 +218,13 @@ int report_ob_vp_time(THD *thd,
                       time_t vp_time);
 
 /*
-  This method updates the engines information for the backup operation
+  This method updates the drivers information for the backup operation
   identified by backup_id. This method appends to the those listed in the
   table for the backup_id.
 */
-int report_ob_engines(THD *thd,
+int report_ob_drivers(THD *thd,
                       ulonglong backup_id,
-                      const char *engine_name);
+                      const char *driver_name);
 
 /*
   This method inserts a new row in the progress table.

=== modified file 'sql/backup/logger.h'
--- a/sql/backup/logger.h	2008-06-25 13:39:04 +0000
+++ b/sql/backup/logger.h	2008-07-09 18:37:42 +0000
@@ -299,7 +299,7 @@ void Logger::report_driver(const char *n
 {
   DBUG_ASSERT(m_state == READY || m_state == RUNNING);
   
-  report_ob_engines(m_thd, m_op_id, name);
+  report_ob_drivers(m_thd, m_op_id, name);
 }
 
 } // backup namespace

=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc	2008-07-09 07:12:43 +0000
+++ b/sql/sql_base.cc	2008-07-09 14:27:18 +0000
@@ -951,7 +951,6 @@ bool close_cached_tables(THD *thd, TABLE
       TABLE *table= find_locked_table(thd->open_tables, table_list->db,
                                       table_list->table_name);
 
-      DEBUG_SYNC(thd, "after_flush_unlock");
       /* May return NULL if this table has already been closed via an alias. */
       if (! table)
         continue;
@@ -975,6 +974,7 @@ bool close_cached_tables(THD *thd, TABLE
       To avoid self and other kinds of deadlock we have to flush open HANDLERs.
     */
     mysql_ha_flush(thd);
+    DEBUG_SYNC(thd, "after_flush_unlock");
 
     pthread_mutex_lock(&LOCK_open);
 
@@ -2520,7 +2520,10 @@ bool open_table(THD *thd, TABLE_LIST *ta
   {
     if (open_table_get_mdl_lock(thd, table_list, mdl_lock_data, flags,
                                 action))
+    {
+      DEBUG_SYNC(thd, "before_open_table_wait_refresh");
       DBUG_RETURN(TRUE);
+    }
   }
 
   pthread_mutex_lock(&LOCK_open);
@@ -2578,10 +2581,7 @@ bool open_table(THD *thd, TABLE_LIST *ta
         that it was a view when the statement was prepared.
       */
       if (check_and_update_table_version(thd, table_list, share))
-      {
-        DEBUG_SYNC(thd, "before_open_table_wait_refresh");
         goto err_unlock;
-      }
       if (table_list->i_s_requested_object &  OPEN_TABLE_ONLY)
         goto err_unlock;
 

Thread
bzr commit into mysql-6.0-backup branch (rsomla:2656) Rafal Somla10 Jul