List:Commits« Previous MessageNext Message »
From:Hakan Kuecuekyilmaz Date:November 27 2008 8:45am
Subject:bzr commit into mysql-6.0-falcon branch (hky:2921)
View as plain text  
#At file:///home/hakan/work/mysql/mysql-6.0-falcon/ based on revid:hky@stripped

 2921 Hakan Kuecuekyilmaz	2008-11-27 [merge]
      Merge.
removed:
  mysql-test/suite/backup/r/backup_commit_blocker.result
  mysql-test/suite/backup/t/backup_commit_blocker.test
added:
  mysql-test/suite/backup/r/backup_vp_nontx.result
  mysql-test/suite/backup/r/backup_vp_tx.result
  mysql-test/suite/backup/t/backup_nodata_driver-master.opt
  mysql-test/suite/backup/t/backup_vp_nontx.test
  mysql-test/suite/backup/t/backup_vp_tx.test
  mysql-test/suite/falcon/r/falcon_bug_34351_A-big.result
  mysql-test/suite/falcon/r/falcon_bug_34351_C-big.result
  mysql-test/suite/falcon/r/falcon_bug_39702.result
  mysql-test/suite/falcon/r/falcon_bug_40614.result
  mysql-test/suite/falcon/t/falcon_bug_34351_A-big.test
  mysql-test/suite/falcon/t/falcon_bug_34351_C-big.test
  mysql-test/suite/falcon/t/falcon_bug_39702.test
  mysql-test/suite/falcon/t/falcon_bug_40614.test
  mysql-test/suite/rpl/r/rpl_extraCol_falcon.result
  mysql-test/suite/rpl/r/rpl_extraColmaster_falcon.result
  mysql-test/suite/rpl/r/rpl_locktrans_falcon.result
  mysql-test/suite/rpl/r/rpl_relay_space_falcon.result
  mysql-test/suite/rpl/r/rpl_row_blob_falcon.result
  mysql-test/suite/rpl/r/rpl_truncate_falcon.result
  mysql-test/suite/rpl/t/rpl_extraCol_falcon.test
  mysql-test/suite/rpl/t/rpl_extraColmaster_falcon.test
  mysql-test/suite/rpl/t/rpl_locktrans_falcon.test
  mysql-test/suite/rpl/t/rpl_relay_space_falcon.test
  mysql-test/suite/rpl/t/rpl_row_blob_falcon.test
  mysql-test/suite/rpl/t/rpl_truncate_falcon.test
  mysql-test/suite/sys_vars/t/disabled.def
modified:
  mysql-test/lib/mtr_report.pl
  mysql-test/r/implicit_commit.result
  mysql-test/suite/backup/r/backup.result
  mysql-test/suite/backup/r/backup_backupdir.result
  mysql-test/suite/backup/r/backup_commit_backup.result
  mysql-test/suite/backup/r/backup_commit_restore.result
  mysql-test/suite/backup/r/backup_compression.result
  mysql-test/suite/backup/r/backup_concurrent.result
  mysql-test/suite/backup/r/backup_db_grants.result
  mysql-test/suite/backup/r/backup_ddl_blocker.result
  mysql-test/suite/backup/r/backup_errors.result
  mysql-test/suite/backup/r/backup_fkey.result
  mysql-test/suite/backup/r/backup_lock_myisam.result
  mysql-test/suite/backup/r/backup_logs.result
  mysql-test/suite/backup/r/backup_logs_output.result
  mysql-test/suite/backup/r/backup_logs_purge.result
  mysql-test/suite/backup/r/backup_no_be.result
  mysql-test/suite/backup/r/backup_no_data.result
  mysql-test/suite/backup/r/backup_nodata_driver.result
  mysql-test/suite/backup/r/backup_security.result
  mysql-test/suite/backup/r/backup_snapshot.result
  mysql-test/suite/backup/r/backup_timeout.result
  mysql-test/suite/backup/t/backup.test
  mysql-test/suite/backup/t/backup_backupdir.test
  mysql-test/suite/backup/t/backup_commit_backup.test
  mysql-test/suite/backup/t/backup_commit_restore.test
  mysql-test/suite/backup/t/backup_compression.test
  mysql-test/suite/backup/t/backup_concurrent.test
  mysql-test/suite/backup/t/backup_db_grants.test
  mysql-test/suite/backup/t/backup_ddl_blocker.test
  mysql-test/suite/backup/t/backup_errors.test
  mysql-test/suite/backup/t/backup_fkey.test
  mysql-test/suite/backup/t/backup_lock_myisam.test
  mysql-test/suite/backup/t/backup_logs.test
  mysql-test/suite/backup/t/backup_logs_output-master.opt
  mysql-test/suite/backup/t/backup_logs_purge.test
  mysql-test/suite/backup/t/backup_no_be.test
  mysql-test/suite/backup/t/backup_no_data.test
  mysql-test/suite/backup/t/backup_nodata_driver.test
  mysql-test/suite/backup/t/backup_security.test
  mysql-test/suite/backup/t/backup_snapshot.test
  mysql-test/suite/backup/t/backup_timeout.test
  mysql-test/suite/backup_engines/include/backup_ptr_commit.inc
  mysql-test/suite/backup_engines/r/backup_online_testing.result
  mysql-test/suite/backup_engines/r/backup_ptr_commit_mixed.result
  mysql-test/suite/backup_engines/r/backup_ptr_commit_row.result
  mysql-test/suite/backup_engines/r/backup_ptr_commit_stmt.result
  mysql-test/suite/backup_engines/r/backup_tmp_tables.result
  mysql-test/suite/backup_engines/t/backup_online_testing.test
  mysql-test/suite/backup_engines/t/backup_tmp_tables.test
  mysql-test/suite/falcon/r/falcon_bug_34351_A.result
  mysql-test/suite/falcon/r/falcon_bug_34351_C.result
  mysql-test/suite/falcon/r/falcon_bug_39708.result
  mysql-test/suite/falcon/t/falcon_bug_34351_A.test
  mysql-test/suite/falcon/t/falcon_bug_34351_C.test
  mysql-test/suite/falcon/t/falcon_bug_39708.test
  mysql-test/suite/rpl/r/rpl_backup.result
  mysql-test/suite/rpl/t/disabled.def
  mysql-test/suite/rpl/t/rpl_backup.test
  mysql-test/t/disabled.def
  mysql-test/t/implicit_commit.test
  sql/backup/backup_info.h
  sql/backup/backup_kernel.h
  sql/backup/kernel.cc
  sql/backup/logger.h
  sql/backup/restore_info.h
  sql/backup/stream.h
  sql/backup/stream_v1.c
  sql/ha_partition.cc
  sql/lex.h
  sql/mysqld.cc
  sql/share/errmsg.txt
  sql/sql_parse.cc
  sql/sql_yacc.yy
  storage/falcon/Configuration.cpp
  storage/falcon/Database.cpp
  storage/falcon/IO.cpp
  storage/falcon/IndexRootPage.cpp
  storage/falcon/IndexWalker.cpp
  storage/falcon/Log.h
  storage/falcon/PageInventoryPage.cpp
  storage/falcon/SRLBlobDelete.h
  storage/falcon/SRLBlobUpdate.h
  storage/falcon/SRLCreateIndex.h
  storage/falcon/SRLCreateSection.h
  storage/falcon/SRLCreateTableSpace.cpp
  storage/falcon/SRLCreateTableSpace.h
  storage/falcon/SRLData.h
  storage/falcon/SRLDelete.h
  storage/falcon/SRLDeleteIndex.cpp
  storage/falcon/SRLDeleteIndex.h
  storage/falcon/SRLDropTableSpace.cpp
  storage/falcon/SRLDropTableSpace.h
  storage/falcon/SRLFreePage.h
  storage/falcon/SRLIndexAdd.h
  storage/falcon/SRLIndexDelete.h
  storage/falcon/SRLIndexPage.h
  storage/falcon/SRLInversionPage.h
  storage/falcon/SRLOverflowPages.h
  storage/falcon/SRLRecordLocator.h
  storage/falcon/SRLRecordStub.h
  storage/falcon/SRLSectionLine.h
  storage/falcon/SRLSectionPage.h
  storage/falcon/SRLSectionPromotion.h
  storage/falcon/SRLSequencePage.h
  storage/falcon/SRLUpdateBlob.h
  storage/falcon/SRLUpdateIndex.h
  storage/falcon/SRLUpdateRecords.cpp
  storage/falcon/SRLUpdateRecords.h
  storage/falcon/SerialLog.cpp
  storage/falcon/SerialLog.h
  storage/falcon/SerialLogRecord.cpp
  storage/falcon/SerialLogRecord.h
  storage/falcon/StorageVersion.h
  storage/falcon/Table.cpp
  storage/falcon/Table.h
  storage/falcon/Transaction.cpp
  storage/falcon/Value.cpp
  storage/falcon/ha_falcon.cpp
  storage/falcon/plug.in

=== modified file 'mysql-test/lib/mtr_report.pl'
--- a/mysql-test/lib/mtr_report.pl	2008-10-27 13:06:21 +0000
+++ b/mysql-test/lib/mtr_report.pl	2008-11-21 15:02:34 +0000
@@ -352,6 +352,19 @@ sub mtr_report_stats ($) {
 		  /Restore:/ or /was skipped because the user does not exist/
 		) or
                 
+		# backup_logs_output has warning because --log-backup-output option does 
+    # not have argument
+		($testname eq 'backup.backup_logs_output') and
+		(
+		  /Although a path was specified for the/
+		) or
+                
+		# backup_nodata_driver intentionally provokes an error in opening a MERGE table
+		($testname eq 'backup.backup_nodata_driver') and
+		(
+		  /Restore: Open and lock tables failed in RESTORE/
+		) or
+                
 		# The tablespace test triggers error below on purpose
 		($testname eq 'backup.backup_tablespace') and
 		(

=== modified file 'mysql-test/r/implicit_commit.result'
--- a/mysql-test/r/implicit_commit.result	2008-07-26 16:38:20 +0000
+++ b/mysql-test/r/implicit_commit.result	2008-11-20 14:03:27 +0000
@@ -1035,7 +1035,7 @@ YES
 # SQLCOM_RESTORE
 #
 INSERT INTO db1.trans (a) VALUES (1);
-restore from 'backup_db1.ba';
+restore from 'backup_db1.ba' overwrite;
 CALL db1.test_if_commit();
 IMPLICIT COMMIT
 YES

=== modified file 'mysql-test/suite/backup/r/backup.result'
--- a/mysql-test/suite/backup/r/backup.result	2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/r/backup.result	2008-11-17 09:57:51 +0000
@@ -562,7 +562,7 @@ id	ccode
 2	bb
 4	dd
 do restore
-RESTORE FROM 'bup_delete.bak';
+RESTORE FROM 'bup_delete.bak' OVERWRITE;
 backup_id
 #
 show the data
@@ -597,7 +597,7 @@ BACKUP DATABASE bup_default TO 'bup_defa
 backup_id
 #
 Restore the database.
-RESTORE FROM 'bup_default_timestamp.bak';
+RESTORE FROM 'bup_default_timestamp.bak' OVERWRITE;
 backup_id
 #
 Show data after restore (timestamp should be same as above).

=== modified file 'mysql-test/suite/backup/r/backup_backupdir.result'
--- a/mysql-test/suite/backup/r/backup_backupdir.result	2008-10-24 15:37:11 +0000
+++ b/mysql-test/suite/backup/r/backup_backupdir.result	2008-11-17 09:57:51 +0000
@@ -15,7 +15,7 @@ backup_id
 Ensure backup image file went to the correct location
 /backup/bup_backupdir.bak
 Perform restore
-RESTORE FROM 'bup_backupdir1.bak';
+RESTORE FROM 'bup_backupdir1.bak' OVERWRITE;
 backup_id
 #
 Now do the backup and restore by specifying a path.
@@ -25,7 +25,7 @@ backup_id
 #
 Ensure backup image file went to the correct location
 Perform restore
-RESTORE FROM '../bup_backupdir2.bak';
+RESTORE FROM '../bup_backupdir2.bak' OVERWRITE;
 backup_id
 #
 Perform backup

=== modified file 'mysql-test/suite/backup/r/backup_commit_backup.result'
--- a/mysql-test/suite/backup/r/backup_commit_backup.result	2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/r/backup_commit_backup.result	2008-11-17 09:57:51 +0000
@@ -299,7 +299,7 @@ SELECT release_lock("sync");
 release_lock("sync")
 1
 Checking contents of the backup image
-RESTORE FROM 'db1.bak';
+RESTORE FROM 'db1.bak' OVERWRITE;
 backup_id
 #
 SELECT * FROM db1.t1;

=== removed file 'mysql-test/suite/backup/r/backup_commit_blocker.result'
--- a/mysql-test/suite/backup/r/backup_commit_blocker.result	2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/r/backup_commit_blocker.result	1970-01-01 00:00:00 +0000
@@ -1,469 +0,0 @@
-SET DEBUG_SYNC= 'RESET';
-DROP DATABASE IF EXISTS bup_commit_blocker;
-CREATE DATABASE bup_commit_blocker;
-
-Starting Test 1
-
-con1: Creating tables
-CREATE TABLE bup_commit_blocker.t1 (col_a CHAR(40)) ENGINE=INNODB;
-CREATE TABLE bup_commit_blocker.t2 (col_a CHAR(40)) ENGINE=INNODB;
-CREATE TABLE bup_commit_blocker.t3 (col_a CHAR(40)) ENGINE=INNODB;
-con1: Loading data
-INSERT INTO bup_commit_blocker.t1 VALUES ("01 Some data to test");
-INSERT INTO bup_commit_blocker.t1 VALUES ("02 Some data to test");
-INSERT INTO bup_commit_blocker.t1 VALUES ("03 Some data to test");
-INSERT INTO bup_commit_blocker.t1 VALUES ("04 Some data to test");
-INSERT INTO bup_commit_blocker.t1 VALUES ("05 Some data to test");
-INSERT INTO bup_commit_blocker.t2 VALUES ("01 Some data to test");
-INSERT INTO bup_commit_blocker.t2 VALUES ("02 Some data to test");
-INSERT INTO bup_commit_blocker.t2 VALUES ("03 Some data to test");
-INSERT INTO bup_commit_blocker.t2 VALUES ("04 Some data to test");
-INSERT INTO bup_commit_blocker.t2 VALUES ("05 Some data to test");
-INSERT INTO bup_commit_blocker.t3 VALUES ("01 Some data to test");
-INSERT INTO bup_commit_blocker.t3 VALUES ("02 Some data to test");
-INSERT INTO bup_commit_blocker.t3 VALUES ("03 Some data to test");
-INSERT INTO bup_commit_blocker.t3 VALUES ("04 Some data to test");
-INSERT INTO bup_commit_blocker.t3 VALUES ("05 Some data to test");
-con1: Show that the new data doesn't exist before backup.
-SELECT * FROM bup_commit_blocker.t1;
-col_a
-01 Some data to test
-02 Some data to test
-03 Some data to test
-04 Some data to test
-05 Some data to test
-SELECT * FROM bup_commit_blocker.t2;
-col_a
-01 Some data to test
-02 Some data to test
-03 Some data to test
-04 Some data to test
-05 Some data to test
-SELECT * FROM bup_commit_blocker.t3;
-col_a
-01 Some data to test
-02 Some data to test
-03 Some data to test
-04 Some data to test
-05 Some data to test
-con2: Get a transaction going and stop in the middle
-Assumption (a): TRX in progress is not included in backup
-BEGIN;
-UPDATE bup_commit_blocker.t1 SET col_a = "con2: CHANGED" WHERE col_a LIKE '01%';
-con3: Start a transaction and send commit after lock is taken
-Assumption (b): TRX in commit is included in backup
-BEGIN;
-INSERT INTO bup_commit_blocker.t2 VALUES ("con3: 04 Some data to test");
-INSERT INTO bup_commit_blocker.t2 VALUES ("con3: 05 Some data to test");
-con1: Activate synchronization points for BACKUP.
-SET DEBUG_SYNC= 'before_commit_block SIGNAL bup_commit_block
-                 WAIT_FOR bup_go_read_lock';
-SET DEBUG_SYNC= 'wait_lock_global_read_lock SIGNAL bup_read_lock';
-SET DEBUG_SYNC= 'before_backup_data_lock WAIT_FOR commit_done';
-SET DEBUG_SYNC= 'before_backup_unblock_commit SIGNAL bup_read_locked
-                 WAIT_FOR finish';
-con1: Backing up database -- will block with lock
-BACKUP DATABASE bup_commit_blocker TO "bup_commit_blocker.bak";
-con5: Wait for BACKUP to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR bup_commit_block';
-con3: Activate synchronization points for COMMIT.
-SET DEBUG_SYNC= 'within_ha_commit_trans SIGNAL commit_read_locked
-                 WAIT_FOR commit_go_done';
-SET DEBUG_SYNC= 'after_commit SIGNAL commit_done WAIT_FOR finish';
-con3: Starting commit -- will block on sync point
-COMMIT;
-con5: Wait for COMMIT to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR commit_read_locked';
-con5: Let BACKUP run until the next sync point.
-SET DEBUG_SYNC= 'now SIGNAL bup_go_read_lock WAIT_FOR bup_read_lock';
-con5: Let COMMIT continue until end of statement.
-con5: The completed COMMIT implicitly wakes BACKUP.
-con5: So wait for BACKUP to reach the next synchronization point.
-SET DEBUG_SYNC= 'now SIGNAL commit_go_done WAIT_FOR bup_read_locked';
-con4: Activate synchronization point for BEGIN.
-SET DEBUG_SYNC= 'before_begin_trans SIGNAL begin_starting
-                 WAIT_FOR finish';
-con4: Starting begin -- will block on sync point
-Assumption (c): TRX not started is not included in backup
-BEGIN;
-con5: Wait for BEGIN to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR begin_starting';
-con5: Sending finish signal to wake them all.
-SET DEBUG_SYNC= 'now SIGNAL finish';
-con2: Completing transaction
-DELETE FROM bup_commit_blocker.t1 WHERE col_a LIKE '02%';
-COMMIT;
-con3: Fetch COMMIT result
-con4: Fetch BEGIN result and completing transaction
-UPDATE bup_commit_blocker.t3 SET col_a = "con4: 05 CHANGED" WHERE col_a LIKE '05%';
-UPDATE bup_commit_blocker.t3 SET col_a = "con4: 06 CHANGED" WHERE col_a LIKE '06%';
-COMMIT;
-con1: Fetch BACKUP result
-backup_id
-#
-con1: Showing data after updates and backup
-SELECT * FROM bup_commit_blocker.t1;
-col_a
-con2: CHANGED
-03 Some data to test
-04 Some data to test
-05 Some data to test
-SELECT * FROM bup_commit_blocker.t2;
-col_a
-01 Some data to test
-02 Some data to test
-03 Some data to test
-04 Some data to test
-05 Some data to test
-con3: 04 Some data to test
-con3: 05 Some data to test
-SELECT * FROM bup_commit_blocker.t3;
-col_a
-01 Some data to test
-02 Some data to test
-03 Some data to test
-04 Some data to test
-con4: 05 CHANGED
-con1: Dropping the database
-DROP TABLE bup_commit_blocker.t1;
-DROP TABLE bup_commit_blocker.t2;
-DROP TABLE bup_commit_blocker.t3;
-con1: Restoring the database
-RESTORE FROM "bup_commit_blocker.bak";
-backup_id
-#
-con1: Showing the data (no new data should be here).
-SELECT * FROM bup_commit_blocker.t1;
-col_a
-01 Some data to test
-02 Some data to test
-03 Some data to test
-04 Some data to test
-05 Some data to test
-SELECT * FROM bup_commit_blocker.t2;
-col_a
-01 Some data to test
-02 Some data to test
-03 Some data to test
-04 Some data to test
-05 Some data to test
-con3: 04 Some data to test
-con3: 05 Some data to test
-SELECT * FROM bup_commit_blocker.t3;
-col_a
-01 Some data to test
-02 Some data to test
-03 Some data to test
-04 Some data to test
-05 Some data to test
-
-Verifying test 1 results:
-
-T1 should not have the changes after backup - count(*) = 0
-SELECT count(*) FROM bup_commit_blocker.t1 WHERE col_a like 'con2%';
-count(*)
-0
-T2 should have the changes after backup - count(*) = 2
-SELECT count(*) FROM bup_commit_blocker.t2 WHERE col_a like 'con3%';
-count(*)
-2
-T3 should not have the changes after backup - count(*) = 0
-SELECT count(*) FROM bup_commit_blocker.t3 WHERE col_a like 'con4%';
-count(*)
-0
-con1: Cleanup
-DROP DATABASE bup_commit_blocker;
-SET DEBUG_SYNC= 'RESET';
-
-Starting Test 2
-
-CREATE DATABASE bup_commit_blocker;
-con1: Creating tables
-CREATE TABLE bup_commit_blocker.t5 (col_a int) ENGINE=MEMORY;
-con1: Loading data
-INSERT INTO bup_commit_blocker.t5 VALUES (10), (20), (30), (40), (50);
-con1: Show that the new data doesn't exist before backup.
-SELECT * FROM bup_commit_blocker.t5;
-col_a
-10
-20
-30
-40
-50
-con1: Activate synchronization point for BACKUP.
-SET DEBUG_SYNC= 'before_backup_data_unlock SIGNAL bup_data_unlock
-                 WAIT_FOR finish';
-con1: Backing up database -- will block with lock
-BACKUP DATABASE bup_commit_blocker TO "bup_commit_blocker.bak";
-con5: Wait for BACKUP to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR bup_data_unlock';
-con7: Show that the statement in progress has executed before backup.
-SELECT * FROM bup_commit_blocker.t5;
-col_a
-10
-20
-30
-40
-50
-con7: Activate synchronization point for UPDATE.
-SET DEBUG_SYNC= 'wait_if_global_read_lock SIGNAL upd_read_lock';
-con7: Starting non-trx about to start
-Assumption (e): non-TRX not started is not included in backup
-UPDATE bup_commit_blocker.t5 SET col_a = 333 WHERE col_a = 30;
-con5: Wait for UPDATE to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR upd_read_lock';
-con5: Sending finish signal to wake them all.
-SET DEBUG_SYNC= 'now SIGNAL finish';
-con7: Fetch UPDATE result
-con1: Fetch BACKUP result
-backup_id
-#
-con1: Showing data after updates and backup
-SELECT * FROM bup_commit_blocker.t5;
-col_a
-10
-20
-333
-40
-50
-con1: Dropping the database
-DROP TABLE bup_commit_blocker.t5;
-con1: Restoring the database
-RESTORE FROM "bup_commit_blocker.bak";
-backup_id
-#
-con1: Showing the data (no new data should be here).
-SELECT * FROM bup_commit_blocker.t5;
-col_a
-10
-20
-30
-40
-50
-
-Verifying test 2 results:
-
-T5 should not have the changes after backup - count(*) = 0
-SELECT count(*) FROM bup_commit_blocker.t5 WHERE col_a = 333;
-count(*)
-0
-con1: Cleanup
-DROP DATABASE bup_commit_blocker;
-SET DEBUG_SYNC= 'RESET';
-
-Starting Test 3
-
-CREATE DATABASE bup_commit_blocker;
-con1: Creating tables
-CREATE TABLE bup_commit_blocker.t1 (col_a CHAR(40)) ENGINE=INNODB;
-CREATE TABLE bup_commit_blocker.t2 (col_a CHAR(40)) ENGINE=INNODB;
-CREATE TABLE bup_commit_blocker.t3 (col_a CHAR(40)) ENGINE=INNODB;
-CREATE TABLE bup_commit_blocker.t5 (col_a int) ENGINE=MEMORY;
-con1: Loading data
-INSERT INTO bup_commit_blocker.t1 VALUES ("01 Some data to test");
-INSERT INTO bup_commit_blocker.t1 VALUES ("02 Some data to test");
-INSERT INTO bup_commit_blocker.t1 VALUES ("03 Some data to test");
-INSERT INTO bup_commit_blocker.t1 VALUES ("04 Some data to test");
-INSERT INTO bup_commit_blocker.t1 VALUES ("05 Some data to test");
-INSERT INTO bup_commit_blocker.t2 VALUES ("01 Some data to test");
-INSERT INTO bup_commit_blocker.t2 VALUES ("02 Some data to test");
-INSERT INTO bup_commit_blocker.t2 VALUES ("03 Some data to test");
-INSERT INTO bup_commit_blocker.t2 VALUES ("04 Some data to test");
-INSERT INTO bup_commit_blocker.t2 VALUES ("05 Some data to test");
-INSERT INTO bup_commit_blocker.t3 VALUES ("01 Some data to test");
-INSERT INTO bup_commit_blocker.t3 VALUES ("02 Some data to test");
-INSERT INTO bup_commit_blocker.t3 VALUES ("03 Some data to test");
-INSERT INTO bup_commit_blocker.t3 VALUES ("04 Some data to test");
-INSERT INTO bup_commit_blocker.t3 VALUES ("05 Some data to test");
-INSERT INTO bup_commit_blocker.t5 VALUES (10), (20), (30), (40), (50);
-con1: Show that the new data doesn't exist before backup.
-SELECT * FROM bup_commit_blocker.t1;
-col_a
-01 Some data to test
-02 Some data to test
-03 Some data to test
-04 Some data to test
-05 Some data to test
-SELECT * FROM bup_commit_blocker.t2;
-col_a
-01 Some data to test
-02 Some data to test
-03 Some data to test
-04 Some data to test
-05 Some data to test
-SELECT * FROM bup_commit_blocker.t3;
-col_a
-01 Some data to test
-02 Some data to test
-03 Some data to test
-04 Some data to test
-05 Some data to test
-SELECT * FROM bup_commit_blocker.t5;
-col_a
-10
-20
-30
-40
-50
-con2: Get a transaction going and stop in the middle
-Assumption (a): TRX in progress is not included in backup
-BEGIN;
-UPDATE bup_commit_blocker.t1 SET col_a = "con2: CHANGED" WHERE col_a LIKE '01%';
-con3: Start a transaction and send commit after lock is taken
-Assumption (b): TRX in commit is included in backup
-BEGIN;
-INSERT INTO bup_commit_blocker.t2 VALUES ("con3: 04 Some data to test");
-INSERT INTO bup_commit_blocker.t2 VALUES ("con3: 05 Some data to test");
-con1: Activate synchronization points for BACKUP.
-SET DEBUG_SYNC= 'before_commit_block SIGNAL bup_commit_block
-                 WAIT_FOR bup_go_read_lock';
-SET DEBUG_SYNC= 'wait_lock_global_read_lock SIGNAL bup_read_lock';
-SET DEBUG_SYNC= 'before_backup_data_lock WAIT_FOR commit_done';
-SET DEBUG_SYNC= 'before_backup_unblock_commit SIGNAL bup_read_locked
-                 WAIT_FOR finish';
-con1: Backing up database -- will block with lock
-BACKUP DATABASE bup_commit_blocker TO "bup_commit_blocker.bak";
-con5: Wait for BACKUP to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR bup_commit_block';
-con3: Activate synchronization points for COMMIT.
-SET DEBUG_SYNC= 'within_ha_commit_trans SIGNAL commit_read_locked
-                 WAIT_FOR commit_go_done';
-SET DEBUG_SYNC= 'after_commit SIGNAL commit_done WAIT_FOR finish';
-con3: Starting commit -- will block on sync point
-COMMIT;
-con5: Wait for COMMIT to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR commit_read_locked';
-con5: Let BACKUP run until the next sync point.
-SET DEBUG_SYNC= 'now SIGNAL bup_go_read_lock WAIT_FOR bup_read_lock';
-con5: Let COMMIT continue until the sync point at its end.
-con5: The completed COMMIT implicitly wakes BACKUP.
-con5: So wait for BACKUP to reach the next synchronization point.
-SET DEBUG_SYNC= 'now SIGNAL commit_go_done WAIT_FOR bup_read_locked';
-con4: Activate synchronization point for BEGIN.
-SET DEBUG_SYNC= 'before_begin_trans SIGNAL begin_starting
-                 WAIT_FOR finish';
-con4: Starting begin -- will block with lock
-Assumption (c): TRX not started is not included in backup
-BEGIN;
-con5: Wait for BEGIN to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR begin_starting';
-con7: Show that the statement in progress has executed before backup.
-SELECT * FROM bup_commit_blocker.t5;
-col_a
-10
-20
-30
-40
-50
-con7: Activate synchronization point for DELETE.
-SET DEBUG_SYNC= 'wait_if_global_read_lock SIGNAL del_read_lock';
-con7: Starting non-trx about to start -- will block with lock
-Assumption (e): non-TRX not started is not included in backup
-DELETE FROM bup_commit_blocker.t5 WHERE col_a = 50;
-con5: Wait for DELETE to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR del_read_lock';
-con5: Sending finish signal to wake them all.
-SET DEBUG_SYNC= 'now SIGNAL finish';
-con2: Completing transaction
-DELETE FROM bup_commit_blocker.t2 WHERE col_a LIKE '02%';
-COMMIT;
-con3: Fetch COMMIT result
-con4: Fetch BEGIN result and completing transaction
-UPDATE bup_commit_blocker.t3 SET col_a = "con4: 05 CHANGED" WHERE col_a LIKE '05%';
-UPDATE bup_commit_blocker.t3 SET col_a = "con4: 06 CHANGED" WHERE col_a LIKE '06%';
-COMMIT;
-con7: Fetch DELETE result
-con1: Fetch BACKUP result
-backup_id
-#
-con1: Showing data after updates and backup
-SELECT * FROM bup_commit_blocker.t1;
-col_a
-con2: CHANGED
-02 Some data to test
-03 Some data to test
-04 Some data to test
-05 Some data to test
-SELECT * FROM bup_commit_blocker.t2;
-col_a
-01 Some data to test
-03 Some data to test
-04 Some data to test
-05 Some data to test
-con3: 04 Some data to test
-con3: 05 Some data to test
-SELECT * FROM bup_commit_blocker.t3;
-col_a
-01 Some data to test
-02 Some data to test
-03 Some data to test
-04 Some data to test
-con4: 05 CHANGED
-SELECT * FROM bup_commit_blocker.t5;
-col_a
-10
-20
-30
-40
-con1: Dropping the database
-DROP TABLE bup_commit_blocker.t1;
-DROP TABLE bup_commit_blocker.t2;
-DROP TABLE bup_commit_blocker.t3;
-DROP TABLE bup_commit_blocker.t5;
-con1: Restoring the database
-RESTORE FROM "bup_commit_blocker.bak";
-backup_id
-#
-con1: Showing the data (no new data should be here).
-SELECT * FROM bup_commit_blocker.t1;
-col_a
-01 Some data to test
-02 Some data to test
-03 Some data to test
-04 Some data to test
-05 Some data to test
-SELECT * FROM bup_commit_blocker.t2;
-col_a
-01 Some data to test
-02 Some data to test
-03 Some data to test
-04 Some data to test
-05 Some data to test
-con3: 04 Some data to test
-con3: 05 Some data to test
-SELECT * FROM bup_commit_blocker.t3;
-col_a
-01 Some data to test
-02 Some data to test
-03 Some data to test
-04 Some data to test
-05 Some data to test
-SELECT * FROM bup_commit_blocker.t5;
-col_a
-10
-20
-30
-40
-50
-
-Verifying test 3 results:
-
-T1 should not have the changes after backup - count(*) = 0
-SELECT count(*) FROM bup_commit_blocker.t1 WHERE col_a like 'con2%';
-count(*)
-0
-T2 should have the changes after backup - count(*) = 2
-SELECT count(*) FROM bup_commit_blocker.t2 WHERE col_a like 'con3%';
-count(*)
-2
-T3 should not have the changes after backup - count(*) = 0
-SELECT count(*) FROM bup_commit_blocker.t3 WHERE col_a like 'con4%';
-count(*)
-0
-T5 should not have the changes after backup - count(*) = 1
-SELECT count(*) FROM bup_commit_blocker.t5 WHERE col_a >= 50;
-count(*)
-1
-con1: Cleanup
-DROP DATABASE bup_commit_blocker;
-SET DEBUG_SYNC= 'RESET';

=== modified file 'mysql-test/suite/backup/r/backup_commit_restore.result'
--- a/mysql-test/suite/backup/r/backup_commit_restore.result	2008-10-23 08:13:54 +0000
+++ b/mysql-test/suite/backup/r/backup_commit_restore.result	2008-11-17 09:57:51 +0000
@@ -6,7 +6,7 @@ INSERT INTO t1 VALUES ('a1');
 BACKUP DATABASE commit_test TO '81';
 backup_id
 #
-RESTORE FROM '81';
+RESTORE FROM '81' OVERWRITE;
 backup_id
 #
 SELECT * FROM t1;
@@ -24,7 +24,7 @@ INSERT INTO t2 VALUES ('a2');
 BACKUP DATABASE commit_test TO '82';
 backup_id
 #
-RESTORE FROM '82';
+RESTORE FROM '82' OVERWRITE;
 backup_id
 #
 SELECT * FROM t1;
@@ -51,7 +51,7 @@ INSERT INTO t3 VALUES ('a3');
 BACKUP DATABASE commit_test TO '83';
 backup_id
 #
-RESTORE FROM '83';
+RESTORE FROM '83' OVERWRITE;
 backup_id
 #
 SELECT * FROM t1;
@@ -89,7 +89,7 @@ INSERT INTO t4 VALUES ('a4');
 BACKUP DATABASE commit_test TO '84';
 backup_id
 #
-RESTORE FROM '84';
+RESTORE FROM '84' OVERWRITE;
 backup_id
 #
 SELECT * FROM t1;
@@ -138,7 +138,7 @@ INSERT INTO t4 VALUES ('a5');
 BACKUP DATABASE commit_test TO '85';
 backup_id
 #
-RESTORE FROM '85';
+RESTORE FROM '85' OVERWRITE;
 backup_id
 #
 SELECT * FROM t1;
@@ -198,7 +198,7 @@ BACKUP DATABASE commit_test TO '86';
 backup_id
 #
 SET @@autocommit=0;
-RESTORE FROM '86';
+RESTORE FROM '86' OVERWRITE;
 backup_id
 #
 DROP TABLE t5;
@@ -265,7 +265,7 @@ BACKUP DATABASE commit_test TO '87';
 backup_id
 #
 SET @@autocommit=1;
-RESTORE FROM '87';
+RESTORE FROM '87' OVERWRITE;
 backup_id
 #
 SELECT * FROM t1;

=== modified file 'mysql-test/suite/backup/r/backup_compression.result'
--- a/mysql-test/suite/backup/r/backup_compression.result	2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/r/backup_compression.result	2008-11-17 09:57:51 +0000
@@ -7,13 +7,13 @@ CREATE TABLE db1.t2(a INT);
 BACKUP DATABASE db1 TO 'db2.bak.gz' WITH COMPRESSION COMPRESSION_ALGORITHM=gzip;
 backup_id
 #
-RESTORE FROM 'db1.bak.gz';
+RESTORE FROM 'db1.bak.gz' OVERWRITE;
 backup_id
 #
 SHOW TABLES FROM db1;
 Tables_in_db1
 t1
-RESTORE FROM 'db2.bak.gz';
+RESTORE FROM 'db2.bak.gz' OVERWRITE;
 backup_id
 #
 SHOW TABLES FROM db1;

=== modified file 'mysql-test/suite/backup/r/backup_concurrent.result'
--- a/mysql-test/suite/backup/r/backup_concurrent.result	2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/r/backup_concurrent.result	2008-11-17 09:57:51 +0000
@@ -49,7 +49,7 @@ Testing starting backup/restore restore 
 ---------------------------------------------------
 Starting restore
 SET DEBUG_SYNC= 'after_backup_start_restore SIGNAL running WAIT_FOR restore';
-RESTORE FROM 'backup1';
+RESTORE FROM 'backup1' OVERWRITE;
 Waiting for restore to get going
 SET DEBUG_SYNC= 'now WAIT_FOR running';
 Starting backup in another connection.  

=== modified file 'mysql-test/suite/backup/r/backup_db_grants.result'
--- a/mysql-test/suite/backup/r/backup_db_grants.result	2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/r/backup_db_grants.result	2008-11-17 09:57:51 +0000
@@ -64,7 +64,7 @@ SHOW GRANTS FOR 'bup_user3'@'%';
 Grants for bup_user3@%
 GRANT USAGE ON *.* TO 'bup_user3'@'%'
 Run Restore
-RESTORE FROM 'bup_db_grants.bak';
+RESTORE FROM 'bup_db_grants.bak' OVERWRITE;
 backup_id
 #
 SHOW TABLES FROM bup_db_grants;
@@ -96,7 +96,7 @@ FLUSH PRIVILEGES;
 CREATE USER 'bup_user1'@'%';
 CREATE USER 'bup_user1'@'nosuchhost';
 Run Restore
-RESTORE FROM 'bup_db_grants.bak';
+RESTORE FROM 'bup_db_grants.bak' OVERWRITE;
 backup_id
 #
 SHOW TABLES FROM bup_db_grants;
@@ -166,7 +166,7 @@ EXECUTE stmt3;
 Grants for �@@%
 GRANT USAGE ON *.* TO '�@'@'%'
 Run restore.
-RESTORE FROM 'bup_db_grants.bak';
+RESTORE FROM 'bup_db_grants.bak' OVERWRITE;
 backup_id
 #
 FLUSH PRIVILEGES;

=== modified file 'mysql-test/suite/backup/r/backup_ddl_blocker.result'
--- a/mysql-test/suite/backup/r/backup_ddl_blocker.result	2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/r/backup_ddl_blocker.result	2008-11-20 14:07:23 +0000
@@ -112,7 +112,7 @@ con1: Dropping the database tables
 DROP TABLE bup_ddl_blocker.t1, bup_ddl_blocker.t2,
 bup_ddl_blocker.t3, bup_ddl_blocker.t4;
 con1: Restoring the database
-RESTORE FROM "bup_ddl_blocker.bak";
+RESTORE FROM "bup_ddl_blocker.bak" OVERWRITE;
 backup_id
 #
 con1: Showing columns that were backed up
@@ -173,13 +173,13 @@ con1: Activate synchronization points fo
 SET DEBUG_SYNC= 'before_block_ddl SIGNAL bup_blocked WAIT_FOR status_shown';
 SET DEBUG_SYNC= 'after_block_ddl SIGNAL bup_started WAIT_FOR status_shown2';
 con1: Restoring database -- will block with lock
-RESTORE FROM "bup_ddl_blocker_orig.bak";
+RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE;
 con6: Wait for con1 to reach its synchronization point.
 SET DEBUG_SYNC= 'now WAIT_FOR bup_blocked';
 SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
 WHERE info LIKE "RESTORE FROM%";
 state	info
-debug sync point: before_block_ddl	RESTORE FROM "bup_ddl_blocker_orig.bak"
+debug sync point: before_block_ddl	RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE
 SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
 WHERE info LIKE "CREATE TABLE bup_ddl_blocker.t1%";
 state	info
@@ -193,7 +193,7 @@ SET DEBUG_SYNC= 'now SIGNAL status_shown
 SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
 WHERE info LIKE "RESTORE FROM%";
 state	info
-debug sync point: after_block_ddl	RESTORE FROM "bup_ddl_blocker_orig.bak"
+debug sync point: after_block_ddl	RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE
 con4: Activate synchronization point for DDL.
 SET DEBUG_SYNC= 'before_check_ddl_blocked SIGNAL con4_started
                  WAIT_FOR status_shown2';
@@ -352,7 +352,7 @@ con1: Dropping the database tables
 DROP TABLE bup_ddl_blocker.t01, bup_ddl_blocker.t2,
 bup_ddl_blocker.t03, bup_ddl_blocker.t4;
 con1: Restoring the database
-RESTORE FROM "bup_ddl_blocker.bak";
+RESTORE FROM "bup_ddl_blocker.bak" OVERWRITE;
 backup_id
 #
 con1: Showing columns that were backed up
@@ -407,13 +407,13 @@ con1: Activate synchronization points fo
 SET DEBUG_SYNC= 'before_block_ddl SIGNAL bup_blocked WAIT_FOR status_shown';
 SET DEBUG_SYNC= 'after_block_ddl SIGNAL bup_started WAIT_FOR status_shown2';
 con1: Restoring database -- will block with lock
-RESTORE FROM "bup_ddl_blocker_orig.bak";
+RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE;
 con6: Wait for con1 to reach its synchronization point.
 SET DEBUG_SYNC= 'now WAIT_FOR bup_blocked';
 SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
 WHERE info LIKE "RESTORE FROM%";
 state	info
-debug sync point: before_block_ddl	RESTORE FROM "bup_ddl_blocker_orig.bak"
+debug sync point: before_block_ddl	RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE
 SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
 WHERE info LIKE "RENAME TABLE bup_ddl_blocker.t1%";
 state	info
@@ -427,7 +427,7 @@ SET DEBUG_SYNC= 'now SIGNAL status_shown
 SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
 WHERE info LIKE "RESTORE FROM%";
 state	info
-debug sync point: after_block_ddl	RESTORE FROM "bup_ddl_blocker_orig.bak"
+debug sync point: after_block_ddl	RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE
 con4: Activate synchronization point for DDL.
 SET DEBUG_SYNC= 'before_check_ddl_blocked SIGNAL con4_started
                  WAIT_FOR status_shown2';
@@ -581,7 +581,7 @@ t3
 con1: Dropping the database tables
 DROP TABLE bup_ddl_blocker.t1, bup_ddl_blocker.t3;
 con1: Restoring the database
-RESTORE FROM "bup_ddl_blocker.bak";
+RESTORE FROM "bup_ddl_blocker.bak" OVERWRITE;
 backup_id
 #
 con1: Showing columns that were backed up
@@ -634,13 +634,13 @@ con1: Activate synchronization points fo
 SET DEBUG_SYNC= 'before_block_ddl SIGNAL bup_blocked WAIT_FOR status_shown';
 SET DEBUG_SYNC= 'after_block_ddl SIGNAL bup_started WAIT_FOR status_shown2';
 con1: Restoring database -- will block with lock
-RESTORE FROM "bup_ddl_blocker_orig.bak";
+RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE;
 con6: Wait for con1 to reach its synchronization point.
 SET DEBUG_SYNC= 'now WAIT_FOR bup_blocked';
 SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
 WHERE info LIKE "RESTORE FROM%";
 state	info
-debug sync point: before_block_ddl	RESTORE FROM "bup_ddl_blocker_orig.bak"
+debug sync point: before_block_ddl	RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE
 SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
 WHERE info LIKE "OPTIMIZE TABLE bup_ddl_blocker.t1%";
 state	info
@@ -654,7 +654,7 @@ SET DEBUG_SYNC= 'now SIGNAL status_shown
 SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
 WHERE info LIKE "RESTORE FROM%";
 state	info
-debug sync point: after_block_ddl	RESTORE FROM "bup_ddl_blocker_orig.bak"
+debug sync point: after_block_ddl	RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE
 con4: Activate synchronization point for DDL.
 SET DEBUG_SYNC= 'before_check_ddl_blocked SIGNAL con4_started
                  WAIT_FOR status_shown2';
@@ -806,7 +806,7 @@ con1: Dropping the database tables
 DROP DATABASE bup_ddl_blocker_1;
 DROP DATABASE bup_ddl_blocker_3;
 con1: Restoring the database
-RESTORE FROM "bup_ddl_blocker.bak";
+RESTORE FROM "bup_ddl_blocker.bak" OVERWRITE;
 backup_id
 #
 con1: Showing databases that were backed up
@@ -862,13 +862,13 @@ con1: Activate synchronization points fo
 SET DEBUG_SYNC= 'before_block_ddl SIGNAL bup_blocked WAIT_FOR status_shown';
 SET DEBUG_SYNC= 'after_block_ddl SIGNAL bup_started WAIT_FOR status_shown2';
 con1: Restoring database -- will block with lock
-RESTORE FROM "bup_ddl_blocker_orig.bak";
+RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE;
 con6: Wait for con1 to reach its synchronization point.
 SET DEBUG_SYNC= 'now WAIT_FOR bup_blocked';
 SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
 WHERE info LIKE "RESTORE FROM%";
 state	info
-debug sync point: before_block_ddl	RESTORE FROM "bup_ddl_blocker_orig.bak"
+debug sync point: before_block_ddl	RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE
 SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
 WHERE info LIKE "CREATE DATABASE bup_ddl_blocker_1%";
 state	info
@@ -882,7 +882,7 @@ SET DEBUG_SYNC= 'now SIGNAL status_shown
 SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
 WHERE info LIKE "RESTORE FROM%";
 state	info
-debug sync point: after_block_ddl	RESTORE FROM "bup_ddl_blocker_orig.bak"
+debug sync point: after_block_ddl	RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE
 con4: Activate synchronization point for DDL.
 SET DEBUG_SYNC= 'before_check_ddl_blocked SIGNAL con4_started
                  WAIT_FOR status_shown2';
@@ -1040,7 +1040,7 @@ con1: Dropping the database tables
 DROP DATABASE bup_ddl_blocker_2;
 DROP DATABASE bup_ddl_blocker_4;
 con1: Restoring the database
-RESTORE FROM "bup_ddl_blocker.bak";
+RESTORE FROM "bup_ddl_blocker.bak" OVERWRITE;
 backup_id
 #
 con1: Showing databases that were backed up
@@ -1112,13 +1112,13 @@ con1: Activate synchronization points fo
 SET DEBUG_SYNC= 'before_block_ddl SIGNAL bup_blocked WAIT_FOR status_shown';
 SET DEBUG_SYNC= 'after_block_ddl SIGNAL bup_started WAIT_FOR status_shown2';
 con1: Restoring database -- will block with lock
-RESTORE FROM "bup_ddl_blocker_orig.bak";
+RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE;
 con6: Wait for con1 to reach its synchronization point.
 SET DEBUG_SYNC= 'now WAIT_FOR bup_blocked';
 SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
 WHERE info LIKE "RESTORE FROM%";
 state	info
-debug sync point: before_block_ddl	RESTORE FROM "bup_ddl_blocker_orig.bak"
+debug sync point: before_block_ddl	RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE
 SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
 WHERE info LIKE "ALTER DATABASE bup_ddl_blocker_2%";
 state	info
@@ -1132,7 +1132,7 @@ SET DEBUG_SYNC= 'now SIGNAL status_shown
 SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
 WHERE info LIKE "RESTORE FROM%";
 state	info
-debug sync point: after_block_ddl	RESTORE FROM "bup_ddl_blocker_orig.bak"
+debug sync point: after_block_ddl	RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE
 con4: Activate synchronization point for DDL.
 SET DEBUG_SYNC= 'before_check_ddl_blocked SIGNAL con4_started
                  WAIT_FOR status_shown2';
@@ -1335,7 +1335,7 @@ DROP DATABASE bup_ddl_blocker_2;
 DROP DATABASE bup_ddl_blocker_3;
 DROP DATABASE bup_ddl_blocker_4;
 con1: Restoring the database
-RESTORE FROM "bup_ddl_blocker.bak";
+RESTORE FROM "bup_ddl_blocker.bak" OVERWRITE;
 backup_id
 #
 con1: Showing databases that were backed up
@@ -1428,13 +1428,13 @@ con1: Activate synchronization points fo
 SET DEBUG_SYNC= 'before_block_ddl SIGNAL bup_blocked WAIT_FOR status_shown';
 SET DEBUG_SYNC= 'after_block_ddl SIGNAL bup_started WAIT_FOR status_shown2';
 con1: Restoring database -- will block with lock
-RESTORE FROM "bup_ddl_blocker_orig.bak";
+RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE;
 con6: Wait for con1 to reach its synchronization point.
 SET DEBUG_SYNC= 'now WAIT_FOR bup_blocked';
 SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
 WHERE info LIKE "RESTORE FROM%";
 state	info
-debug sync point: before_block_ddl	RESTORE FROM "bup_ddl_blocker_orig.bak"
+debug sync point: before_block_ddl	RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE
 SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
 WHERE info LIKE "CREATE INDEX 1t1col_b%";
 state	info
@@ -1448,7 +1448,7 @@ SET DEBUG_SYNC= 'now SIGNAL status_shown
 SELECT state, info FROM INFORMATION_SCHEMA.PROCESSLIST
 WHERE info LIKE "RESTORE FROM%";
 state	info
-debug sync point: after_block_ddl	RESTORE FROM "bup_ddl_blocker_orig.bak"
+debug sync point: after_block_ddl	RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE
 con4: Activate synchronization point for DDL.
 SET DEBUG_SYNC= 'before_check_ddl_blocked SIGNAL con4_started
                  WAIT_FOR status_shown2';

=== modified file 'mysql-test/suite/backup/r/backup_errors.result'
--- a/mysql-test/suite/backup/r/backup_errors.result	2008-11-05 09:41:15 +0000
+++ b/mysql-test/suite/backup/r/backup_errors.result	2008-11-17 09:57:51 +0000
@@ -135,3 +135,50 @@ SET DEBUG_SYNC= 'reset';
 DROP DATABASE db1;
 
 Done testing for Bug#38624
+
+Testing RESTORE ... OVERWRITE functionality
+See bug#34579
+
+Initialize
+CREATE DATABASE db1;
+USE db1;
+CREATE TABLE table1 (text VARCHAR(20));
+INSERT INTO table1 VALUES ('Inserted before');
+
+Backup database
+BACKUP DATABASE db1 TO 'overwrite.bak';
+backup_id
+#
+
+Insert more data and display
+INSERT INTO table1 VALUES ('Inserted after');
+SELECT * FROM table1;
+text
+Inserted before
+Inserted after
+
+Restore without OVERWRITE flag; will fail
+RESTORE FROM 'overwrite.bak';
+ERROR HY000: Database 'db1' already exists. Use OVERWRITE flag to overwrite.
+
+Restore with OVERWRITE flag; will succeed
+RESTORE FROM 'overwrite.bak' OVERWRITE;
+backup_id
+#
+
+Show that inserted value 2 is not there
+SELECT * FROM table1;
+text
+Inserted before
+DROP DATABASE db1;
+
+Restore after deleting db; will succeed
+RESTORE FROM 'overwrite.bak';
+backup_id
+#
+
+Show that inserted value 2 is not there
+SELECT * FROM table1;
+text
+Inserted before
+DROP DATABASE db1;

=== modified file 'mysql-test/suite/backup/r/backup_fkey.result'
--- a/mysql-test/suite/backup/r/backup_fkey.result	2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/r/backup_fkey.result	2008-11-17 09:57:51 +0000
@@ -43,10 +43,10 @@ SHOW VARIABLES LIKE 'foreign_key_checks%
 Variable_name	Value
 foreign_key_checks	ON
 Now restore the database.
-RESTORE FROM 'backup_fkey.bak';
+RESTORE FROM 'backup_fkey.bak' OVERWRITE;
 backup_id
 #
-RESTORE FROM 'backup_fkey_orig.bak';
+RESTORE FROM 'backup_fkey_orig.bak' OVERWRITE;
 backup_id
 #
 Show data
@@ -84,7 +84,7 @@ SHOW VARIABLES LIKE 'foreign_key_checks%
 Variable_name	Value
 foreign_key_checks	ON
 Restoring data
-RESTORE FROM 'backup_fkey.bak';
+RESTORE FROM 'backup_fkey.bak' OVERWRITE;
 backup_id
 #
 Verify foreign_key_checks = ON
@@ -97,7 +97,7 @@ SHOW VARIABLES LIKE 'foreign_key_checks%
 Variable_name	Value
 foreign_key_checks	OFF
 Restoring data
-RESTORE FROM 'backup_fkey.bak';
+RESTORE FROM 'backup_fkey.bak' OVERWRITE;
 backup_id
 #
 Verify foreign_key_checks = OFF

=== modified file 'mysql-test/suite/backup/r/backup_lock_myisam.result'
--- a/mysql-test/suite/backup/r/backup_lock_myisam.result	2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/r/backup_lock_myisam.result	2008-11-17 09:57:51 +0000
@@ -54,7 +54,7 @@ DROP DATABASE db1;
 now start the restore and while the restore is running, fire the trigger
 activate synchronization points for restore.
 SET DEBUG_SYNC= 'restore_in_progress SIGNAL wait_for_restore WAIT_FOR finish';
-RESTORE FROM 'db1.bak';
+RESTORE FROM 'db1.bak' OVERWRITE;;
 From breakpoints:
 Wait for restore to reach its synchronization point.
 SET DEBUG_SYNC= 'now WAIT_FOR wait_for_restore';
@@ -92,7 +92,7 @@ DELETE FROM db2.t2;
 now start the restore and while the restore is running, fire the trigger
 activate synchronization points for restore.
 SET DEBUG_SYNC= 'restore_in_progress SIGNAL wait_for_restore WAIT_FOR finish';
-RESTORE FROM 'db1.bak';
+RESTORE FROM 'db1.bak' OVERWRITE;;
 From breakpoints:
 Wait for restore to reach its synchronization point.
 SET DEBUG_SYNC= 'now WAIT_FOR wait_for_restore';

=== modified file 'mysql-test/suite/backup/r/backup_logs.result'
--- a/mysql-test/suite/backup/r/backup_logs.result	2008-11-07 10:40:48 +0000
+++ b/mysql-test/suite/backup/r/backup_logs.result	2008-11-17 09:57:51 +0000
@@ -137,7 +137,7 @@ SET DEBUG_SYNC= 'after_backup_log_init  
 SET DEBUG_SYNC= 'after_backup_start_restore SIGNAL running WAIT_FOR finish';
 con2: Send restore command.
 con2: Backup id = 501.
-RESTORE FROM 'backup_logs_orig.bak';
+RESTORE FROM 'backup_logs_orig.bak' OVERWRITE;
 con1: Wait for the restore to be started.
 SET DEBUG_SYNC= 'now WAIT_FOR started';
 con1: Display progress
@@ -177,7 +177,7 @@ username	root
 backup_file	#
 backup_file_path	#
 user_comment	
-command	RESTORE FROM 'backup_logs_orig.bak'
+command	RESTORE FROM 'backup_logs_orig.bak' OVERWRITE
 drivers	MyISAM, Snapshot, Default
 SELECT * FROM mysql.backup_progress WHERE backup_id = 501;
 backup_id	object	start_time	stop_time	total_bytes	progress	error_num	notes

=== modified file 'mysql-test/suite/backup/r/backup_logs_output.result'
--- a/mysql-test/suite/backup/r/backup_logs_output.result	2008-11-10 16:49:10 +0000
+++ b/mysql-test/suite/backup/r/backup_logs_output.result	2008-11-17 11:17:59 +0000
@@ -13,7 +13,7 @@ backup_progress_log	ON
 backup_progress_log_file	MYSQLTEST_VARDIR/master-data/progress.txt
 SHOW VARIABLES LIKE 'log_backup_output';
 Variable_name	Value
-log_backup_output	FILE
+log_backup_output	TABLE
 Set the backup log file names to default values.
 SET @@global.backup_history_log_file = DEFAULT;
 SET @@global.backup_progress_log_file = DEFAULT;

=== modified file 'mysql-test/suite/backup/r/backup_logs_purge.result'
--- a/mysql-test/suite/backup/r/backup_logs_purge.result	2008-10-28 14:17:05 +0000
+++ b/mysql-test/suite/backup/r/backup_logs_purge.result	2008-11-17 09:57:51 +0000
@@ -45,19 +45,19 @@ BACKUP DATABASE backup_logs to 'backup4.
 backup_id
 503
 Do restore of database
-RESTORE from 'backup1.bak';
+RESTORE from 'backup1.bak' OVERWRITE;
 backup_id
 504
 Do restore of database
-RESTORE from 'backup2.bak';
+RESTORE from 'backup2.bak' OVERWRITE;
 backup_id
 505
 Do restore of database
-RESTORE from 'backup3.bak';
+RESTORE from 'backup3.bak' OVERWRITE;
 backup_id
 506
 Do restore of database
-RESTORE from 'backup4.bak';
+RESTORE from 'backup4.bak' OVERWRITE;
 backup_id
 507
 Display results from backup logs
@@ -149,20 +149,20 @@ backup_id
 503
 SET SESSION debug="-d";
 Do restore of database
-RESTORE from 'backup1.bak';
+RESTORE from 'backup1.bak' OVERWRITE;
 backup_id
 504
 Do restore of database
-RESTORE from 'backup2.bak';
+RESTORE from 'backup2.bak' OVERWRITE;
 backup_id
 505
 Do restore of database
-RESTORE from 'backup3.bak';
+RESTORE from 'backup3.bak' OVERWRITE;
 backup_id
 506
 SET SESSION debug="+d,set_log_time";
 Do restore of database
-RESTORE from 'backup4.bak';
+RESTORE from 'backup4.bak' OVERWRITE;
 backup_id
 507
 SET SESSION debug="-d";
@@ -286,16 +286,16 @@ progress	0
 error_num	0
 notes	complete
 Now do the same test for restore.
-RESTORE FROM 'backup1.bak';
+RESTORE FROM 'backup1.bak' OVERWRITE;
 backup_id
 #
-RESTORE FROM 'backup2.bak';
+RESTORE FROM 'backup2.bak' OVERWRITE;
 backup_id
 #
-RESTORE FROM 'backup3.bak';
+RESTORE FROM 'backup3.bak' OVERWRITE;
 backup_id
 #
-RESTORE FROM 'backup4.bak';
+RESTORE FROM 'backup4.bak' OVERWRITE;
 backup_id
 #
 SELECT count(*) FROM mysql.backup_history;
@@ -306,7 +306,7 @@ count(*)
 13
 con2: Activate sync points for the backup statement.
 SET DEBUG_SYNC= 'before_restore_done SIGNAL ready WAIT_FOR proceed';
-RESTORE FROM 'backup5.bak';
+RESTORE FROM 'backup5.bak' OVERWRITE;
 con1: Wait for the backup to be ready.
 SET DEBUG_SYNC= 'now WAIT_FOR ready';
 PURGE BACKUP LOGS;
@@ -320,7 +320,7 @@ count(*)
 1
 SELECT backup_id, command FROM mysql.backup_history;
 backup_id	command
-505	RESTORE FROM 'backup5.bak'
+505	RESTORE FROM 'backup5.bak' OVERWRITE
 There should be one row in this table: the backup id from last
 restore (505). We should only see the complete progress 
 statement because all others were deleted while restore was

=== modified file 'mysql-test/suite/backup/r/backup_no_be.result'
--- a/mysql-test/suite/backup/r/backup_no_be.result	2008-10-30 10:41:48 +0000
+++ b/mysql-test/suite/backup/r/backup_no_be.result	2008-11-17 09:57:51 +0000
@@ -32,7 +32,7 @@ WHERE command LIKE 'BACKUP DATABASE db1 
 SELECT drivers FROM mysql.backup_history WHERE backup_id=@id;
 drivers
 Default
-RESTORE FROM 'db1.bak';
+RESTORE FROM 'db1.bak' OVERWRITE;
 backup_id
 #
 SHOW TABLES IN db1;

=== modified file 'mysql-test/suite/backup/r/backup_no_data.result'
--- a/mysql-test/suite/backup/r/backup_no_data.result	2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/r/backup_no_data.result	2008-11-20 14:07:23 +0000
@@ -15,7 +15,7 @@ Database
 information_schema
 mysql
 test
-RESTORE FROM 'all.bak';
+RESTORE FROM 'all.bak' OVERWRITE;
 backup_id
 #
 SHOW DATABASES;
@@ -38,7 +38,7 @@ mysql
 test
 SHOW TABLES IN empty_db;
 Tables_in_empty_db
-RESTORE FROM 'all.bak';
+RESTORE FROM 'all.bak' OVERWRITE;
 backup_id
 #
 SHOW DATABASES;
@@ -66,7 +66,7 @@ empty_db
 mysql
 other_db
 test
-RESTORE FROM 'empty_db.bak';
+RESTORE FROM 'empty_db.bak' OVERWRITE;
 backup_id
 #
 USE empty_db;

=== modified file 'mysql-test/suite/backup/r/backup_nodata_driver.result'
--- a/mysql-test/suite/backup/r/backup_nodata_driver.result	2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/r/backup_nodata_driver.result	2008-11-21 15:02:34 +0000
@@ -1,7 +1,10 @@
+INSTALL PLUGIN example SONAME 'ha_example.so';
 DROP DATABASE IF EXISTS bup_nodata;
 DROP DATABASE IF EXISTS bup_data;
-Creating tables
-CREATE DATABASE bup_nodata;
+#
+# Create a database with tables that can work as
+# base tables for MERGE and FEDERATED.
+#
 CREATE DATABASE bup_data;
 CREATE TABLE bup_data.myisam1 (a int, b char(30)) ENGINE=MYISAM;
 CREATE TABLE bup_data.myisam2 (a int, b char(30)) ENGINE=MYISAM;
@@ -14,6 +17,10 @@ CREATE TABLE bup_data.f1 (
 `name` varchar(32) NOT NULL default ''
     )
 DEFAULT CHARSET=latin1;
+#
+# Create a database with tables from no-data engines.
+#
+CREATE DATABASE bup_nodata;
 CREATE TABLE bup_nodata.merge1 (a int, b char(30))
 ENGINE=MERGE UNION=(bup_data.myisam1, bup_data.myisam2, bup_data.myisam3);
 CREATE TABLE bup_nodata.f1 (
@@ -30,7 +37,9 @@ CREATE TABLE bup_nodata.e1 (
 Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL,
 Vapor_period smallint(4) unsigned DEFAULT '0' NOT NULL
 ) ENGINE=example;
-Inserting data
+#
+# Insert some data.
+#
 INSERT INTO bup_data.myisam1 VALUES (11, 'table 1');
 INSERT INTO bup_data.myisam1 VALUES (12, 'table 1');
 INSERT INTO bup_data.myisam1 VALUES (13, 'table 1');
@@ -45,7 +54,9 @@ INSERT INTO bup_data.f1 (id, name) VALUE
 INSERT INTO bup_data.f1 (id, `group`) VALUES (3, 42);
 INSERT INTO bup_data.f1 (id, `batch`) VALUES (4, 23);
 INSERT INTO bup_data.f1 (id, `qty`) VALUES (5, 1);
-show data
+#
+# Show the data.
+#
 SHOW FULL TABLES FROM bup_data;
 Tables_in_bup_data	Table_type
 f1	BASE TABLE
@@ -80,13 +91,21 @@ SELECT * FROM bup_nodata.b1;
 a	b	c
 SELECT * FROM bup_nodata.e1;
 Period	Vapor_period
+#
+# Backup the bup_data DB, which tables contain data.
+#
 BACKUP DATABASE bup_data TO 'bup_data.bak';
 backup_id
 #
+#
+# Backup the bup_nodata DB, which tables do not contain data.
+#
 BACKUP DATABASE bup_nodata TO 'bup_nodata.bak';
 backup_id
 #
-show data
+#
+# Show the data again. Backup did not modify them.
+#
 SHOW FULL TABLES FROM bup_data;
 Tables_in_bup_data	Table_type
 f1	BASE TABLE
@@ -121,8 +140,15 @@ SELECT * FROM bup_nodata.b1;
 a	b	c
 SELECT * FROM bup_nodata.e1;
 Period	Vapor_period
+#
+# Now drop the bup_data database.
+#
 DROP DATABASE bup_data;
-show data
+#
+# Show that the data have gone.
+# The MERGE and FEDERATED tables have errors since
+# their base tables have been dropped with bup_data.
+#
 SHOW FULL TABLES FROM bup_nodata;
 Tables_in_bup_nodata	Table_type
 b1	BASE TABLE
@@ -130,19 +156,34 @@ e1	BASE TABLE
 f1	BASE TABLE
 merge1	BASE TABLE
 SELECT * FROM bup_nodata.merge1;
-ERROR 42S02: Table 'bup_data.myisam1' doesn't exist
+ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
 SELECT * FROM bup_nodata.f1;
 Got one of the listed errors
 SELECT * FROM bup_nodata.b1;
 a	b	c
 SELECT * FROM bup_nodata.e1;
 Period	Vapor_period
+#
+# Now drop the bup_nodata database too.
+#
 DROP DATABASE bup_nodata;
-Restoring nodata database.
-RESTORE FROM 'bup_nodata.bak';
-backup_id
 #
-show data
+# Now try to restore the bup_nodata database. This fails because
+# restore opens the tables for filling them with data, even when
+# they were empty on backup. 'bup_nodata.bak' does not contain
+# the base tables for the MERGE and FEDERATED tables.
+# NOTE: Since restore fails after restoring the meta data,
+# after creating the tables that is, we have the same
+# situation as before. The tables exist, but the base
+# tables for MERGE and FEDERATED do not exist.
+#
+RESTORE FROM 'bup_nodata.bak' OVERWRITE;
+Got one of the listed errors
+#
+# Show what we have.
+# NOTE: If restore would work as all or nothing,
+# all of the SHOW and SELECT statements in this section would fail.
+#
 SHOW FULL TABLES FROM bup_nodata;
 Tables_in_bup_nodata	Table_type
 b1	BASE TABLE
@@ -150,18 +191,24 @@ e1	BASE TABLE
 f1	BASE TABLE
 merge1	BASE TABLE
 SELECT * FROM bup_nodata.merge1;
-ERROR 42S02: Table 'bup_data.myisam1' doesn't exist
+ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
 SELECT * FROM bup_nodata.f1;
 Got one of the listed errors
 SELECT * FROM bup_nodata.b1;
 a	b	c
 SELECT * FROM bup_nodata.e1;
 Period	Vapor_period
-Restoring data database.
+#
+# Now restore the bup_data database as well.
+#
 RESTORE FROM 'bup_data.bak';
 backup_id
 #
-show data
+#
+# Show that everything is well.
+# NOTE: If restore would work as all or nothing,
+# the bup_nodata tables would not exist here.
+#
 SHOW FULL TABLES FROM bup_data;
 Tables_in_bup_data	Table_type
 f1	BASE TABLE
@@ -196,5 +243,72 @@ SELECT * FROM bup_nodata.b1;
 a	b	c
 SELECT * FROM bup_nodata.e1;
 Period	Vapor_period
+#
+# Now restore the bup_nodata database and see if it is the same
+# as above. Note that this step would not be required here
+# because all bup_nodata tables have no data and were created
+# by the failed restore. Anyway, the correct approach is to do a
+# succeeding restore before assuming that everything exists again.
+#
+RESTORE FROM 'bup_nodata.bak' OVERWRITE;
+backup_id
+#
+#
+# Show that everything is well.
+#
+SHOW FULL TABLES FROM bup_nodata;
+Tables_in_bup_nodata	Table_type
+b1	BASE TABLE
+e1	BASE TABLE
+f1	BASE TABLE
+merge1	BASE TABLE
+SELECT * FROM bup_nodata.merge1;
+a	b
+11	table 1
+12	table 1
+13	table 1
+21	table 2
+22	table 2
+23	table 2
+31	table 3
+32	table 3
+33	table 3
+SELECT * FROM bup_nodata.f1;
+id	group	batch	qty	name
+1	0	0	0	foo
+2	0	0	0	fee
+3	42	0	0	
+4	0	23	0	
+5	0	0	1	
+SELECT * FROM bup_nodata.b1;
+a	b	c
+SELECT * FROM bup_nodata.e1;
+Period	Vapor_period
+#
+# Now drop the bup_data database with the base tables again.
+#
 DROP DATABASE bup_data;
+#
+# Show that the data have gone.
+# The MERGE and FEDERATED tables have errors since
+# their base tables have been dropped with bup_data.
+#
+SHOW FULL TABLES FROM bup_nodata;
+Tables_in_bup_nodata	Table_type
+b1	BASE TABLE
+e1	BASE TABLE
+f1	BASE TABLE
+merge1	BASE TABLE
+SELECT * FROM bup_nodata.merge1;
+ERROR HY000: Unable to open underlying table which is differently defined or of non-MyISAM type or doesn't exist
+SELECT * FROM bup_nodata.f1;
+Got one of the listed errors
+SELECT * FROM bup_nodata.b1;
+a	b	c
+SELECT * FROM bup_nodata.e1;
+Period	Vapor_period
+#
+# Cleanup.
+#
 DROP DATABASE bup_nodata;
+UNINSTALL PLUGIN example;

=== modified file 'mysql-test/suite/backup/r/backup_security.result'
--- a/mysql-test/suite/backup/r/backup_security.result	2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/r/backup_security.result	2008-11-17 09:57:51 +0000
@@ -49,7 +49,7 @@ BACKUP DATABASE backup_test to 'bup_with
 backup_id
 #
 no_rights: Attempting restore. Should succeed
-RESTORE FROM 'bup_with_rights.bak';
+RESTORE FROM 'bup_with_rights.bak' OVERWRITE;
 backup_id
 #
 SELECT * FROM backup_test.t1;
@@ -62,7 +62,7 @@ a
 06 Test #1 - super privilege
 07 Test #1 - super privilege
 default: Do restore to ensure it still works with default test user.
-RESTORE FROM 'backup_test_orig.bak';
+RESTORE FROM 'backup_test_orig.bak' OVERWRITE;
 backup_id
 #
 SELECT * FROM backup_test.t1;

=== modified file 'mysql-test/suite/backup/r/backup_snapshot.result'
--- a/mysql-test/suite/backup/r/backup_snapshot.result	2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/r/backup_snapshot.result	2008-11-17 09:57:51 +0000
@@ -60,7 +60,7 @@ backup_id
 con1: Dropping the database
 DROP TABLE bup_snapshot.t1;
 con1: Restoring the database
-RESTORE FROM "bup_snapshot.bak";
+RESTORE FROM "bup_snapshot.bak" OVERWRITE;
 backup_id
 #
 con1: Showing the data (no new data should be here).
@@ -106,7 +106,7 @@ backup_id
 con1: Dropping the database
 DROP TABLE bup_snapshot.t1;
 con1: Restoring the database
-RESTORE FROM "bup_snapshot.bak";
+RESTORE FROM "bup_snapshot.bak" OVERWRITE;
 backup_id
 #
 con1: Showing the data (no new data should be here).

=== modified file 'mysql-test/suite/backup/r/backup_timeout.result'
--- a/mysql-test/suite/backup/r/backup_timeout.result	2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/r/backup_timeout.result	2008-11-19 22:01:28 +0000
@@ -71,3 +71,4 @@ SHOW VARIABLES LIKE 'backup_wait%';
 Variable_name	Value
 backup_wait_timeout	50
 DROP DATABASE bup_ddl_blocker;
+SET DEBUG_SYNC= 'reset';

=== added file 'mysql-test/suite/backup/r/backup_vp_nontx.result'
--- a/mysql-test/suite/backup/r/backup_vp_nontx.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/backup/r/backup_vp_nontx.result	2008-11-20 09:49:34 +0000
@@ -0,0 +1,115 @@
+SET DEBUG_SYNC= 'RESET';
+DROP DATABASE IF EXISTS bup_vp;
+CREATE DATABASE bup_vp;
+
+Starting Test
+
+con_bup: Creating tables
+CREATE TABLE bup_vp.t1 (col_a CHAR(40)) ENGINE=MEMORY;
+con_bup: Loading data
+con_bup: Scenario a) - commited before backup
+INSERT INTO bup_vp.t1 VALUES ("01 Some data to test");
+INSERT INTO bup_vp.t1 VALUES ("02 Some data to test");
+INSERT INTO bup_vp.t1 VALUES ("03 Some data to test");
+INSERT INTO bup_vp.t1 VALUES ("04 Some data to test");
+INSERT INTO bup_vp.t1 VALUES ("05 Some data to test");
+
+con_bup: Show the data before we start backup
+SELECT * FROM bup_vp.t1;
+col_a
+01 Some data to test
+02 Some data to test
+03 Some data to test
+04 Some data to test
+05 Some data to test
+
+Scenario (b): Insert in progress blocks CB and is included in backup
+con_ntx1: Start insert and stop it in the middle of processing
+con_ntx1: Make insert stop in the middle of execution
+SET DEBUG_SYNC= 'after_insert_locked_tables SIGNAL insert_started
+                   WAIT_FOR complete_insert';
+INSERT INTO bup_vp.t1 VALUES ("ntx1: 06 Some data to test");
+
+con_bup: Activate synchronization points for BACKUP.
+SET DEBUG_SYNC= 'wait_lock_global_read_lock SIGNAL sync_complete_insert';
+SET DEBUG_SYNC= 'before_backup_data_lock SIGNAL try_insert
+                 WAIT_FOR insert_blocked';
+SET DEBUG_SYNC= 'after_backup_binlog SIGNAL commit_unblocked
+                 WAIT_FOR finish_bup';
+con_bup: Backing up database -- will block with lock
+BACKUP DATABASE bup_vp TO "bup_vp.bak";
+
+SET DEBUG_SYNC= 'now WAIT_FOR sync_complete_insert';
+Backup has been blocked by ongoing insert
+SET DEBUG_SYNC= 'now SIGNAL complete_insert';
+
+con_ntx1: Reap insert
+Check that record has been inserted; Should be 1 record
+SELECT * FROM bup_vp.t1 WHERE col_a like 'ntx1%';
+col_a
+ntx1: 06 Some data to test
+
+con_ntx2: Wait until backup has set CB, then try to insert
+SET DEBUG_SYNC= 'now WAIT_FOR try_insert';
+SET DEBUG_SYNC= 'wait_if_global_read_lock SIGNAL sync_insert_blocked';
+INSERT INTO bup_vp.t1 VALUES ("ntx2: Should NOT be in backup");
+
+SET DEBUG_SYNC= 'now WAIT_FOR sync_insert_blocked';
+Insert in ntx2 is blocked and should not be in t1; Should be 0 records
+SELECT * FROM bup_vp.t1 WHERE col_a like 'ntx2%';
+col_a
+
+SET DEBUG_SYNC= 'now SIGNAL insert_blocked';
+
+con_ntx1: Backup has now released CB. Perform insert
+SET DEBUG_SYNC= 'now WAIT_FOR commit_unblocked';
+INSERT INTO bup_vp.t1 VALUES ("ntx1: Should NOT be in backup");
+SET DEBUG_SYNC= 'now SIGNAL finish_bup';
+
+con_ntx1: Reap backup
+backup_id
+#
+
+con_bup: Showing data after updates and backup
+SELECT * FROM bup_vp.t1;
+col_a
+01 Some data to test
+02 Some data to test
+03 Some data to test
+04 Some data to test
+05 Some data to test
+ntx1: 06 Some data to test
+ntx2: Should NOT be in backup
+ntx1: Should NOT be in backup
+con_bup: Dropping the database
+DROP TABLE bup_vp.t1;
+DROP DATABASE bup_vp;
+con_bup: Restoring the database
+RESTORE FROM "bup_vp.bak";
+backup_id
+#
+
+con_bup: Showing the data after restore
+SELECT * FROM bup_vp.t1;
+col_a
+01 Some data to test
+02 Some data to test
+03 Some data to test
+04 Some data to test
+05 Some data to test
+ntx1: 06 Some data to test
+
+Verifying results:
+
+T1 should have changes from con_ntx1; Should be 1 record
+SELECT * FROM bup_vp.t1 WHERE col_a like 'ntx1%';
+col_a
+ntx1: 06 Some data to test
+
+T1 should not have the changes from con_ntx2; Should be 0 records
+SELECT * FROM bup_vp.t1 WHERE col_a like 'ntx2%';
+col_a
+
+con_bup: Cleanup
+DROP DATABASE bup_vp;
+SET DEBUG_SYNC= 'RESET';

=== added file 'mysql-test/suite/backup/r/backup_vp_tx.result'
--- a/mysql-test/suite/backup/r/backup_vp_tx.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/backup/r/backup_vp_tx.result	2008-11-20 09:49:34 +0000
@@ -0,0 +1,203 @@
+SET DEBUG_SYNC= 'RESET';
+DROP DATABASE IF EXISTS bup_vp;
+CREATE DATABASE bup_vp;
+
+Starting Test
+
+con_bup: Creating tables
+CREATE TABLE bup_vp.t1 (col_a CHAR(40)) ENGINE=INNODB;
+CREATE TABLE bup_vp.t2 (col_a CHAR(40)) ENGINE=INNODB;
+CREATE TABLE bup_vp.t3 (col_a CHAR(40)) ENGINE=INNODB;
+
+con_bup: Loading data
+con_bup: Scenario a) - commited before backup
+INSERT INTO bup_vp.t1 VALUES ("01 Some data to test");
+INSERT INTO bup_vp.t1 VALUES ("02 Some data to test");
+INSERT INTO bup_vp.t1 VALUES ("03 Some data to test");
+INSERT INTO bup_vp.t1 VALUES ("04 Some data to test");
+INSERT INTO bup_vp.t1 VALUES ("05 Some data to test");
+INSERT INTO bup_vp.t2 VALUES ("01 Some data to test");
+INSERT INTO bup_vp.t2 VALUES ("02 Some data to test");
+INSERT INTO bup_vp.t2 VALUES ("03 Some data to test");
+INSERT INTO bup_vp.t2 VALUES ("04 Some data to test");
+INSERT INTO bup_vp.t2 VALUES ("05 Some data to test");
+INSERT INTO bup_vp.t3 VALUES ("01 Some data to test");
+INSERT INTO bup_vp.t3 VALUES ("02 Some data to test");
+INSERT INTO bup_vp.t3 VALUES ("03 Some data to test");
+INSERT INTO bup_vp.t3 VALUES ("04 Some data to test");
+INSERT INTO bup_vp.t3 VALUES ("05 Some data to test");
+
+con_bup: Show the data before we start backup
+SELECT * FROM bup_vp.t1;
+col_a
+01 Some data to test
+02 Some data to test
+03 Some data to test
+04 Some data to test
+05 Some data to test
+SELECT * FROM bup_vp.t2;
+col_a
+01 Some data to test
+02 Some data to test
+03 Some data to test
+04 Some data to test
+05 Some data to test
+SELECT * FROM bup_vp.t3;
+col_a
+01 Some data to test
+02 Some data to test
+03 Some data to test
+04 Some data to test
+05 Some data to test
+
+Scenario d) - commit after VP; tx not included in backup
+con_tx3: Start transaction but do not commit
+BEGIN;
+INSERT INTO bup_vp.t3 VALUES ("tx3: 06 Should NOT be in backup");
+
+Scenario b) - Commit in progress blocks CB; tx is included in backup
+con_tx1: Get a transaction going and stop in the middle of commit
+BEGIN;
+INSERT INTO bup_vp.t1 VALUES ("tx1: 06 Some data to test");
+con_tx1: Make commit stop in the middle of execution
+SET DEBUG_SYNC= 'within_ha_commit_trans SIGNAL commit_started
+                       WAIT_FOR complete_commit';
+COMMIT;
+
+Scenario c) - commit blocked by CB; tx not included in backup
+con_tx2: Wait until tx1 has started
+SET DEBUG_SYNC= 'now WAIT_FOR commit_started';
+con_tx2: Start transaction but do not commit
+BEGIN;
+INSERT INTO bup_vp.t2 VALUES ("tx2: 06 Should NOT be in backup");
+
+con_bup: Activate synchronization points for BACKUP.
+SET DEBUG_SYNC= 'wait_lock_global_read_lock SIGNAL sync_complete_commit';
+SET DEBUG_SYNC= 'before_backup_data_lock SIGNAL try_commit 
+                 WAIT_FOR commit_blocked';
+SET DEBUG_SYNC= 'after_backup_binlog SIGNAL commit_unblocked
+                 WAIT_FOR finish_bup';
+con_bup: Backing up database -- will block with lock
+BACKUP DATABASE bup_vp TO "bup_vp.bak";
+
+SET DEBUG_SYNC= 'now WAIT_FOR sync_complete_commit';
+Backup has been blocked by ongoing commit
+Check that con_tx1 has not committed; Should be 0 records
+SELECT * FROM bup_vp.t1 WHERE col_a like 'tx1%';
+col_a
+
+SET DEBUG_SYNC= 'now SIGNAL complete_commit';
+
+con_tx1: Reap commit
+Check that con_tx1 has committed; Should be 1 record
+SELECT * FROM bup_vp.t1 WHERE col_a like 'tx1%';
+col_a
+tx1: 06 Some data to test
+
+
+con_tx2: Commit request will be blocked by CB
+SET DEBUG_SYNC= 'now WAIT_FOR try_commit';
+SET DEBUG_SYNC= 'wait_if_global_read_lock SIGNAL sync_commit_blocked';
+COMMIT;
+
+SET DEBUG_SYNC= 'now WAIT_FOR sync_commit_blocked';
+Check that con_tx2 has not committed; Should be 0 records
+SELECT * FROM bup_vp.t2 WHERE col_a like 'tx2%';
+col_a
+
+SET DEBUG_SYNC= 'now SIGNAL commit_blocked';
+
+con_bup: Reap commit
+con_tx2: Backup has now released CB.
+Check that con_tx2 has committed; Should be 1 record
+SELECT * FROM bup_vp.t2 WHERE col_a like 'tx2%';
+col_a
+tx2: 06 Should NOT be in backup
+
+
+con_tx3: Backup has now released CB. Commit transaction
+SET DEBUG_SYNC= 'now WAIT_FOR commit_unblocked';
+COMMIT;
+SET DEBUG_SYNC= 'now SIGNAL finish_bup';
+
+con_bup: Reap backup
+backup_id
+#
+
+con_bup: Showing data after updates and backup
+SELECT * FROM bup_vp.t1;
+col_a
+01 Some data to test
+02 Some data to test
+03 Some data to test
+04 Some data to test
+05 Some data to test
+tx1: 06 Some data to test
+SELECT * FROM bup_vp.t2;
+col_a
+01 Some data to test
+02 Some data to test
+03 Some data to test
+04 Some data to test
+05 Some data to test
+tx2: 06 Should NOT be in backup
+SELECT * FROM bup_vp.t3;
+col_a
+01 Some data to test
+02 Some data to test
+03 Some data to test
+04 Some data to test
+05 Some data to test
+tx3: 06 Should NOT be in backup
+con_bup: Dropping the database
+DROP TABLE bup_vp.t1;
+DROP TABLE bup_vp.t2;
+DROP TABLE bup_vp.t3;
+DROP DATABASE bup_vp;
+con_bup: Restoring the database
+RESTORE FROM "bup_vp.bak";
+backup_id
+#
+
+con_bup: Showing the data after restore (tx2 and tx3 should not be there)
+SELECT * FROM bup_vp.t1;
+col_a
+01 Some data to test
+02 Some data to test
+03 Some data to test
+04 Some data to test
+05 Some data to test
+tx1: 06 Some data to test
+SELECT * FROM bup_vp.t2;
+col_a
+01 Some data to test
+02 Some data to test
+03 Some data to test
+04 Some data to test
+05 Some data to test
+SELECT * FROM bup_vp.t3;
+col_a
+01 Some data to test
+02 Some data to test
+03 Some data to test
+04 Some data to test
+05 Some data to test
+
+Verifying results:
+
+T1 should have changes from con_tx1; Should be 1 record
+SELECT * FROM bup_vp.t1 WHERE col_a like 'tx1%';
+col_a
+tx1: 06 Some data to test
+
+T2 should not have the changes from con_tx2; Should be 0 records
+SELECT * FROM bup_vp.t2 WHERE col_a like 'tx2%';
+col_a
+
+T3 should not have the changes from con_tx3; Should be 0 records
+SELECT * FROM bup_vp.t3 WHERE col_a like 'tx3%';
+col_a
+
+con_bup: Cleanup
+DROP DATABASE bup_vp;
+SET DEBUG_SYNC= 'RESET';

=== modified file 'mysql-test/suite/backup/t/backup.test'
--- a/mysql-test/suite/backup/t/backup.test	2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/t/backup.test	2008-11-17 09:57:51 +0000
@@ -434,7 +434,7 @@ SELECT * FROM bup_delete.me;
 
 --echo do restore
 --replace_column 1 #
-RESTORE FROM 'bup_delete.bak';
+RESTORE FROM 'bup_delete.bak' OVERWRITE;
 
 --echo show the data
 SELECT * FROM bup_delete.me;
@@ -472,7 +472,7 @@ BACKUP DATABASE bup_default TO 'bup_defa
 
 --echo Restore the database.
 --replace_column 1 #
-RESTORE FROM 'bup_default_timestamp.bak';
+RESTORE FROM 'bup_default_timestamp.bak' OVERWRITE;
 
 --echo Show data after restore (timestamp should be same as above).
 SELECT * FROM bup_default.time_t1;

=== modified file 'mysql-test/suite/backup/t/backup_backupdir.test'
--- a/mysql-test/suite/backup/t/backup_backupdir.test	2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/t/backup_backupdir.test	2008-11-17 09:57:51 +0000
@@ -41,7 +41,7 @@ BACKUP DATABASE bup_backupdir TO 'bup_ba
 
 --echo Perform restore
 --replace_column 1 #
-RESTORE FROM 'bup_backupdir1.bak';
+RESTORE FROM 'bup_backupdir1.bak' OVERWRITE;
 
 --echo Now do the backup and restore by specifying a path.
 
@@ -54,7 +54,7 @@ BACKUP DATABASE bup_backupdir TO '../bup
 
 --echo Perform restore
 --replace_column 1 #
-RESTORE FROM '../bup_backupdir2.bak';
+RESTORE FROM '../bup_backupdir2.bak' OVERWRITE;
 
 --echo Perform backup
 --replace_column 1 #

=== modified file 'mysql-test/suite/backup/t/backup_commit_backup.test'
--- a/mysql-test/suite/backup/t/backup_commit_backup.test	2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/t/backup_commit_backup.test	2008-11-17 09:57:51 +0000
@@ -216,7 +216,7 @@ SELECT release_lock("sync");
 echo Checking contents of the backup image;
 
 replace_column 1 #;
-RESTORE FROM 'db1.bak';
+RESTORE FROM 'db1.bak' OVERWRITE;
 
 SELECT * FROM db1.t1;
 SELECT * FROM db1.t2;

=== removed file 'mysql-test/suite/backup/t/backup_commit_blocker.test'
--- a/mysql-test/suite/backup/t/backup_commit_blocker.test	2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/t/backup_commit_blocker.test	1970-01-01 00:00:00 +0000
@@ -1,800 +0,0 @@
-#
-# This test is for the commit blocker
-# The goals of the test should be to ensure the following assumptions for
-# the behaviour of the commit blocker hold true.
-#
-# a) transactions in progress are not committed until after the backup
-# b) transactions that are committing are allowed to commit
-# c) transactions that have not started are allowed to start but do not commit
-# d) non-transaction statements in progress are allowed to finish
-# e) non-transaction statements that have not started are blocked
-#
-# The results of the backup should show (based on statements above):
-#
-# a) Test result for this assumption: Not included in backup
-# b) Test result for this assumption: Included in backup
-# c) Test result for this assumption: Not included in backup
-# d) Test result for this assumption: Included in backup
-# e) Test result for this assumption: Not included in backup
-#
-# Note: the statements above assume statements that change data.
-#
-# The test shall run three sets of data manipulation statements. 
-#
-# 1) transactional statments only
-# 2) non-transactional statements only
-# 3) mix of both transactional and non-transactional statements
-#
-# TODO : Add a native driver to the test when one becomes available
-#
-
---source include/have_innodb.inc
---source include/have_debug_sync.inc
---source include/not_embedded.inc
-
---disable_warnings
-SET DEBUG_SYNC= 'RESET';
-DROP DATABASE IF EXISTS bup_commit_blocker;
---error 0,1
---remove_file $MYSQLTEST_VARDIR/master-data/bup_commit_blocker.bak;
---enable_warnings
-
-CREATE DATABASE bup_commit_blocker;
-
-#
-# Connections used in this test
-#
-# con1 - used to create data, load data, and run the backup 
-# con2 - used for setting up transactions in progress
-# con3 - used for setting up transactions in commit
-# con4 - used for setting up transactions about to start
-# con5 - used to show status
-# con6 - used for setting up non-transactions in progress
-# con7 - used for setting up non-transactions about to start
-#
-
-connect (con1,localhost,root,,);
-connect (con2,localhost,root,,);
-connect (con3,localhost,root,,);
-connect (con4,localhost,root,,);
-connect (con5,localhost,root,,);
-connect (con6,localhost,root,,);
-connect (con7,localhost,root,,);
-
-#
-# Note: Originally we used SELECT ... FROM INFORMATION_SCHEMA.PROCESSLIST; to show status of 
-# the various connections participating in the test. But INFORMATION_SCHEMA.PROCESSLIST implementation
-# proved to be not relaiable. From time to time (nondeterminisrtically) test hanged on these SELECTs.
-# As showing the status is not essential for the test (we test correctness by checking the contents of
-# the created backup image), the selects are commented out now. They can be re-enabled when
-# I_S.PROCESSLIST is in a better shape.
-#
-
-connection con1;
-
-#
-# Test 1 - transactional statements only
-#
-
---echo 
---echo Starting Test 1
---echo 
-
-#
-# Test 1 sequence diagram (not UML)
-#
-#   con1     con2     con3     con4     con5
-#  (setup)    |        |        |        |
-#     |       |        |        |        |
-#     |     BEGIN      |        |        |
-#     |    UPDATE t1   |        |        |
-#     |       |      BEGIN      |        |
-#     |       |     INSERT t2   |        |
-#     |       |     INSERT t2   |        |
-#     |       |        |        |    show status
-#   BACKUP    |        |        |        |
-#     |       |      COMMIT     |        |
-#     |       |        |        |    show status
-#     |       |        |      BEGIN      |
-#     |       |        |        |    show status
-#     |    DELETE t1   |        |        |
-#     |     COMMIT     |        |        |
-#     |       |      <...>      |        |
-#     |       |        |     UPDATE t3   |
-#     |       |        |     COMMIT      |
-#   <...>     |        |        |        |
-# (results)   |        |        |        |
-#
-# Note: The resume of the commands is indicated with <...> and
-#       may occur in any order.
-#
-
-# Create transaction tables and load them with data.
---echo con1: Creating tables
-CREATE TABLE bup_commit_blocker.t1 (col_a CHAR(40)) ENGINE=INNODB;
-CREATE TABLE bup_commit_blocker.t2 (col_a CHAR(40)) ENGINE=INNODB;
-CREATE TABLE bup_commit_blocker.t3 (col_a CHAR(40)) ENGINE=INNODB;
-
---echo con1: Loading data
-INSERT INTO bup_commit_blocker.t1 VALUES ("01 Some data to test");
-INSERT INTO bup_commit_blocker.t1 VALUES ("02 Some data to test");
-INSERT INTO bup_commit_blocker.t1 VALUES ("03 Some data to test");
-INSERT INTO bup_commit_blocker.t1 VALUES ("04 Some data to test");
-INSERT INTO bup_commit_blocker.t1 VALUES ("05 Some data to test");
-
-INSERT INTO bup_commit_blocker.t2 VALUES ("01 Some data to test");
-INSERT INTO bup_commit_blocker.t2 VALUES ("02 Some data to test");
-INSERT INTO bup_commit_blocker.t2 VALUES ("03 Some data to test");
-INSERT INTO bup_commit_blocker.t2 VALUES ("04 Some data to test");
-INSERT INTO bup_commit_blocker.t2 VALUES ("05 Some data to test");
-
-INSERT INTO bup_commit_blocker.t3 VALUES ("01 Some data to test");
-INSERT INTO bup_commit_blocker.t3 VALUES ("02 Some data to test");
-INSERT INTO bup_commit_blocker.t3 VALUES ("03 Some data to test");
-INSERT INTO bup_commit_blocker.t3 VALUES ("04 Some data to test");
-INSERT INTO bup_commit_blocker.t3 VALUES ("05 Some data to test");
-
---echo con1: Show that the new data doesn't exist before backup.
-SELECT * FROM bup_commit_blocker.t1;
-SELECT * FROM bup_commit_blocker.t2;
-SELECT * FROM bup_commit_blocker.t3;
-
-connection con2;
-
---echo con2: Get a transaction going and stop in the middle
---echo Assumption (a): TRX in progress is not included in backup
-BEGIN;
-  UPDATE bup_commit_blocker.t1 SET col_a = "con2: CHANGED" WHERE col_a LIKE '01%';
-
-connection con3;
-
---echo con3: Start a transaction and send commit after lock is taken
---echo Assumption (b): TRX in commit is included in backup
-BEGIN;
-  INSERT INTO bup_commit_blocker.t2 VALUES ("con3: 04 Some data to test");
-  INSERT INTO bup_commit_blocker.t2 VALUES ("con3: 05 Some data to test");
-
-connection con1;
-
-#
-# We must start the backup and allow it to gather the metadata first.
-# We stop (with a sync point) the backup after the metadata but before
-# the commit blocker.
-#
---echo con1: Activate synchronization points for BACKUP.
-# Before blocking commits, pause to show processlist state.
-# Before going to wait for the protection against global read lock to
-# disappear, signal about the wait, so that another thread can continue.
-# When COMMIT finishes, it releases the protection against global read lock,
-# which would allow BACKUP to continue while COMMIT also continues and
-# signals "commit_done". It is important that BACKUP does not run in
-# parallel and send another signal without waiting for the commit_done
-# signal to be processed. So BACKUP itself has to wait for that signal
-# after awaking and taking the global read lock. Only then BACKUP
-# can proceed and send a signal telling that it took the global read
-# lock. Unfortunately DEBUG_SYNC does not allow a sync point to emit a
-# signal after a wait_for action. So we need to send the signal in a later
-# sync point. For this test it is not important where this signal is sent,
-# as long as it is sent while BACKUP holds the global read lock.
-# Here we do it "before_backup_unblock_commit", where we have to
-# synchronize anyway.
-SET DEBUG_SYNC= 'before_commit_block SIGNAL bup_commit_block
-                 WAIT_FOR bup_go_read_lock';
-SET DEBUG_SYNC= 'wait_lock_global_read_lock SIGNAL bup_read_lock';
-SET DEBUG_SYNC= 'before_backup_data_lock WAIT_FOR commit_done';
-SET DEBUG_SYNC= 'before_backup_unblock_commit SIGNAL bup_read_locked
-                 WAIT_FOR finish';
---echo con1: Backing up database -- will block with lock
-send BACKUP DATABASE bup_commit_blocker TO "bup_commit_blocker.bak";
-
-connection con5;
-
---echo con5: Wait for BACKUP to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR bup_commit_block';
-#SELECT state, info FROM
-#INFORMATION_SCHEMA.PROCESSLIST
-#WHERE info LIKE "BACKUP DATABASE%";
-
-connection con3;
-
---echo con3: Activate synchronization points for COMMIT.
-SET DEBUG_SYNC= 'within_ha_commit_trans SIGNAL commit_read_locked
-                 WAIT_FOR commit_go_done';
-SET DEBUG_SYNC= 'after_commit SIGNAL commit_done WAIT_FOR finish';
---echo con3: Starting commit -- will block on sync point
-send COMMIT;
-
-connection con5;
-
---echo con5: Wait for COMMIT to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR commit_read_locked';
-#SELECT state, info FROM
-#INFORMATION_SCHEMA.PROCESSLIST
-#WHERE info LIKE "COMMIT%";
-
---echo con5: Let BACKUP run until the next sync point.
-SET DEBUG_SYNC= 'now SIGNAL bup_go_read_lock WAIT_FOR bup_read_lock';
-#SELECT state, info FROM
-#INFORMATION_SCHEMA.PROCESSLIST
-#WHERE info LIKE "BACKUP DATABASE%";
-
---echo con5: Let COMMIT continue until end of statement.
---echo con5: The completed COMMIT implicitly wakes BACKUP.
---echo con5: So wait for BACKUP to reach the next synchronization point.
-SET DEBUG_SYNC= 'now SIGNAL commit_go_done WAIT_FOR bup_read_locked';
-#SELECT state, info FROM
-#INFORMATION_SCHEMA.PROCESSLIST
-#WHERE info LIKE "COMMIT%";
-#SELECT state, info FROM
-#INFORMATION_SCHEMA.PROCESSLIST
-#WHERE info LIKE "BACKUP DATABASE%";
-
-connection con4;
-
---echo con4: Activate synchronization point for BEGIN.
-SET DEBUG_SYNC= 'before_begin_trans SIGNAL begin_starting
-                 WAIT_FOR finish';
---echo con4: Starting begin -- will block on sync point
---echo Assumption (c): TRX not started is not included in backup
-send BEGIN;
-
-connection con5;
-
---echo con5: Wait for BEGIN to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR begin_starting';
-#SELECT state, info FROM
-#INFORMATION_SCHEMA.PROCESSLIST
-#WHERE info LIKE "BEGIN%";
-
---echo con5: Sending finish signal to wake them all.
-SET DEBUG_SYNC= 'now SIGNAL finish';
-
-# Reconnect to connections and fetch their results.
-
-connection con2;
-
---echo con2: Completing transaction
-  DELETE FROM bup_commit_blocker.t1 WHERE col_a LIKE '02%';
-COMMIT;
-
-connection con3;
-
---echo con3: Fetch COMMIT result
-reap;
-
-connection con4;
-
---echo con4: Fetch BEGIN result and completing transaction
-reap;
-  UPDATE bup_commit_blocker.t3 SET col_a = "con4: 05 CHANGED" WHERE col_a LIKE '05%';
-  UPDATE bup_commit_blocker.t3 SET col_a = "con4: 06 CHANGED" WHERE col_a LIKE '06%';
-COMMIT;
-
-connection con1;
-
---echo con1: Fetch BACKUP result
---replace_column 1 #
-reap;
-
-# Now restore the database and then check to make sure the new rows
-# were not backed up.
-
-# Do selects to show that all changes got applied.
---echo con1: Showing data after updates and backup
-SELECT * FROM bup_commit_blocker.t1;
-SELECT * FROM bup_commit_blocker.t2;
-SELECT * FROM bup_commit_blocker.t3;
-
---echo con1: Dropping the database
-DROP TABLE bup_commit_blocker.t1;
-DROP TABLE bup_commit_blocker.t2;
-DROP TABLE bup_commit_blocker.t3;
-
---echo con1: Restoring the database
---replace_column 1 #
- RESTORE FROM "bup_commit_blocker.bak";
-
---echo con1: Showing the data (no new data should be here).
-SELECT * FROM bup_commit_blocker.t1;
-SELECT * FROM bup_commit_blocker.t2;
-SELECT * FROM bup_commit_blocker.t3;
-
---echo
---echo Verifying test 1 results:
---echo
-
---echo T1 should not have the changes after backup - count(*) = 0
-SELECT count(*) FROM bup_commit_blocker.t1 WHERE col_a like 'con2%';
-
---echo T2 should have the changes after backup - count(*) = 2
-SELECT count(*) FROM bup_commit_blocker.t2 WHERE col_a like 'con3%';
-
---echo T3 should not have the changes after backup - count(*) = 0
-SELECT count(*) FROM bup_commit_blocker.t3 WHERE col_a like 'con4%';
-
---echo con1: Cleanup
-DROP DATABASE bup_commit_blocker;
-
-remove_file $MYSQLTEST_VARDIR/master-data/bup_commit_blocker.bak;
-SET DEBUG_SYNC= 'RESET';
-
-#
-# Test 2 - non-transactional statements only
-#
-
---echo 
---echo Starting Test 2
---echo 
-
-# Ingo: DELETE was disabled before converting the test from
-#       BACKUP_BREAKPOINT to DEBUG_SYNC. I left it disabled
-#       as an attempt to enable it made an infinite loop in
-#       write_table_data() in the loop:
-#    while (sch.prepare_count > 0)
-#    if (sch.step())
-#      goto error;
-#        sch.prepare_count did not change from being 1.
-#        When this is fixed, please remove this comment.
-
-#
-# Test 2 sequence diagram (not UML)
-#
-#   con1     con2     con3     con4     con5     con6       con7
-#  (setup)    |        |        |        |        |          |
-#     |       |        |        |        |        |          |
-#     |       |        |        |        |   #DELETE t4      |
-#     |       |        |        |   #show status  |          |
-#   BACKUP    |        |        |        |        |          |
-#     |       |        |        |    show status  |          |
-#     |       |        |        |        |        |       (results)
-#     |       |        |        |        |        |       UPDATE t5
-#     |       |        |        |    show status  |          |
-#   <...>     |        |        |        |      <...>      <...>
-# (results)   |        |        |        |        |          |
-#
-# Note: The resume of the commands is indicated with <...> and
-#       may occur in any order.
-#
-
-CREATE DATABASE bup_commit_blocker;
-
-# Create a non-transaction table and load it with data.
---echo con1: Creating tables
-#CREATE TABLE bup_commit_blocker.t4 (col_a int) ENGINE=MEMORY;
-CREATE TABLE bup_commit_blocker.t5 (col_a int) ENGINE=MEMORY;
-
---echo con1: Loading data
-#INSERT INTO bup_commit_blocker.t4 VALUES (1), (2), (3), (4), (5);
-INSERT INTO bup_commit_blocker.t5 VALUES (10), (20), (30), (40), (50);
-
---echo con1: Show that the new data doesn't exist before backup.
-#SELECT * FROM bup_commit_blocker.t4;
-SELECT * FROM bup_commit_blocker.t5;
-
-#connection con6;
-#
-#--echo con6: Activate synchronization point for DELETE.
-#SET DEBUG_SYNC= 'at_delete_end SIGNAL del_at_end WAIT_FOR finish';
-#--echo con6: Starting non-trx in progress -- will block with lock
-#--echo Assumption (d): non-TRX in progress is included in backup
-#send DELETE FROM bup_commit_blocker.t4 WHERE col_a <= 2;
-#
-#connection con5;
-#
-#--echo con5: Wait for DELETE to reach its synchronization point.
-#SET DEBUG_SYNC= 'now WAIT_FOR del_at_end';
-#SELECT state, info FROM
-#INFORMATION_SCHEMA.PROCESSLIST
-#WHERE info LIKE "DELETE%";
-
-connection con1;
-
---echo con1: Activate synchronization point for BACKUP.
-SET DEBUG_SYNC= 'before_backup_data_unlock SIGNAL bup_data_unlock
-                 WAIT_FOR finish';
---echo con1: Backing up database -- will block with lock
-send BACKUP DATABASE bup_commit_blocker TO "bup_commit_blocker.bak";
-
-connection con5;
-
---echo con5: Wait for BACKUP to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR bup_data_unlock';
-#SELECT state, info FROM
-#INFORMATION_SCHEMA.PROCESSLIST
-#WHERE info LIKE "BACKUP DATABASE%";
-
-connection con7;
-
---echo con7: Show that the statement in progress has executed before backup.
-#SELECT * FROM bup_commit_blocker.t4;
-SELECT * FROM bup_commit_blocker.t5;
-
---echo con7: Activate synchronization point for UPDATE.
-SET DEBUG_SYNC= 'wait_if_global_read_lock SIGNAL upd_read_lock';
---echo con7: Starting non-trx about to start
---echo Assumption (e): non-TRX not started is not included in backup
-send UPDATE bup_commit_blocker.t5 SET col_a = 333 WHERE col_a = 30;
-
-connection con5;
-
---echo con5: Wait for UPDATE to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR upd_read_lock';
-#SELECT state, info FROM
-#INFORMATION_SCHEMA.PROCESSLIST
-#WHERE info LIKE "UPDATE%";
-
---echo con5: Sending finish signal to wake them all.
-SET DEBUG_SYNC= 'now SIGNAL finish';
-
-# Reconnect to con6 and con7 and fetch their results.
-
-#connection con6;
-#
-#--echo con6: Fetch DELETE result
-#reap;
-
-connection con7;
-
---echo con7: Fetch UPDATE result
-reap;
-
-connection con1;
-
---echo con1: Fetch BACKUP result
---replace_column 1 #
-reap;
-
-# Now restore the database and then check to make sure the new rows
-# were not backed up.
-
-# Do selects to show that all changes got applied.
---echo con1: Showing data after updates and backup
-#SELECT * FROM bup_commit_blocker.t4;
-SELECT * FROM bup_commit_blocker.t5;
-
---echo con1: Dropping the database
-#DROP TABLE bup_commit_blocker.t4;
-DROP TABLE bup_commit_blocker.t5;
-
---echo con1: Restoring the database
---replace_column 1 #
- RESTORE FROM "bup_commit_blocker.bak";
-
---echo con1: Showing the data (no new data should be here).
-#SELECT * FROM bup_commit_blocker.t4;
-SELECT * FROM bup_commit_blocker.t5;
-
---echo
---echo Verifying test 2 results:
---echo
-
-#--echo T4 should have the changes after backup - count(*) = 3
-#SELECT count(*) FROM bup_commit_blocker.t4 WHERE col_a > 2;
-
---echo T5 should not have the changes after backup - count(*) = 0
-SELECT count(*) FROM bup_commit_blocker.t5 WHERE col_a = 333;
-
---echo con1: Cleanup
-DROP DATABASE bup_commit_blocker;
-
-remove_file $MYSQLTEST_VARDIR/master-data/bup_commit_blocker.bak;
-SET DEBUG_SYNC= 'RESET';
-
-#
-# Test 3 - mix of both transactional and non-transactional statements
-#
-
---echo 
---echo Starting Test 3
---echo 
-
-#
-# Test 3 sequence diagram (not UML)
-#
-#   con1     con2     con3     con4     con5     con6       con7
-#  (setup)    |        |        |        |        |          |
-#     |       |        |        |        |        |          |
-#     |     BEGIN      |        |        |        |          |
-#     |    UPDATE t1   |        |        |        |          |
-#     |       |      BEGIN      |        |        |          |
-#     |       |     INSERT t2   |        |        |          |
-#     |       |     INSERT t2   |        |        |          |
-#   BACKUP    |        |        |        |        |          |
-#     |       |        |        |        |    #INSERT t4     |
-#     |       |        |        |    show status  |          |
-#     |       |      COMMIT     |        |        |          |
-#     |       |        |        |    show status  |          |
-#     |       |        |      BEGIN      |        |          |
-#     |       |        |        |    show status  |          |
-#     |       |        |        |        |        |      (results)
-#     |       |        |        |        |        |       DELETE t5
-#     |       |        |        |    show status  |          |
-#     |       |        |        |     wake all    |          |
-#     |    DELETE t1   |        |        |        |          |
-#     |     COMMIT     |        |        |        |          |
-#     |       |      <...>      |        |        |          |
-#     |       |        |     UPDATE t3   |        |          |
-#     |       |        |     UPDATE t3   |        |          |
-#     |       |        |     COMMIT      |        |          |
-#   <...>     |        |        |        |      <...>      <...>
-# (results)   |        |        |        |        |          |
-#
-# Note: The resume of the commands is indicated with <...> and
-#       may occur in any order.
-#
-
-CREATE DATABASE bup_commit_blocker;
-
-# Create tables and load them with data.
---echo con1: Creating tables
-CREATE TABLE bup_commit_blocker.t1 (col_a CHAR(40)) ENGINE=INNODB;
-CREATE TABLE bup_commit_blocker.t2 (col_a CHAR(40)) ENGINE=INNODB;
-CREATE TABLE bup_commit_blocker.t3 (col_a CHAR(40)) ENGINE=INNODB;
-#CREATE TABLE bup_commit_blocker.t4 (col_a int) ENGINE=MEMORY;
-CREATE TABLE bup_commit_blocker.t5 (col_a int) ENGINE=MEMORY;
-
---echo con1: Loading data
-INSERT INTO bup_commit_blocker.t1 VALUES ("01 Some data to test");
-INSERT INTO bup_commit_blocker.t1 VALUES ("02 Some data to test");
-INSERT INTO bup_commit_blocker.t1 VALUES ("03 Some data to test");
-INSERT INTO bup_commit_blocker.t1 VALUES ("04 Some data to test");
-INSERT INTO bup_commit_blocker.t1 VALUES ("05 Some data to test");
-
-INSERT INTO bup_commit_blocker.t2 VALUES ("01 Some data to test");
-INSERT INTO bup_commit_blocker.t2 VALUES ("02 Some data to test");
-INSERT INTO bup_commit_blocker.t2 VALUES ("03 Some data to test");
-INSERT INTO bup_commit_blocker.t2 VALUES ("04 Some data to test");
-INSERT INTO bup_commit_blocker.t2 VALUES ("05 Some data to test");
-
-INSERT INTO bup_commit_blocker.t3 VALUES ("01 Some data to test");
-INSERT INTO bup_commit_blocker.t3 VALUES ("02 Some data to test");
-INSERT INTO bup_commit_blocker.t3 VALUES ("03 Some data to test");
-INSERT INTO bup_commit_blocker.t3 VALUES ("04 Some data to test");
-INSERT INTO bup_commit_blocker.t3 VALUES ("05 Some data to test");
-
-#INSERT INTO bup_commit_blocker.t4 VALUES (1), (2), (3), (4), (5);
-INSERT INTO bup_commit_blocker.t5 VALUES (10), (20), (30), (40), (50);
-
---echo con1: Show that the new data doesn't exist before backup.
-SELECT * FROM bup_commit_blocker.t1;
-SELECT * FROM bup_commit_blocker.t2;
-SELECT * FROM bup_commit_blocker.t3;
-#SELECT * FROM bup_commit_blocker.t4;
-SELECT * FROM bup_commit_blocker.t5;
-
-connection con2;
-
---echo con2: Get a transaction going and stop in the middle
---echo Assumption (a): TRX in progress is not included in backup
-BEGIN;
-  UPDATE bup_commit_blocker.t1 SET col_a = "con2: CHANGED" WHERE col_a LIKE '01%';
-
-connection con3;
-
---echo con3: Start a transaction and send commit after lock is taken
---echo Assumption (b): TRX in commit is included in backup
-BEGIN;
-  INSERT INTO bup_commit_blocker.t2 VALUES ("con3: 04 Some data to test");
-  INSERT INTO bup_commit_blocker.t2 VALUES ("con3: 05 Some data to test");
-
-connection con1;
-
-#
-# We must start the backup and allow it to gather the metadata first.
-# We stop (with a sync point) the backup after the metadata but before
-# the commit blocker.
-#
---echo con1: Activate synchronization points for BACKUP.
-# Before blocking commits, pause to show processlist state.
-# Before going to wait for the protection against global read lock to
-# disappear, signal about the wait, so that another thread can continue.
-# When COMMIT finishes, it releases the protection against global read lock,
-# which would allow BACKUP to continue while COMMIT also continues and
-# signals "commit_done". It is important that BACKUP does not run in
-# parallel and send another signal without waiting for the commit_done
-# signal to be processed. So BACKUP itself has to wait for that signal
-# after awaking and taking the global read lock. Only then BACKUP
-# can proceed and send a signal telling that it took the global read
-# lock. Unfortunately DEBUG_SYNC does not allow a sync point to emit a
-# signal after a wait_for action. So we need to send the signal in a later
-# sync point. For this test it is not important where this signal is sent,
-# as long as it is sent while BACKUP holds the global read lock.
-# Here we do it "before_backup_unblock_commit", where we have to
-# synchronize anyway.
-SET DEBUG_SYNC= 'before_commit_block SIGNAL bup_commit_block
-                 WAIT_FOR bup_go_read_lock';
-SET DEBUG_SYNC= 'wait_lock_global_read_lock SIGNAL bup_read_lock';
-SET DEBUG_SYNC= 'before_backup_data_lock WAIT_FOR commit_done';
-SET DEBUG_SYNC= 'before_backup_unblock_commit SIGNAL bup_read_locked
-                 WAIT_FOR finish';
---echo con1: Backing up database -- will block with lock
-send BACKUP DATABASE bup_commit_blocker TO "bup_commit_blocker.bak";
-
-#connection con6;
-#
-#--echo con6: Activate synchronization point for INSERT.
-#SET DEBUG_SYNC= 'after_insert_locked_tables SIGNAL insert_table_locked
-#                 WAIT_FOR finish';
-#--echo con6: Starting non-trx in progress -- will block
-#--echo Assumption (d): non-TRX in progress is included in backup
-#send INSERT INTO bup_commit_blocker.t4 VALUES (31), (32), (33);
-
-connection con5;
-
---echo con5: Wait for BACKUP to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR bup_commit_block';
-#SELECT state, info FROM
-#INFORMATION_SCHEMA.PROCESSLIST
-#WHERE info LIKE "BACKUP DATABASE%";
-
-#--echo con5: Wait for INSERT to reach its synchronization point.
-#SET DEBUG_SYNC= 'now WAIT_FOR insert_table_locked';
-#SELECT state, info FROM
-#INFORMATION_SCHEMA.PROCESSLIST
-#WHERE info LIKE "BACKUP DATABASE%";
-
-connection con3;
-
---echo con3: Activate synchronization points for COMMIT.
-SET DEBUG_SYNC= 'within_ha_commit_trans SIGNAL commit_read_locked
-                 WAIT_FOR commit_go_done';
-SET DEBUG_SYNC= 'after_commit SIGNAL commit_done WAIT_FOR finish';
---echo con3: Starting commit -- will block on sync point
-send COMMIT;
-
-connection con5;
-
---echo con5: Wait for COMMIT to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR commit_read_locked';
-#SELECT state, info FROM
-#INFORMATION_SCHEMA.PROCESSLIST
-#WHERE info LIKE "COMMIT%";
-
---echo con5: Let BACKUP run until the next sync point.
-SET DEBUG_SYNC= 'now SIGNAL bup_go_read_lock WAIT_FOR bup_read_lock';
-#SELECT state, info FROM
-#INFORMATION_SCHEMA.PROCESSLIST
-#WHERE info LIKE "BACKUP DATABASE%";
-
---echo con5: Let COMMIT continue until the sync point at its end.
---echo con5: The completed COMMIT implicitly wakes BACKUP.
---echo con5: So wait for BACKUP to reach the next synchronization point.
-SET DEBUG_SYNC= 'now SIGNAL commit_go_done WAIT_FOR bup_read_locked';
-#SELECT state, info FROM
-#INFORMATION_SCHEMA.PROCESSLIST
-#WHERE info LIKE "COMMIT%";
-#SELECT state, info FROM
-#INFORMATION_SCHEMA.PROCESSLIST
-#WHERE info LIKE "BACKUP DATABASE%";
-
-connection con4;
-
---echo con4: Activate synchronization point for BEGIN.
-SET DEBUG_SYNC= 'before_begin_trans SIGNAL begin_starting
-                 WAIT_FOR finish';
---echo con4: Starting begin -- will block with lock
---echo Assumption (c): TRX not started is not included in backup
-send BEGIN;
-
-connection con5;
-
---echo con5: Wait for BEGIN to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR begin_starting';
-#SELECT state, info FROM
-#INFORMATION_SCHEMA.PROCESSLIST
-#WHERE info LIKE "BEGIN%";
-
-connection con7;
-
---echo con7: Show that the statement in progress has executed before backup.
-#SELECT * FROM bup_commit_blocker.t4;
-SELECT * FROM bup_commit_blocker.t5;
-
---echo con7: Activate synchronization point for DELETE.
-SET DEBUG_SYNC= 'wait_if_global_read_lock SIGNAL del_read_lock';
---echo con7: Starting non-trx about to start -- will block with lock
---echo Assumption (e): non-TRX not started is not included in backup
-send DELETE FROM bup_commit_blocker.t5 WHERE col_a = 50;
-
-connection con5;
-
---echo con5: Wait for DELETE to reach its synchronization point.
-SET DEBUG_SYNC= 'now WAIT_FOR del_read_lock';
-#SELECT state, info FROM
-#INFORMATION_SCHEMA.PROCESSLIST
-#WHERE info LIKE "DELETE%";
-
---echo con5: Sending finish signal to wake them all.
-SET DEBUG_SYNC= 'now SIGNAL finish';
-
-# Reconnect to con2, con3, con4, con6, and con7 and fetch their results.
-
-connection con2;
-
---echo con2: Completing transaction
-  DELETE FROM bup_commit_blocker.t2 WHERE col_a LIKE '02%';
-COMMIT;
-
-connection con3;
-
---echo con3: Fetch COMMIT result
-reap;
-
-connection con4;
-
---echo con4: Fetch BEGIN result and completing transaction
-reap;
-  UPDATE bup_commit_blocker.t3 SET col_a = "con4: 05 CHANGED" WHERE col_a LIKE '05%';
-  UPDATE bup_commit_blocker.t3 SET col_a = "con4: 06 CHANGED" WHERE col_a LIKE '06%';
-COMMIT;
-
-connection con6;
-
-#--echo con6: Fetch INSERT result
-#reap;
-
-connection con7;
-
---echo con7: Fetch DELETE result
-reap;
-
-connection con1;
-
---echo con1: Fetch BACKUP result
---replace_column 1 #
-reap;
-
-# Now restore the database and then check to make sure the new rows
-# were not backed up.
-
-# Do selects to show that all changes got applied.
---echo con1: Showing data after updates and backup
-SELECT * FROM bup_commit_blocker.t1;
-SELECT * FROM bup_commit_blocker.t2;
-SELECT * FROM bup_commit_blocker.t3;
-#SELECT * FROM bup_commit_blocker.t4;
-SELECT * FROM bup_commit_blocker.t5;
-
---echo con1: Dropping the database
-DROP TABLE bup_commit_blocker.t1;
-DROP TABLE bup_commit_blocker.t2;
-DROP TABLE bup_commit_blocker.t3;
-#DROP TABLE bup_commit_blocker.t4;
-DROP TABLE bup_commit_blocker.t5;
-
---echo con1: Restoring the database
---replace_column 1 #
-RESTORE FROM "bup_commit_blocker.bak";
-
---echo con1: Showing the data (no new data should be here).
-SELECT * FROM bup_commit_blocker.t1;
-SELECT * FROM bup_commit_blocker.t2;
-SELECT * FROM bup_commit_blocker.t3;
-#SELECT * FROM bup_commit_blocker.t4;
-SELECT * FROM bup_commit_blocker.t5;
-
---echo
---echo Verifying test 3 results:
---echo
-
---echo T1 should not have the changes after backup - count(*) = 0
-SELECT count(*) FROM bup_commit_blocker.t1 WHERE col_a like 'con2%';
-
---echo T2 should have the changes after backup - count(*) = 2
-SELECT count(*) FROM bup_commit_blocker.t2 WHERE col_a like 'con3%';
-
---echo T3 should not have the changes after backup - count(*) = 0
-SELECT count(*) FROM bup_commit_blocker.t3 WHERE col_a like 'con4%';
-
-#--echo T4 should have the changes after backup - count(*) = 3
-#SELECT count(*) FROM bup_commit_blocker.t4 WHERE col_a > 30;
-
---echo T5 should not have the changes after backup - count(*) = 1
-SELECT count(*) FROM bup_commit_blocker.t5 WHERE col_a >= 50;
-
---echo con1: Cleanup
-DROP DATABASE bup_commit_blocker;
-
-remove_file $MYSQLTEST_VARDIR/master-data/bup_commit_blocker.bak;
-SET DEBUG_SYNC= 'RESET';
-

=== modified file 'mysql-test/suite/backup/t/backup_commit_restore.test'
--- a/mysql-test/suite/backup/t/backup_commit_restore.test	2008-10-23 08:13:54 +0000
+++ b/mysql-test/suite/backup/t/backup_commit_restore.test	2008-11-17 09:57:51 +0000
@@ -20,7 +20,7 @@ replace_column 1 #;
 BACKUP DATABASE commit_test TO '81';
 
 replace_column 1 #;
-RESTORE FROM '81';
+RESTORE FROM '81' OVERWRITE;
 
 SELECT * FROM t1;
 ROLLBACK;
@@ -37,7 +37,7 @@ replace_column 1 #;
 BACKUP DATABASE commit_test TO '82';
 
 replace_column 1 #;
-RESTORE FROM '82';
+RESTORE FROM '82' OVERWRITE;
 
 SELECT * FROM t1;
 SELECT * FROM t2;
@@ -58,7 +58,7 @@ replace_column 1 #;
 BACKUP DATABASE commit_test TO '83';
 
 replace_column 1 #;
-RESTORE FROM '83';
+RESTORE FROM '83' OVERWRITE;
 
 SELECT * FROM t1;
 SELECT * FROM t2;
@@ -81,7 +81,7 @@ replace_column 1 #;
 BACKUP DATABASE commit_test TO '84';
 
 replace_column 1 #;
-RESTORE FROM '84';
+RESTORE FROM '84' OVERWRITE;
 
 SELECT * FROM t1;
 SELECT * FROM t2;
@@ -106,7 +106,7 @@ replace_column 1 #;
 BACKUP DATABASE commit_test TO '85';
 
 replace_column 1 #;
-RESTORE FROM '85';
+RESTORE FROM '85' OVERWRITE;
 
 SELECT * FROM t1;
 SELECT * FROM t2;
@@ -133,7 +133,7 @@ BACKUP DATABASE commit_test TO '86';
 
 SET @@autocommit=0;
 replace_column 1 #;
-RESTORE FROM '86';
+RESTORE FROM '86' OVERWRITE;
 
 #Test of scenario from BUG#34205
 DROP TABLE t5;
@@ -162,7 +162,7 @@ BACKUP DATABASE commit_test TO '87';
 
 SET @@autocommit=1;
 replace_column 1 #;
-RESTORE FROM '87';
+RESTORE FROM '87' OVERWRITE;
 
 SELECT * FROM t1;
 SELECT * FROM t2;

=== modified file 'mysql-test/suite/backup/t/backup_compression.test'
--- a/mysql-test/suite/backup/t/backup_compression.test	2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/t/backup_compression.test	2008-11-17 09:57:51 +0000
@@ -12,11 +12,11 @@ replace_column 1 #;
 BACKUP DATABASE db1 TO 'db2.bak.gz' WITH COMPRESSION COMPRESSION_ALGORITHM=gzip;
 
 replace_column 1 #;
-RESTORE FROM 'db1.bak.gz';
+RESTORE FROM 'db1.bak.gz' OVERWRITE;
 SHOW TABLES FROM db1;
 
 replace_column 1 #;
-RESTORE FROM 'db2.bak.gz';
+RESTORE FROM 'db2.bak.gz' OVERWRITE;
 SHOW TABLES FROM db1;
 
 DROP DATABASE db1;

=== modified file 'mysql-test/suite/backup/t/backup_concurrent.test'
--- a/mysql-test/suite/backup/t/backup_concurrent.test	2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/t/backup_concurrent.test	2008-11-17 09:57:51 +0000
@@ -79,7 +79,7 @@ reap;
 --echo ---------------------------------------------------
 --echo Starting restore
 SET DEBUG_SYNC= 'after_backup_start_restore SIGNAL running WAIT_FOR restore';
-send RESTORE FROM 'backup1';
+send RESTORE FROM 'backup1' OVERWRITE;
 
 connection default;
 --echo Waiting for restore to get going

=== modified file 'mysql-test/suite/backup/t/backup_db_grants.test'
--- a/mysql-test/suite/backup/t/backup_db_grants.test	2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/t/backup_db_grants.test	2008-11-17 09:57:51 +0000
@@ -63,7 +63,7 @@ SHOW GRANTS FOR 'bup_user3'@'%';
 
 --echo Run Restore
 --replace_column 1 #
-RESTORE FROM 'bup_db_grants.bak';
+RESTORE FROM 'bup_db_grants.bak' OVERWRITE;
 
 SHOW TABLES FROM bup_db_grants;
 
@@ -90,7 +90,7 @@ CREATE USER 'bup_user1'@'nosuchhost';
 
 --echo Run Restore
 --replace_column 1 #
-RESTORE FROM 'bup_db_grants.bak';
+RESTORE FROM 'bup_db_grants.bak' OVERWRITE;
 
 SHOW TABLES FROM bup_db_grants;
 
@@ -178,7 +178,7 @@ EXECUTE stmt3;
 
 --echo Run restore.
 --replace_column 1 #
-RESTORE FROM 'bup_db_grants.bak';
+RESTORE FROM 'bup_db_grants.bak' OVERWRITE;
 
 FLUSH PRIVILEGES;
 

=== modified file 'mysql-test/suite/backup/t/backup_ddl_blocker.test'
--- a/mysql-test/suite/backup/t/backup_ddl_blocker.test	2008-10-24 08:25:48 +0000
+++ b/mysql-test/suite/backup/t/backup_ddl_blocker.test	2008-11-20 14:07:23 +0000
@@ -243,7 +243,7 @@ DROP TABLE bup_ddl_blocker.t1, bup_ddl_b
 
 --echo con1: Restoring the database
 --replace_column 1 #
-RESTORE FROM "bup_ddl_blocker.bak";
+RESTORE FROM "bup_ddl_blocker.bak" OVERWRITE;
 
 --echo con1: Showing columns that were backed up
 
@@ -297,7 +297,7 @@ SET DEBUG_SYNC= 'now WAIT_FOR con3_start
 SET DEBUG_SYNC= 'before_block_ddl SIGNAL bup_blocked WAIT_FOR status_shown';
 SET DEBUG_SYNC= 'after_block_ddl SIGNAL bup_started WAIT_FOR status_shown2';
 --echo con1: Restoring database -- will block with lock
-send RESTORE FROM "bup_ddl_blocker_orig.bak";
+send RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE;
 
 connection con6;
 
@@ -514,7 +514,7 @@ DROP TABLE bup_ddl_blocker.t01, bup_ddl_
 
 --echo con1: Restoring the database
 --replace_column 1 #
-RESTORE FROM "bup_ddl_blocker.bak";
+RESTORE FROM "bup_ddl_blocker.bak" OVERWRITE;
 
 --echo con1: Showing columns that were backed up
 --echo con1: Table t01 should be in restore
@@ -564,7 +564,7 @@ SET DEBUG_SYNC= 'now WAIT_FOR con3_start
 SET DEBUG_SYNC= 'before_block_ddl SIGNAL bup_blocked WAIT_FOR status_shown';
 SET DEBUG_SYNC= 'after_block_ddl SIGNAL bup_started WAIT_FOR status_shown2';
 --echo con1: Restoring database -- will block with lock
-send RESTORE FROM "bup_ddl_blocker_orig.bak";
+send RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE;
 
 connection con6;
 
@@ -774,7 +774,7 @@ DROP TABLE bup_ddl_blocker.t1, bup_ddl_b
 
 --echo con1: Restoring the database
 --replace_column 1 #
-RESTORE FROM "bup_ddl_blocker.bak";
+RESTORE FROM "bup_ddl_blocker.bak" OVERWRITE;
 
 --echo con1: Showing columns that were backed up
 --echo con1: Table t2 should not be in restore
@@ -823,7 +823,7 @@ SET DEBUG_SYNC= 'now WAIT_FOR con3_start
 SET DEBUG_SYNC= 'before_block_ddl SIGNAL bup_blocked WAIT_FOR status_shown';
 SET DEBUG_SYNC= 'after_block_ddl SIGNAL bup_started WAIT_FOR status_shown2';
 --echo con1: Restoring database -- will block with lock
-send RESTORE FROM "bup_ddl_blocker_orig.bak";
+send RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE;
 
 connection con6;
 
@@ -1061,7 +1061,7 @@ DROP DATABASE bup_ddl_blocker_3;
 --echo con1: Restoring the database
 --replace_column 1 #
 --disable_warnings
-RESTORE FROM "bup_ddl_blocker.bak";
+RESTORE FROM "bup_ddl_blocker.bak" OVERWRITE;
 --enable_warnings
 
 --echo con1: Showing databases that were backed up
@@ -1137,7 +1137,7 @@ SET DEBUG_SYNC= 'now WAIT_FOR con3_start
 SET DEBUG_SYNC= 'before_block_ddl SIGNAL bup_blocked WAIT_FOR status_shown';
 SET DEBUG_SYNC= 'after_block_ddl SIGNAL bup_started WAIT_FOR status_shown2';
 --echo con1: Restoring database -- will block with lock
-send RESTORE FROM "bup_ddl_blocker_orig.bak";
+send RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE;
 
 connection con6;
 
@@ -1381,7 +1381,7 @@ DROP DATABASE bup_ddl_blocker_4;
 
 --echo con1: Restoring the database
 --replace_column 1 #
-RESTORE FROM "bup_ddl_blocker.bak";
+RESTORE FROM "bup_ddl_blocker.bak" OVERWRITE;
 
 --echo con1: Showing databases that were backed up
 --echo con1: bup_ddl_blocker_1 has been renamed and
@@ -1465,7 +1465,7 @@ SET DEBUG_SYNC= 'now WAIT_FOR con3_start
 SET DEBUG_SYNC= 'before_block_ddl SIGNAL bup_blocked WAIT_FOR status_shown';
 SET DEBUG_SYNC= 'after_block_ddl SIGNAL bup_started WAIT_FOR status_shown2';
 --echo con1: Restoring database -- will block with lock
-send RESTORE FROM "bup_ddl_blocker_orig.bak";
+send RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE;
 
 connection con6;
 
@@ -1732,7 +1732,7 @@ DROP DATABASE bup_ddl_blocker_4;
 --echo con1: Restoring the database
 --replace_column 1 #
 --disable_warnings
-RESTORE FROM "bup_ddl_blocker.bak";
+RESTORE FROM "bup_ddl_blocker.bak" OVERWRITE;
 --enable_warnings
 
 --echo con1: Showing databases that were backed up
@@ -1829,7 +1829,7 @@ SET DEBUG_SYNC= 'now WAIT_FOR con3_start
 SET DEBUG_SYNC= 'before_block_ddl SIGNAL bup_blocked WAIT_FOR status_shown';
 SET DEBUG_SYNC= 'after_block_ddl SIGNAL bup_started WAIT_FOR status_shown2';
 --echo con1: Restoring database -- will block with lock
-send RESTORE FROM "bup_ddl_blocker_orig.bak";
+send RESTORE FROM "bup_ddl_blocker_orig.bak" OVERWRITE;
 
 connection con6;
 

=== modified file 'mysql-test/suite/backup/t/backup_errors.test'
--- a/mysql-test/suite/backup/t/backup_errors.test	2008-11-05 09:41:15 +0000
+++ b/mysql-test/suite/backup/t/backup_errors.test	2008-11-17 09:57:51 +0000
@@ -294,3 +294,54 @@ DROP DATABASE db1;
 
 --echo
 --echo Done testing for Bug#38624
+
+
+--echo 
+--echo Testing RESTORE ... OVERWRITE functionality
+--echo See bug#34579
+--echo
+
+--source include/not_embedded.inc
+
+--echo Initialize
+CREATE DATABASE db1;
+USE db1;
+CREATE TABLE table1 (text VARCHAR(20));
+INSERT INTO table1 VALUES ('Inserted before');
+
+--echo 
+--echo Backup database
+--replace_column 1 #
+BACKUP DATABASE db1 TO 'overwrite.bak';
+
+--echo 
+--echo Insert more data and display
+INSERT INTO table1 VALUES ('Inserted after');
+SELECT * FROM table1;
+
+--echo 
+--echo Restore without OVERWRITE flag; will fail
+--error ER_RESTORE_DB_EXISTS
+RESTORE FROM 'overwrite.bak';
+
+--echo 
+--echo Restore with OVERWRITE flag; will succeed
+--replace_column 1 #
+RESTORE FROM 'overwrite.bak' OVERWRITE;
+
+--echo 
+--echo Show that inserted value 2 is not there
+SELECT * FROM table1;
+
+DROP DATABASE db1;
+
+--echo 
+--echo Restore after deleting db; will succeed
+--replace_column 1 #
+RESTORE FROM 'overwrite.bak';
+
+--echo 
+--echo Show that inserted value 2 is not there
+SELECT * FROM table1;
+
+DROP DATABASE db1;

=== modified file 'mysql-test/suite/backup/t/backup_fkey.test'
--- a/mysql-test/suite/backup/t/backup_fkey.test	2008-10-24 08:25:48 +0000
+++ b/mysql-test/suite/backup/t/backup_fkey.test	2008-11-17 09:57:51 +0000
@@ -79,12 +79,12 @@ SHOW VARIABLES LIKE 'foreign_key_checks%
 # Restore the database and ensure there are no errors.
 --echo Now restore the database.
 --replace_column 1 #
-RESTORE FROM 'backup_fkey.bak';
+RESTORE FROM 'backup_fkey.bak' OVERWRITE;
 
 # Now restore the original files to show there are no problems
 # restoring valid fkey relationships.
 --replace_column 1 #
-RESTORE FROM 'backup_fkey_orig.bak';
+RESTORE FROM 'backup_fkey_orig.bak' OVERWRITE;
 
 --echo Show data
 SELECT * FROM backup_fkey.parent;
@@ -120,7 +120,7 @@ SHOW VARIABLES LIKE 'foreign_key_checks%
 
 --echo Restoring data
 --replace_column 1 #
-RESTORE FROM 'backup_fkey.bak';
+RESTORE FROM 'backup_fkey.bak' OVERWRITE;
 
 --echo Verify foreign_key_checks = ON
 SHOW VARIABLES LIKE 'foreign_key_checks%';
@@ -131,7 +131,7 @@ SHOW VARIABLES LIKE 'foreign_key_checks%
 
 --echo Restoring data
 --replace_column 1 #
-RESTORE FROM 'backup_fkey.bak';
+RESTORE FROM 'backup_fkey.bak' OVERWRITE;
 
 --echo Verify foreign_key_checks = OFF
 SHOW VARIABLES LIKE 'foreign_key_checks%';

=== modified file 'mysql-test/suite/backup/t/backup_lock_myisam.test'
--- a/mysql-test/suite/backup/t/backup_lock_myisam.test	2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/t/backup_lock_myisam.test	2008-11-17 09:57:51 +0000
@@ -98,7 +98,7 @@ DROP DATABASE db1;
 --echo now start the restore and while the restore is running, fire the trigger
 --echo activate synchronization points for restore.
 SET DEBUG_SYNC= 'restore_in_progress SIGNAL wait_for_restore WAIT_FOR finish';
---send RESTORE FROM 'db1.bak'
+--send RESTORE FROM 'db1.bak' OVERWRITE;
 
 --echo From breakpoints:
 --connection breakpoints
@@ -147,7 +147,7 @@ DELETE FROM db2.t2;
 --echo now start the restore and while the restore is running, fire the trigger
 --echo activate synchronization points for restore.
 SET DEBUG_SYNC= 'restore_in_progress SIGNAL wait_for_restore WAIT_FOR finish';
---send RESTORE FROM 'db1.bak'
+--send RESTORE FROM 'db1.bak' OVERWRITE;
 
 --echo From breakpoints:
 --connection breakpoints

=== modified file 'mysql-test/suite/backup/t/backup_logs.test'
--- a/mysql-test/suite/backup/t/backup_logs.test	2008-11-07 10:40:48 +0000
+++ b/mysql-test/suite/backup/t/backup_logs.test	2008-11-17 09:57:51 +0000
@@ -154,7 +154,7 @@ SET DEBUG_SYNC= 'after_backup_start_rest
 
 --echo con2: Send restore command.
 --echo con2: Backup id = 501.
-send RESTORE FROM 'backup_logs_orig.bak';
+send RESTORE FROM 'backup_logs_orig.bak' OVERWRITE;
 
 connection con1;
 

=== modified file 'mysql-test/suite/backup/t/backup_logs_output-master.opt'
--- a/mysql-test/suite/backup/t/backup_logs_output-master.opt	2008-11-11 08:37:27 +0000
+++ b/mysql-test/suite/backup/t/backup_logs_output-master.opt	2008-11-17 11:17:59 +0000
@@ -1 +1 @@
---backup_history_log_file=$MYSQLTEST_VARDIR/master-data/history.txt --backup_progress_log_file=$MYSQLTEST_VARDIR/master-data/progress.txt --log-backup-output=FILE
+--backup_history_log_file=$MYSQLTEST_VARDIR/master-data/history.txt --backup_progress_log_file=$MYSQLTEST_VARDIR/master-data/progress.txt --log-backup-output

=== modified file 'mysql-test/suite/backup/t/backup_logs_purge.test'
--- a/mysql-test/suite/backup/t/backup_logs_purge.test	2008-10-28 14:17:05 +0000
+++ b/mysql-test/suite/backup/t/backup_logs_purge.test	2008-11-17 09:57:51 +0000
@@ -74,16 +74,16 @@ BACKUP DATABASE backup_logs to 'backup3.
 BACKUP DATABASE backup_logs to 'backup4.bak';
 
 --echo Do restore of database
-RESTORE from 'backup1.bak';
+RESTORE from 'backup1.bak' OVERWRITE;
 
 --echo Do restore of database
-RESTORE from 'backup2.bak';
+RESTORE from 'backup2.bak' OVERWRITE;
 
 --echo Do restore of database
-RESTORE from 'backup3.bak';
+RESTORE from 'backup3.bak' OVERWRITE;
 
 --echo Do restore of database
-RESTORE from 'backup4.bak';
+RESTORE from 'backup4.bak' OVERWRITE;
 
 --file_exists $MYSQLTEST_VARDIR/master-data/backup1.bak
 --file_exists $MYSQLTEST_VARDIR/master-data/backup2.bak
@@ -148,18 +148,18 @@ BACKUP DATABASE backup_logs to 'backup4.
 SET SESSION debug="-d";
 
 --echo Do restore of database
-RESTORE from 'backup1.bak';
+RESTORE from 'backup1.bak' OVERWRITE;
 
 --echo Do restore of database
-RESTORE from 'backup2.bak';
+RESTORE from 'backup2.bak' OVERWRITE;
 
 --echo Do restore of database
-RESTORE from 'backup3.bak';
+RESTORE from 'backup3.bak' OVERWRITE;
 
 SET SESSION debug="+d,set_log_time";
 
 --echo Do restore of database
-RESTORE from 'backup4.bak';
+RESTORE from 'backup4.bak' OVERWRITE;
 
 SET SESSION debug="-d";
 
@@ -310,13 +310,13 @@ SELECT count(*) FROM mysql.backup_progre
 --echo Now do the same test for restore.
 
 --replace_column 1 #
-RESTORE FROM 'backup1.bak';
+RESTORE FROM 'backup1.bak' OVERWRITE;
 --replace_column 1 #
-RESTORE FROM 'backup2.bak';
+RESTORE FROM 'backup2.bak' OVERWRITE;
 --replace_column 1 #
-RESTORE FROM 'backup3.bak';
+RESTORE FROM 'backup3.bak' OVERWRITE;
 --replace_column 1 #
-RESTORE FROM 'backup4.bak';
+RESTORE FROM 'backup4.bak' OVERWRITE;
 
 SELECT count(*) FROM mysql.backup_history;
 SELECT count(*) FROM mysql.backup_progress;
@@ -329,7 +329,7 @@ connection con2;
 #
 --echo con2: Activate sync points for the backup statement.
 SET DEBUG_SYNC= 'before_restore_done SIGNAL ready WAIT_FOR proceed';
-SEND RESTORE FROM 'backup5.bak';
+SEND RESTORE FROM 'backup5.bak' OVERWRITE;
 
 connection con1;
 

=== modified file 'mysql-test/suite/backup/t/backup_no_be.test'
--- a/mysql-test/suite/backup/t/backup_no_be.test	2008-10-30 10:41:48 +0000
+++ b/mysql-test/suite/backup/t/backup_no_be.test	2008-11-17 09:57:51 +0000
@@ -84,7 +84,7 @@ SELECT drivers FROM mysql.backup_history
 # check that we can restore from the created image.
 
 --replace_column 1 #
-RESTORE FROM 'db1.bak';
+RESTORE FROM 'db1.bak' OVERWRITE;
 SHOW TABLES IN db1;
 
 

=== modified file 'mysql-test/suite/backup/t/backup_no_data.test'
--- a/mysql-test/suite/backup/t/backup_no_data.test	2008-10-09 09:55:08 +0000
+++ b/mysql-test/suite/backup/t/backup_no_data.test	2008-11-20 14:07:23 +0000
@@ -26,7 +26,7 @@ DROP DATABASE other_db;
 SHOW DATABASES;
 
 --replace_column 1 #
-RESTORE FROM 'all.bak';
+RESTORE FROM 'all.bak' OVERWRITE;
 
 SHOW DATABASES;
 
@@ -40,7 +40,7 @@ SHOW DATABASES;
 SHOW TABLES IN empty_db;
 
 --replace_column 1 #
-RESTORE FROM 'all.bak';
+RESTORE FROM 'all.bak' OVERWRITE;
 
 SHOW DATABASES;
 SHOW TABLES IN empty_db;
@@ -64,7 +64,7 @@ BACKUP DATABASE empty_db TO 'empty_db.ba
 SHOW DATABASES;
 
 --replace_column 1 #
-RESTORE FROM 'empty_db.bak';
+RESTORE FROM 'empty_db.bak' OVERWRITE;
 
 USE empty_db;
 

=== added file 'mysql-test/suite/backup/t/backup_nodata_driver-master.opt'
--- a/mysql-test/suite/backup/t/backup_nodata_driver-master.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/backup/t/backup_nodata_driver-master.opt	2008-11-21 15:02:34 +0000
@@ -0,0 +1 @@
+$EXAMPLE_PLUGIN_OPT

=== modified file 'mysql-test/suite/backup/t/backup_nodata_driver.test'
--- a/mysql-test/suite/backup/t/backup_nodata_driver.test	2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/t/backup_nodata_driver.test	2008-11-21 15:02:34 +0000
@@ -1,5 +1,9 @@
 #
 # This test tests the backup using no data engines.
+# These are engines which tables don't contain data.
+# This is obvious for BLACKHOLE and EXAMPLE.
+# Other engines behave like placeholders for tables of other
+# engines and don't have data themselves. Examples are MERGE and FEDERATED.
 # It was made a separate test due to the possibility that some
 # of the engines used may not be available on all platforms or
 # builds.
@@ -10,18 +14,26 @@
 #
 --source include/not_embedded.inc
 --source include/have_federated_db.inc
---source include/have_exampledb.inc
+# MERGE is always available --source include/have_merge.inc
 --source include/have_blackhole.inc
+#
+# Example engine must be loaded as plugin.
+# Currently this does not work on Windows yet.
+#
+--source include/not_windows.inc
+--source include/have_example_plugin.inc
+INSTALL PLUGIN example SONAME 'ha_example.so';
+--source include/have_exampledb.inc
 
 --disable_warnings
 DROP DATABASE IF EXISTS bup_nodata;
 DROP DATABASE IF EXISTS bup_data;
 --enable_warnings
 
-# Create data
---echo Creating tables
-CREATE DATABASE bup_nodata;
-
+--echo #
+--echo # Create a database with tables that can work as
+--echo # base tables for MERGE and FEDERATED.
+--echo #
 CREATE DATABASE bup_data;
 
 CREATE TABLE bup_data.myisam1 (a int, b char(30)) ENGINE=MYISAM;
@@ -39,6 +51,11 @@ CREATE TABLE bup_data.f1 (
     )
   DEFAULT CHARSET=latin1;
 
+--echo #
+--echo # Create a database with tables from no-data engines.
+--echo #
+CREATE DATABASE bup_nodata;
+
 CREATE TABLE bup_nodata.merge1 (a int, b char(30))
   ENGINE=MERGE UNION=(bup_data.myisam1, bup_data.myisam2, bup_data.myisam3);
 
@@ -60,8 +77,9 @@ CREATE TABLE bup_nodata.e1 (
   Vapor_period smallint(4) unsigned DEFAULT '0' NOT NULL
 ) ENGINE=example;
 
-# Insert some data (for merge and federated to ensure proper working tables)
---echo Inserting data
+--echo #
+--echo # Insert some data.
+--echo #
 INSERT INTO bup_data.myisam1 VALUES (11, 'table 1');
 INSERT INTO bup_data.myisam1 VALUES (12, 'table 1');
 INSERT INTO bup_data.myisam1 VALUES (13, 'table 1');
@@ -78,85 +96,146 @@ INSERT INTO bup_data.f1 (id, `group`) VA
 INSERT INTO bup_data.f1 (id, `batch`) VALUES (4, 23);
 INSERT INTO bup_data.f1 (id, `qty`) VALUES (5, 1);
 
-# Show the data
---echo show data
+--echo #
+--echo # Show the data.
+--echo #
 SHOW FULL TABLES FROM bup_data;
 SHOW FULL TABLES FROM bup_nodata;
-
 SELECT * FROM bup_nodata.merge1;
 SELECT * FROM bup_nodata.f1;
 SELECT * FROM bup_nodata.b1;
 SELECT * FROM bup_nodata.e1;
 
-# Do the backup of the bup_data DB.
+--echo #
+--echo # Backup the bup_data DB, which tables contain data.
+--echo #
 --replace_column 1 #
 BACKUP DATABASE bup_data TO 'bup_data.bak';
 
-# Do the backup of the bup_nodata DB.
+--echo #
+--echo # Backup the bup_nodata DB, which tables do not contain data.
+--echo #
 --replace_column 1 #
 BACKUP DATABASE bup_nodata TO 'bup_nodata.bak';
 
-# Show the data
---echo show data
+--echo #
+--echo # Show the data again. Backup did not modify them.
+--echo #
 SHOW FULL TABLES FROM bup_data;
 SHOW FULL TABLES FROM bup_nodata;
-
 SELECT * FROM bup_nodata.merge1;
 SELECT * FROM bup_nodata.f1;
 SELECT * FROM bup_nodata.b1;
 SELECT * FROM bup_nodata.e1;
 
-# Now drop the data database and show what is left
-
+--echo #
+--echo # Now drop the bup_data database.
+--echo #
 DROP DATABASE bup_data;
 
-# Show the data
---echo show data
+--echo #
+--echo # Show that the data have gone.
+--echo # The MERGE and FEDERATED tables have errors since
+--echo # their base tables have been dropped with bup_data.
+--echo #
 SHOW FULL TABLES FROM bup_nodata;
-
-# The merge and federated tables should have errors since data is missing.
---error ER_NO_SUCH_TABLE
+--error ER_WRONG_MRG_TABLE
 SELECT * FROM bup_nodata.merge1;
 --error ER_CONNECT_TO_FOREIGN_DATA_SOURCE,ER_QUERY_ON_FOREIGN_DATA_SOURCE
 SELECT * FROM bup_nodata.f1;
 SELECT * FROM bup_nodata.b1;
 SELECT * FROM bup_nodata.e1;
 
+--echo #
+--echo # Now drop the bup_nodata database too.
+--echo #
 DROP DATABASE bup_nodata;
 
-# Now restore the nodata database and see if it is the same as above.
---echo Restoring nodata database.
+--echo #
+--echo # Now try to restore the bup_nodata database. This fails because
+--echo # restore opens the tables for filling them with data, even when
+--echo # they were empty on backup. 'bup_nodata.bak' does not contain
+--echo # the base tables for the MERGE and FEDERATED tables.
+--echo # NOTE: Since restore fails after restoring the meta data,
+--echo # after creating the tables that is, we have the same
+--echo # situation as before. The tables exist, but the base
+--echo # tables for MERGE and FEDERATED do not exist.
+--echo #
 --replace_column 1 #
-RESTORE FROM 'bup_nodata.bak';
+--error ER_WRONG_MRG_TABLE,ER_CONNECT_TO_FOREIGN_DATA_SOURCE,ER_QUERY_ON_FOREIGN_DATA_SOURCE
+RESTORE FROM 'bup_nodata.bak' OVERWRITE;
 
-# Show the data
---echo show data
+--echo #
+--echo # Show what we have.
+--echo # NOTE: If restore would work as all or nothing,
+--echo # all of the SHOW and SELECT statements in this section would fail.
+--echo #
 SHOW FULL TABLES FROM bup_nodata;
-
-# The merge and federated tables should have errors since data is missing.
---error ER_NO_SUCH_TABLE
+--error ER_WRONG_MRG_TABLE
 SELECT * FROM bup_nodata.merge1;
 --error ER_CONNECT_TO_FOREIGN_DATA_SOURCE,ER_QUERY_ON_FOREIGN_DATA_SOURCE
 SELECT * FROM bup_nodata.f1;
 SELECT * FROM bup_nodata.b1;
 SELECT * FROM bup_nodata.e1;
 
-# Now restore the data database and see that all is well.
---echo Restoring data database.
+--echo #
+--echo # Now restore the bup_data database as well.
+--echo #
 --replace_column 1 #
 RESTORE FROM 'bup_data.bak';
 
-# Show the data
---echo show data
+--echo #
+--echo # Show that everything is well.
+--echo # NOTE: If restore would work as all or nothing,
+--echo # the bup_nodata tables would not exist here.
+--echo #
 SHOW FULL TABLES FROM bup_data;
 SHOW FULL TABLES FROM bup_nodata;
+SELECT * FROM bup_nodata.merge1;
+SELECT * FROM bup_nodata.f1;
+SELECT * FROM bup_nodata.b1;
+SELECT * FROM bup_nodata.e1;
+
+--echo #
+--echo # Now restore the bup_nodata database and see if it is the same
+--echo # as above. Note that this step would not be required here
+--echo # because all bup_nodata tables have no data and were created
+--echo # by the failed restore. Anyway, the correct approach is to do a
+--echo # succeeding restore before assuming that everything exists again.
+--echo #
+--replace_column 1 #
+RESTORE FROM 'bup_nodata.bak' OVERWRITE;
 
+--echo #
+--echo # Show that everything is well.
+--echo #
+SHOW FULL TABLES FROM bup_nodata;
 SELECT * FROM bup_nodata.merge1;
 SELECT * FROM bup_nodata.f1;
 SELECT * FROM bup_nodata.b1;
 SELECT * FROM bup_nodata.e1;
 
+--echo #
+--echo # Now drop the bup_data database with the base tables again.
+--echo #
 DROP DATABASE bup_data;
+
+--echo #
+--echo # Show that the data have gone.
+--echo # The MERGE and FEDERATED tables have errors since
+--echo # their base tables have been dropped with bup_data.
+--echo #
+SHOW FULL TABLES FROM bup_nodata;
+--error ER_WRONG_MRG_TABLE
+SELECT * FROM bup_nodata.merge1;
+--error ER_CONNECT_TO_FOREIGN_DATA_SOURCE,ER_QUERY_ON_FOREIGN_DATA_SOURCE
+SELECT * FROM bup_nodata.f1;
+SELECT * FROM bup_nodata.b1;
+SELECT * FROM bup_nodata.e1;
+
+--echo #
+--echo # Cleanup.
+--echo #
 DROP DATABASE bup_nodata;
 
 --error 0,1
@@ -164,3 +243,5 @@ DROP DATABASE bup_nodata;
 --error 0,1
 --remove_file $MYSQLTEST_VARDIR/master-data/bup_nodata.bak
 
+UNINSTALL PLUGIN example;
+

=== modified file 'mysql-test/suite/backup/t/backup_security.test'
--- a/mysql-test/suite/backup/t/backup_security.test	2008-10-24 08:25:48 +0000
+++ b/mysql-test/suite/backup/t/backup_security.test	2008-11-17 09:57:51 +0000
@@ -72,7 +72,7 @@ BACKUP DATABASE backup_test to 'bup_with
 
 --echo no_rights: Attempting restore. Should succeed
 --replace_column 1 #
-RESTORE FROM 'bup_with_rights.bak';
+RESTORE FROM 'bup_with_rights.bak' OVERWRITE;
 
 SELECT * FROM backup_test.t1;
 
@@ -82,7 +82,7 @@ disconnect with_rights;
 connection default;
 
 --replace_column 1 #
-RESTORE FROM 'backup_test_orig.bak';
+RESTORE FROM 'backup_test_orig.bak' OVERWRITE;
 
 SELECT * FROM backup_test.t1;
 

=== modified file 'mysql-test/suite/backup/t/backup_snapshot.test'
--- a/mysql-test/suite/backup/t/backup_snapshot.test	2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/t/backup_snapshot.test	2008-11-17 09:57:51 +0000
@@ -116,7 +116,7 @@ DROP TABLE bup_snapshot.t1;
 
 --echo con1: Restoring the database
 --replace_column 1 #
-RESTORE FROM "bup_snapshot.bak";
+RESTORE FROM "bup_snapshot.bak" OVERWRITE;
 
 --echo con1: Showing the data (no new data should be here).
 SELECT * FROM bup_snapshot.t1 WHERE word LIKE '-%';
@@ -175,7 +175,7 @@ DROP TABLE bup_snapshot.t1;
 
 --echo con1: Restoring the database
 --replace_column 1 #
-RESTORE FROM "bup_snapshot.bak";
+RESTORE FROM "bup_snapshot.bak" OVERWRITE;
 
 --echo con1: Showing the data (no new data should be here).
 SELECT * FROM bup_snapshot.t1 WHERE word LIKE '-%';

=== modified file 'mysql-test/suite/backup/t/backup_timeout.test'
--- a/mysql-test/suite/backup/t/backup_timeout.test	2008-10-07 17:15:44 +0000
+++ b/mysql-test/suite/backup/t/backup_timeout.test	2008-11-19 22:01:28 +0000
@@ -159,4 +159,6 @@ SHOW VARIABLES LIKE 'backup_wait%';
 
 DROP DATABASE bup_ddl_blocker;
 
+SET DEBUG_SYNC= 'reset';
+
 --remove_file $MYSQLTEST_VARDIR/master-data/bup_ddl_blocker.bak

=== added file 'mysql-test/suite/backup/t/backup_vp_nontx.test'
--- a/mysql-test/suite/backup/t/backup_vp_nontx.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/backup/t/backup_vp_nontx.test	2008-11-20 09:49:34 +0000
@@ -0,0 +1,256 @@
+#
+# This test is one of two validity point tests. See:
+#    backup_vp_tx.test
+#
+# The goal of the test should be to ensure the following assumptions
+# for the behavior of validity point (VP) hold. Validity point is
+# implemented using commit blocker (CB).
+#
+# Note: in this file, "DML" refers to DML operations executed in
+#       non-transactional storage engines.
+#
+# a) DMLs that are executed before VP are in the backup image
+#
+# b) setting the validity point should not be done while DMLs are
+#    being processed in any table involved in the backup. An active
+#    DML therefore blocks backup from setting commit blocker. The DML
+#    has to complete before backup can set CB (and ultimately set the
+#    VP), and will therefore be in the backup image
+#
+# c) setting the validity point should not be done while DMLs are
+#    being processed in any table involved in the backup. A DML
+#    operation requested when backup is ready to set VP is therefore
+#    blocked by CB. The DML has to wait for CB to be released before
+#    it can continue, and will therefore not be in the backup image
+#
+# d) DMLs executed after VP are not in the backup image
+#
+#
+
+--source include/have_debug_sync.inc
+--source include/not_embedded.inc
+
+--disable_warnings
+SET DEBUG_SYNC= 'RESET';
+DROP DATABASE IF EXISTS bup_vp;
+
+let $bdir=`SELECT @@backupdir`;
+
+--error 0,1
+remove_file $bdir/bup_vp.bak;
+--enable_warnings
+
+
+CREATE DATABASE bup_vp;
+
+#
+# Connections used in this test
+#
+# con_bup  - used to create data, load data, and run the backup 
+# con_ntx1 - used for non-transactional execution
+# con_ntx2 - used for non-transactional execution
+# con_sync - used to make sync point work flow easier to read
+#
+
+connect (con_bup,localhost,root,,);
+connect (con_ntx1,localhost,root,,);
+connect (con_ntx2,localhost,root,,);
+connect (con_sync,localhost,root,,);
+
+connection con_bup;
+
+--echo 
+--echo Starting Test
+--echo 
+
+#
+# Sequence diagram (not UML), only relevant parts shown
+#
+#      bup     tx1      tx2
+#       |       |        | 
+#       a)      |        | 
+#    (setup)    |        | 
+#       |       b)       | 
+#       |    INSERT      | 
+#     BACKUP  <...>      | 
+#     SET CB  <...>      | 
+#     <###>   <...>      | 
+#     <...>     |        c)
+#       |       |     INSERT
+#    SET VP     |      <###>
+#   RELEASE CB  |      <###>
+#       |       d)     <...>
+#       |    INSERT      | 
+#    BUP DONE   |        | 
+#   (results)   |        | 
+#
+# Note: Ongoing operations are indicated with <...>
+#       Blocked operations are indicated with <###>
+#
+
+# Create transaction tables and load them with data.
+--echo con_bup: Creating tables
+CREATE TABLE bup_vp.t1 (col_a CHAR(40)) ENGINE=MEMORY;
+
+--echo con_bup: Loading data
+--echo con_bup: Scenario a) - commited before backup
+INSERT INTO bup_vp.t1 VALUES ("01 Some data to test");
+INSERT INTO bup_vp.t1 VALUES ("02 Some data to test");
+INSERT INTO bup_vp.t1 VALUES ("03 Some data to test");
+INSERT INTO bup_vp.t1 VALUES ("04 Some data to test");
+INSERT INTO bup_vp.t1 VALUES ("05 Some data to test");
+
+--echo 
+--echo con_bup: Show the data before we start backup
+SELECT * FROM bup_vp.t1;
+
+### CON 1 ###
+  --echo 
+  connection con_ntx1;
+
+  --echo Scenario (b): Insert in progress blocks CB and is included in backup
+  --echo con_ntx1: Start insert and stop it in the middle of processing
+
+  --echo con_ntx1: Make insert stop in the middle of execution
+  # Will continue once backup has been blocked from setting CB
+  SET DEBUG_SYNC= 'after_insert_locked_tables SIGNAL insert_started
+                   WAIT_FOR complete_insert';
+  send INSERT INTO bup_vp.t1 VALUES ("ntx1: 06 Some data to test");
+
+
+### CON BUP ###
+--echo 
+connection con_bup;
+
+# Backup will be blocked from setting CB by the ongoing insert in
+# con_ntx1. Backup will signal con_ntx1 that it has been blocked. The
+# insert will then finish, making backup able to set CB. When CB has
+# been set, ntx2 will be signaled to try to insert. ntx2 insert will
+# be blocked by the CB and send a signal that it has been blocked. CB
+# is then released, but backup is stopped immediately after releasing
+# CB. ntx2 will now be able to complete the insert, and ntx1 will
+# issue and complete another insert. Finally, backup is allowed to
+# complete.
+
+--echo con_bup: Activate synchronization points for BACKUP.
+# Signal when backup is blocked by ongoing insert in con_ntx1
+SET DEBUG_SYNC= 'wait_lock_global_read_lock SIGNAL sync_complete_insert';
+
+# ntx1 insert is completed, so backup can set CB. Just before reaching
+# VP, signal ntx2 should try to insert. Wait until ntx2 signals it has
+# been blocked
+SET DEBUG_SYNC= 'before_backup_data_lock SIGNAL try_insert
+                 WAIT_FOR insert_blocked';
+
+# ntx2 insert has been blocked. Create VP and release CB, and then wait
+# while ntx2 and ntx1 inserts.
+SET DEBUG_SYNC= 'after_backup_binlog SIGNAL commit_unblocked
+                 WAIT_FOR finish_bup';
+
+--echo con_bup: Backing up database -- will block with lock
+send BACKUP DATABASE bup_vp TO "bup_vp.bak";
+
+### CON SYNC ###
+--echo 
+connection con_sync;
+SET DEBUG_SYNC= 'now WAIT_FOR sync_complete_insert';
+--echo Backup has been blocked by ongoing insert
+
+# cannot test with select that insert has not completed ntx1 has X-lock
+SET DEBUG_SYNC= 'now SIGNAL complete_insert';
+
+### CON 1 ###
+  --echo 
+  connection con_ntx1;
+  --echo con_ntx1: Reap insert
+  reap;
+
+  --echo Check that record has been inserted; Should be 1 record
+  SELECT * FROM bup_vp.t1 WHERE col_a like 'ntx1%';
+  --echo 
+
+###########
+## Below this line happens after BACKUP has taken CB
+###########
+
+### CON 2 ###
+    connection con_ntx2;
+
+    --echo con_ntx2: Wait until backup has set CB, then try to insert
+    # Wait for backup to set CB
+    SET DEBUG_SYNC= 'now WAIT_FOR try_insert';
+    # Signal to backup that the insert is blocked
+    SET DEBUG_SYNC= 'wait_if_global_read_lock SIGNAL sync_insert_blocked';
+    send INSERT INTO bup_vp.t1 VALUES ("ntx2: Should NOT be in backup");
+
+    # INSERT is blocked until CB has been released
+
+### CON SYNC ###
+--echo 
+connection con_sync;
+SET DEBUG_SYNC= 'now WAIT_FOR sync_insert_blocked';
+
+--echo Insert in ntx2 is blocked and should not be in t1; Should be 0 records
+SELECT * FROM bup_vp.t1 WHERE col_a like 'ntx2%';
+--echo 
+
+SET DEBUG_SYNC= 'now SIGNAL insert_blocked';
+
+
+### CON 1 ###
+  --echo 
+  connection con_ntx1;
+
+  --echo con_ntx1: Backup has now released CB. Perform insert
+  # Double-check that backup has reached sync point after CB release
+  SET DEBUG_SYNC= 'now WAIT_FOR commit_unblocked';
+  INSERT INTO bup_vp.t1 VALUES ("ntx1: Should NOT be in backup");
+  SET DEBUG_SYNC= 'now SIGNAL finish_bup';
+
+
+### CON BUP ###
+--echo 
+connection con_bup;
+--echo con_ntx1: Reap backup
+--replace_column 1 #
+reap;
+
+
+###########
+## Verify results
+###########
+
+# Do selects to show that all changes got applied.
+--echo 
+--echo con_bup: Showing data after updates and backup
+SELECT * FROM bup_vp.t1;
+
+--echo con_bup: Dropping the database
+DROP TABLE bup_vp.t1;
+DROP DATABASE bup_vp;
+
+--echo con_bup: Restoring the database
+--replace_column 1 #
+RESTORE FROM "bup_vp.bak";
+
+--echo 
+--echo con_bup: Showing the data after restore
+SELECT * FROM bup_vp.t1;
+
+--echo
+--echo Verifying results:
+--echo
+
+--echo T1 should have changes from con_ntx1; Should be 1 record
+SELECT * FROM bup_vp.t1 WHERE col_a like 'ntx1%';
+--echo 
+
+--echo T1 should not have the changes from con_ntx2; Should be 0 records
+SELECT * FROM bup_vp.t1 WHERE col_a like 'ntx2%';
+--echo 
+
+--echo con_bup: Cleanup
+DROP DATABASE bup_vp;
+
+remove_file $bdir/bup_vp.bak;
+SET DEBUG_SYNC= 'RESET';

=== added file 'mysql-test/suite/backup/t/backup_vp_tx.test'
--- a/mysql-test/suite/backup/t/backup_vp_tx.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/backup/t/backup_vp_tx.test	2008-11-20 09:49:34 +0000
@@ -0,0 +1,329 @@
+#
+# This test is one of two validity point tests. See:
+#    backup_vp_nontx.test
+#
+# The goal of the test should be to ensure the following assumptions
+# for the behavior of validity point (VP) hold. Validity point is
+# implemented using commit blocker (CB).
+#
+# a) transactions that commit before VP are in the backup image
+#
+# b) setting the validity point should not be done while commits are
+#    being processed in any table involved in the backup. Transactions
+#    with ongoing commits therefore block backup from setting commit
+#    blocker. The commit has to complete before backup can set CB (and
+#    ultimately set the VP), and will therefore be in the backup image
+#
+# c) setting the validity point should not be done while commits are
+#    being processed in any table involved in the backup. Transactions
+#    that try to commit when backup is ready to set VP are therefore
+#    blocked by CB. The commit has to wait for CB to be released
+#    before it can continue, and will therefore not be in the backup
+#    image
+#
+# d) transactions that commit after VP are not in the backup image
+#
+# Note: the transactions have to modify data.
+#
+#
+#
+
+--source include/have_innodb.inc
+--source include/have_debug_sync.inc
+--source include/not_embedded.inc
+
+--disable_warnings
+SET DEBUG_SYNC= 'RESET';
+DROP DATABASE IF EXISTS bup_vp;
+
+let $bdir=`SELECT @@backupdir`;
+
+--error 0,1
+remove_file $bdir/bup_vp.bak;
+--enable_warnings
+
+CREATE DATABASE bup_vp;
+
+#
+# Connections used in this test
+#
+# con_bup  - used to create data, load data, and run the backup 
+# con_tx1  - used for transactional execution
+# con_tx2  - used for transactional execution
+# con_tx3  - used for transactional execution
+# con_sync - used to make sync point work flow easier to read
+#
+
+connect (con_bup,localhost,root,,);
+connect (con_tx1,localhost,root,,);
+connect (con_tx2,localhost,root,,);
+connect (con_tx3,localhost,root,,);
+connect (con_sync,localhost,root,,);
+
+connection con_bup;
+
+--echo 
+--echo Starting Test
+--echo 
+
+#
+# Sequence diagram (not UML), only relevant parts shown
+#
+#      bup     tx1      tx2      tx3
+#       |       |        |        |
+#       a)      |        |        |
+#    (setup)    |        |        |
+#     COMMIT    |        |        d)
+#       |       |        |      BEGIN
+#       |       b)       |    INSERT t3
+#       |     BEGIN      |        |
+#       |   INSERT t1    |        |
+#       |     COMMIT     c)       |
+#       |     <...>    BEGIN      |
+#       |     <...>  INSERT t2    |
+#       |     <...>      |        |   
+#     BACKUP  <...>      |        |
+#     SET CB  <...>      |        |   
+#     <###>   <...>      |        |  
+#     <...>     |        |        |  
+#       |       |     COMMIT      |  
+#    SET VP     |      <###>      |   
+#   RELEASE CB  |      <###>      |  
+#       |       |      <...>    COMMIT
+#       |       |        |        |  
+#    BUP DONE   |        |        |  
+#   (results)   |        |        |     
+#
+# Note: Ongoing operations are indicated with <...>
+#       Blocked operations are indicated with <###>
+#
+
+# Create transaction tables and load them with data.
+--echo con_bup: Creating tables
+CREATE TABLE bup_vp.t1 (col_a CHAR(40)) ENGINE=INNODB;
+CREATE TABLE bup_vp.t2 (col_a CHAR(40)) ENGINE=INNODB;
+CREATE TABLE bup_vp.t3 (col_a CHAR(40)) ENGINE=INNODB;
+
+--echo 
+--echo con_bup: Loading data
+--echo con_bup: Scenario a) - commited before backup
+INSERT INTO bup_vp.t1 VALUES ("01 Some data to test");
+INSERT INTO bup_vp.t1 VALUES ("02 Some data to test");
+INSERT INTO bup_vp.t1 VALUES ("03 Some data to test");
+INSERT INTO bup_vp.t1 VALUES ("04 Some data to test");
+INSERT INTO bup_vp.t1 VALUES ("05 Some data to test");
+
+INSERT INTO bup_vp.t2 VALUES ("01 Some data to test");
+INSERT INTO bup_vp.t2 VALUES ("02 Some data to test");
+INSERT INTO bup_vp.t2 VALUES ("03 Some data to test");
+INSERT INTO bup_vp.t2 VALUES ("04 Some data to test");
+INSERT INTO bup_vp.t2 VALUES ("05 Some data to test");
+
+INSERT INTO bup_vp.t3 VALUES ("01 Some data to test");
+INSERT INTO bup_vp.t3 VALUES ("02 Some data to test");
+INSERT INTO bup_vp.t3 VALUES ("03 Some data to test");
+INSERT INTO bup_vp.t3 VALUES ("04 Some data to test");
+INSERT INTO bup_vp.t3 VALUES ("05 Some data to test");
+
+--echo 
+--echo con_bup: Show the data before we start backup
+SELECT * FROM bup_vp.t1;
+SELECT * FROM bup_vp.t2;
+SELECT * FROM bup_vp.t3;
+
+### CON 3 ###
+      --echo 
+      connection con_tx3;
+
+      --echo Scenario d) - commit after VP; tx not included in backup
+      --echo con_tx3: Start transaction but do not commit
+      BEGIN;
+          INSERT INTO bup_vp.t3 VALUES ("tx3: 06 Should NOT be in backup");
+
+### CON 1 ###
+  --echo 
+  connection con_tx1;
+
+  --echo Scenario b) - Commit in progress blocks CB; tx is included in backup
+  --echo con_tx1: Get a transaction going and stop in the middle of commit
+  BEGIN;
+      INSERT INTO bup_vp.t1 VALUES ("tx1: 06 Some data to test");
+
+      --echo con_tx1: Make commit stop in the middle of execution
+      # Will continue once backup has been blocked from setting CB
+      SET DEBUG_SYNC= 'within_ha_commit_trans SIGNAL commit_started
+                       WAIT_FOR complete_commit';
+      send COMMIT;
+
+### CON 2 ###
+    --echo 
+    connection con_tx2;
+
+    --echo Scenario c) - commit blocked by CB; tx not included in backup
+    --echo con_tx2: Wait until tx1 has started
+    SET DEBUG_SYNC= 'now WAIT_FOR commit_started';
+    --echo con_tx2: Start transaction but do not commit
+    BEGIN;
+        INSERT INTO bup_vp.t2 VALUES ("tx2: 06 Should NOT be in backup");
+    
+### CON BUP ###
+--echo 
+connection con_bup;
+
+# Backup will be blocked from setting CB by the ongoing commit in
+# con_tx1. Backup will signal con_tx1 that it has been blocked. The
+# commit will then finish, making backup able to set CB. When CB has
+# been set, tx2 will be signaled to try to commit. tx2 commit will be
+# blocked by the CB and send a signal that it has been blocked. CB is
+# then released, but backup is stopped immediately after releasing CB.
+# tx2 will now be able to complete the commit, and tx3 will issue and
+# complete a commit. Finally, backup is allowed to complete.
+
+--echo con_bup: Activate synchronization points for BACKUP.
+# Signal when backup is blocked by ongoing commit in con_tx1
+SET DEBUG_SYNC= 'wait_lock_global_read_lock SIGNAL sync_complete_commit';
+
+# tx1 commit is completed, so backup can set CB. Just before reaching
+# VP, signal tx2 should try to commit. Wait until tx2 signals it has
+# been blocked
+SET DEBUG_SYNC= 'before_backup_data_lock SIGNAL try_commit 
+                 WAIT_FOR commit_blocked';
+
+# tx2 commit has been blocked. Create VP and release CB, and then wait
+# while tx2 and tx2 commits.
+SET DEBUG_SYNC= 'after_backup_binlog SIGNAL commit_unblocked
+                 WAIT_FOR finish_bup';
+
+--echo con_bup: Backing up database -- will block with lock
+send BACKUP DATABASE bup_vp TO "bup_vp.bak";
+
+
+### CON SYNC ###
+--echo 
+connection con_sync;
+SET DEBUG_SYNC= 'now WAIT_FOR sync_complete_commit';
+--echo Backup has been blocked by ongoing commit
+
+--echo Check that con_tx1 has not committed; Should be 0 records
+SELECT * FROM bup_vp.t1 WHERE col_a like 'tx1%';
+--echo 
+
+SET DEBUG_SYNC= 'now SIGNAL complete_commit';
+
+### CON 1 ###
+  --echo 
+  connection con_tx1;
+  --echo con_tx1: Reap commit
+  reap;
+  --echo Check that con_tx1 has committed; Should be 1 record
+  SELECT * FROM bup_vp.t1 WHERE col_a like 'tx1%';
+  --echo 
+
+###########
+## Below this line happens after BACKUP has taken CB
+###########
+
+### CON 2 ###
+    --echo 
+    connection con_tx2;
+    --echo con_tx2: Commit request will be blocked by CB
+
+    # Wait for backup to set CB
+    SET DEBUG_SYNC= 'now WAIT_FOR try_commit';
+
+    # Signal to backup that the commit is blocked
+    SET DEBUG_SYNC= 'wait_if_global_read_lock SIGNAL sync_commit_blocked';
+
+    send COMMIT;
+
+    # Test is blocked on COMMIT until CB has been released
+
+### CON SYNC ###
+--echo 
+connection con_sync;
+SET DEBUG_SYNC= 'now WAIT_FOR sync_commit_blocked';
+
+--echo Check that con_tx2 has not committed; Should be 0 records
+SELECT * FROM bup_vp.t2 WHERE col_a like 'tx2%';
+--echo 
+
+SET DEBUG_SYNC= 'now SIGNAL commit_blocked';
+
+### CON 2 ###
+    --echo 
+    connection con_tx2;
+    --echo con_bup: Reap commit
+    # commit completes only after CB has been released
+    reap;
+
+    --echo con_tx2: Backup has now released CB.
+    --echo Check that con_tx2 has committed; Should be 1 record
+    SELECT * FROM bup_vp.t2 WHERE col_a like 'tx2%';
+    --echo 
+
+### CON 3 ###
+      --echo 
+      connection con_tx3;
+      --echo con_tx3: Backup has now released CB. Commit transaction
+
+      # Double-check that backup has reached sync point after CB release
+      SET DEBUG_SYNC= 'now WAIT_FOR commit_unblocked';
+      COMMIT;
+      SET DEBUG_SYNC= 'now SIGNAL finish_bup';
+
+
+### CON BUP ###
+--echo 
+connection con_bup;
+--echo con_bup: Reap backup
+--replace_column 1 #
+reap;
+
+###########
+## Verify results
+###########
+
+# Do selects to show that all changes got applied.
+--echo 
+--echo con_bup: Showing data after updates and backup
+SELECT * FROM bup_vp.t1;
+SELECT * FROM bup_vp.t2;
+SELECT * FROM bup_vp.t3;
+
+--echo con_bup: Dropping the database
+DROP TABLE bup_vp.t1;
+DROP TABLE bup_vp.t2;
+DROP TABLE bup_vp.t3;
+DROP DATABASE bup_vp;
+
+--echo con_bup: Restoring the database
+--replace_column 1 #
+RESTORE FROM "bup_vp.bak";
+
+--echo 
+--echo con_bup: Showing the data after restore (tx2 and tx3 should not be there)
+SELECT * FROM bup_vp.t1;
+SELECT * FROM bup_vp.t2;
+SELECT * FROM bup_vp.t3;
+
+--echo
+--echo Verifying results:
+--echo
+
+--echo T1 should have changes from con_tx1; Should be 1 record
+SELECT * FROM bup_vp.t1 WHERE col_a like 'tx1%';
+
+--echo 
+--echo T2 should not have the changes from con_tx2; Should be 0 records
+SELECT * FROM bup_vp.t2 WHERE col_a like 'tx2%';
+
+--echo 
+--echo T3 should not have the changes from con_tx3; Should be 0 records
+SELECT * FROM bup_vp.t3 WHERE col_a like 'tx3%';
+
+--echo 
+--echo con_bup: Cleanup
+DROP DATABASE bup_vp;
+
+remove_file $bdir/bup_vp.bak;
+SET DEBUG_SYNC= 'RESET';

=== modified file 'mysql-test/suite/backup_engines/include/backup_ptr_commit.inc'
--- a/mysql-test/suite/backup_engines/include/backup_ptr_commit.inc	2008-10-08 04:26:25 +0000
+++ b/mysql-test/suite/backup_engines/include/backup_ptr_commit.inc	2008-11-17 09:57:51 +0000
@@ -202,7 +202,7 @@ SELECT * FROM ptr.t3;
 
 --echo Perform restore operation
 --replace_column 1 #
-RESTORE FROM 'ptr_commit.bak';
+RESTORE FROM 'ptr_commit.bak' OVERWRITE;
 SHOW TABLES FROM ptr;
 SELECT * FROM ptr.t1;
 SELECT * FROM ptr.t2;

=== modified file 'mysql-test/suite/backup_engines/r/backup_online_testing.result'
--- a/mysql-test/suite/backup_engines/r/backup_online_testing.result	2008-06-30 19:40:33 +0000
+++ b/mysql-test/suite/backup_engines/r/backup_online_testing.result	2008-11-19 22:01:28 +0000
@@ -1135,3 +1135,4 @@ COUNT(*)
 ***  DROP bup_online DATABASE ****
 
 DROP DATABASE bup_online;
+SET DEBUG_SYNC= 'RESET';

=== modified file 'mysql-test/suite/backup_engines/r/backup_ptr_commit_mixed.result'
--- a/mysql-test/suite/backup_engines/r/backup_ptr_commit_mixed.result	2008-10-08 04:26:25 +0000
+++ b/mysql-test/suite/backup_engines/r/backup_ptr_commit_mixed.result	2008-11-17 09:57:51 +0000
@@ -304,7 +304,7 @@ id	name
 Perform Restore and Recover committed data using mysqlbinlog position
 after backup.
 Perform restore operation
-RESTORE FROM 'ptr_commit.bak';
+RESTORE FROM 'ptr_commit.bak' OVERWRITE;
 backup_id
 #
 SHOW TABLES FROM ptr;

=== modified file 'mysql-test/suite/backup_engines/r/backup_ptr_commit_row.result'
--- a/mysql-test/suite/backup_engines/r/backup_ptr_commit_row.result	2008-10-08 04:26:25 +0000
+++ b/mysql-test/suite/backup_engines/r/backup_ptr_commit_row.result	2008-11-17 09:57:51 +0000
@@ -304,7 +304,7 @@ id	name
 Perform Restore and Recover committed data using mysqlbinlog position
 after backup.
 Perform restore operation
-RESTORE FROM 'ptr_commit.bak';
+RESTORE FROM 'ptr_commit.bak' OVERWRITE;
 backup_id
 #
 SHOW TABLES FROM ptr;

=== modified file 'mysql-test/suite/backup_engines/r/backup_ptr_commit_stmt.result'
--- a/mysql-test/suite/backup_engines/r/backup_ptr_commit_stmt.result	2008-10-08 04:26:25 +0000
+++ b/mysql-test/suite/backup_engines/r/backup_ptr_commit_stmt.result	2008-11-17 09:57:51 +0000
@@ -304,7 +304,7 @@ id	name
 Perform Restore and Recover committed data using mysqlbinlog position
 after backup.
 Perform restore operation
-RESTORE FROM 'ptr_commit.bak';
+RESTORE FROM 'ptr_commit.bak' OVERWRITE;
 backup_id
 #
 SHOW TABLES FROM ptr;

=== modified file 'mysql-test/suite/backup_engines/r/backup_tmp_tables.result'
--- a/mysql-test/suite/backup_engines/r/backup_tmp_tables.result	2008-10-30 12:29:54 +0000
+++ b/mysql-test/suite/backup_engines/r/backup_tmp_tables.result	2008-11-17 09:57:51 +0000
@@ -29,7 +29,7 @@ backup_id
 ** Drop and restore the database
 DROP TABLE t1;
 DROP TABLE t2;
-RESTORE FROM 'db.bkp';
+RESTORE FROM 'db.bkp' OVERWRITE;
 backup_id
 #
 ** Check definitions of the tables after restore

=== modified file 'mysql-test/suite/backup_engines/t/backup_online_testing.test'
--- a/mysql-test/suite/backup_engines/t/backup_online_testing.test	2008-06-30 19:40:33 +0000
+++ b/mysql-test/suite/backup_engines/t/backup_online_testing.test	2008-11-19 22:01:28 +0000
@@ -1152,3 +1152,4 @@ DROP DATABASE bup_online;
 
 remove_file $MYSQLTEST_VARDIR/master-data/bup_online.bak;
 
+SET DEBUG_SYNC= 'RESET';

=== modified file 'mysql-test/suite/backup_engines/t/backup_tmp_tables.test'
--- a/mysql-test/suite/backup_engines/t/backup_tmp_tables.test	2008-11-12 17:42:23 +0000
+++ b/mysql-test/suite/backup_engines/t/backup_tmp_tables.test	2008-11-17 09:57:51 +0000
@@ -52,7 +52,7 @@ BACKUP DATABASE db TO 'db.bkp';
 DROP TABLE t1;
 DROP TABLE t2;
 --replace_column 1 #
-RESTORE FROM 'db.bkp';
+RESTORE FROM 'db.bkp' OVERWRITE;
 
 #
 # Note: Above DROP TABLE statements should be removed once BUG#30099 is fixed.

=== added file 'mysql-test/suite/falcon/r/falcon_bug_34351_A-big.result'
--- a/mysql-test/suite/falcon/r/falcon_bug_34351_A-big.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/falcon/r/falcon_bug_34351_A-big.result	2008-11-20 15:58:23 +0000
@@ -0,0 +1,43 @@
+*** Bug #34351_A ***
+SET @@storage_engine = 'Falcon';
+DROP TABLE IF EXISTS t1;
+DROP PROCEDURE IF EXISTS p1;
+# Establish connection conn1 (user = root)
+SET @@autocommit = 1;
+# Switch to connection default
+SET @@autocommit = 1;
+CREATE TABLE t1 (
+t1_autoinc INTEGER NOT NULL AUTO_INCREMENT,
+t1_uuid CHAR(36),
+PRIMARY KEY (t1_autoinc), KEY (t1_uuid)
+) ENGINE = Falcon;
+CREATE PROCEDURE p1 ()
+begin
+DECLARE my_count INT DEFAULT 0;
+DECLARE my_uuid CHAR(36) DEFAULT 0;
+while my_count < 20000 do
+SET my_uuid = UUID();
+START TRANSACTION;
+INSERT INTO t1 (t1_uuid) VALUES (my_uuid);
+DELETE FROM t1 WHERE t1_uuid IN (my_uuid);
+COMMIT;
+SET my_count = my_count + 1;
+end while;
+end//
+# Send call p1() to the server but do not pull the results
+CALL p1();
+# Switch to connection conn1
+CALL p1();
+# Switch to connection default
+# Pull the results of the preceeding call p1()
+# Send call p1() to the server but do not pull the results
+CALL p1();
+# Switch to connection conn1
+CALL p1();
+# Switch to connection default
+# Pull the results of the preceeding call p1()
+SELECT count(*) FROM t1;
+count(*)
+0
+DROP PROCEDURE p1;
+DROP TABLE t1;

=== modified file 'mysql-test/suite/falcon/r/falcon_bug_34351_A.result'
--- a/mysql-test/suite/falcon/r/falcon_bug_34351_A.result	2008-03-05 20:25:44 +0000
+++ b/mysql-test/suite/falcon/r/falcon_bug_34351_A.result	2008-11-20 15:58:23 +0000
@@ -15,7 +15,7 @@ CREATE PROCEDURE p1 ()
 begin
 DECLARE my_count INT DEFAULT 0;
 DECLARE my_uuid CHAR(36) DEFAULT 0;
-while my_count < 10000 do
+while my_count < 5000 do
 SET my_uuid = UUID();
 START TRANSACTION;
 INSERT INTO t1 (t1_uuid) VALUES (my_uuid);
@@ -40,3 +40,4 @@ SELECT count(*) FROM t1;
 count(*)
 0
 DROP PROCEDURE p1;
+DROP TABLE t1;

=== added file 'mysql-test/suite/falcon/r/falcon_bug_34351_C-big.result'
--- a/mysql-test/suite/falcon/r/falcon_bug_34351_C-big.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/falcon/r/falcon_bug_34351_C-big.result	2008-11-20 15:58:23 +0000
@@ -0,0 +1,39 @@
+*** Bug #34351_C-big ***
+SET @@storage_engine = 'Falcon';
+DROP TABLE IF EXISTS t1;
+DROP PROCEDURE IF EXISTS p1;
+# Establish connection conn1 (user = root)
+SET @@autocommit = 1;
+# Switch to connection default
+SET @@autocommit = 1;
+CREATE TABLE t1 (
+t1_autoinc INTEGER NOT NULL AUTO_INCREMENT,
+t1_uuid CHAR(36),
+PRIMARY KEY (t1_autoinc), key(t1_uuid)
+) ENGINE = Falcon;
+CREATE PROCEDURE p1 ()
+begin
+DECLARE my_count INT DEFAULT 0;
+DECLARE my_uuid CHAR(36) DEFAULT 0;
+SET FALCON_CONSISTENT_READ=OFF;
+while my_count < 20000 do
+SET my_uuid = UUID();
+INSERT INTO t1 (t1_uuid) VALUES (my_uuid);
+DELETE FROM t1 WHERE t1_uuid IN (my_uuid);
+SET my_count = my_count + 1;
+end while;
+end//
+# Send call p1() to the server but do not pull the results
+CALL p1();
+# Switch to connection conn1
+CALL p1();
+# Switch to connection default
+# Pull the results of the preceeding call p1()
+# Send call p1() to the server but do not pull the results
+CALL p1();
+# Switch to connection conn1
+CALL p1();
+# Switch to connection default
+# Pull the results of the preceeding call p1()
+DROP PROCEDURE p1;
+DROP TABLE t1;

=== modified file 'mysql-test/suite/falcon/r/falcon_bug_34351_C.result'
--- a/mysql-test/suite/falcon/r/falcon_bug_34351_C.result	2008-09-28 08:07:30 +0000
+++ b/mysql-test/suite/falcon/r/falcon_bug_34351_C.result	2008-11-20 15:58:23 +0000
@@ -16,7 +16,7 @@ begin
 DECLARE my_count INT DEFAULT 0;
 DECLARE my_uuid CHAR(36) DEFAULT 0;
 SET FALCON_CONSISTENT_READ=OFF;
-while my_count < 10000 do
+while my_count < 5000 do
 SET my_uuid = UUID();
 INSERT INTO t1 (t1_uuid) VALUES (my_uuid);
 DELETE FROM t1 WHERE t1_uuid IN (my_uuid);

=== added file 'mysql-test/suite/falcon/r/falcon_bug_39702.result'
--- a/mysql-test/suite/falcon/r/falcon_bug_39702.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/falcon/r/falcon_bug_39702.result	2008-11-25 09:56:21 +0000
@@ -0,0 +1,7 @@
+*** Bug #39702 ***
+SET @@storage_engine = 'Falcon';
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1(a INT) PARTITION BY RANGE(a) (
+PARTITION p1 VALUES LESS THAN (10) TABLESPACE nosuchtablespace,
+PARTITION p2 VALUES LESS THAN MAXVALUE TABLESPACE nosuchtablespace);
+ERROR HY000: Tablespace 'nosuchtablespace' doesn't exist

=== modified file 'mysql-test/suite/falcon/r/falcon_bug_39708.result'
--- a/mysql-test/suite/falcon/r/falcon_bug_39708.result	2008-10-29 11:41:14 +0000
+++ b/mysql-test/suite/falcon/r/falcon_bug_39708.result	2008-11-27 08:45:16 +0000
@@ -1,4 +1,7 @@
-CREATE TABLE t1(a VARCHAR(140) CHARACTER SET utf8, KEY(a)) ENGINE=falcon;
+*** Bug #39708 ***
+SET @@storage_engine = 'Falcon';
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1(a VARCHAR(140) CHARACTER SET utf8, KEY(a));
 ERROR 42000: Specified key was too long; max key length is 540 bytes
 SHOW WARNINGS;
 Level	Code	Message

=== added file 'mysql-test/suite/falcon/r/falcon_bug_40614.result'
--- a/mysql-test/suite/falcon/r/falcon_bug_40614.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/falcon/r/falcon_bug_40614.result	2008-11-24 08:56:29 +0000
@@ -0,0 +1,774 @@
+*** Bug #40614 ***
+SET @@storage_engine = 'Falcon';
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (datetime_key datetime, key(datetime_key));
+insert into t1 values ('0000-00-00');
+select * from  t1 where datetime_key < '1000-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1901-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1902-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1903-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1904-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1905-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1906-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1907-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1908-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1909-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1910-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1911-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1912-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1913-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1914-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1915-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1916-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1917-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1918-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1919-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1920-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1921-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1922-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1923-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1924-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1925-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1926-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1927-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1928-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1929-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1930-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1931-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1932-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1933-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1934-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1935-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1936-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1937-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1938-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1939-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1940-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1941-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1942-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1943-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1944-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1945-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1946-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1947-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1948-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1949-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1950-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1951-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1952-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1953-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1954-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1955-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1956-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1957-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1958-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1959-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1960-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1961-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1962-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1963-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1964-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1965-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1966-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1967-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1968-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1969-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1970-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1971-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1972-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1973-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1974-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1975-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1976-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1977-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1978-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1979-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1980-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1981-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1982-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1983-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1984-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1985-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1986-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1987-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1988-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1989-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1990-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1991-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1992-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1993-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1994-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1995-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1996-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1997-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1998-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '1999-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2000-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2001-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2002-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2003-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2004-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2005-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2006-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2007-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2008-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2009-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2010-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2011-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2012-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2013-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2014-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2015-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2016-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2017-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2018-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2019-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2020-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2021-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2022-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2023-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2024-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2025-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2026-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2027-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2028-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2029-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2030-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2031-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2032-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2033-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2034-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2035-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2036-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2037-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2038-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2039-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2040-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2041-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2042-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2043-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2044-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2045-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2046-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2047-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2048-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2049-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2050-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2051-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2052-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2053-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2054-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2055-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2056-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2057-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2058-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2059-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2060-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2061-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2062-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2063-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2064-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2065-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2066-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2067-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2068-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2069-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2070-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2071-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2072-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2073-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2074-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2075-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2076-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2077-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2078-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2079-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2080-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2081-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2082-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2083-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2084-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2085-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2086-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2087-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2088-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2089-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2090-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2091-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2092-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2093-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2094-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2095-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2096-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2097-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2098-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2099-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2100-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2101-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2102-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2103-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2104-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2105-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2106-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2107-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2108-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2109-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2110-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2111-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2112-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2113-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2114-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2115-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2116-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2117-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2118-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2119-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2120-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2121-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2122-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2123-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2124-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2125-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2126-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2127-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2128-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2129-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2130-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2131-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2132-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2133-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2134-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2135-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2136-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2137-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2138-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2139-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2140-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2141-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2142-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2143-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2144-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2145-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2146-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2147-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2148-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2149-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2150-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2151-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2152-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2153-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '2154-01-01';
+datetime_key
+0000-00-00 00:00:00
+select * from  t1 where datetime_key < '9999-12-31';
+datetime_key
+0000-00-00 00:00:00
+DROP TABLE t1;

=== added file 'mysql-test/suite/falcon/t/falcon_bug_34351_A-big.test'
--- a/mysql-test/suite/falcon/t/falcon_bug_34351_A-big.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/falcon/t/falcon_bug_34351_A-big.test	2008-11-20 15:58:23 +0000
@@ -0,0 +1,101 @@
+--source include/have_falcon.inc
+--source include/big_test.inc
+#
+# Bug #34351: Update Conflict on non-overlapping transactions.
+#
+# Test A-big: Running loop of 20 000 iterations inside procedure. 
+# Original test ran 10k iterations but could potentially time 
+# out in Pushbuild (automatic testing). Original test 
+# (falcon_bug_24351_A.test) changed to run the loop 5k times 
+# per procedure call instead.
+#
+# This test works because the INSERT and DELETE are in the same 
+# transaction and so the INSERT is not seen by other transactions.
+#
+--echo *** Bug #34351_A ***
+
+# ----------------------------------------------------- #
+# --- Initialisation                                --- #
+# ----------------------------------------------------- #
+let $engine = 'Falcon';
+eval SET @@storage_engine = $engine;
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+DROP PROCEDURE IF EXISTS p1;
+--enable_warnings
+
+--echo # Establish connection conn1 (user = root)
+connect (conn1,localhost,root,,);
+SET @@autocommit = 1;
+
+--echo # Switch to connection default
+connection default;
+SET @@autocommit = 1;
+
+CREATE TABLE t1 (
+  t1_autoinc INTEGER NOT NULL AUTO_INCREMENT,
+  t1_uuid CHAR(36),
+  PRIMARY KEY (t1_autoinc), KEY (t1_uuid)
+) ENGINE = Falcon;
+
+#   declare continue handler for sqlexception
+
+delimiter //;
+CREATE PROCEDURE p1 ()
+begin
+  DECLARE my_count INT DEFAULT 0;
+  DECLARE my_uuid CHAR(36) DEFAULT 0;
+  while my_count < 20000 do
+    SET my_uuid = UUID();
+	START TRANSACTION;
+    INSERT INTO t1 (t1_uuid) VALUES (my_uuid);
+    DELETE FROM t1 WHERE t1_uuid IN (my_uuid);
+    COMMIT;
+    SET my_count = my_count + 1;
+  end while;
+end//
+delimiter ;//
+
+# ----------------------------------------------------- #
+# --- Test                                          --- #
+# ----------------------------------------------------- #
+
+--echo # Send call p1() to the server but do not pull the results
+--send CALL p1()
+
+--echo # Switch to connection conn1
+connection conn1;
+--real_sleep 1
+CALL p1();
+
+--echo # Switch to connection default
+connection default;
+--echo # Pull the results of the preceeding call p1()
+--reap
+--echo # Send call p1() to the server but do not pull the results
+--real_sleep 1
+--send CALL p1()
+
+--echo # Switch to connection conn1
+connection conn1;
+--real_sleep 1
+CALL p1();
+
+--echo # Switch to connection default
+connection default;
+--echo # Pull the results of the preceeding call p1()
+--reap
+
+
+# ----------------------------------------------------- #
+# --- Check                                         --- #
+# ----------------------------------------------------- #
+# Checking row count is not applicable here.
+SELECT count(*) FROM t1;
+
+# ----------------------------------------------------- #
+# --- Final cleanup                                 --- #
+# ----------------------------------------------------- #
+DROP PROCEDURE p1;
+DROP TABLE t1;

=== modified file 'mysql-test/suite/falcon/t/falcon_bug_34351_A.test'
--- a/mysql-test/suite/falcon/t/falcon_bug_34351_A.test	2008-03-05 20:25:44 +0000
+++ b/mysql-test/suite/falcon/t/falcon_bug_34351_A.test	2008-11-20 15:58:23 +0000
@@ -38,7 +38,7 @@ CREATE PROCEDURE p1 ()
 begin
   DECLARE my_count INT DEFAULT 0;
   DECLARE my_uuid CHAR(36) DEFAULT 0;
-  while my_count < 10000 do
+  while my_count < 5000 do
     SET my_uuid = UUID();
 	START TRANSACTION;
     INSERT INTO t1 (t1_uuid) VALUES (my_uuid);
@@ -90,3 +90,4 @@ SELECT count(*) FROM t1;
 # --- Final cleanup                                 --- #
 # ----------------------------------------------------- #
 DROP PROCEDURE p1;
+DROP TABLE t1;

=== added file 'mysql-test/suite/falcon/t/falcon_bug_34351_C-big.test'
--- a/mysql-test/suite/falcon/t/falcon_bug_34351_C-big.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/falcon/t/falcon_bug_34351_C-big.test	2008-11-20 15:58:23 +0000
@@ -0,0 +1,101 @@
+--source include/have_falcon.inc
+--source include/big_test.inc
+
+#
+# Bug #34351: Update Conflict on non-overlapping transactions
+# This test works because it uses FALCON_CONSISTENT_READ=OFF
+#
+# Test C-big: Running loop of 20 000 iterations inside procedure.
+# Original test ran 10k iterations but would sometimes time
+# out in Pushbuild (automatic testing) - Bug#35503.
+# 
+# Original test (falcon_bug_24351_C.test) changed to run the 
+# loop 5k times per procedure call instead, hoping that it 
+# would still be able to detect a regression. 
+# This -big test was created as an extra precaution, in 
+# case 5k iterations is not enough.
+#
+#
+--echo *** Bug #34351_C-big ***
+
+# ----------------------------------------------------- #
+# --- Initialisation                                --- #
+# ----------------------------------------------------- #
+let $engine = 'Falcon';
+eval SET @@storage_engine = $engine;
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+DROP PROCEDURE IF EXISTS p1;
+--enable_warnings
+
+--echo # Establish connection conn1 (user = root)
+connect (conn1,localhost,root,,);
+SET @@autocommit = 1;
+
+--echo # Switch to connection default
+connection default;
+SET @@autocommit = 1;
+
+CREATE TABLE t1 (
+  t1_autoinc INTEGER NOT NULL AUTO_INCREMENT,
+  t1_uuid CHAR(36),
+  PRIMARY KEY (t1_autoinc), key(t1_uuid)
+) ENGINE = Falcon;
+
+delimiter //;
+CREATE PROCEDURE p1 ()
+begin
+  DECLARE my_count INT DEFAULT 0;
+  DECLARE my_uuid CHAR(36) DEFAULT 0;
+  SET FALCON_CONSISTENT_READ=OFF;
+  while my_count < 20000 do
+    SET my_uuid = UUID();
+    INSERT INTO t1 (t1_uuid) VALUES (my_uuid);
+    DELETE FROM t1 WHERE t1_uuid IN (my_uuid);
+    SET my_count = my_count + 1;
+  end while;
+end//
+delimiter ;//
+
+# ----------------------------------------------------- #
+# --- Test                                          --- #
+# ----------------------------------------------------- #
+
+--echo # Send call p1() to the server but do not pull the results
+--send CALL p1()
+
+--echo # Switch to connection conn1
+connection conn1;
+--real_sleep 1
+CALL p1();
+
+--echo # Switch to connection default
+connection default;
+--echo # Pull the results of the preceeding call p1()
+--reap
+--echo # Send call p1() to the server but do not pull the results
+--real_sleep 1
+--send CALL p1()
+
+--echo # Switch to connection conn1
+connection conn1;
+--real_sleep 1
+CALL p1();
+
+--echo # Switch to connection default
+connection default;
+--echo # Pull the results of the preceeding call p1()
+--reap
+
+# ----------------------------------------------------- #
+# --- Check                                         --- #
+# ----------------------------------------------------- #
+# Checking row count is not applicable here.
+#SELECT count(*) FROM t1;
+
+# ----------------------------------------------------- #
+# --- Final cleanup                                 --- #
+# ----------------------------------------------------- #
+DROP PROCEDURE p1;
+DROP TABLE t1;

=== modified file 'mysql-test/suite/falcon/t/falcon_bug_34351_C.test'
--- a/mysql-test/suite/falcon/t/falcon_bug_34351_C.test	2008-09-28 08:07:30 +0000
+++ b/mysql-test/suite/falcon/t/falcon_bug_34351_C.test	2008-11-20 15:58:23 +0000
@@ -37,7 +37,7 @@ begin
   DECLARE my_count INT DEFAULT 0;
   DECLARE my_uuid CHAR(36) DEFAULT 0;
   SET FALCON_CONSISTENT_READ=OFF;
-  while my_count < 10000 do
+  while my_count < 5000 do
     SET my_uuid = UUID();
     INSERT INTO t1 (t1_uuid) VALUES (my_uuid);
     DELETE FROM t1 WHERE t1_uuid IN (my_uuid);

=== added file 'mysql-test/suite/falcon/t/falcon_bug_39702.test'
--- a/mysql-test/suite/falcon/t/falcon_bug_39702.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/falcon/t/falcon_bug_39702.test	2008-11-25 09:56:21 +0000
@@ -0,0 +1,34 @@
+--source include/have_falcon.inc
+--source include/have_partition.inc
+
+#
+# Bug #39702: Unspecific error msg when using non-existent tablespace in
+#             partition definition
+#
+--echo *** Bug #39702 ***
+
+# ----------------------------------------------------- #
+# --- Initialisation                                --- #
+# ----------------------------------------------------- #
+let $engine = 'Falcon';
+eval SET @@storage_engine = $engine;
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+# ----------------------------------------------------- #
+# --- Test                                          --- #
+# ----------------------------------------------------- #
+--error ER_NO_SUCH_TABLESPACE
+CREATE TABLE t1(a INT) PARTITION BY RANGE(a) (
+  PARTITION p1 VALUES LESS THAN (10) TABLESPACE nosuchtablespace,
+  PARTITION p2 VALUES LESS THAN MAXVALUE TABLESPACE nosuchtablespace);
+
+# ----------------------------------------------------- #
+# --- Check                                         --- #
+# ----------------------------------------------------- #
+
+# ----------------------------------------------------- #
+# --- Final cleanup                                 --- #
+# ----------------------------------------------------- #

=== modified file 'mysql-test/suite/falcon/t/falcon_bug_39708.test'
--- a/mysql-test/suite/falcon/t/falcon_bug_39708.test	2008-11-27 08:24:39 +0000
+++ b/mysql-test/suite/falcon/t/falcon_bug_39708.test	2008-11-27 08:45:16 +0000
@@ -27,7 +27,7 @@ SHOW WARNINGS;
 # --- Check                                         --- #
 # ----------------------------------------------------- #
 # Check not applicable here.
-SELECT count(*) FROM t1;
+#SELECT count(*) FROM t1;
 
 # ----------------------------------------------------- #
 # --- Final cleanup                                 --- #

=== added file 'mysql-test/suite/falcon/t/falcon_bug_40614.test'
--- a/mysql-test/suite/falcon/t/falcon_bug_40614.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/falcon/t/falcon_bug_40614.test	2008-11-24 08:56:29 +0000
@@ -0,0 +1,311 @@
+--source include/have_falcon.inc
+
+#
+# Bug #40614: Falcon datetime indexes can not handle 0000-00-00
+#
+--echo *** Bug #40614 ***
+
+# ----------------------------------------------------- #
+# --- Initialisation                                --- #
+# ----------------------------------------------------- #
+let $engine = 'Falcon';
+eval SET @@storage_engine = $engine;
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+# ----------------------------------------------------- #
+# --- Test                                          --- #
+# ----------------------------------------------------- #
+
+CREATE TABLE t1 (datetime_key datetime, key(datetime_key));
+insert into t1 values ('0000-00-00'); 
+
+# The returned row would vary depending on the year, therefore
+# we are testing for a lot of them.
+#
+# The valid datetime value ranges from '1000-01-01 00:00:00'
+# to '9999-12-31 23:59:59'. This is too many values to test
+# all of them in a simple bug test, but I have included 
+# the endpoints as well as the range of the YEAR type. 
+# This should be more than sufficient to test for this bug 
+# and some more.
+#
+# Pointers to the reference manual are:
+#
+# DATETIME:
+# http://dev.mysql.com/doc/refman/5.1/en/datetime.html
+#
+# YEAR:
+# http://dev.mysql.com/doc/refman/5.1/en/year.html
+#
+
+select * from  t1 where datetime_key < '1000-01-01';
+select * from  t1 where datetime_key < '1901-01-01';
+select * from  t1 where datetime_key < '1902-01-01';
+select * from  t1 where datetime_key < '1903-01-01';
+select * from  t1 where datetime_key < '1904-01-01';
+select * from  t1 where datetime_key < '1905-01-01';
+select * from  t1 where datetime_key < '1906-01-01';
+select * from  t1 where datetime_key < '1907-01-01';
+select * from  t1 where datetime_key < '1908-01-01';
+select * from  t1 where datetime_key < '1909-01-01';
+select * from  t1 where datetime_key < '1910-01-01';
+select * from  t1 where datetime_key < '1911-01-01';
+select * from  t1 where datetime_key < '1912-01-01';
+select * from  t1 where datetime_key < '1913-01-01';
+select * from  t1 where datetime_key < '1914-01-01';
+select * from  t1 where datetime_key < '1915-01-01';
+select * from  t1 where datetime_key < '1916-01-01';
+select * from  t1 where datetime_key < '1917-01-01';
+select * from  t1 where datetime_key < '1918-01-01';
+select * from  t1 where datetime_key < '1919-01-01';
+select * from  t1 where datetime_key < '1920-01-01';
+select * from  t1 where datetime_key < '1921-01-01';
+select * from  t1 where datetime_key < '1922-01-01';
+select * from  t1 where datetime_key < '1923-01-01';
+select * from  t1 where datetime_key < '1924-01-01';
+select * from  t1 where datetime_key < '1925-01-01';
+select * from  t1 where datetime_key < '1926-01-01';
+select * from  t1 where datetime_key < '1927-01-01';
+select * from  t1 where datetime_key < '1928-01-01';
+select * from  t1 where datetime_key < '1929-01-01';
+select * from  t1 where datetime_key < '1930-01-01';
+select * from  t1 where datetime_key < '1931-01-01';
+select * from  t1 where datetime_key < '1932-01-01';
+select * from  t1 where datetime_key < '1933-01-01';
+select * from  t1 where datetime_key < '1934-01-01';
+select * from  t1 where datetime_key < '1935-01-01';
+select * from  t1 where datetime_key < '1936-01-01';
+select * from  t1 where datetime_key < '1937-01-01';
+select * from  t1 where datetime_key < '1938-01-01';
+select * from  t1 where datetime_key < '1939-01-01';
+select * from  t1 where datetime_key < '1940-01-01';
+select * from  t1 where datetime_key < '1941-01-01';
+select * from  t1 where datetime_key < '1942-01-01';
+select * from  t1 where datetime_key < '1943-01-01';
+select * from  t1 where datetime_key < '1944-01-01';
+select * from  t1 where datetime_key < '1945-01-01';
+select * from  t1 where datetime_key < '1946-01-01';
+select * from  t1 where datetime_key < '1947-01-01';
+select * from  t1 where datetime_key < '1948-01-01';
+select * from  t1 where datetime_key < '1949-01-01';
+select * from  t1 where datetime_key < '1950-01-01';
+select * from  t1 where datetime_key < '1951-01-01';
+select * from  t1 where datetime_key < '1952-01-01';
+select * from  t1 where datetime_key < '1953-01-01';
+select * from  t1 where datetime_key < '1954-01-01';
+select * from  t1 where datetime_key < '1955-01-01';
+select * from  t1 where datetime_key < '1956-01-01';
+select * from  t1 where datetime_key < '1957-01-01';
+select * from  t1 where datetime_key < '1958-01-01';
+select * from  t1 where datetime_key < '1959-01-01';
+select * from  t1 where datetime_key < '1960-01-01';
+select * from  t1 where datetime_key < '1961-01-01';
+select * from  t1 where datetime_key < '1962-01-01';
+select * from  t1 where datetime_key < '1963-01-01';
+select * from  t1 where datetime_key < '1964-01-01';
+select * from  t1 where datetime_key < '1965-01-01';
+select * from  t1 where datetime_key < '1966-01-01';
+select * from  t1 where datetime_key < '1967-01-01';
+select * from  t1 where datetime_key < '1968-01-01';
+select * from  t1 where datetime_key < '1969-01-01';
+select * from  t1 where datetime_key < '1970-01-01';
+select * from  t1 where datetime_key < '1971-01-01';
+select * from  t1 where datetime_key < '1972-01-01';
+select * from  t1 where datetime_key < '1973-01-01';
+select * from  t1 where datetime_key < '1974-01-01';
+select * from  t1 where datetime_key < '1975-01-01';
+select * from  t1 where datetime_key < '1976-01-01';
+select * from  t1 where datetime_key < '1977-01-01';
+select * from  t1 where datetime_key < '1978-01-01';
+select * from  t1 where datetime_key < '1979-01-01';
+select * from  t1 where datetime_key < '1980-01-01';
+select * from  t1 where datetime_key < '1981-01-01';
+select * from  t1 where datetime_key < '1982-01-01';
+select * from  t1 where datetime_key < '1983-01-01';
+select * from  t1 where datetime_key < '1984-01-01';
+select * from  t1 where datetime_key < '1985-01-01';
+select * from  t1 where datetime_key < '1986-01-01';
+select * from  t1 where datetime_key < '1987-01-01';
+select * from  t1 where datetime_key < '1988-01-01';
+select * from  t1 where datetime_key < '1989-01-01';
+select * from  t1 where datetime_key < '1990-01-01';
+select * from  t1 where datetime_key < '1991-01-01';
+select * from  t1 where datetime_key < '1992-01-01';
+select * from  t1 where datetime_key < '1993-01-01';
+select * from  t1 where datetime_key < '1994-01-01';
+select * from  t1 where datetime_key < '1995-01-01';
+select * from  t1 where datetime_key < '1996-01-01';
+select * from  t1 where datetime_key < '1997-01-01';
+select * from  t1 where datetime_key < '1998-01-01';
+select * from  t1 where datetime_key < '1999-01-01';
+select * from  t1 where datetime_key < '2000-01-01';
+select * from  t1 where datetime_key < '2001-01-01';
+select * from  t1 where datetime_key < '2002-01-01';
+select * from  t1 where datetime_key < '2003-01-01';
+select * from  t1 where datetime_key < '2004-01-01';
+select * from  t1 where datetime_key < '2005-01-01';
+select * from  t1 where datetime_key < '2006-01-01';
+select * from  t1 where datetime_key < '2007-01-01';
+select * from  t1 where datetime_key < '2008-01-01';
+select * from  t1 where datetime_key < '2009-01-01';
+select * from  t1 where datetime_key < '2010-01-01';
+select * from  t1 where datetime_key < '2011-01-01';
+select * from  t1 where datetime_key < '2012-01-01';
+select * from  t1 where datetime_key < '2013-01-01';
+select * from  t1 where datetime_key < '2014-01-01';
+select * from  t1 where datetime_key < '2015-01-01';
+select * from  t1 where datetime_key < '2016-01-01';
+select * from  t1 where datetime_key < '2017-01-01';
+select * from  t1 where datetime_key < '2018-01-01';
+select * from  t1 where datetime_key < '2019-01-01';
+select * from  t1 where datetime_key < '2020-01-01';
+select * from  t1 where datetime_key < '2021-01-01';
+select * from  t1 where datetime_key < '2022-01-01';
+select * from  t1 where datetime_key < '2023-01-01';
+select * from  t1 where datetime_key < '2024-01-01';
+select * from  t1 where datetime_key < '2025-01-01';
+select * from  t1 where datetime_key < '2026-01-01';
+select * from  t1 where datetime_key < '2027-01-01';
+select * from  t1 where datetime_key < '2028-01-01';
+select * from  t1 where datetime_key < '2029-01-01';
+select * from  t1 where datetime_key < '2030-01-01';
+select * from  t1 where datetime_key < '2031-01-01';
+select * from  t1 where datetime_key < '2032-01-01';
+select * from  t1 where datetime_key < '2033-01-01';
+select * from  t1 where datetime_key < '2034-01-01';
+select * from  t1 where datetime_key < '2035-01-01';
+select * from  t1 where datetime_key < '2036-01-01';
+select * from  t1 where datetime_key < '2037-01-01';
+select * from  t1 where datetime_key < '2038-01-01';
+select * from  t1 where datetime_key < '2039-01-01';
+select * from  t1 where datetime_key < '2040-01-01';
+select * from  t1 where datetime_key < '2041-01-01';
+select * from  t1 where datetime_key < '2042-01-01';
+select * from  t1 where datetime_key < '2043-01-01';
+select * from  t1 where datetime_key < '2044-01-01';
+select * from  t1 where datetime_key < '2045-01-01';
+select * from  t1 where datetime_key < '2046-01-01';
+select * from  t1 where datetime_key < '2047-01-01';
+select * from  t1 where datetime_key < '2048-01-01';
+select * from  t1 where datetime_key < '2049-01-01';
+select * from  t1 where datetime_key < '2050-01-01';
+select * from  t1 where datetime_key < '2051-01-01';
+select * from  t1 where datetime_key < '2052-01-01';
+select * from  t1 where datetime_key < '2053-01-01';
+select * from  t1 where datetime_key < '2054-01-01';
+select * from  t1 where datetime_key < '2055-01-01';
+select * from  t1 where datetime_key < '2056-01-01';
+select * from  t1 where datetime_key < '2057-01-01';
+select * from  t1 where datetime_key < '2058-01-01';
+select * from  t1 where datetime_key < '2059-01-01';
+select * from  t1 where datetime_key < '2060-01-01';
+select * from  t1 where datetime_key < '2061-01-01';
+select * from  t1 where datetime_key < '2062-01-01';
+select * from  t1 where datetime_key < '2063-01-01';
+select * from  t1 where datetime_key < '2064-01-01';
+select * from  t1 where datetime_key < '2065-01-01';
+select * from  t1 where datetime_key < '2066-01-01';
+select * from  t1 where datetime_key < '2067-01-01';
+select * from  t1 where datetime_key < '2068-01-01';
+select * from  t1 where datetime_key < '2069-01-01';
+select * from  t1 where datetime_key < '2070-01-01';
+select * from  t1 where datetime_key < '2071-01-01';
+select * from  t1 where datetime_key < '2072-01-01';
+select * from  t1 where datetime_key < '2073-01-01';
+select * from  t1 where datetime_key < '2074-01-01';
+select * from  t1 where datetime_key < '2075-01-01';
+select * from  t1 where datetime_key < '2076-01-01';
+select * from  t1 where datetime_key < '2077-01-01';
+select * from  t1 where datetime_key < '2078-01-01';
+select * from  t1 where datetime_key < '2079-01-01';
+select * from  t1 where datetime_key < '2080-01-01';
+select * from  t1 where datetime_key < '2081-01-01';
+select * from  t1 where datetime_key < '2082-01-01';
+select * from  t1 where datetime_key < '2083-01-01';
+select * from  t1 where datetime_key < '2084-01-01';
+select * from  t1 where datetime_key < '2085-01-01';
+select * from  t1 where datetime_key < '2086-01-01';
+select * from  t1 where datetime_key < '2087-01-01';
+select * from  t1 where datetime_key < '2088-01-01';
+select * from  t1 where datetime_key < '2089-01-01';
+select * from  t1 where datetime_key < '2090-01-01';
+select * from  t1 where datetime_key < '2091-01-01';
+select * from  t1 where datetime_key < '2092-01-01';
+select * from  t1 where datetime_key < '2093-01-01';
+select * from  t1 where datetime_key < '2094-01-01';
+select * from  t1 where datetime_key < '2095-01-01';
+select * from  t1 where datetime_key < '2096-01-01';
+select * from  t1 where datetime_key < '2097-01-01';
+select * from  t1 where datetime_key < '2098-01-01';
+select * from  t1 where datetime_key < '2099-01-01';
+select * from  t1 where datetime_key < '2100-01-01';
+select * from  t1 where datetime_key < '2101-01-01';
+select * from  t1 where datetime_key < '2102-01-01';
+select * from  t1 where datetime_key < '2103-01-01';
+select * from  t1 where datetime_key < '2104-01-01';
+select * from  t1 where datetime_key < '2105-01-01';
+select * from  t1 where datetime_key < '2106-01-01';
+select * from  t1 where datetime_key < '2107-01-01';
+select * from  t1 where datetime_key < '2108-01-01';
+select * from  t1 where datetime_key < '2109-01-01';
+select * from  t1 where datetime_key < '2110-01-01';
+select * from  t1 where datetime_key < '2111-01-01';
+select * from  t1 where datetime_key < '2112-01-01';
+select * from  t1 where datetime_key < '2113-01-01';
+select * from  t1 where datetime_key < '2114-01-01';
+select * from  t1 where datetime_key < '2115-01-01';
+select * from  t1 where datetime_key < '2116-01-01';
+select * from  t1 where datetime_key < '2117-01-01';
+select * from  t1 where datetime_key < '2118-01-01';
+select * from  t1 where datetime_key < '2119-01-01';
+select * from  t1 where datetime_key < '2120-01-01';
+select * from  t1 where datetime_key < '2121-01-01';
+select * from  t1 where datetime_key < '2122-01-01';
+select * from  t1 where datetime_key < '2123-01-01';
+select * from  t1 where datetime_key < '2124-01-01';
+select * from  t1 where datetime_key < '2125-01-01';
+select * from  t1 where datetime_key < '2126-01-01';
+select * from  t1 where datetime_key < '2127-01-01';
+select * from  t1 where datetime_key < '2128-01-01';
+select * from  t1 where datetime_key < '2129-01-01';
+select * from  t1 where datetime_key < '2130-01-01';
+select * from  t1 where datetime_key < '2131-01-01';
+select * from  t1 where datetime_key < '2132-01-01';
+select * from  t1 where datetime_key < '2133-01-01';
+select * from  t1 where datetime_key < '2134-01-01';
+select * from  t1 where datetime_key < '2135-01-01';
+select * from  t1 where datetime_key < '2136-01-01';
+select * from  t1 where datetime_key < '2137-01-01';
+select * from  t1 where datetime_key < '2138-01-01';
+select * from  t1 where datetime_key < '2139-01-01';
+select * from  t1 where datetime_key < '2140-01-01';
+select * from  t1 where datetime_key < '2141-01-01';
+select * from  t1 where datetime_key < '2142-01-01';
+select * from  t1 where datetime_key < '2143-01-01';
+select * from  t1 where datetime_key < '2144-01-01';
+select * from  t1 where datetime_key < '2145-01-01';
+select * from  t1 where datetime_key < '2146-01-01';
+select * from  t1 where datetime_key < '2147-01-01';
+select * from  t1 where datetime_key < '2148-01-01';
+select * from  t1 where datetime_key < '2149-01-01';
+select * from  t1 where datetime_key < '2150-01-01';
+select * from  t1 where datetime_key < '2151-01-01';
+select * from  t1 where datetime_key < '2152-01-01';
+select * from  t1 where datetime_key < '2153-01-01';
+select * from  t1 where datetime_key < '2154-01-01';
+select * from  t1 where datetime_key < '9999-12-31';
+
+
+# ----------------------------------------------------- #
+# --- Check                                         --- #
+# ----------------------------------------------------- #
+
+# Nothing here
+
+# ----------------------------------------------------- #
+# --- Final cleanup                                 --- #
+# ----------------------------------------------------- #
+DROP TABLE t1;

=== modified file 'mysql-test/suite/rpl/r/rpl_backup.result'
--- a/mysql-test/suite/rpl/r/rpl_backup.result	2008-10-31 15:31:52 +0000
+++ b/mysql-test/suite/rpl/r/rpl_backup.result	2008-11-17 09:57:51 +0000
@@ -169,7 +169,7 @@ CREATE TABLE rpl_backup.t2 (b int);
 INSERT INTO rpl_backup.t2 VALUES (888), (999);
 Get master's binlog position before restore.
 Backup_id = 502.
-RESTORE FROM 'rpl_bup_m2.bak';
+RESTORE FROM 'rpl_bup_m2.bak' OVERWRITE;
 backup_id
 502
 Show the incident event issued as a result of restore.
@@ -241,7 +241,7 @@ t1	BASE TABLE
 t2	BASE TABLE
 STOP SLAVE;
 Backup_id = 602.
-RESTORE FROM '../master-data/rpl_bup_m2.bak';
+RESTORE FROM '../master-data/rpl_bup_m2.bak' OVERWRITE;
 backup_id
 602
 Showing databases on slave.
@@ -258,11 +258,11 @@ BACKUP DATABASE rpl_backup TO 'rpl_bup_s
 backup_id
 603
 Test restore on slave while replication turned on.
-RESTORE FROM 'rpl_bup_s1.bak';
+RESTORE FROM 'rpl_bup_s1.bak' OVERWRITE;
 ERROR HY000: A restore operation was attempted on a slave during replication. You must stop the slave prior to running a restore.
 Stop slave and restart after restore.
 STOP SLAVE;
-RESTORE FROM 'rpl_bup_s3.bak';
+RESTORE FROM 'rpl_bup_s3.bak' OVERWRITE;
 backup_id
 #
 START SLAVE;
@@ -312,7 +312,7 @@ sql_log_bin	ON
 RESET MASTER;
 Get master's binlog position before restore.
 Backup_id = 504.
-RESTORE FROM 'rpl_bup_m3.bak';
+RESTORE FROM 'rpl_bup_m3.bak' OVERWRITE;
 backup_id
 504
 Get master's binlog position after restore.

=== added file 'mysql-test/suite/rpl/r/rpl_extraCol_falcon.result'
--- a/mysql-test/suite/rpl/r/rpl_extraCol_falcon.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/r/rpl_extraCol_falcon.result	2008-11-17 10:57:50 +0000
@@ -0,0 +1,969 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+**** Diff Table Def Start ****
+*** On Slave ***
+STOP SLAVE;
+RESET SLAVE;
+CREATE TABLE t1 (a INT, b INT PRIMARY KEY, c CHAR(20),
+d FLOAT DEFAULT '2.00', 
+e CHAR(4) DEFAULT 'TEST') 
+ENGINE='Falcon';
+*** Create t1 on Master ***
+CREATE TABLE t1 (a INT PRIMARY KEY, b INT, c CHAR(10)
+) ENGINE='Falcon';
+RESET MASTER;
+*** Start Slave ***
+START SLAVE;
+*** Master Data Insert ***
+INSERT INTO t1 () VALUES(1,2,'TEXAS'),(2,1,'AUSTIN'),(3,4,'QA');
+SELECT * FROM t1 ORDER BY a;
+a	b	c
+1	2	TEXAS
+2	1	AUSTIN
+3	4	QA
+*** Select from slave ***
+SELECT * FROM t1 ORDER BY a;
+a	b	c	d	e
+1	2	TEXAS	2	TEST
+2	1	AUSTIN	2	TEST
+3	4	QA	2	TEST
+*** Drop t1  ***
+DROP TABLE t1;
+*** Create t2 on slave  ***
+STOP SLAVE;
+RESET SLAVE;
+CREATE TABLE t2 (a INT, b INT PRIMARY KEY, c CHAR(5),
+d FLOAT DEFAULT '2.00',
+e CHAR(5) DEFAULT 'TEST2')
+ENGINE='Falcon';
+*** Create t2 on Master ***
+CREATE TABLE t2 (a INT PRIMARY KEY, b INT, c CHAR(10)
+) ENGINE='Falcon';
+RESET MASTER;
+*** Master Data Insert ***
+INSERT INTO t2 () VALUES(1,2,'Kyle, TEX'),(2,1,'JOE AUSTIN'),(3,4,'QA TESTING');
+SELECT * FROM t2 ORDER BY a;
+a	b	c
+1	2	Kyle, TEX
+2	1	JOE AUSTIN
+3	4	QA TESTING
+*** Start Slave ***
+START SLAVE;
+SHOW SLAVE STATUS;
+Slave_IO_State	#
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	#
+Connect_Retry	1
+Master_Log_File	master-bin.000001
+Read_Master_Log_Pos	#
+Relay_Log_File	#
+Relay_Log_Pos	#
+Relay_Master_Log_File	master-bin.000001
+Slave_IO_Running	Yes
+Slave_SQL_Running	No
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	#
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	1535
+Last_Error	Table definition on master and slave does not match: Column 2 size mismatch - master has size 10, test.t2 on slave has size 6. Master's column size should be <= the slave's column size.
+Skip_Counter	0
+Exec_Master_Log_Pos	#
+Relay_Log_Space	#
+Until_Condition	None
+Until_Log_File	
+Until_Log_Pos	0
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	#
+Master_SSL_Verify_Server_Cert	No
+Last_IO_Errno	#
+Last_IO_Error	#
+Last_SQL_Errno	1535
+Last_SQL_Error	Table definition on master and slave does not match: Column 2 size mismatch - master has size 10, test.t2 on slave has size 6. Master's column size should be <= the slave's column size.
+STOP SLAVE;
+RESET SLAVE;
+SELECT * FROM t2 ORDER BY a;
+a	b	c	d	e
+RESET MASTER;
+START SLAVE;
+*** Drop t2  ***
+DROP TABLE t2;
+*** Create t3 on slave  ***
+STOP SLAVE;
+RESET SLAVE;
+CREATE TABLE t3 (a INT, b INT PRIMARY KEY, c CHAR(20),
+d FLOAT DEFAULT '2.00',
+e CHAR(5) DEFAULT 'TEST2')
+ENGINE='Falcon';
+*** Create t3 on Master ***
+CREATE TABLE t3 (a BLOB, b INT PRIMARY KEY, c CHAR(20)
+) ENGINE='Falcon';
+RESET MASTER;
+*** Start Slave ***
+START SLAVE;
+*** Master Data Insert ***
+set @b1 = 'b1';
+set @b1 = concat(@b1,@b1);
+INSERT INTO t3 () VALUES(@b1,2,'Kyle, TEX'),(@b1,1,'JOE AUSTIN'),(@b1,4,'QA TESTING');
+********************************************
+*** Expect slave to fail with Error 1522 ***
+********************************************
+SHOW SLAVE STATUS;
+Slave_IO_State	#
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	#
+Connect_Retry	1
+Master_Log_File	master-bin.000001
+Read_Master_Log_Pos	#
+Relay_Log_File	#
+Relay_Log_Pos	#
+Relay_Master_Log_File	master-bin.000001
+Slave_IO_Running	Yes
+Slave_SQL_Running	No
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	#
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	1535
+Last_Error	Table definition on master and slave does not match: Column 0 type mismatch - received type 252, test.t3 has type 3
+Skip_Counter	0
+Exec_Master_Log_Pos	#
+Relay_Log_Space	#
+Until_Condition	None
+Until_Log_File	
+Until_Log_Pos	0
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	#
+Master_SSL_Verify_Server_Cert	No
+Last_IO_Errno	#
+Last_IO_Error	#
+Last_SQL_Errno	1535
+Last_SQL_Error	Table definition on master and slave does not match: Column 0 type mismatch - received type 252, test.t3 has type 3
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
+START SLAVE;
+*** Drop t3  ***
+DROP TABLE t3;
+*** Create t4 on slave  ***
+STOP SLAVE;
+RESET SLAVE;
+CREATE TABLE t4 (a INT, b INT PRIMARY KEY, c CHAR(20),
+d FLOAT DEFAULT '2.00',
+e CHAR(5) DEFAULT 'TEST2')
+ENGINE='Falcon';
+*** Create t4 on Master ***
+CREATE TABLE t4 (a DECIMAL(8,2), b INT PRIMARY KEY, c CHAR(20)
+) ENGINE='Falcon';
+RESET MASTER;
+*** Start Slave ***
+START SLAVE;
+*** Master Data Insert ***
+INSERT INTO t4 () VALUES(100.22,2,'Kyle, TEX'),(200.26,1,'JOE AUSTIN'),
+(30000.22,4,'QA TESTING');
+********************************************
+*** Expect slave to fail with Error 1522 ***
+********************************************
+SHOW SLAVE STATUS;
+Slave_IO_State	#
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	#
+Connect_Retry	1
+Master_Log_File	master-bin.000001
+Read_Master_Log_Pos	#
+Relay_Log_File	#
+Relay_Log_Pos	#
+Relay_Master_Log_File	master-bin.000001
+Slave_IO_Running	Yes
+Slave_SQL_Running	No
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	#
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	1535
+Last_Error	Table definition on master and slave does not match: Column 0 type mismatch - received type 246, test.t4 has type 3
+Skip_Counter	0
+Exec_Master_Log_Pos	#
+Relay_Log_Space	#
+Until_Condition	None
+Until_Log_File	
+Until_Log_Pos	0
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	#
+Master_SSL_Verify_Server_Cert	No
+Last_IO_Errno	#
+Last_IO_Error	#
+Last_SQL_Errno	1535
+Last_SQL_Error	Table definition on master and slave does not match: Column 0 type mismatch - received type 246, test.t4 has type 3
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
+START SLAVE;
+*** Drop t4  ***
+DROP TABLE t4;
+*** Create t5 on slave  ***
+STOP SLAVE;
+RESET SLAVE;
+CREATE TABLE t5 (a INT PRIMARY KEY, b CHAR(5),
+c FLOAT, d INT, e DOUBLE,
+f DECIMAL(8,2))ENGINE='Falcon';
+*** Create t5 on Master ***
+CREATE TABLE t5 (a INT PRIMARY KEY, b VARCHAR(6),
+c DECIMAL(8,2), d BIT, e BLOB,
+f FLOAT) ENGINE='Falcon';
+RESET MASTER;
+*** Start Slave ***
+START SLAVE;
+*** Master Data Insert ***
+INSERT INTO t5 () VALUES(1,'Kyle',200.23,1,'b1b1',23.00098),
+(2,'JOE',300.01,0,'b2b2',1.0000009);
+********************************************
+*** Expect slave to fail with Error 1522 ***
+********************************************
+SHOW SLAVE STATUS;
+Slave_IO_State	#
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	#
+Connect_Retry	1
+Master_Log_File	master-bin.000001
+Read_Master_Log_Pos	#
+Relay_Log_File	#
+Relay_Log_Pos	#
+Relay_Master_Log_File	master-bin.000001
+Slave_IO_Running	Yes
+Slave_SQL_Running	No
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	#
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	1535
+Last_Error	Table definition on master and slave does not match: Column 5 type mismatch - received type 4, test.t5 has type 246
+Skip_Counter	0
+Exec_Master_Log_Pos	#
+Relay_Log_Space	#
+Until_Condition	None
+Until_Log_File	
+Until_Log_Pos	0
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	#
+Master_SSL_Verify_Server_Cert	No
+Last_IO_Errno	#
+Last_IO_Error	#
+Last_SQL_Errno	1535
+Last_SQL_Error	Table definition on master and slave does not match: Column 5 type mismatch - received type 4, test.t5 has type 246
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
+START SLAVE;
+*** Drop t5  ***
+DROP TABLE t5;
+*** Create t6 on slave  ***
+STOP SLAVE;
+RESET SLAVE;
+CREATE TABLE t6 (a INT PRIMARY KEY, b CHAR(5),
+c FLOAT, d INT)ENGINE='Falcon';
+*** Create t6 on Master ***
+CREATE TABLE t6 (a INT PRIMARY KEY, b VARCHAR(6),
+c DECIMAL(8,2), d BIT 
+) ENGINE='Falcon';
+RESET MASTER;
+*** Start Slave ***
+START SLAVE;
+*** Master Data Insert ***
+INSERT INTO t6 () VALUES(1,'Kyle',200.23,1),
+(2,'JOE',300.01,0);
+********************************************
+*** Expect slave to fail with Error 1522 ***
+********************************************
+SHOW SLAVE STATUS;
+Slave_IO_State	#
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	#
+Connect_Retry	1
+Master_Log_File	master-bin.000001
+Read_Master_Log_Pos	#
+Relay_Log_File	#
+Relay_Log_Pos	#
+Relay_Master_Log_File	master-bin.000001
+Slave_IO_Running	Yes
+Slave_SQL_Running	No
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	#
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	1535
+Last_Error	Table definition on master and slave does not match: Column 3 type mismatch - received type 16, test.t6 has type 3
+Skip_Counter	0
+Exec_Master_Log_Pos	#
+Relay_Log_Space	#
+Until_Condition	None
+Until_Log_File	
+Until_Log_Pos	0
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	#
+Master_SSL_Verify_Server_Cert	No
+Last_IO_Errno	#
+Last_IO_Error	#
+Last_SQL_Errno	1535
+Last_SQL_Error	Table definition on master and slave does not match: Column 3 type mismatch - received type 16, test.t6 has type 3
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=3;
+*** Drop t6  ***
+DROP TABLE t6;
+DROP TABLE t6;
+START SLAVE;
+**** Diff Table Def End ****
+**** Extra Colums Start ****
+*** Create t7 on slave  ***
+STOP SLAVE;
+RESET SLAVE;
+CREATE TABLE t7 (a INT KEY, b BLOB, c CHAR(5),
+d TIMESTAMP NULL DEFAULT '0000-00-00 00:00:00',
+e CHAR(20) DEFAULT 'Extra Column Testing')
+ENGINE='Falcon';
+*** Create t7 on Master ***
+CREATE TABLE t7 (a INT PRIMARY KEY, b BLOB, c CHAR(5)
+) ENGINE='Falcon';
+RESET MASTER;
+*** Start Slave ***
+START SLAVE;
+*** Master Data Insert ***
+set @b1 = 'b1';
+set @b1 = concat(@b1,@b1);
+INSERT INTO t7 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
+SELECT * FROM t7 ORDER BY a;
+a	b	c
+1	b1b1	Kyle
+2	b1b1	JOE
+3	b1b1	QA
+*** Select from slave ***
+SELECT * FROM t7 ORDER BY a;
+a	b	c	d	e
+1	b1b1	Kyle	0000-00-00 00:00:00	Extra Column Testing
+2	b1b1	JOE	0000-00-00 00:00:00	Extra Column Testing
+3	b1b1	QA	0000-00-00 00:00:00	Extra Column Testing
+*** Drop t7  ***
+DROP TABLE t7;
+*** Create t8 on slave  ***
+STOP SLAVE;
+RESET SLAVE;
+CREATE TABLE t8 (a INT KEY, b BLOB, c CHAR(5),
+d TIMESTAMP NULL DEFAULT '0000-00-00 00:00:00',
+e INT)ENGINE='Falcon';
+*** Create t8 on Master ***
+CREATE TABLE t8 (a INT PRIMARY KEY, b BLOB, c CHAR(5)
+) ENGINE='Falcon';
+RESET MASTER;
+*** Start Slave ***
+START SLAVE;
+*** Master Data Insert ***
+set @b1 = 'b1b1b1b1';
+set @b1 = concat(@b1,@b1);
+INSERT INTO t8 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
+*** Drop t8  ***
+DROP TABLE t8;
+STOP SLAVE;
+RESET SLAVE;
+CREATE TABLE t9 (a INT KEY, b BLOB, c CHAR(5),
+d TIMESTAMP,
+e INT NOT NULL) ENGINE='Falcon';
+*** Create t9 on Master ***
+CREATE TABLE t9 (a INT PRIMARY KEY, b BLOB, c CHAR(5)
+) ENGINE='Falcon';
+RESET MASTER;
+*** Start Slave ***
+START SLAVE;
+*** Master Data Insert ***
+set @b1 = 'b1b1b1b1';
+set @b1 = concat(@b1,@b1);
+INSERT INTO t9 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
+SHOW SLAVE STATUS;
+Slave_IO_State	#
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	#
+Connect_Retry	1
+Master_Log_File	master-bin.000001
+Read_Master_Log_Pos	#
+Relay_Log_File	#
+Relay_Log_Pos	#
+Relay_Master_Log_File	master-bin.000001
+Slave_IO_Running	Yes
+Slave_SQL_Running	No
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	#
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	1364
+Last_Error	Could not execute Write_rows event on table test.t9; Field 'e' doesn't have a default value, Error_code: 1364; handler error HA_ERR_ROWS_EVENT_APPLY; the event's master log master-bin.000001, end_log_pos 331
+Skip_Counter	0
+Exec_Master_Log_Pos	#
+Relay_Log_Space	#
+Until_Condition	None
+Until_Log_File	
+Until_Log_Pos	0
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	#
+Master_SSL_Verify_Server_Cert	No
+Last_IO_Errno	#
+Last_IO_Error	#
+Last_SQL_Errno	1364
+Last_SQL_Error	Could not execute Write_rows event on table test.t9; Field 'e' doesn't have a default value, Error_code: 1364; handler error HA_ERR_ROWS_EVENT_APPLY; the event's master log master-bin.000001, end_log_pos 331
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
+START SLAVE;
+*** Create t10 on slave  ***
+STOP SLAVE;
+RESET SLAVE;
+CREATE TABLE t10 (a INT KEY, b BLOB, f DOUBLE DEFAULT '233', 
+c CHAR(5), e INT DEFAULT '1')ENGINE='Falcon';
+*** Create t10 on Master ***
+CREATE TABLE t10 (a INT PRIMARY KEY, b BLOB, c CHAR(5)
+) ENGINE='Falcon';
+RESET MASTER;
+*** Start Slave ***
+START SLAVE;
+*** Master Data Insert ***
+set @b1 = 'b1b1b1b1';
+set @b1 = concat(@b1,@b1);
+INSERT INTO t10 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
+********************************************
+*** Expect slave to fail with Error 1522 ***
+********************************************
+SHOW SLAVE STATUS;
+Slave_IO_State	#
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	#
+Connect_Retry	1
+Master_Log_File	master-bin.000001
+Read_Master_Log_Pos	#
+Relay_Log_File	#
+Relay_Log_Pos	#
+Relay_Master_Log_File	master-bin.000001
+Slave_IO_Running	Yes
+Slave_SQL_Running	No
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	#
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	1535
+Last_Error	Table definition on master and slave does not match: Column 2 type mismatch - received type 254, test.t10 has type 5
+Skip_Counter	0
+Exec_Master_Log_Pos	#
+Relay_Log_Space	#
+Until_Condition	None
+Until_Log_File	
+Until_Log_Pos	0
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	#
+Master_SSL_Verify_Server_Cert	No
+Last_IO_Errno	#
+Last_IO_Error	#
+Last_SQL_Errno	1535
+Last_SQL_Error	Table definition on master and slave does not match: Column 2 type mismatch - received type 254, test.t10 has type 5
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
+START SLAVE;
+*** Drop t10  ***
+DROP TABLE t10;
+*** Create t11 on slave  ***
+STOP SLAVE;
+RESET SLAVE;
+CREATE TABLE t11 (a INT KEY, b BLOB, f TEXT,
+c CHAR(5) DEFAULT 'test', e INT DEFAULT '1')ENGINE='Falcon';
+*** Create t11 on Master ***
+CREATE TABLE t11 (a INT PRIMARY KEY, b BLOB, c VARCHAR(254)
+) ENGINE='Falcon';
+RESET MASTER;
+*** Start Slave ***
+START SLAVE;
+*** Master Data Insert ***
+set @b1 = 'b1b1b1b1';
+set @b1 = concat(@b1,@b1);
+INSERT INTO t11 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
+********************************************
+*** Expect slave to fail with Error 1522 ***
+********************************************
+SHOW SLAVE STATUS;
+Slave_IO_State	#
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	#
+Connect_Retry	1
+Master_Log_File	master-bin.000001
+Read_Master_Log_Pos	#
+Relay_Log_File	#
+Relay_Log_Pos	#
+Relay_Master_Log_File	master-bin.000001
+Slave_IO_Running	Yes
+Slave_SQL_Running	No
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	#
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	1535
+Last_Error	Table definition on master and slave does not match: Column 2 type mismatch - received type 15, test.t11 has type 252
+Skip_Counter	0
+Exec_Master_Log_Pos	#
+Relay_Log_Space	#
+Until_Condition	None
+Until_Log_File	
+Until_Log_Pos	0
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	#
+Master_SSL_Verify_Server_Cert	No
+Last_IO_Errno	#
+Last_IO_Error	#
+Last_SQL_Errno	1535
+Last_SQL_Error	Table definition on master and slave does not match: Column 2 type mismatch - received type 15, test.t11 has type 252
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
+START SLAVE;
+*** Drop t11  ***
+DROP TABLE t11;
+*** Create t12 on slave  ***
+STOP SLAVE;
+RESET SLAVE;
+CREATE TABLE t12 (a INT KEY, b BLOB, f TEXT,
+c CHAR(5) DEFAULT 'test', e INT DEFAULT '1')ENGINE='Falcon';
+*** Create t12 on Master ***
+CREATE TABLE t12 (a INT PRIMARY KEY, b BLOB, c BLOB
+) ENGINE='Falcon';
+RESET MASTER;
+*** Start Slave ***
+START SLAVE;
+*** Master Data Insert ***
+set @b1 = 'b1b1b1b1';
+set @b1 = concat(@b1,@b1);
+INSERT INTO t12 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
+SELECT * FROM t12 ORDER BY a;
+a	b	c
+1	b1b1b1b1b1b1b1b1	Kyle
+2	b1b1b1b1b1b1b1b1	JOE
+3	b1b1b1b1b1b1b1b1	QA
+*** Select on Slave ***
+SELECT * FROM t12 ORDER BY a;
+a	b	f	c	e
+1	b1b1b1b1b1b1b1b1	Kyle	test	1
+2	b1b1b1b1b1b1b1b1	JOE	test	1
+3	b1b1b1b1b1b1b1b1	QA	test	1
+*** Drop t12  ***
+DROP TABLE t12;
+**** Extra Colums End ****
+*** BUG 22177 Start ***
+*** Create t13 on slave  ***
+STOP SLAVE;
+RESET SLAVE;
+CREATE TABLE t13 (a INT KEY, b BLOB, c CHAR(5),
+d INT DEFAULT '1',
+e TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
+)ENGINE='Falcon';
+*** Create t13 on Master ***
+CREATE TABLE t13 (a INT PRIMARY KEY, b BLOB, c CHAR(5)
+) ENGINE='Falcon';
+RESET MASTER;
+*** Start Slave ***
+START SLAVE;
+*** Master Data Insert ***
+set @b1 = 'b1b1b1b1';
+set @b1 = concat(@b1,@b1);
+INSERT INTO t13 () VALUES(1,@b1,'Kyle'),(2,@b1,'JOE'),(3,@b1,'QA');
+SELECT * FROM t13 ORDER BY a;
+a	b	c
+1	b1b1b1b1b1b1b1b1	Kyle
+2	b1b1b1b1b1b1b1b1	JOE
+3	b1b1b1b1b1b1b1b1	QA
+*** Select on Slave ****
+SELECT * FROM t13 ORDER BY a;
+a	b	c	d	e
+1	b1b1b1b1b1b1b1b1	Kyle	1	CURRENT_TIMESTAMP
+2	b1b1b1b1b1b1b1b1	JOE	1	CURRENT_TIMESTAMP
+3	b1b1b1b1b1b1b1b1	QA	1	CURRENT_TIMESTAMP
+*** Drop t13  ***
+DROP TABLE t13;
+*** 22117 END *** 
+*** Alter Master Table Testing Start ***
+*** Create t14 on slave  ***
+STOP SLAVE;
+RESET SLAVE;
+CREATE TABLE t14 (c1 INT KEY, c4 BLOB, c5 CHAR(5),
+c6 INT DEFAULT '1',
+c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
+)ENGINE='Falcon';
+*** Create t14 on Master ***
+CREATE TABLE t14 (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
+) ENGINE='Falcon';
+RESET MASTER;
+*** Start Slave ***
+START SLAVE;
+*** Master Data Insert ***
+ALTER TABLE t14 ADD COLUMN c2 DECIMAL(8,2) AFTER c1;
+ALTER TABLE t14 ADD COLUMN c3 TEXT AFTER c2;
+set @b1 = 'b1b1b1b1';
+set @b1 = concat(@b1,@b1);
+INSERT INTO t14 () VALUES(1,1.00,'Replication Testing Extra Col',@b1,'Kyle'),
+(2,2.00,'This Test Should work',@b1,'JOE'),
+(3,3.00,'If is does not, I will open a bug',@b1,'QA');
+SELECT * FROM t14 ORDER BY c1;
+c1	c2	c3	c4	c5
+1	1.00	Replication Testing Extra Col	b1b1b1b1b1b1b1b1	Kyle
+2	2.00	This Test Should work	b1b1b1b1b1b1b1b1	JOE
+3	3.00	If is does not, I will open a bug	b1b1b1b1b1b1b1b1	QA
+*** Select on Slave ****
+SELECT * FROM t14 ORDER BY c1;
+c1	c2	c3	c4	c5	c6	c7
+1	1.00	Replication Testing Extra Col	b1b1b1b1b1b1b1b1	Kyle	1	CURRENT_TIMESTAMP
+2	2.00	This Test Should work	b1b1b1b1b1b1b1b1	JOE	1	CURRENT_TIMESTAMP
+3	3.00	If is does not, I will open a bug	b1b1b1b1b1b1b1b1	QA	1	CURRENT_TIMESTAMP
+*** Create t14a on slave  ***
+STOP SLAVE;
+RESET SLAVE;
+CREATE TABLE t14a (c1 INT KEY, c4 BLOB, c5 CHAR(5),
+c6 INT DEFAULT '1',
+c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
+)ENGINE='Falcon';
+*** Create t14a on Master ***
+CREATE TABLE t14a (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
+) ENGINE='Falcon';
+RESET MASTER;
+*** Start Slave ***
+START SLAVE;
+*** Master Data Insert ***
+set @b1 = 'b1b1b1b1';
+set @b1 = concat(@b1,@b1);
+INSERT INTO t14a () VALUES(1,@b1,'Kyle'),
+(2,@b1,'JOE'),
+(3,@b1,'QA');
+SELECT * FROM t14a ORDER BY c1;
+c1	c4	c5
+1	b1b1b1b1b1b1b1b1	Kyle
+2	b1b1b1b1b1b1b1b1	JOE
+3	b1b1b1b1b1b1b1b1	QA
+*** Select on Slave ****
+SELECT * FROM t14a ORDER BY c1;
+c1	c4	c5	c6	c7
+1	b1b1b1b1b1b1b1b1	Kyle	1	CURRENT_TIMESTAMP
+2	b1b1b1b1b1b1b1b1	JOE	1	CURRENT_TIMESTAMP
+3	b1b1b1b1b1b1b1b1	QA	1	CURRENT_TIMESTAMP
+STOP SLAVE;
+RESET SLAVE;
+*** Master Drop c5 ***
+ALTER TABLE t14a DROP COLUMN c5;
+RESET MASTER;
+*** Start Slave ***
+START SLAVE;
+*** Master Data Insert ***
+set @b1 = 'b1b1b1b1';
+set @b1 = concat(@b1,@b1);
+INSERT INTO t14a () VALUES(4,@b1),
+(5,@b1),
+(6,@b1);
+SELECT * FROM t14a ORDER BY c1;
+c1	c4
+1	b1b1b1b1b1b1b1b1
+2	b1b1b1b1b1b1b1b1
+3	b1b1b1b1b1b1b1b1
+4	b1b1b1b1b1b1b1b1
+5	b1b1b1b1b1b1b1b1
+6	b1b1b1b1b1b1b1b1
+*** Select on Slave ****
+SELECT * FROM t14a ORDER BY c1;
+c1	c4	c5	c6	c7
+1	b1b1b1b1b1b1b1b1	Kyle	1	CURRENT_TIMESTAMP
+2	b1b1b1b1b1b1b1b1	JOE	1	CURRENT_TIMESTAMP
+3	b1b1b1b1b1b1b1b1	QA	1	CURRENT_TIMESTAMP
+4	b1b1b1b1b1b1b1b1	NULL	1	CURRENT_TIMESTAMP
+5	b1b1b1b1b1b1b1b1	NULL	1	CURRENT_TIMESTAMP
+6	b1b1b1b1b1b1b1b1	NULL	1	CURRENT_TIMESTAMP
+*** connect to master and drop columns ***
+ALTER TABLE t14 DROP COLUMN c2;
+ALTER TABLE t14 DROP COLUMN c4;
+*** Select from Master ***
+SELECT * FROM t14 ORDER BY c1;
+c1	c3	c5
+1	Replication Testing Extra Col	Kyle
+2	This Test Should work	JOE
+3	If is does not, I will open a bug	QA
+*** Select from Slave ***
+SELECT * FROM t14 ORDER BY c1;
+c1	c3	c5	c6	c7
+1	Replication Testing Extra Col	Kyle	1	CURRENT_TIMESTAMP
+2	This Test Should work	JOE	1	CURRENT_TIMESTAMP
+3	If is does not, I will open a bug	QA	1	CURRENT_TIMESTAMP
+*** Drop t14  ***
+DROP TABLE t14;
+*** Create t15 on slave  ***
+STOP SLAVE;
+RESET SLAVE;
+CREATE TABLE t15 (c1 INT KEY, c2 DECIMAL(8,2), c3 TEXT,
+c4 BLOB, c5 CHAR(5),
+c6 INT DEFAULT '1',
+c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
+)ENGINE='Falcon';
+*** Create t15 on Master ***
+CREATE TABLE t15 (c1 INT PRIMARY KEY, c2 DECIMAL(8,2), c3 TEXT,
+c4 BLOB, c5 CHAR(5)) ENGINE='Falcon';
+RESET MASTER;
+*** Start Slave ***
+START SLAVE;
+*** Master Data Insert ***
+set @b1 = 'b1b1b1b1';
+set @b1 = concat(@b1,@b1);
+INSERT INTO t15 () VALUES(1,1.00,'Replication Testing Extra Col',@b1,'Kyle'),
+(2,2.00,'This Test Should work',@b1,'JOE'),
+(3,3.00,'If is does not, I will open a bug',@b1,'QA');
+SELECT * FROM t15 ORDER BY c1;
+c1	c2	c3	c4	c5
+1	1.00	Replication Testing Extra Col	b1b1b1b1b1b1b1b1	Kyle
+2	2.00	This Test Should work	b1b1b1b1b1b1b1b1	JOE
+3	3.00	If is does not, I will open a bug	b1b1b1b1b1b1b1b1	QA
+*** Select on Slave ****
+SELECT * FROM t15 ORDER BY c1;
+c1	c2	c3	c4	c5	c6	c7
+1	1.00	Replication Testing Extra Col	b1b1b1b1b1b1b1b1	Kyle	1	CURRENT_TIMESTAMP
+2	2.00	This Test Should work	b1b1b1b1b1b1b1b1	JOE	1	CURRENT_TIMESTAMP
+3	3.00	If is does not, I will open a bug	b1b1b1b1b1b1b1b1	QA	1	CURRENT_TIMESTAMP
+*** Add column on master that is a Extra on Slave ***
+ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5;
+********************************************
+*** Expect slave to fail with Error 1060 ***
+********************************************
+SHOW SLAVE STATUS;
+Slave_IO_State	#
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	#
+Connect_Retry	1
+Master_Log_File	master-bin.000001
+Read_Master_Log_Pos	#
+Relay_Log_File	#
+Relay_Log_Pos	#
+Relay_Master_Log_File	master-bin.000001
+Slave_IO_Running	Yes
+Slave_SQL_Running	No
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	#
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	1060
+Last_Error	Error 'Duplicate column name 'c6'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5'
+Skip_Counter	0
+Exec_Master_Log_Pos	#
+Relay_Log_Space	#
+Until_Condition	None
+Until_Log_File	
+Until_Log_Pos	0
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	#
+Master_SSL_Verify_Server_Cert	No
+Last_IO_Errno	#
+Last_IO_Error	#
+Last_SQL_Errno	1060
+Last_SQL_Error	Error 'Duplicate column name 'c6'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c6 INT AFTER c5'
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1;
+START SLAVE;
+*** Try to insert in master ****
+INSERT INTO t15 () VALUES(5,2.00,'Replication Testing',@b1,'Buda',2);
+SELECT * FROM t15 ORDER BY c1;
+c1	c2	c3	c4	c5	c6
+1	1.00	Replication Testing Extra Col	b1b1b1b1b1b1b1b1	Kyle	NULL
+2	2.00	This Test Should work	b1b1b1b1b1b1b1b1	JOE	NULL
+3	3.00	If is does not, I will open a bug	b1b1b1b1b1b1b1b1	QA	NULL
+5	2.00	Replication Testing	b1b1b1b1b1b1b1b1	Buda	2
+*** Try to select from slave ****
+SELECT * FROM t15 ORDER BY c1;
+c1	c2	c3	c4	c5	c6	c7
+1	1.00	Replication Testing Extra Col	b1b1b1b1b1b1b1b1	Kyle	1	CURRENT_TIMESTAMP
+2	2.00	This Test Should work	b1b1b1b1b1b1b1b1	JOE	1	CURRENT_TIMESTAMP
+3	3.00	If is does not, I will open a bug	b1b1b1b1b1b1b1b1	QA	1	CURRENT_TIMESTAMP
+5	2.00	Replication Testing	b1b1b1b1b1b1b1b1	Buda	2	CURRENT_TIMESTAMP
+*** DROP TABLE t15 ***
+DROP TABLE t15;
+*** Create t16 on slave  ***
+STOP SLAVE;
+RESET SLAVE;
+CREATE TABLE t16 (c1 INT KEY, c2 DECIMAL(8,2), c3 TEXT,
+c4 BLOB, c5 CHAR(5),
+c6 INT DEFAULT '1',
+c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
+)ENGINE='Falcon';
+*** Create t16 on Master ***
+CREATE TABLE t16 (c1 INT PRIMARY KEY, c2 DECIMAL(8,2), c3 TEXT,
+c4 BLOB, c5 CHAR(5))ENGINE='Falcon';
+RESET MASTER;
+*** Start Slave ***
+START SLAVE;
+*** Master Data Insert ***
+set @b1 = 'b1b1b1b1';
+set @b1 = concat(@b1,@b1);
+INSERT INTO t16 () VALUES(1,1.00,'Replication Testing Extra Col',@b1,'Kyle'),
+(2,2.00,'This Test Should work',@b1,'JOE'),
+(3,3.00,'If is does not, I will open a bug',@b1,'QA');
+SELECT * FROM t16 ORDER BY c1;
+c1	c2	c3	c4	c5
+1	1.00	Replication Testing Extra Col	b1b1b1b1b1b1b1b1	Kyle
+2	2.00	This Test Should work	b1b1b1b1b1b1b1b1	JOE
+3	3.00	If is does not, I will open a bug	b1b1b1b1b1b1b1b1	QA
+*** Select on Slave ****
+SELECT * FROM t16 ORDER BY c1;
+c1	c2	c3	c4	c5	c6	c7
+1	1.00	Replication Testing Extra Col	b1b1b1b1b1b1b1b1	Kyle	1	CURRENT_TIMESTAMP
+2	2.00	This Test Should work	b1b1b1b1b1b1b1b1	JOE	1	CURRENT_TIMESTAMP
+3	3.00	If is does not, I will open a bug	b1b1b1b1b1b1b1b1	QA	1	CURRENT_TIMESTAMP
+*** Add Partition on master ***
+ALTER TABLE t16 PARTITION BY KEY(c1) PARTITIONS 4;
+INSERT INTO t16 () VALUES(4,1.00,'Replication Rocks',@b1,'Omer');
+SHOW CREATE TABLE t16;
+Table	Create Table
+t16	CREATE TABLE `t16` (
+  `c1` int(11) NOT NULL,
+  `c2` decimal(8,2) DEFAULT NULL,
+  `c3` text,
+  `c4` blob,
+  `c5` char(5) DEFAULT NULL,
+  PRIMARY KEY (`c1`)
+) ENGINE=Falcon DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY KEY (c1)
+PARTITIONS 4 */
+*** Show table on Slave ****
+SHOW CREATE TABLE t16;
+Table	Create Table
+t16	CREATE TABLE `t16` (
+  `c1` int(11) NOT NULL,
+  `c2` decimal(8,2) DEFAULT NULL,
+  `c3` text,
+  `c4` blob,
+  `c5` char(5) DEFAULT NULL,
+  `c6` int(11) DEFAULT '1',
+  `c7` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
+  PRIMARY KEY (`c1`)
+) ENGINE=Falcon DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY KEY (c1)
+PARTITIONS 4 */
+*** DROP TABLE t16 ***
+DROP TABLE t16;
+*** Alter Master End ***
+*** Create t17 on slave  ***
+STOP SLAVE;
+RESET SLAVE;
+CREATE TABLE t17 (a SMALLINT, b INT PRIMARY KEY, c CHAR(5),
+d FLOAT DEFAULT '2.00',
+e CHAR(5) DEFAULT 'TEST2')
+ENGINE='Falcon';
+*** Create t17 on Master ***
+CREATE TABLE t17 (a BIGINT PRIMARY KEY, b INT, c CHAR(10)
+) ENGINE='Falcon';
+RESET MASTER;
+*** Start Slave ***
+START SLAVE;
+*** Master Data Insert ***
+INSERT INTO t17 () VALUES(9223372036854775807,2,'Kyle, TEX');
+********************************************
+*** Expect slave to fail with Error 1522 ***
+********************************************
+SHOW SLAVE STATUS;
+Slave_IO_State	#
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	#
+Connect_Retry	1
+Master_Log_File	master-bin.000001
+Read_Master_Log_Pos	#
+Relay_Log_File	#
+Relay_Log_Pos	#
+Relay_Master_Log_File	master-bin.000001
+Slave_IO_Running	Yes
+Slave_SQL_Running	No
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	#
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	1535
+Last_Error	Table definition on master and slave does not match: Column 0 type mismatch - received type 8, test.t17 has type 2
+Skip_Counter	0
+Exec_Master_Log_Pos	#
+Relay_Log_Space	#
+Until_Condition	None
+Until_Log_File	
+Until_Log_Pos	0
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	#
+Master_SSL_Verify_Server_Cert	No
+Last_IO_Errno	#
+Last_IO_Error	#
+Last_SQL_Errno	1535
+Last_SQL_Error	Table definition on master and slave does not match: Column 0 type mismatch - received type 8, test.t17 has type 2
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
+START SLAVE;
+** DROP table t17 ***
+DROP TABLE t17;

=== added file 'mysql-test/suite/rpl/r/rpl_extraColmaster_falcon.result'
--- a/mysql-test/suite/rpl/r/rpl_extraColmaster_falcon.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/r/rpl_extraColmaster_falcon.result	2008-11-17 10:57:50 +0000
@@ -0,0 +1,1144 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+
+***********************************************************
+***********************************************************
+***************** Start of Testing ************************
+***********************************************************
+***********************************************************
+* This test format == binlog_format	ROW and engine == 'Falcon'
+***********************************************************
+***********************************************************
+
+***** Testing more columns on the Master *****
+
+CREATE TABLE t1 (f1 INT, f2 INT, f3 INT PRIMARY KEY, f4 CHAR(20),
+/* extra */
+f5 FLOAT DEFAULT '2.00', 
+f6 CHAR(4) DEFAULT 'TEST',
+f7 INT DEFAULT '0',
+f8 TEXT,
+f9 LONGBLOB,
+f10 BIT(63),
+f11 VARBINARY(64))ENGINE='Falcon';
+
+* Alter Table on Slave and drop columns f5 through f11 *
+
+alter table t1 drop f5, drop f6, drop f7, drop f8, drop f9, drop f10, drop f11;
+
+* Insert data in Master then update and delete some rows*
+
+* Select count and 20 rows from Master *
+
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+40
+
+SELECT f1,f2,f3,f4,f5,f6,f7,f8,f9,
+hex(f10),hex(f11) FROM t1 ORDER BY f3 LIMIT 20;
+f1	f2	f3	f4	f5	f6	f7	f8	f9	hex(f10)	hex(f11)
+2	2	2	second	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
+3	3	3	next	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
+5	5	5	second	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
+6	6	6	next	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
+8	8	8	second	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
+9	9	9	next	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
+11	11	11	second	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
+12	12	12	next	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
+14	14	14	second	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
+15	15	15	next	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
+17	17	17	second	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
+18	18	18	next	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
+20	20	20	second	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
+21	21	21	next	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
+23	23	23	second	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
+24	24	24	next	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
+26	26	26	second	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
+27	27	27	next	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
+29	29	29	second	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
+30	30	30	next	2	kaks	2	got stolen from the paradise	very fat blob	1555	123456
+
+* Select count and 20 rows from Slave *
+
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+40
+
+SELECT * FROM t1 ORDER BY f3 LIMIT 20;
+f1	f2	f3	f4
+2	2	2	second
+3	3	3	next
+5	5	5	second
+6	6	6	next
+8	8	8	second
+9	9	9	next
+11	11	11	second
+12	12	12	next
+14	14	14	second
+15	15	15	next
+17	17	17	second
+18	18	18	next
+20	20	20	second
+21	21	21	next
+23	23	23	second
+24	24	24	next
+26	26	26	second
+27	27	27	next
+29	29	29	second
+30	30	30	next
+
+* Show Slave Status *
+
+show slave status;;
+Slave_IO_State	#
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	#
+Connect_Retry	1
+Master_Log_File	master-bin.000001
+Read_Master_Log_Pos	#
+Relay_Log_File	#
+Relay_Log_Pos	#
+Relay_Master_Log_File	master-bin.000001
+Slave_IO_Running	Yes
+Slave_SQL_Running	Yes
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	0
+Last_Error	
+Skip_Counter	0
+Exec_Master_Log_Pos	#
+Relay_Log_Space	#
+Until_Condition	None
+Until_Log_File	
+Until_Log_Pos	0
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	#
+Master_SSL_Verify_Server_Cert	No
+Last_IO_Errno	#
+Last_IO_Error	#
+Last_SQL_Errno	0
+Last_SQL_Error	
+
+
+***** Testing Altering table def scenario *****
+
+CREATE TABLE t2 (f1 INT, f2 INT, f3 INT PRIMARY KEY, f4 CHAR(20),
+/* extra */
+f5 DOUBLE DEFAULT '2.00', 
+f6 ENUM('a', 'b', 'c') default 'a',
+f7 DECIMAL(17,9) default '1000.00',
+f8 MEDIUMBLOB,
+f9 NUMERIC(6,4) default '2000.00',
+f10 VARCHAR(1024),
+f11 BINARY(20) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0',
+f12 SET('a', 'b', 'c') default 'b')
+ENGINE='Falcon';
+Warnings:
+Warning	1264	Out of range value for column 'f9' at row 1
+
+CREATE TABLE t3 (f1 INT, f2 INT, f3 INT PRIMARY KEY, f4 CHAR(20),
+/* extra */
+f5 DOUBLE DEFAULT '2.00', 
+f6 ENUM('a', 'b', 'c') default 'a',
+f8 MEDIUMBLOB,
+f10 VARCHAR(1024),
+f11 BINARY(20) NOT NULL DEFAULT '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0',
+f12 SET('a', 'b', 'c') default 'b')
+ENGINE='Falcon';
+
+CREATE TABLE t4 (f1 INT, f2 INT, f3 INT PRIMARY KEY, f4 CHAR(20),
+/* extra */
+f5 DOUBLE DEFAULT '2.00', 
+f6 DECIMAL(17,9) default '1000.00',
+f7 MEDIUMBLOB,
+f8 NUMERIC(6,4) default '2000.00',
+f9 VARCHAR(1024),
+f10 BINARY(20) not null default '\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0',
+f11 CHAR(255))
+ENGINE='Falcon';
+Warnings:
+Warning	1264	Out of range value for column 'f8' at row 1
+
+CREATE TABLE t31 (f1 INT, f2 INT, f3 INT PRIMARY KEY, f4 CHAR(20),
+/* extra */
+f5  BIGINT,
+f6  BLOB,
+f7  DATE,
+f8  DATETIME,
+f9  FLOAT,
+f10 INT,
+f11 LONGBLOB,
+f12 LONGTEXT,
+f13 MEDIUMBLOB,
+f14 MEDIUMINT,
+f15 MEDIUMTEXT,
+f16 REAL,
+f17 SMALLINT,
+f18 TEXT,
+f19 TIME,
+f20 TIMESTAMP,
+f21 TINYBLOB,
+f22 TINYINT,
+f23 TINYTEXT,
+f24 YEAR,
+f25 BINARY(255),
+f26 BIT(64),
+f27 CHAR(255),
+f28 DECIMAL(30,7),
+f29 DOUBLE,
+f30 ENUM ('a','b', 'c') default 'a',
+f31 FLOAT,
+f32 NUMERIC(17,9),
+f33 SET ('a', 'b', 'c') default 'b',
+f34 VARBINARY(1025),
+f35 VARCHAR(257)       
+) ENGINE='Falcon';
+
+** Alter tables on slave and drop columns **
+
+alter table t2 drop f5, drop f6, drop f7, drop f8, drop f9, drop f10, drop f11, drop
+f12;
+alter table t3 drop f5, drop f6, drop f8, drop f10, drop f11, drop f12;
+alter table t4 drop f5, drop f6, drop f7, drop f8, drop f9, drop f10, drop f11;
+alter table t31 
+drop f5, drop f6, drop f7, drop f8, drop f9, drop f10, drop f11,
+drop f12, drop f13, drop f14, drop f15, drop f16, drop f17, drop f18,
+drop f19, drop f20, drop f21, drop f22, drop f23, drop f24, drop f25,
+drop f26, drop f27, drop f28, drop f29, drop f30, drop f31, drop f32,
+drop f33, drop f34, drop f35;
+
+** Insert Data into Master **
+INSERT into t2 set f1=1, f2=1, f3=1, f4='first', f8='f8: medium size blob', f10='f10:
+some var char';
+INSERT into t2 values (2, 2, 2, 'second',
+2.0, 'b', 2000.0002, 'f8: medium size blob', 2000, 'f10: some var char',
+'01234567', 'c'),
+(3, 3, 3, 'third',
+3.0, 'b', 3000.0003, 'f8: medium size blob', 3000, 'f10: some var char',
+'01234567', 'c');
+Warnings:
+Warning	1264	Out of range value for column 'f9' at row 1
+Warning	1264	Out of range value for column 'f9' at row 2
+INSERT into t3 set f1=1, f2=1, f3=1, f4='first', f10='f10: some var char';
+INSERT into t4 set f1=1, f2=1, f3=1, f4='first', f7='f7: medium size blob', f10='f10:
+binary data';
+INSERT into t31 set f1=1, f2=1, f3=1, f4='first';
+INSERT into t31 set f1=1, f2=1, f3=2, f4='second',
+f9=2.2,  f10='seven samurai', f28=222.222, f35='222';
+Warnings:
+Warning	1366	Incorrect integer value: 'seven samurai' for column 'f10' at row 1
+INSERT into t31 values (1, 1, 3, 'third',
+/* f5  BIGINT,  */            333333333333333333333333,
+/* f6  BLOB,  */              '3333333333333333333333',
+/* f7  DATE,  */              '2007-07-18',
+/* f8  DATETIME,  */          "2007-07-18",
+/* f9  FLOAT,  */             3.33333333,
+/* f10 INT,  */               333333333,
+/* f11 LONGBLOB,  */          '3333333333333333333',
+/* f12 LONGTEXT,  */          '3333333333333333333',
+/* f13 MEDIUMBLOB,  */        '3333333333333333333',
+/* f14 MEDIUMINT,  */         33,
+/* f15 MEDIUMTEXT,  */        3.3,
+/* f16 REAL,  */              3.3,
+/* f17 SMALLINT,  */          3,
+/* f18 TEXT,  */              '33',
+/* f19 TIME,  */              '2:59:58.999',
+/* f20 TIMESTAMP,  */         20000303000000,
+/* f21 TINYBLOB,  */          '3333',
+/* f22 TINYINT,  */           3,
+/* f23 TINYTEXT,  */          '3',
+/* f24 YEAR,  */              3000,
+/* f25 BINARY(255),  */       'three_33333',
+/* f26 BIT(64),  */           b'011', 
+/* f27 CHAR(255),  */         'three',
+/* f28 DECIMAL(30,7),  */     3.333,
+/* f29 DOUBLE,  */            3.333333333333333333333333333,
+/* f30 ENUM ('a','b','c')*/   'c',
+/* f31 FLOAT,  */             3.0,
+/* f32 NUMERIC(17,9),  */     3.3333,
+/* f33 SET ('a','b','c'),*/   'c',
+/*f34 VARBINARY(1025),*/      '3333 minus 3',
+/*f35 VARCHAR(257),*/         'three times three'
+      );
+Warnings:
+Warning	1264	Out of range value for column 'f5' at row 1
+Warning	1264	Out of range value for column 'f24' at row 1
+INSERT into t31 values (1, 1, 4, 'fourth',
+/* f5  BIGINT,  */            333333333333333333333333,
+/* f6  BLOB,  */              '3333333333333333333333',
+/* f7  DATE,  */              '2007-07-18',
+/* f8  DATETIME,  */          "2007-07-18",
+/* f9  FLOAT,  */             3.33333333,
+/* f10 INT,  */               333333333,
+/* f11 LONGBLOB,  */          '3333333333333333333',
+/* f12 LONGTEXT,  */          '3333333333333333333',
+/* f13 MEDIUMBLOB,  */        '3333333333333333333',
+/* f14 MEDIUMINT,  */         33,
+/* f15 MEDIUMTEXT,  */        3.3,
+/* f16 REAL,  */              3.3,
+/* f17 SMALLINT,  */          3,
+/* f18 TEXT,  */              '33',
+/* f19 TIME,  */              '2:59:58.999',
+/* f20 TIMESTAMP,  */         20000303000000,
+/* f21 TINYBLOB,  */          '3333',
+/* f22 TINYINT,  */           3,
+/* f23 TINYTEXT,  */          '3',
+/* f24 YEAR,  */              3000,
+/* f25 BINARY(255),  */       'three_33333',
+/* f26 BIT(64),  */           b'011',
+/* f27 CHAR(255),  */         'three',
+/* f28 DECIMAL(30,7),  */     3.333,
+/* f29 DOUBLE,  */            3.333333333333333333333333333,
+/* f30 ENUM ('a','b','c')*/   'c',
+/* f31 FLOAT,  */             3.0,
+/* f32 NUMERIC(17,9),  */     3.3333,
+/* f33 SET ('a','b','c'),*/   'c',
+/*f34 VARBINARY(1025),*/      '3333 minus 3',
+/*f35 VARCHAR(257),*/         'three times three'
+       ),
+(1, 1, 5, 'fifth',
+/* f5  BIGINT,  */            333333333333333333333333,
+/* f6  BLOB,  */              '3333333333333333333333',
+/* f7  DATE,  */              '2007-07-18',
+/* f8  DATETIME,  */          "2007-07-18",
+/* f9  FLOAT,  */             3.33333333,
+/* f10 INT,  */               333333333,
+/* f11 LONGBLOB,  */          '3333333333333333333',
+/* f12 LONGTEXT,  */          '3333333333333333333',
+/* f13 MEDIUMBLOB,  */        '3333333333333333333',
+/* f14 MEDIUMINT,  */         33,
+/* f15 MEDIUMTEXT,  */        3.3,
+/* f16 REAL,  */              3.3,
+/* f17 SMALLINT,  */          3,
+/* f18 TEXT,  */              '33',
+/* f19 TIME,  */              '2:59:58.999',
+/* f20 TIMESTAMP,  */         20000303000000,
+/* f21 TINYBLOB,  */          '3333',
+/* f22 TINYINT,  */           3,
+/* f23 TINYTEXT,  */          '3',
+/* f24 YEAR,  */              3000,
+/* f25 BINARY(255),  */       'three_33333',
+/* f26 BIT(64),  */           b'011',
+/* f27 CHAR(255),  */         'three',
+/* f28 DECIMAL(30,7),  */     3.333,
+/* f29 DOUBLE,  */            3.333333333333333333333333333,
+/* f30 ENUM ('a','b','c')*/   'c',
+/* f31 FLOAT,  */             3.0,
+/* f32 NUMERIC(17,9),  */     3.3333,
+/* f33 SET ('a','b','c'),*/   'c',
+/*f34 VARBINARY(1025),*/      '3333 minus 3',
+/*f35 VARCHAR(257),*/         'three times three'
+       ),
+(1, 1, 6, 'sixth',
+/* f5  BIGINT,  */            NULL,
+/* f6  BLOB,  */              '3333333333333333333333',
+/* f7  DATE,  */              '2007-07-18',
+/* f8  DATETIME,  */          "2007-07-18",
+/* f9  FLOAT,  */             3.33333333,
+/* f10 INT,  */               333333333,
+/* f11 LONGBLOB,  */          '3333333333333333333',
+/* f12 LONGTEXT,  */          '3333333333333333333',
+/* f13 MEDIUMBLOB,  */        '3333333333333333333',
+/* f14 MEDIUMINT,  */         33,
+/* f15 MEDIUMTEXT,  */        3.3,
+/* f16 REAL,  */              3.3,
+/* f17 SMALLINT,  */          3,
+/* f18 TEXT,  */              '33',
+/* f19 TIME,  */              '2:59:58.999',
+/* f20 TIMESTAMP,  */         20000303000000,
+/* f21 TINYBLOB,  */          '3333',
+/* f22 TINYINT,  */           3,
+/* f23 TINYTEXT,  */          '3',
+/* f24 YEAR,  */              3000,
+/* f25 BINARY(255),  */       'three_33333',
+/* f26 BIT(64),  */           b'011',
+/* f27 CHAR(255),  */         'three',
+/* f28 DECIMAL(30,7),  */     3.333,
+/* f29 DOUBLE,  */            3.333333333333333333333333333,
+/* f30 ENUM ('a','b','c')*/   'c',
+/* f31 FLOAT,  */             3.0,
+/* f32 NUMERIC(17,9),  */     3.3333,
+/* f33 SET ('a','b','c'),*/   'c',
+/*f34 VARBINARY(1025),*/      '3333 minus 3',
+/*f35 VARCHAR(257),*/         NULL
+);
+Warnings:
+Warning	1264	Out of range value for column 'f5' at row 1
+Warning	1264	Out of range value for column 'f24' at row 1
+Warning	1264	Out of range value for column 'f5' at row 2
+Warning	1264	Out of range value for column 'f24' at row 2
+Warning	1264	Out of range value for column 'f24' at row 3
+
+** Sync slave with master ** 
+** Do selects from tables **
+
+select * from t1 order by f3;
+f1	f2	f3	f4
+2	2	2	second
+3	3	3	next
+5	5	5	second
+6	6	6	next
+8	8	8	second
+9	9	9	next
+11	11	11	second
+12	12	12	next
+14	14	14	second
+15	15	15	next
+17	17	17	second
+18	18	18	next
+20	20	20	second
+21	21	21	next
+23	23	23	second
+24	24	24	next
+26	26	26	second
+27	27	27	next
+29	29	29	second
+30	30	30	next
+31	31	31	second
+32	32	32	second
+33	33	33	second
+34	34	34	second
+35	35	35	second
+36	36	36	second
+37	37	37	second
+38	38	38	second
+39	39	39	second
+40	40	40	second
+41	41	41	second
+42	42	42	second
+43	43	43	second
+44	44	44	second
+45	45	45	second
+46	46	46	second
+47	47	47	second
+48	48	48	second
+49	49	49	second
+50	50	50	second
+select * from t2 order by f1;
+f1	f2	f3	f4
+1	1	1	first
+2	2	2	second
+3	3	3	third
+select * from t3 order by f1;
+f1	f2	f3	f4
+1	1	1	first
+select * from t4 order by f1;
+f1	f2	f3	f4
+1	1	1	first
+select * from t31 order by f3;
+f1	f2	f3	f4
+1	1	1	first
+1	1	2	second
+1	1	3	third
+1	1	4	fourth
+1	1	5	fifth
+1	1	6	sixth
+
+** Do updates master **
+
+update t31 set f5=555555555555555 where f3=6;
+update t31 set f2=2 where f3=2;
+update t31 set f1=NULL where f3=1;
+update t31 set f3=0, f27=NULL, f35='f35 new value' where f3=3;
+
+** Delete from Master **
+
+delete from t1;
+delete from t2;
+delete from t3;
+delete from t4;
+delete from t31;
+
+** Check slave status **
+
+select * from t31;
+f1	f2	f3	f4
+show slave status;;
+Slave_IO_State	#
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	#
+Connect_Retry	1
+Master_Log_File	master-bin.000001
+Read_Master_Log_Pos	#
+Relay_Log_File	#
+Relay_Log_Pos	#
+Relay_Master_Log_File	master-bin.000001
+Slave_IO_Running	Yes
+Slave_SQL_Running	Yes
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	0
+Last_Error	
+Skip_Counter	0
+Exec_Master_Log_Pos	#
+Relay_Log_Space	#
+Until_Condition	None
+Until_Log_File	
+Until_Log_Pos	0
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	#
+Master_SSL_Verify_Server_Cert	No
+Last_IO_Errno	#
+Last_IO_Error	#
+Last_SQL_Errno	0
+Last_SQL_Error	
+
+****************************************
+* columns in master at middle of table *
+* Expect: Proper error message         *
+****************************************
+
+** Stop and Reset Slave **
+
+STOP SLAVE;
+RESET SLAVE;
+
+** create table slave side **
+CREATE TABLE t10 (a INT PRIMARY KEY, b BLOB, c CHAR(5)
+) ENGINE='Falcon';
+
+** Connect to master and create table **
+
+CREATE TABLE t10 (a INT KEY, b BLOB, f DOUBLE DEFAULT '233',
+c CHAR(5), e INT DEFAULT '1')ENGINE='Falcon';
+RESET MASTER;
+
+*** Start Slave ***
+START SLAVE;
+
+*** Master Data Insert ***
+set @b1 = 'b1b1b1b1';
+set @b1 = concat(@b1,@b1);
+INSERT INTO t10 () VALUES(1,@b1,DEFAULT,'Kyle',DEFAULT),
+(2,@b1,DEFAULT,'JOE',DEFAULT),
+(3,@b1,DEFAULT,'QA',DEFAULT);
+
+********************************************
+*** Expect slave to fail with Error 1523 ***
+********************************************
+
+SHOW SLAVE STATUS;
+Slave_IO_State	#
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	#
+Connect_Retry	1
+Master_Log_File	master-bin.000001
+Read_Master_Log_Pos	#
+Relay_Log_File	#
+Relay_Log_Pos	#
+Relay_Master_Log_File	master-bin.000001
+Slave_IO_Running	Yes
+Slave_SQL_Running	No
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	1535
+Last_Error	Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254
+Skip_Counter	0
+Exec_Master_Log_Pos	#
+Relay_Log_Space	#
+Until_Condition	None
+Until_Log_File	
+Until_Log_Pos	0
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	#
+Master_SSL_Verify_Server_Cert	No
+Last_IO_Errno	#
+Last_IO_Error	#
+Last_SQL_Errno	1535
+Last_SQL_Error	Table definition on master and slave does not match: Column 2 type mismatch - received type 5, test.t10 has type 254
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
+START SLAVE;
+
+*** Drop t10  ***
+DROP TABLE t10;
+
+*********************************************
+* More columns in master at middle of table *
+* Expect: Proper error message              *
+*********************************************
+
+*** Create t11 on slave  ***
+STOP SLAVE;
+RESET SLAVE;
+CREATE TABLE t11 (a INT PRIMARY KEY, b BLOB, c VARCHAR(254)
+) ENGINE='Falcon';
+
+*** Create t11 on Master ***
+CREATE TABLE t11 (a INT KEY, b BLOB, f TEXT,
+c CHAR(5) DEFAULT 'test', e INT DEFAULT '1')ENGINE='Falcon';
+RESET MASTER;
+
+*** Start Slave ***
+START SLAVE;
+
+*** Master Data Insert ***
+set @b1 = 'b1b1b1b1';
+set @b1 = concat(@b1,@b1);
+INSERT INTO t11 () VALUES(1,@b1,'Testing is fun','Kyle',DEFAULT),
+(2,@b1,'Testing is cool','JOE',DEFAULT),
+(3,@b1,DEFAULT,'QA',DEFAULT);
+
+********************************************
+*** Expect slave to fail with Error 1523 ***
+********************************************
+
+SHOW SLAVE STATUS;
+Slave_IO_State	#
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	#
+Connect_Retry	1
+Master_Log_File	master-bin.000001
+Read_Master_Log_Pos	#
+Relay_Log_File	#
+Relay_Log_Pos	#
+Relay_Master_Log_File	master-bin.000001
+Slave_IO_Running	Yes
+Slave_SQL_Running	No
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	1535
+Last_Error	Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15
+Skip_Counter	0
+Exec_Master_Log_Pos	#
+Relay_Log_Space	#
+Until_Condition	None
+Until_Log_File	
+Until_Log_Pos	0
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	#
+Master_SSL_Verify_Server_Cert	No
+Last_IO_Errno	#
+Last_IO_Error	#
+Last_SQL_Errno	1535
+Last_SQL_Error	Table definition on master and slave does not match: Column 2 type mismatch - received type 252, test.t11 has type 15
+SET GLOBAL SQL_SLAVE_SKIP_COUNTER=2;
+START SLAVE;
+
+*** Drop t11  ***
+DROP TABLE t11;
+
+*********************************************
+* More columns in master at middle of table *
+* Expect: This one should pass blob-text    *
+*********************************************
+
+*** Create t12 on slave  ***
+STOP SLAVE;
+RESET SLAVE;
+CREATE TABLE t12 (a INT PRIMARY KEY, b BLOB, c BLOB
+) ENGINE='Falcon';
+
+*** Create t12 on Master ***
+CREATE TABLE t12 (a INT KEY, b BLOB, f TEXT,
+c CHAR(5) DEFAULT 'test', e INT DEFAULT '1')ENGINE='Falcon';
+RESET MASTER;
+
+*** Start Slave ***
+START SLAVE;
+
+*** Master Data Insert ***
+set @b1 = 'b1b1b1b1';
+set @b1 = concat(@b1,@b1);
+INSERT INTO t12 () VALUES(1,@b1,'Kyle',DEFAULT,DEFAULT),
+(2,@b1,'JOE',DEFAULT,DEFAULT),
+(3,@b1,'QA',DEFAULT,DEFAULT);
+
+SELECT a,hex(b),f,c,e FROM t12 ORDER BY a;
+a	hex(b)	f	c	e
+1	62316231623162316231623162316231	Kyle	test	1
+2	62316231623162316231623162316231	JOE	test	1
+3	62316231623162316231623162316231	QA	test	1
+
+*** Select on Slave ***
+SELECT a,hex(b),c FROM t12 ORDER BY a;
+a	hex(b)	c
+1	62316231623162316231623162316231	Kyle
+2	62316231623162316231623162316231	JOE
+3	62316231623162316231623162316231	QA
+
+*** Drop t12  ***
+DROP TABLE t12;
+
+****************************************************
+* - Alter Master adding columns at middle of table *
+*   Expect: columns added                          *
+****************************************************
+
+
+*** Create t14 on slave  ***
+STOP SLAVE;
+RESET SLAVE;
+CREATE TABLE t14 (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
+) ENGINE='Falcon';
+
+*** Create t14 on Master ***
+CREATE TABLE t14 (c1 INT KEY, c4 BLOB, c5 CHAR(5),
+c6 INT DEFAULT '1',
+c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
+)ENGINE='Falcon';
+RESET MASTER;
+
+*** Start Slave ***
+START SLAVE;
+
+*** Master Data Insert ***
+ALTER TABLE t14 ADD COLUMN c2 DECIMAL(8,2) AFTER c1;
+ALTER TABLE t14 ADD COLUMN c3 TEXT AFTER c2;
+
+set @b1 = 'b1b1b1b1';
+set @b1 = concat(@b1,@b1);
+INSERT INTO t14 () VALUES(1,1.00,'Replication Testing Extra Col',@b1,'Kyle',DEFAULT,DEFAULT),
+(2,2.00,'This Test Should work',@b1,'JOE',DEFAULT,DEFAULT),
+(3,3.00,'If is does not, I will open a bug',@b1,'QA',DEFAULT,DEFAULT);
+
+SELECT c1,c2,c3,hex(c4),c5,c6,c7 FROM t14 ORDER BY c1;
+c1	c2	c3	hex(c4)	c5	c6	c7
+1	1.00	Replication Testing Extra Col	62316231623162316231623162316231	Kyle	1	CURRENT_TIMESTAMP
+2	2.00	This Test Should work	62316231623162316231623162316231	JOE	1	CURRENT_TIMESTAMP
+3	3.00	If is does not, I will open a bug	62316231623162316231623162316231	QA	1	CURRENT_TIMESTAMP
+
+*** Select on Slave ****
+SELECT c1,c2,c3,hex(c4),c5 FROM t14 ORDER BY c1;
+c1	c2	c3	hex(c4)	c5
+1	1.00	Replication Testing Extra Col	62316231623162316231623162316231	Kyle
+2	2.00	This Test Should work	62316231623162316231623162316231	JOE
+3	3.00	If is does not, I will open a bug	62316231623162316231623162316231	QA
+
+****************************************************
+* - Alter Master Dropping columns from the middle. *
+*   Expect: columns dropped                        *
+****************************************************
+
+*** connect to master and drop columns ***
+ALTER TABLE t14 DROP COLUMN c2;
+ALTER TABLE t14 DROP COLUMN c7;
+
+*** Select from Master ***
+SELECT c1,c3,hex(c4),c5,c6 FROM t14 ORDER BY c1;
+c1	c3	hex(c4)	c5	c6
+1	Replication Testing Extra Col	62316231623162316231623162316231	Kyle	1
+2	This Test Should work	62316231623162316231623162316231	JOE	1
+3	If is does not, I will open a bug	62316231623162316231623162316231	QA	1
+
+************
+* Bug30415 *
+************
+SHOW SLAVE STATUS;
+Slave_IO_State	#
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	#
+Connect_Retry	1
+Master_Log_File	master-bin.000001
+Read_Master_Log_Pos	#
+Relay_Log_File	#
+Relay_Log_Pos	#
+Relay_Master_Log_File	master-bin.000001
+Slave_IO_Running	Yes
+Slave_SQL_Running	No
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	1091
+Last_Error	Error 'Can't DROP 'c7'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7'
+Skip_Counter	0
+Exec_Master_Log_Pos	#
+Relay_Log_Space	#
+Until_Condition	None
+Until_Log_File	
+Until_Log_Pos	0
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	#
+Master_SSL_Verify_Server_Cert	No
+Last_IO_Errno	#
+Last_IO_Error	#
+Last_SQL_Errno	1091
+Last_SQL_Error	Error 'Can't DROP 'c7'; check that column/key exists' on query. Default database: 'test'. Query: 'ALTER TABLE t14 DROP COLUMN c7'
+STOP SLAVE;
+RESET SLAVE;
+
+*** Drop t14  ***
+DROP TABLE t14;
+DROP TABLE t14;
+RESET MASTER;
+START SLAVE;
+
+*************************************************
+* - Alter Master adding columns at end of table *
+*   Expect: Error 1054                          *
+*************************************************
+
+*** Create t15 on slave  ***
+STOP SLAVE;
+RESET SLAVE;
+CREATE TABLE t15 (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
+) ENGINE='Falcon';
+
+*** Create t15 on Master ***
+CREATE TABLE t15 (c1 INT KEY, c4 BLOB, c5 CHAR(5),
+c6 INT DEFAULT '1',
+c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
+)ENGINE='Falcon';
+RESET MASTER;
+
+*** Start Slave ***
+START SLAVE;
+
+*** Master Data Insert ***
+ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7;
+set @b1 = 'b1b1b1b1';
+set @b1 = concat(@b1,@b1);
+INSERT INTO t15 () VALUES(1,@b1,'Kyle',DEFAULT,DEFAULT,3.00),
+(2,@b1,'JOE',DEFAULT,DEFAULT,3.00),
+(3,@b1,'QA',DEFAULT,DEFAULT,3.00);
+SELECT c1,hex(c4),c5,c6,c7,c2 FROM t15 ORDER BY c1;
+c1	hex(c4)	c5	c6	c7	c2
+1	62316231623162316231623162316231	Kyle	1	CURRENT_TIMESTAMP	3.00
+2	62316231623162316231623162316231	JOE	1	CURRENT_TIMESTAMP	3.00
+3	62316231623162316231623162316231	QA	1	CURRENT_TIMESTAMP	3.00
+
+********************************************
+*** Expect slave to fail with Error 1054 ***
+********************************************
+
+SHOW SLAVE STATUS;
+Slave_IO_State	#
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	#
+Connect_Retry	1
+Master_Log_File	master-bin.000001
+Read_Master_Log_Pos	#
+Relay_Log_File	#
+Relay_Log_Pos	#
+Relay_Master_Log_File	master-bin.000001
+Slave_IO_Running	Yes
+Slave_SQL_Running	No
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	1054
+Last_Error	Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7'
+Skip_Counter	0
+Exec_Master_Log_Pos	#
+Relay_Log_Space	#
+Until_Condition	None
+Until_Log_File	
+Until_Log_Pos	0
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	#
+Master_SSL_Verify_Server_Cert	No
+Last_IO_Errno	#
+Last_IO_Error	#
+Last_SQL_Errno	1054
+Last_SQL_Error	Error 'Unknown column 'c7' in 't15'' on query. Default database: 'test'. Query: 'ALTER TABLE t15 ADD COLUMN c2 DECIMAL(8,2) AFTER c7'
+STOP SLAVE;
+RESET SLAVE;
+
+*** Drop t15  ***
+DROP TABLE t15;
+DROP TABLE t15;
+RESET MASTER;
+START SLAVE;
+
+************************************************
+* - Create index on Master column not on slave *
+*   Expect:Warning                             *
+************************************************
+
+*** Create t16 on slave  ***
+STOP SLAVE;
+RESET SLAVE;
+CREATE TABLE t16 (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
+) ENGINE='Falcon';
+
+*** Create t16 on Master ***
+CREATE TABLE t16 (c1 INT KEY, c4 BLOB, c5 CHAR(5),
+c6 INT DEFAULT '1',
+c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
+)ENGINE='Falcon';
+RESET MASTER;
+
+*** Start Slave ***
+START SLAVE;
+
+*** Master Create Index and Data Insert ***
+CREATE INDEX part_of_c6 ON t16 (c6);
+set @b1 = 'b1b1b1b1';
+set @b1 = concat(@b1,@b1);
+INSERT INTO t16 () VALUES(1,@b1,'Kyle',DEFAULT,DEFAULT),
+(2,@b1,'JOE',2,DEFAULT),
+(3,@b1,'QA',3,DEFAULT);
+SELECT c1,hex(c4),c5,c6,c7 FROM t16 ORDER BY c1;
+c1	hex(c4)	c5	c6	c7
+1	62316231623162316231623162316231	Kyle	1	CURRENT_TIMESTAMP
+2	62316231623162316231623162316231	JOE	2	CURRENT_TIMESTAMP
+3	62316231623162316231623162316231	QA	3	CURRENT_TIMESTAMP
+
+*****************
+*** BUG 30434 ***
+*****************
+
+SHOW SLAVE STATUS;
+Slave_IO_State	#
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	#
+Connect_Retry	1
+Master_Log_File	master-bin.000001
+Read_Master_Log_Pos	#
+Relay_Log_File	#
+Relay_Log_Pos	#
+Relay_Master_Log_File	master-bin.000001
+Slave_IO_Running	Yes
+Slave_SQL_Running	No
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	1072
+Last_Error	Error 'Key column 'c6' doesn't exist in table' on query. Default database: 'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)'
+Skip_Counter	0
+Exec_Master_Log_Pos	#
+Relay_Log_Space	#
+Until_Condition	None
+Until_Log_File	
+Until_Log_Pos	0
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	#
+Master_SSL_Verify_Server_Cert	No
+Last_IO_Errno	#
+Last_IO_Error	#
+Last_SQL_Errno	1072
+Last_SQL_Error	Error 'Key column 'c6' doesn't exist in table' on query. Default database: 'test'. Query: 'CREATE INDEX part_of_c6 ON t16 (c6)'
+STOP SLAVE;
+RESET SLAVE;
+
+*** Drop t16  ***
+DROP TABLE t16;
+DROP TABLE t16;
+RESET MASTER;
+START SLAVE;
+
+*****************************************************
+* - Delete rows using column on Master not on slave *
+*   Expect: Rows Deleted                            *
+*****************************************************
+
+*** Create t17 on slave  ***
+STOP SLAVE;
+RESET SLAVE;
+CREATE TABLE t17 (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
+) ENGINE='Falcon';
+
+*** Create t17 on Master ***
+CREATE TABLE t17 (c1 INT KEY, c4 BLOB, c5 CHAR(5),
+c6 INT DEFAULT '1',
+c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
+)ENGINE='Falcon';
+RESET MASTER;
+
+*** Start Slave ***
+START SLAVE;
+
+*** Master Data Insert ***
+set @b1 = 'b1b1b1b1';
+set @b1 = concat(@b1,@b1);
+INSERT INTO t17 () VALUES(1,@b1,'Kyle',DEFAULT,DEFAULT),
+(2,@b1,'JOE',2,DEFAULT),
+(3,@b1,'QA',3,DEFAULT);
+SELECT c1,hex(c4),c5,c6,c7 FROM t17 ORDER BY c1;
+c1	hex(c4)	c5	c6	c7
+1	62316231623162316231623162316231	Kyle	1	CURRENT_TIMESTAMP
+2	62316231623162316231623162316231	JOE	2	CURRENT_TIMESTAMP
+3	62316231623162316231623162316231	QA	3	CURRENT_TIMESTAMP
+
+** Select * from Slave **
+SELECT c1,hex(c4),c5 FROM t17 ORDER BY c1;
+c1	hex(c4)	c5
+1	62316231623162316231623162316231	Kyle
+2	62316231623162316231623162316231	JOE
+3	62316231623162316231623162316231	QA
+
+** Delete from master **
+DELETE FROM t17 WHERE c6 = 3;
+SELECT c1,hex(c4),c5,c6,c7 FROM t17 ORDER BY c1;
+c1	hex(c4)	c5	c6	c7
+1	62316231623162316231623162316231	Kyle	1	CURRENT_TIMESTAMP
+2	62316231623162316231623162316231	JOE	2	CURRENT_TIMESTAMP
+
+** Check slave **
+SELECT c1,hex(c4),c5 FROM t17 ORDER BY c1;
+c1	hex(c4)	c5
+1	62316231623162316231623162316231	Kyle
+2	62316231623162316231623162316231	JOE
+DROP TABLE t17;
+
+
+*****************************************************
+* - Update row using column on Master not on slave *
+*   Expect: Rows updated                           *
+*****************************************************
+
+** Bug30674 **
+
+*** Create t18 on slave  ***
+
+STOP SLAVE;
+RESET SLAVE;
+CREATE TABLE t18 (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
+) ENGINE='Falcon';
+
+*** Create t18 on Master ***
+CREATE TABLE t18 (c1 INT KEY, c4 BLOB, c5 CHAR(5),
+c6 INT DEFAULT '1',
+c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
+)ENGINE='Falcon';
+RESET MASTER;
+
+*** Start Slave ***
+START SLAVE;
+
+*** Master Data Insert ***
+set @b1 = 'b1b1b1b1';
+set @b1 = concat(@b1,@b1);
+INSERT INTO t18 () VALUES(1,@b1,'Kyle',DEFAULT,DEFAULT),
+(2,@b1,'JOE',2,DEFAULT),
+(3,@b1,'QA',3,DEFAULT);
+SELECT c1,hex(c4),c5,c6,c7 FROM t18 ORDER BY c1;
+c1	hex(c4)	c5	c6	c7
+1	62316231623162316231623162316231	Kyle	1	CURRENT_TIMESTAMP
+2	62316231623162316231623162316231	JOE	2	CURRENT_TIMESTAMP
+3	62316231623162316231623162316231	QA	3	CURRENT_TIMESTAMP
+
+** Select * from Slave **
+SELECT c1,hex(c4),c5 FROM t18 ORDER BY c1;
+c1	hex(c4)	c5
+1	62316231623162316231623162316231	Kyle
+2	62316231623162316231623162316231	JOE
+3	62316231623162316231623162316231	QA
+
+** update from master **
+UPDATE t18 SET c5 = 'TEST' WHERE c6 = 3;
+SELECT c1,hex(c4),c5,c6,c7 FROM t18 ORDER BY c1;
+c1	hex(c4)	c5	c6	c7
+1	62316231623162316231623162316231	Kyle	1	CURRENT_TIMESTAMP
+2	62316231623162316231623162316231	JOE	2	CURRENT_TIMESTAMP
+3	62316231623162316231623162316231	TEST	3	CURRENT_TIMESTAMP
+
+** Check slave **
+SELECT c1,hex(c4),c5 FROM t18 ORDER BY c1;
+c1	hex(c4)	c5
+1	62316231623162316231623162316231	Kyle
+2	62316231623162316231623162316231	JOE
+3	62316231623162316231623162316231	TEST
+DROP TABLE t18;
+
+
+*****************************************************
+* - Insert UUID  column on Master not on slave *
+*   Expect: Rows inserted                      *
+*****************************************************
+
+*** Create t5 on slave  ***
+STOP SLAVE;
+RESET SLAVE;
+CREATE TABLE t5 (c1 INT PRIMARY KEY, c4 BLOB, c5 CHAR(5)
+) ENGINE='Falcon';
+
+*** Create t5 on Master ***
+CREATE TABLE t5 (c1 INT KEY, c4 BLOB, c5 CHAR(5),
+c6 LONG, 
+c7 TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP
+)ENGINE='Falcon';
+RESET MASTER;
+
+*** Start Slave ***
+START SLAVE;
+
+*** Master Data Insert ***
+set @b1 = 'b1b1b1b1';
+INSERT INTO t5 () VALUES(1,@b1,'Kyle',UUID(),DEFAULT),
+(2,@b1,'JOE',UUID(),DEFAULT),
+(3,@b1,'QA',UUID(),DEFAULT);
+SELECT c1,hex(c4),c5,c6,c7 FROM t5 ORDER BY c1;
+c1	hex(c4)	c5	c6	c7
+1	6231623162316231	Kyle	UUID	TIME
+2	6231623162316231	JOE	UUID	TIME
+3	6231623162316231	QA	UUID	TIME
+
+** Select * from Slave **
+SELECT c1,hex(c4),c5 FROM t5 ORDER BY c1;
+c1	hex(c4)	c5
+1	6231623162316231	Kyle
+2	6231623162316231	JOE
+3	6231623162316231	QA
+DROP TABLE t5;
+

=== added file 'mysql-test/suite/rpl/r/rpl_locktrans_falcon.result'
--- a/mysql-test/suite/rpl/r/rpl_locktrans_falcon.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/r/rpl_locktrans_falcon.result	2008-11-17 10:57:50 +0000
@@ -0,0 +1,439 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP DATABASE  IF EXISTS mysqltest;
+DROP TABLE     IF EXISTS t1, t2, t3, t4, v1;
+DROP VIEW      IF EXISTS t1, t2, t3, t4, v1;
+DROP PROCEDURE IF EXISTS lock_t1_excl;
+DROP PROCEDURE IF EXISTS count_t2;
+DROP PROCEDURE IF EXISTS update_t2;
+DROP TRIGGER   IF EXISTS t1_ai;
+#
+# WL3561 - transactional LOCK TABLE - Syntax tests
+# ================================================
+CREATE TABLE t1 (c1 INT ) ENGINE=Falcon;
+CREATE TABLE t2 (c2 INT ) ENGINE=Falcon;
+CREATE TABLE t3 (c3 INT ) ENGINE=Falcon;
+#
+# Valid syntax for non-transactional locks.
+LOCK TABLE t1 READ, t2 WRITE;
+UNLOCK TABLES;
+LOCK TABLE t1 READ LOCAL, t2 LOW_PRIORITY WRITE;
+UNLOCK TABLES;
+#
+# Valid syntax for transactional locks.
+LOCK TABLE t1 IN SHARE MODE, t2 IN EXCLUSIVE MODE;
+Warnings:
+Warning	1621	Converted to non-transactional lock on 't1'
+Warning	1621	Converted to non-transactional lock on 't2'
+UNLOCK TABLES;
+#
+# Valid syntax for aliases with and without 'AS'.
+LOCK TABLE t1 AS a1 READ, t2 a2 WRITE;
+UNLOCK TABLES;
+LOCK TABLE t1 AS a1 IN SHARE MODE, t2 a2 IN EXCLUSIVE MODE;
+Warnings:
+Warning	1621	Converted to non-transactional lock on 'a1'
+Warning	1621	Converted to non-transactional lock on 'a2'
+UNLOCK TABLES;
+#
+# Transactional locks taken on a view.
+CREATE VIEW v1 AS SELECT * FROM t1, t2 WHERE t1.c1 = t2.c2;
+LOCK TABLE v1 IN SHARE MODE;
+Warnings:
+Warning	1621	Converted to non-transactional lock on 't1'
+Warning	1621	Converted to non-transactional lock on 't2'
+LOCK TABLE v1 IN EXCLUSIVE MODE;
+Warnings:
+Warning	1621	Converted to non-transactional lock on 'v1'
+UNLOCK TABLES;
+DROP VIEW v1;
+#
+# Locking INFORMATION_SCHEMA fails on missing privileges.
+LOCK TABLE information_schema.tables IN SHARE MODE;
+ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
+LOCK TABLE information_schema.tables IN EXCLUSIVE MODE;
+ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
+LOCK TABLE information_schema.tables READ;
+ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
+LOCK TABLE information_schema.tables WRITE;
+ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
+#
+# The new keywords EXCLUSIVE and NOWAIT are not reserved words.
+CREATE TABLE t4 (exclusive INT, nowait INT) ENGINE=Falcon;
+LOCK TABLE t4 WRITE;
+DROP TABLE t4;
+#
+# Syntax errors for misspelled modes or left out symbols.
+##-------------------------------------------------------
+LOCK TABLE t1 IN SHARED MODE;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SHARED MODE' at line 1
+LOCK TABLE t1 SHARE MODE;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'MODE' at line 1
+LOCK TABLE t1 IN SHARE;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
+LOCK TABLE t1 IN MODE;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'MODE' at line 1
+LOCK TABLE t1 READ NOWAIT, t2 WRITE NOWAIT;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NOWAIT, t2 WRITE NOWAIT' at line 1
+LOCK TABLE t1 READ NOWAIT, t2 IN EXCLUSIVE MODE NOWAIT;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NOWAIT, t2 IN EXCLUSIVE MODE NOWAIT' at line 1
+LOCK TABLE t1 IN SHARE MODE NOWAIT, t2 WRITE NOWAIT;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NOWAIT' at line 1
+LOCK TABLE t1 IN SHARED MODE NOWAIT;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SHARED MODE NOWAIT' at line 1
+LOCK TABLE t1 SHARE MODE NOWAIT;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'MODE NOWAIT' at line 1
+LOCK TABLE t1 IN SHARE NOWAIT;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NOWAIT' at line 1
+LOCK TABLE t1 IN MODE NOWAIT;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'MODE NOWAIT' at line 1
+##----------------------
+## End of syntax errors.
+#
+#
+# WL3561 - transactional LOCK TABLE - Lock method conversion
+# ==========================================================
+#
+# Implicit lock method conversion due to mix in statement.
+LOCK TABLE t1 READ, t2 IN EXCLUSIVE MODE;
+Warnings:
+Warning	1621	Converted to non-transactional lock on 't2'
+UNLOCK TABLES;
+# Lock t1 share (converted to read), t2 write.
+LOCK TABLE t1 IN SHARE MODE, t2 WRITE;
+Warnings:
+Warning	1621	Converted to non-transactional lock on 't1'
+# Show t1 is read locked, t2 write locked.
+INSERT INTO t1 SELECT * FROM t2;
+ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
+INSERT INTO t2 SELECT * FROM t1;
+#
+# Implicit lock method conversion due to existing non-transact. locks.
+# Implicitly unlock existing non-transactional locks and take new ones.
+# Lock t1 exclusive (converted to write), t2 share (converted to read).
+LOCK TABLE t1 IN EXCLUSIVE MODE, t2 IN SHARE MODE;
+Warnings:
+Warning	1621	Converted to non-transactional lock on 't1'
+Warning	1621	Converted to non-transactional lock on 't2'
+# Show t1 is write locked, t2 read locked.
+INSERT INTO t1 SELECT * FROM t2;
+INSERT INTO t2 SELECT * FROM t1;
+ERROR HY000: Table 't2' was locked with a READ lock and can't be updated
+UNLOCK TABLES;
+#
+# Reject lock method conversion in strict mode.
+# Set strict mode.
+SET @wl3561_save_sql_mode= @@SQL_MODE;
+SET @@SQL_MODE= 'STRICT_ALL_TABLES';
+# Try mixed mode locks.
+LOCK TABLE t1 READ, t2 IN EXCLUSIVE MODE;
+ERROR HY000: Cannot convert to non-transactional lock in strict mode on 't2'
+LOCK TABLE t1 IN SHARE MODE, t2 WRITE;
+ERROR HY000: Cannot convert to non-transactional lock in strict mode on 't1'
+# Lock non-transactional.
+LOCK TABLE t1 READ, t2 WRITE;
+# Try transactional locks on top of the existing non-transactional locks.
+LOCK TABLE t1 IN SHARE MODE, t2 IN EXCLUSIVE MODE;
+ERROR HY000: Cannot convert to non-transactional lock in strict mode on 't1'
+## Error is reported on first table only. Show both errors:
+SHOW WARNINGS;
+Level	Code	Message
+Error	1622	Cannot convert to non-transactional lock in strict mode on 't1'
+Error	1622	Cannot convert to non-transactional lock in strict mode on 't2'
+UNLOCK TABLES;
+SET @@SQL_MODE= @wl3561_save_sql_mode;
+#
+# Reject lock method conversion in an active transaction.
+# Start transaction.
+START TRANSACTION;
+# Try mixed mode locks.
+LOCK TABLE t1 READ, t2 IN EXCLUSIVE MODE;
+ERROR HY000: Cannot convert to non-transactional lock in an active transaction on 't2'
+LOCK TABLE t1 IN SHARE MODE, t2 WRITE;
+ERROR HY000: Cannot convert to non-transactional lock in an active transaction on 't1'
+COMMIT;
+#
+# Implicit lock method conversion for non-transactional storage engine.
+# Create a non-transactional table.
+CREATE TABLE t4 (c4 INT) ENGINE= MyISAM;
+# Request a transactional lock, which is converted to non-transactional.
+LOCK TABLE t4 IN SHARE MODE;
+Warnings:
+Warning	1621	Converted to non-transactional lock on 't4'
+# Try a conflict with the existing non-transactional lock.
+INSERT INTO t4 VALUES(444);
+ERROR HY000: Table 't4' was locked with a READ lock and can't be updated
+UNLOCK TABLES;
+# Set strict mode.
+SET @@SQL_MODE= 'STRICT_ALL_TABLES';
+# Try a transactional lock, which would need a conversion.
+LOCK TABLE t4 IN SHARE MODE;
+ERROR HY000: Cannot convert to non-transactional lock in strict mode on 't4'
+SET @@SQL_MODE= @wl3561_save_sql_mode;
+#
+# View with transactional and non-transactional storage engine.
+CREATE VIEW v1 AS SELECT * FROM t3, t4 WHERE t3.c3 = t4.c4;
+# Request a share lock on the view, which is converted to read locks.
+LOCK TABLE v1 IN SHARE MODE;
+Warnings:
+Warning	1621	Converted to non-transactional lock on 't3'
+Warning	1621	Converted to non-transactional lock on 't4'
+# Show that read locks on the base tables prohibit writing ...
+INSERT INTO t3 SELECT * FROM t4;
+ERROR HY000: Table 't3' was locked with a READ lock and can't be updated
+INSERT INTO t4 SELECT * FROM t3;
+ERROR HY000: Table 't4' was locked with a READ lock and can't be updated
+# ... but allow reading.
+SELECT COUNT(*) FROM t3, t4 WHERE t3.c3 = t4.c4;
+COUNT(*)
+0
+SELECT COUNT(*) FROM v1;
+COUNT(*)
+0
+## Report conversion on view due to existing non-transactional locks.
+LOCK TABLE v1 IN EXCLUSIVE MODE;
+Warnings:
+Warning	1621	Converted to non-transactional lock on 'v1'
+INSERT INTO t3 VALUES(333);
+INSERT INTO t4 VALUES(444);
+INSERT INTO t1 VALUES(111);
+ERROR HY000: Table 't1' was not locked with LOCK TABLES
+UNLOCK TABLES;
+## Now report conversion on base table again.
+LOCK TABLE v1 IN EXCLUSIVE MODE;
+Warnings:
+Warning	1621	Converted to non-transactional lock on 't3'
+Warning	1621	Converted to non-transactional lock on 't4'
+INSERT INTO t3 VALUES(333);
+INSERT INTO t4 VALUES(444);
+INSERT INTO t1 VALUES(111);
+ERROR HY000: Table 't1' was not locked with LOCK TABLES
+UNLOCK TABLES;
+DROP VIEW v1;
+TRUNCATE t4;
+#
+# Insufficient privileges do not unlock tables nor end transactions.
+# Prepare database, tables and an user with insufficient privileges.
+# Make a new connection with this user.
+CREATE DATABASE mysqltest;
+CREATE TABLE mysqltest.t5 (c5 INT) ENGINE=Falcon;
+CREATE TABLE mysqltest.t6 (c6 INT) ENGINE=Falcon;
+CREATE USER mysqltest_1@localhost;
+GRANT SELECT, INSERT ON mysqltest.* TO mysqltest_1@localhost;
+# connection conn1.
+# Show sufficient privileges to lock tables in the test database.
+LOCK TABLE t1 READ, t2 WRITE;
+# Show insufficient privileges in the mysqltest database.
+LOCK TABLE mysqltest.t5 READ, mysqltest.t6 WRITE;
+ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysqltest'
+# Show that the locks in 'test' still exist.
+INSERT INTO t1 SELECT * FROM t2;
+ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
+INSERT INTO t2 SELECT * FROM t1;
+# Unlock tables.
+UNLOCK TABLES;
+# Start transaction.
+START TRANSACTION;
+# Insert a value.
+INSERT INTO t1 VALUES(111);
+# Try a lock that fails on privileges.
+LOCK TABLE mysqltest.t5 READ;
+ERROR 42000: Access denied for user 'mysqltest_1'@'localhost' to database 'mysqltest'
+# Rollback transaction.
+ROLLBACK;
+# Show that the inserted value has gone.
+SELECT * FROM t1;
+c1
+# Drop the connection with the unprivileged user.
+# connection default.
+#
+# Sufficient privileges do unlock tables and end transactions.
+# Grant sufficient privileges to the user.
+# Make a new connection with this user.
+GRANT SELECT, INSERT, LOCK TABLES ON mysqltest.* TO mysqltest_1@localhost;
+# connection conn1.
+# Lock tables in the test database.
+LOCK TABLE t1 READ, t2 WRITE;
+# Lock tables in the mysqltest database.
+LOCK TABLE mysqltest.t5 READ, mysqltest.t6 WRITE;
+# Show that the locks in 'test' have been replaced ...
+INSERT INTO t1 SELECT * FROM t2;
+ERROR HY000: Table 't1' was not locked with LOCK TABLES
+INSERT INTO t2 SELECT * FROM t1;
+ERROR HY000: Table 't2' was not locked with LOCK TABLES
+# ... by the locks in 'mysqltest'.
+INSERT INTO mysqltest.t5 SELECT * FROM mysqltest.t6;
+ERROR HY000: Table 't5' was locked with a READ lock and can't be updated
+INSERT INTO mysqltest.t6 SELECT * FROM mysqltest.t5;
+# Unlock tables.
+UNLOCK TABLES;
+# Start transaction.
+START TRANSACTION;
+# Insert a value.
+INSERT INTO t1 VALUES(111);
+# Take a new lock.
+LOCK TABLE mysqltest.t5 READ;
+# Rollback transaction.
+ROLLBACK;
+UNLOCK TABLES;
+# Show that the inserted value had been committed.
+SELECT * FROM t1;
+c1
+111
+TRUNCATE t1;
+# connection default.
+UNLOCK TABLES;
+DROP USER mysqltest_1@localhost;
+DROP DATABASE mysqltest;
+DROP TABLE t1, t2, t3, t4;
+#
+# WL3594 - transactional LOCK TABLE Testing - Functional tests
+# ============================================================
+# Prepare tables and connections.
+# Set AUTOCOMMIT= 0 in each connection.
+SET AUTOCOMMIT= 0;
+CREATE TABLE t1 (c1 INT) ENGINE=Falcon;
+CREATE TABLE t2 (c2 INT) ENGINE=Falcon;
+# connection conn1.
+SET AUTOCOMMIT= 0;
+# connection conn2.
+SET AUTOCOMMIT= 0;
+# connection default.
+#
+# Normal WRITE locks go before readers (autocommit).
+# Set AUTOCOMMIT= 1.
+SET AUTOCOMMIT= 1;
+# Insert a value.
+INSERT INTO t1 VALUES(111);
+# Take a non-transactional lock.
+LOCK TABLE t1 READ;
+# connection conn1.
+# Set AUTOCOMMIT= 1.
+SET AUTOCOMMIT= 1;
+# Take a non-transactional WRITE lock,
+# which waits in background until first read lock is released.
+LOCK TABLE t1 WRITE;
+# connection default.
+# Wait for the helper thread to sit on its lock.
+# connection conn2.
+# Set AUTOCOMMIT= 1.
+SET AUTOCOMMIT= 1;
+# Take a non-transactional READ lock,
+# which waits in background until the WRITE lock is released.
+LOCK TABLE t1 READ;
+# connection default.
+# Wait for the helper threads to sit on their locks.
+# Unlock this connections non-transactional lock.
+UNLOCK TABLES;
+# connection conn1.
+# Now the WRITE lock is taken.
+# Insert a value.
+INSERT INTO t1 VALUES(1111);
+# Unlock table.
+UNLOCK TABLES;
+# connection conn2.
+# Now the READ lock is taken.
+# Select from the table.
+SELECT * FROM t1;
+c1
+111
+1111
+# Unlock table.
+UNLOCK TABLES;
+# connection default.
+TRUNCATE t1;
+#
+# LOW_PRIORITY WRITE locks wait for readers (autocommit).
+# Insert a value.
+INSERT INTO t1 VALUES(111);
+# Take a non-transactional lock.
+LOCK TABLE t1 READ;
+# connection conn1.
+# Take a non-transactional LOW_PRIORITY WRITE lock,
+# which waits in background until all read locks are released.
+LOCK TABLE t1 LOW_PRIORITY WRITE;
+# connection default.
+# Wait for the helper thread to sit on its lock.
+# connection conn2.
+# Take a non-transactional READ lock,
+# which goes before the LOW_PRIORITY WRITE lock.
+LOCK TABLE t1 READ;
+# The READ lock could be taken immediately.
+# Select from the table.
+SELECT * FROM t1;
+c1
+111
+# Unlock table.
+UNLOCK TABLES;
+SET AUTOCOMMIT= 0;
+# connection default.
+# Unlock this connections non-transactional lock.
+UNLOCK TABLES;
+# connection conn1.
+# Now the LOW_PRIORITY WRITE lock is taken.
+# Insert a value.
+INSERT INTO t1 VALUES(1111);
+# Unlock table.
+UNLOCK TABLES;
+SET AUTOCOMMIT= 0;
+# connection default.
+TRUNCATE t1;
+SET AUTOCOMMIT= 0;
+COMMIT;
+#
+# LOCK TABLE is prohibited in stored procedure.
+CREATE PROCEDURE lock_t1_excl()
+LOCK TABLE t1 IN EXCLUSIVE MODE;
+ERROR 0A000: LOCK is not allowed in stored procedures
+#
+# LOCK TABLE is prohibited in trigger.
+CREATE TRIGGER t1_ai AFTER INSERT ON t1 FOR EACH ROW
+LOCK TABLE t2 IN EXCLUSIVE MODE;
+ERROR 0A000: LOCK is not allowed in stored procedures
+## Cleanup.
+SET AUTOCOMMIT= 1;
+UNLOCK TABLES;
+DROP TABLE t1, t2;
+show slave status;;
+Slave_IO_State	#
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	MASTER_PORT
+Connect_Retry	1
+Master_Log_File	master-bin.000001
+Read_Master_Log_Pos	#
+Relay_Log_File	#
+Relay_Log_Pos	#
+Relay_Master_Log_File	master-bin.000001
+Slave_IO_Running	Yes
+Slave_SQL_Running	Yes
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	0
+Last_Error	
+Skip_Counter	0
+Exec_Master_Log_Pos	#
+Relay_Log_Space	#
+Until_Condition	None
+Until_Log_File	
+Until_Log_Pos	0
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	#
+Master_SSL_Verify_Server_Cert	No
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	0
+Last_SQL_Error	

=== added file 'mysql-test/suite/rpl/r/rpl_relay_space_falcon.result'
--- a/mysql-test/suite/rpl/r/rpl_relay_space_falcon.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/r/rpl_relay_space_falcon.result	2008-11-17 10:57:50 +0000
@@ -0,0 +1,25 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+SHOW VARIABLES LIKE 'relay_log_space_limit';
+Variable_name	Value
+relay_log_space_limit	0
+CREATE TABLE t1 (name varchar(64), age smallint(3))ENGINE=Falcon;
+INSERT INTO t1 SET name='Andy', age=31;
+INSERT INTO t1 SET name='Jacob', age=2;
+INSERT INTO t1 SET name='Caleb', age=1;
+ALTER TABLE t1 ADD id int(8) ZEROFILL AUTO_INCREMENT PRIMARY KEY;
+SELECT * FROM t1 ORDER BY id;
+name	age	id
+Andy	31	00000001
+Jacob	2	00000002
+Caleb	1	00000003
+SELECT * FROM t1 ORDER BY id;
+name	age	id
+Andy	31	00000001
+Jacob	2	00000002
+Caleb	1	00000003
+DROP TABLE t1;

=== added file 'mysql-test/suite/rpl/r/rpl_row_blob_falcon.result'
--- a/mysql-test/suite/rpl/r/rpl_row_blob_falcon.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/r/rpl_row_blob_falcon.result	2008-11-17 10:57:50 +0000
@@ -0,0 +1,156 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;
+*****  Table Create Section ****
+
+CREATE TABLE test.t1 (c1 int not null auto_increment, 
+data LONGBLOB, PRIMARY KEY(c1))ENGINE=#;
+
+**** Data Insert Section test.t1 *****
+
+INSERT INTO test.t1 VALUES (NULL, NULL);
+INSERT INTO test.t1 VALUES (NULL, repeat('a',1*1024));
+INSERT INTO test.t1 VALUES (NULL, repeat('b',16*1024));
+
+**** Data Insert Validation Master Section test.t1 ****
+
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1;
+LENGTH(data)
+NULL
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2;
+LENGTH(data)
+1024
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 3;
+LENGTH(data)
+16384
+
+**** Data Insert Validation Slave Section test.t1 ****
+
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1;
+LENGTH(data)
+NULL
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2;
+LENGTH(data)
+1024
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 3;
+LENGTH(data)
+16384
+
+**** Data Update Section test.t1 ****
+
+UPDATE test.t1 set data=repeat('a',18*1024) where c1 = 1;
+UPDATE t1 set data=repeat('c',17*1024) where c1 = 2;
+
+**** Data Update Validation Master Section test.t1 ****
+
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1;
+LENGTH(data)
+18432
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2;
+LENGTH(data)
+17408
+
+**** Data Update Validation Slave Section test.t1 ****
+
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 1;
+LENGTH(data)
+18432
+SELECT LENGTH(data) FROM test.t1 WHERE c1 = 2;
+LENGTH(data)
+17408
+
+**** End Test Section test.t1 ****
+
+**** Create Table test.t2 ****
+
+CREATE TABLE test.t2 (
+c1 INT NOT NULL PRIMARY KEY,
+c2 TEXT,
+c3 INT,
+c4 LONGBLOB,
+KEY(c3))ENGINE=#;
+
+*** Setup Values For test.t2 ***
+set @x0 = '01234567012345670123456701234567';
+set @x0 = concat(@x0,@x0,@x0,@x0,@x0,@x0,@x0,@x0);
+set @b1 = 'b1';
+set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
+set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
+set @b1 = concat(@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1,@b1);
+set @b1 = concat(@b1,@x0);
+set @d1 = 'dd1';
+set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
+set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
+set @d1 = concat(@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1,@d1);
+set @b2 = 'b2';
+set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
+set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
+set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
+set @b2 = concat(@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2,@b2);
+set @d2 = 'dd2';
+set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
+set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
+set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
+set @d2 = concat(@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2,@d2);
+
+**** Data Insert Section test.t2 *****
+
+INSERT INTO test.t2 VALUES(1,@b1,111,@d1);
+INSERT INTO test.t2 VALUES(2,@b2,222,@d2);
+
+**** Data Insert Validation Master Section test.t2 ****
+
+SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
+FROM test.t2 WHERE c1=1;
+c1	LENGTH(c2)	SUBSTR(c2,1+2*900,2)	LENGTH(c4)	SUBSTR(c4,1+3*900,3)
+1	2256	b1	3000	dd1
+SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
+FROM test.t2 WHERE c1=2;
+c1	LENGTH(c2)	SUBSTR(c2,1+2*900,2)	LENGTH(c4)	SUBSTR(c4,1+3*900,3)
+2	20000	b2	30000	dd2
+
+**** Data Insert Validation Slave Section test.t2 ****
+
+SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
+FROM test.t2 WHERE c1=1;
+c1	LENGTH(c2)	SUBSTR(c2,1+2*900,2)	LENGTH(c4)	SUBSTR(c4,1+3*900,3)
+1	2256	b1	3000	dd1
+SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
+FROM test.t2 WHERE c1=2;
+c1	LENGTH(c2)	SUBSTR(c2,1+2*900,2)	LENGTH(c4)	SUBSTR(c4,1+3*900,3)
+2	20000	b2	30000	dd2
+
+**** Data Update Section test.t2 ****
+
+UPDATE test.t2 SET c2=@b2, c4=@d2 WHERE c1=1;
+UPDATE test.t2 SET c2=@b1, c4=@d1 WHERE c1=2;
+
+**** Data Update Validation Master Section test.t2 ****
+
+SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
+FROM test.t2 WHERE c1=1;
+c1	LENGTH(c2)	SUBSTR(c2,1+2*900,2)	LENGTH(c4)	SUBSTR(c4,1+3*900,3)
+1	20000	b2	30000	dd2
+SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
+FROM test.t2 WHERE c1=2;
+c1	LENGTH(c2)	SUBSTR(c2,1+2*900,2)	LENGTH(c4)	SUBSTR(c4,1+3*900,3)
+2	2256	b1	3000	dd1
+
+**** Data Update Validation Slave Section test.t2 ****
+
+SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
+FROM test.t2 WHERE c1=1;
+c1	LENGTH(c2)	SUBSTR(c2,1+2*900,2)	LENGTH(c4)	SUBSTR(c4,1+3*900,3)
+1	20000	b2	30000	dd2
+SELECT c1, LENGTH(c2), SUBSTR(c2,1+2*900,2), LENGTH(c4), SUBSTR(c4,1+3*900,3)
+FROM test.t2 WHERE c1=2;
+c1	LENGTH(c2)	SUBSTR(c2,1+2*900,2)	LENGTH(c4)	SUBSTR(c4,1+3*900,3)
+2	2256	b1	3000	dd1
+
+DROP TABLE IF EXISTS test.t1;
+DROP TABLE IF EXISTS test.t2;

=== added file 'mysql-test/suite/rpl/r/rpl_truncate_falcon.result'
--- a/mysql-test/suite/rpl/r/rpl_truncate_falcon.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/r/rpl_truncate_falcon.result	2008-11-17 10:57:50 +0000
@@ -0,0 +1,94 @@
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+STOP SLAVE;
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t1;
+RESET SLAVE;
+START SLAVE;
+**** On Master ****
+SET SESSION BINLOG_FORMAT=ROW;
+SET GLOBAL  BINLOG_FORMAT=ROW;
+CREATE TABLE t1 (a INT, b LONG) ENGINE=Falcon;
+INSERT INTO t1 VALUES (1,1), (2,2);
+SELECT * FROM t1;
+a	b
+1	1
+2	2
+**** On Slave ****
+INSERT INTO t1 VALUE (3,3);
+SELECT * FROM t1;
+a	b
+1	1
+2	2
+3	3
+**** On Master ****
+TRUNCATE TABLE t1;
+SELECT * FROM t1;
+a	b
+**** On Slave ****
+SELECT * FROM t1;
+a	b
+**** On Master ****
+DROP TABLE t1;
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS t1
+master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=Falcon
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; COMMIT
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Query	#	#	use `test`; TRUNCATE TABLE t1
+master-bin.000001	#	Query	#	#	use `test`; COMMIT
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE t1
+RESET MASTER;
+STOP SLAVE;
+DROP TABLE IF EXISTS t1;
+DROP TABLE IF EXISTS t1;
+RESET SLAVE;
+START SLAVE;
+**** On Master ****
+SET SESSION BINLOG_FORMAT=ROW;
+SET GLOBAL  BINLOG_FORMAT=ROW;
+CREATE TABLE t1 (a INT, b LONG) ENGINE=Falcon;
+INSERT INTO t1 VALUES (1,1), (2,2);
+SELECT * FROM t1;
+a	b
+1	1
+2	2
+**** On Slave ****
+INSERT INTO t1 VALUE (3,3);
+SELECT * FROM t1;
+a	b
+1	1
+2	2
+3	3
+**** On Master ****
+DELETE FROM t1;
+SELECT * FROM t1;
+a	b
+**** On Slave ****
+SELECT * FROM t1;
+a	b
+3	3
+**** On Master ****
+DROP TABLE t1;
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE IF EXISTS t1
+master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT, b LONG) ENGINE=Falcon
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; COMMIT
+master-bin.000001	#	Query	#	#	use `test`; BEGIN
+master-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
+master-bin.000001	#	Delete_rows	#	#	table_id: # flags: STMT_END_F
+master-bin.000001	#	Query	#	#	use `test`; COMMIT
+master-bin.000001	#	Query	#	#	use `test`; DROP TABLE t1
+RESET MASTER;

=== modified file 'mysql-test/suite/rpl/t/disabled.def'
--- a/mysql-test/suite/rpl/t/disabled.def	2008-11-06 16:18:25 +0000
+++ b/mysql-test/suite/rpl/t/disabled.def	2008-11-21 16:29:38 +0000
@@ -31,3 +31,6 @@ rpl_idempotency            : Bug#37767 2
 rpl_locktrans_innodb       : Bug#37712 2008-07-17 alik Disabled to make 6.0 greaner (the test fails too often)
 rpl_temporary_errors       : Bug#36968 2008-07-17 alik Disabled to make 6.0 greaner (the test fails too often)
 rpl_flushlog_loop          : BUG#37733 2008-07-23 Sven disabled in 5.1-bugteam. the bug has been fixed in 5.1-rpl: please re-enable when that gets pushed to main
+rpl_truncate_falcon        : Bug#40926 2008-11-21 johnemb rpl.rpl_truncate_falcon fails in Pushbuild due to wrong binlog-format being used
+rpl_relay_space_falcon     : Bug#40927 2008-11-21 johnemb rpl.rpl_relay_space_falcon fails when binlog-format is explicitly set to mixed
+rpl_extraCol_falcon        : Bug#40930 2008-11-21 johnemb rpl.rpl_extraCol_falcon fails doing STOP SLAVE (on Windows PB2)

=== modified file 'mysql-test/suite/rpl/t/rpl_backup.test'
--- a/mysql-test/suite/rpl/t/rpl_backup.test	2008-10-31 15:31:52 +0000
+++ b/mysql-test/suite/rpl/t/rpl_backup.test	2008-11-17 09:57:51 +0000
@@ -209,7 +209,7 @@ INSERT INTO rpl_backup.t2 VALUES (888), 
 let $master_before_pos = query_get_value("SHOW MASTER STATUS", Position, 1);
 
 --echo Backup_id = 502.
-RESTORE FROM 'rpl_bup_m2.bak';
+RESTORE FROM 'rpl_bup_m2.bak' OVERWRITE;
 
 --echo Show the incident event issued as a result of restore.
 --replace_column 2 # 5 #
@@ -266,7 +266,7 @@ STOP SLAVE;
 --source include/wait_for_slave_to_stop.inc
 
 --echo Backup_id = 602.
-RESTORE FROM '../master-data/rpl_bup_m2.bak';
+RESTORE FROM '../master-data/rpl_bup_m2.bak' OVERWRITE;
 
 --echo Showing databases on slave.
 SHOW DATABASES LIKE 'rpl_backup%';
@@ -289,13 +289,13 @@ connection slave;
 --echo Test restore on slave while replication turned on.
 
 --error ER_RESTORE_ON_SLAVE
-RESTORE FROM 'rpl_bup_s1.bak';
+RESTORE FROM 'rpl_bup_s1.bak' OVERWRITE;
 
 --echo Stop slave and restart after restore.
 STOP SLAVE;
 
 --replace_column 1 #
-RESTORE FROM 'rpl_bup_s3.bak';
+RESTORE FROM 'rpl_bup_s3.bak' OVERWRITE;
 
 START SLAVE;
 --source include/wait_for_slave_to_start.inc
@@ -354,7 +354,7 @@ RESET MASTER;
 let $master_before_pos = query_get_value("SHOW MASTER STATUS", Position, 1);
 
 --echo Backup_id = 504.
-RESTORE FROM 'rpl_bup_m3.bak';
+RESTORE FROM 'rpl_bup_m3.bak' OVERWRITE;
 
 --echo Get master's binlog position after restore.
 let $master_after_pos = query_get_value("SHOW MASTER STATUS", Position, 1);

=== added file 'mysql-test/suite/rpl/t/rpl_extraCol_falcon.test'
--- a/mysql-test/suite/rpl/t/rpl_extraCol_falcon.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_extraCol_falcon.test	2008-11-17 10:57:50 +0000
@@ -0,0 +1,20 @@
+###################################################################
+# Purpose: To test having extra columns on the slave, using Falcon.
+# WL#3259.
+#
+# This is a test wrapper for the Falcon storage engine, using
+# the "engine independent" test rpl_extraSlave_Col in
+# mysql-test/extra/rpl_tests/.
+###################################################################
+--source include/master-slave.inc
+--source include/have_falcon.inc
+
+# Falcon does not support statement-based replication.
+# In 'mixed' mode only 'row' is used with Falcon.
+--source include/have_binlog_format_mixed_or_row.inc
+
+let $engine_type = 'Falcon';
+
+--source extra/rpl_tests/rpl_extraSlave_Col.test
+
+

=== added file 'mysql-test/suite/rpl/t/rpl_extraColmaster_falcon.test'
--- a/mysql-test/suite/rpl/t/rpl_extraColmaster_falcon.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_extraColmaster_falcon.test	2008-11-17 10:57:50 +0000
@@ -0,0 +1,22 @@
+################################################################
+# Purpose: To test having extra columns on the master. WL#3915.
+#
+# This is a test wrapper for the Falcon storage engine, using
+# the "engine independent" test rpl_extraMaster_Col in 
+# mysql-test/extra/rpl_tests/.
+################################################################
+--source include/master-slave.inc
+--source include/have_falcon.inc
+
+# Falcon does not support statement-based replication.
+# In 'mixed' mode only 'row' is used with Falcon.
+#
+# Test outputs binlog format, so let's not jump through result 
+# file hoops in order to run with different binlog formats, which
+# would be the same for Falcon anyway. Hence, we require 'row' 
+# for this test.
+--source include/have_binlog_format_row.inc
+
+let $engine_type = 'Falcon';
+
+--source extra/rpl_tests/rpl_extraMaster_Col.test

=== added file 'mysql-test/suite/rpl/t/rpl_locktrans_falcon.test'
--- a/mysql-test/suite/rpl/t/rpl_locktrans_falcon.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_locktrans_falcon.test	2008-11-17 10:57:50 +0000
@@ -0,0 +1,41 @@
+#####################################################################
+# Transactional LOCK TABLE tests.
+# Calls include/locktrans.inc.
+# Based on rpl_locktrans_{innodb,myisam}.
+#####################################################################
+
+# Transactional lock tests require multiple sessions.
+--source include/not_embedded.inc
+
+# This is a replication test.
+--source include/master-slave.inc
+
+# This is a falcon test.
+--source include/have_falcon.inc
+let $engine_type= Falcon;
+
+# Falcon does not support statement-based replication.
+# In 'mixed' mode only 'row' is used with Falcon.
+--source include/have_binlog_format_mixed_or_row.inc
+
+# Storage engine supports transactional locking?
+# According to 6.0 docs, only InnoDB supports transactional locking.
+# Falcon does not support it, see http://lists.mysql.com/falcon/179
+let $transactional= 0;
+
+# Storage engine supports the NOWAIT option?
+# According to 6.0 docs, no storage engine supports this...
+let $nowait_support= 0;
+
+# Define a storage engine that does not support transactional locking.
+let $other_non_trans_engine_type= MyISAM;
+
+# The real test
+--source include/locktrans.inc
+
+# Some post-processing (verifying slave status)
+sync_slave_with_master;
+connection slave;
+--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
+--query_vertical show slave status;

=== added file 'mysql-test/suite/rpl/t/rpl_relay_space_falcon.test'
--- a/mysql-test/suite/rpl/t/rpl_relay_space_falcon.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_relay_space_falcon.test	2008-11-17 10:57:50 +0000
@@ -0,0 +1,19 @@
+########################################################################
+# Wrapper for rpl_sv_relay_space.test.
+# This test is a wrapper for the rpl_sv_relayspace test, which is able 
+# to test multiple storage engines, in this case Falcon.
+#
+# By wrapping we are saving some space and making the test more
+# maintainable by only having one test file and reusing the code.
+# One result file per wrapper is still needed, though.
+########################################################################
+
+-- source include/not_ndb_default.inc
+-- source include/have_falcon.inc
+
+# Falcon does not support statement-based replication.
+# In 'mixed' mode only 'row' is used with Falcon.
+--source include/have_binlog_format_mixed_or_row.inc
+
+let $engine_type=Falcon;
+-- source extra/rpl_tests/rpl_sv_relay_space.test

=== added file 'mysql-test/suite/rpl/t/rpl_row_blob_falcon.test'
--- a/mysql-test/suite/rpl/t/rpl_row_blob_falcon.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_row_blob_falcon.test	2008-11-17 10:57:50 +0000
@@ -0,0 +1,20 @@
+############################################################
+# Wrapper for rpl_row_blob.test
+#
+# - By johnemb 2008-11-12:
+#    Wrapped to allow reuse of test code for different 
+#    storage engines. Following pattern already used for
+#    myisam and innodb.
+############################################################
+--source include/not_ndb_default.inc
+--source include/have_falcon.inc
+--source include/have_binlog_format_row.inc
+--source include/master-slave.inc
+
+# Set engine type. All CREATE TABLE statements must specify
+# engine, or default storage engine on slave must be 
+# specified in <test>-slave.opt file.
+
+let $engine_type=Falcon;
+--source extra/rpl_tests/rpl_row_blob.test
+

=== added file 'mysql-test/suite/rpl/t/rpl_truncate_falcon.test'
--- a/mysql-test/suite/rpl/t/rpl_truncate_falcon.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/rpl/t/rpl_truncate_falcon.test	2008-11-17 10:57:50 +0000
@@ -0,0 +1,33 @@
+#####################################################################
+# Wrapper for "engine independent" test rpl_truncate_helper.test, 
+# using the Falcon storage engine.
+#
+# This wrapper omits the "middle man" rpl_truncate.test, as that test
+# file explicitly runs rpl_truncate_helper with all 3 binlog
+# formats, and Falcon does not support 'stmt'.
+#####################################################################
+
+--source include/master-slave.inc
+--source include/have_falcon.inc
+--source include/not_ndb_default.inc
+
+# Falcon does not support statement-based replication.
+# In 'mixed' mode only 'row' is used with Falcon, so
+# we don't bother testing that here.
+--source include/have_binlog_format_row.inc
+
+let $engine=Falcon;
+
+# Truncating a table can be done in two ways. Make sure to test both:
+
+# Sourced test includes setting binlog format, so specify it here.
+# Since 'mixed' => 'row' with Falcon, we only test 'row'.
+# Also set truncate method (statement) before running test.
+
+let $format=ROW;
+let $stmt = TRUNCATE TABLE;
+--source extra/rpl_tests/rpl_truncate_helper.test
+
+let $format=ROW;
+let $stmt = DELETE FROM;
+--source extra/rpl_tests/rpl_truncate_helper.test

=== added file 'mysql-test/suite/sys_vars/t/disabled.def'
--- a/mysql-test/suite/sys_vars/t/disabled.def	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/sys_vars/t/disabled.def	2008-11-26 15:16:58 +0000
@@ -0,0 +1,21 @@
+##############################################################################
+#
+#  List the test cases that are to be disabled temporarily.
+#
+#  Separate the test case name and the comment with ':'.
+#
+#    <testcasename> : BUG#<xxxx> <date disabled> <disabler> <comment>
+#
+#  Do not use any TAB characters for whitespace.
+#
+##############################################################################
+key_buffer_size_basic_64    : Bug #36522: Some tests of system variables have diffs on 64bit platorms
+rpl_recovery_rank_basic_64  : Bug #36522: Some tests of system variables have diffs on 64bit platorms
+sort_buffer_size_basic_64   : Bug #36522: Some tests of system variables have diffs on 64bit platorms
+query_cache_size_basic_32   : Bug#36747: Allocating a large query cache is not deterministic
+query_cache_size_basic_64   : Bug#36747: Allocating a large query cache is not deterministic
+query_alloc_block_size_basic_64:  Bug #37708 query_alloc_block_size_basic_64 fails in pushbuild
+sort_buffer_size_basic_32   : Bug#36875 main.sort_buffer_size_basic_32 fails on some systems
+key_buffer_size_basic_32    : Bug#36876 main.key_buffer_size_basic_32 fails on some systems
+max_heap_table_size_basic_32 : Bug#36877 main.max_heap_table_size_basic_32 fails on some systems
+tmp_table_size_basic_32     : Bug#36878 main.tmp_table_size_basic_32 fails on some systems

=== modified file 'mysql-test/t/disabled.def'
--- a/mysql-test/t/disabled.def	2008-11-07 11:45:16 +0000
+++ b/mysql-test/t/disabled.def	2008-11-26 15:16:58 +0000
@@ -9,32 +9,14 @@
 #  Do not use any TAB characters for whitespace.
 #
 ##############################################################################
-innodb          : WL#1213: Waiting for InnoDB team to add support for 4-byte character sets.
-concurrent_innodb        : BUG#21579 2006-08-11 mleich innodb_concurrent random failures with varying differences
 federated_transactions   : Bug#29523 Transactions do not work
 show_check      : Bug #32682    Test show_check fails in 6.0
 lowercase_table3         : Bug#32667 lowercase_table3.test reports to error log
-rpl_log_pos          : Bug#8693 Test 'rpl_log_pos' fails sometimes
 ctype_create         : Bug#32965 main.ctype_create fails
-backup_no_engine     : Bug#36021 2008-04-13 rsomla server crashes when openning table with unknown storage engine
 csv_alter_table      : Bug#33696 2008-01-21 pcrews no .result file - bug allows NULL columns in CSV tables
-query_cache_wlock_invalidate_func: Bug#35390 causes not deterministic results.
 cast                 : Bug#35594 2008-03-27 main.cast fails on Windows2003-64
-maria-preload        : Bug#35107 crashes
-key_buffer_size_basic_64    : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-rpl_recovery_rank_basic_64  : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-sort_buffer_size_basic_64   : Bug #36522: Some tests of system variables have diffs on 64bit platorms
-log_output_basic      : Bug#34820 log_output can be set to illegal value
-query_cache_size_basic_32   : Bug#36747: Allocating a large query cache is not deterministic
-query_cache_size_basic_64   : Bug#36747: Allocating a large query cache is not deterministic
-query_alloc_block_size_basic_64:  Bug #37708 query_alloc_block_size_basic_64 fails in pushbuild
 wait_timeout_func           : Bug #36873 wait_timeout_func.test fails randomly
 timestamp_func              : Bug #37702 timestamp_func relies on sleep and is unstable in pushbuild
-sort_buffer_size_basic_32   : Bug#36875 main.sort_buffer_size_basic_32 fails on some systems
-key_buffer_size_basic_32    : Bug#36876 main.key_buffer_size_basic_32 fails on some systems
-max_heap_table_size_basic_32 : Bug#36877 main.max_heap_table_size_basic_32 fails on some systems
-tmp_table_size_basic_32     : Bug#36878 main.tmp_table_size_basic_32 fails on some systems
-backup_triggers_and_events  : Bug#37762 2008-07-01 rafal Test fails on remove_file for unknown reasons
-backup_no_be                : Bug#38023 2008-07-16 rafal Test triggers valgrind warnings described in the bug
-user_limits                 : Bug#23921 2008-07-25 joro random failure of user_limits.test
 thread_cache_size_func      : Bug#40574 2008-11-07 joro main.thread_cache_size_func fails in pushbuild when run with pool of threads
+log_output_basic     : Bug #40988       log_output_basic.test succeeded though syntactically false.
+innodb               : Bug #41056    Innodb.test shows some difference to its result file.

=== modified file 'mysql-test/t/implicit_commit.test'
--- a/mysql-test/t/implicit_commit.test	2008-07-27 13:14:46 +0000
+++ b/mysql-test/t/implicit_commit.test	2008-11-20 14:03:27 +0000
@@ -1136,7 +1136,7 @@ source include/implicit_commit_helper.in
 --echo #
 
 let $statement=
-  restore from 'backup_db1.ba';
+  restore from 'backup_db1.ba' overwrite;
 source include/implicit_commit_helper.inc;
 
 --remove_file $MYSQLTEST_VARDIR/master-data/backup_db1.ba

=== modified file 'sql/backup/backup_info.h'
--- a/sql/backup/backup_info.h	2008-10-27 13:06:21 +0000
+++ b/sql/backup/backup_info.h	2008-11-13 13:02:36 +0000
@@ -48,6 +48,10 @@ class Backup_info: public backup::Image_
 
  private:
 
+  // Prevent copying/assignments
+  Backup_info(const Backup_info&);
+  Backup_info& operator=(const Backup_info&);
+
   class Global_iterator; ///< Iterates over global items (for which meta-data is stored).
   class Perdb_iterator;  ///< Iterates over all per-database objects (except tables).
 

=== modified file 'sql/backup/backup_kernel.h'
--- a/sql/backup/backup_kernel.h	2008-10-30 17:53:24 +0000
+++ b/sql/backup/backup_kernel.h	2008-11-17 09:57:51 +0000
@@ -30,7 +30,7 @@ void backup_shutdown();
   Called from the big switch in mysql_execute_command() to execute
   backup related statement
 */
-int execute_backup_command(THD*, LEX*, String*);
+int execute_backup_command(THD*, LEX*, String*, bool);
 
 // forward declarations
 
@@ -74,7 +74,7 @@ class Backup_restore_ctx: public backup:
                                    const char*);  
 
   int do_backup();
-  int do_restore();
+  int do_restore(bool overwrite);
   int fatal_error(int, ...);
   int log_error(int, ...);
 
@@ -84,6 +84,10 @@ class Backup_restore_ctx: public backup:
 
  private:
 
+  // Prevent copying/assignments
+  Backup_restore_ctx(const Backup_restore_ctx&);
+  Backup_restore_ctx& operator=(const Backup_restore_ctx&);
+
   /** @c current_op points to the @c Backup_restore_ctx for the
       ongoing backup/restore operation.  If pointer is null, no
       operation is currently running. */

=== modified file 'sql/backup/kernel.cc'
--- a/sql/backup/kernel.cc	2008-11-13 08:40:43 +0000
+++ b/sql/backup/kernel.cc	2008-11-20 13:53:41 +0000
@@ -121,6 +121,8 @@ static int send_reply(Backup_restore_ctx
   @param[IN] thd        current thread object reference.
   @param[IN] lex        results of parsing the statement.
   @param[IN] backupdir  value of the backupdir variable from server.
+  @param[IN] overwrite  whether or not restore should overwrite existing
+                        DB with same name as in backup image
 
   @note This function sends response to the client (ok, result set or error).
 
@@ -132,7 +134,7 @@ static int send_reply(Backup_restore_ctx
  */
 
 int
-execute_backup_command(THD *thd, LEX *lex, String *backupdir)
+execute_backup_command(THD *thd, LEX *lex, String *backupdir, bool overwrite)
 {
   int res= 0;
   
@@ -226,7 +228,7 @@ execute_backup_command(THD *thd, LEX *le
     
     DEBUG_SYNC(thd, "after_backup_start_restore");
 
-    res= context.do_restore();      
+    res= context.do_restore(overwrite);      
 
     DEBUG_SYNC(thd, "restore_before_end");
 
@@ -331,7 +333,6 @@ int send_reply(Backup_restore_ctx &conte
     goto err;
   }
   my_eof(context.thd());                        // Never errors
-  context.report_cleanup();                     // Never errors
   DBUG_RETURN(0);
 
  err:
@@ -399,7 +400,7 @@ Backup_restore_ctx::Backup_restore_ctx(T
 Backup_restore_ctx::~Backup_restore_ctx()
 {
   close();
-  
+
   delete mem_alloc;
   delete m_catalog;  
   delete m_stream;
@@ -1199,11 +1200,14 @@ int Backup_restore_ctx::restore_triggers
 
   @pre @c prepare_for_restore() method was called.
 
+  @param[IN] overwrite whether or not restore should overwrite existing
+                       DB with same name as in backup image
+
   @returns 0 on success, error code otherwise.
 
   @todo Remove the @c reset_diagnostic_area() hack.
 */
-int Backup_restore_ctx::do_restore()
+int Backup_restore_ctx::do_restore(bool overwrite)
 {
   DBUG_ENTER("do_restore");
 
@@ -1223,6 +1227,24 @@ int Backup_restore_ctx::do_restore()
 
   DBUG_PRINT("restore", ("Restoring meta-data"));
 
+  // unless RESTORE... OVERWRITE: return error if database already exists
+  if (!overwrite) {
+    Image_info::Db_iterator *dbit= info.get_dbs();
+
+    if (!dbit) {
+      DBUG_RETURN(fatal_error(ER_OUT_OF_RESOURCES));
+    }
+
+    Image_info::Db *mydb;
+    while ((mydb= static_cast<Image_info::Db*>((*dbit)++))) {
+      if (!obs::check_db_existence(&mydb->name())) {
+        delete dbit;
+        DBUG_RETURN(fatal_error(ER_RESTORE_DB_EXISTS, mydb->name().ptr()));
+      }
+    }
+    delete dbit;
+  }
+
   disable_fkey_constraints();                   // Never errors
 
   if (read_meta_data(info, s))
@@ -1971,6 +1993,7 @@ int bcat_create_item(st_bstream_image_he
     {
       DBUG_PRINT("restore",(" tablespace has changed on the server - aborting"));
       info->m_ctx.fatal_error(ER_BACKUP_TS_CHANGE, desc);
+      delete ts;
       return BSTREAM_ERROR;
     }
   }

=== modified file 'sql/backup/logger.h'
--- a/sql/backup/logger.h	2008-11-13 08:40:43 +0000
+++ b/sql/backup/logger.h	2008-11-14 15:02:10 +0000
@@ -67,7 +67,6 @@ class Logger
      DBUG_ASSERT(backup_log);
      return backup_log->get_backup_id(); 
    }
-   void report_cleanup() { delete backup_log; }
    
    void save_errors();
    void stop_save_errors();
@@ -85,6 +84,10 @@ class Logger
   int write_message(log_level::value level , int error_code, const char *msg);
 
  private:
+  // Prevent copying/assigments
+  Logger(const Logger&);
+  Logger& operator=(const Logger&);
+
   util::SAVED_MYSQL_ERROR error;   ///< Used to store saved errors.
   bool m_save_errors;        ///< Flag telling if errors should be saved.
   bool m_push_errors;        ///< Should errors be pushed on warning stack?
@@ -96,12 +99,16 @@ inline
 Logger::Logger(THD *thd) 
   :m_type(BACKUP), m_state(CREATED),
    m_thd(thd), m_save_errors(FALSE), m_push_errors(TRUE), backup_log(0)
-{}
+{
+  clear_saved_errors();
+}
+ 
 
 inline
 Logger::~Logger()
 {
   clear_saved_errors();
+  delete backup_log;
 }
 
 /// Report unregistered message.

=== modified file 'sql/backup/restore_info.h'
--- a/sql/backup/restore_info.h	2008-05-05 15:06:40 +0000
+++ b/sql/backup/restore_info.h	2008-11-13 13:02:36 +0000
@@ -47,6 +47,10 @@ class Restore_info: public backup::Image
 
  private:
 
+  // Prevent copying/assignments
+  Restore_info(const Restore_info&);
+  Restore_info& operator=(const Restore_info&);
+
   friend int backup::restore_table_data(THD*, Restore_info&, 
                                         backup::Input_stream&);
   friend int ::bcat_add_item(st_bstream_image_header*,

=== modified file 'sql/backup/stream.h'
--- a/sql/backup/stream.h	2008-10-15 20:00:48 +0000
+++ b/sql/backup/stream.h	2008-11-13 13:02:36 +0000
@@ -98,7 +98,7 @@ class Stream: public fd_stream
   ::String  *m_path;
   int     m_flags;  ///< flags used when opening the file
   size_t  m_block_size;
-  Logger  m_log;
+  Logger&  m_log;
 
   friend int stream_write(void*, bstream_blob*, bstream_blob);
   friend int stream_read(void*, bstream_blob*, bstream_blob);

=== modified file 'sql/backup/stream_v1.c'
--- a/sql/backup/stream_v1.c	2008-09-30 08:08:16 +0000
+++ b/sql/backup/stream_v1.c	2008-11-13 13:02:36 +0000
@@ -1277,10 +1277,9 @@ int bstream_wr_meta_data(backup_stream *
     CHECK_WR_RES(bstream_wr_item_def(s,cat,PER_TABLE_ITEM,item));
   }
 
+wr_error:
   bcat_iterator_free(cat,iter);
 
-  wr_error:
-
   return ret;
 }
 

=== modified file 'sql/ha_partition.cc'
--- a/sql/ha_partition.cc	2008-11-06 18:39:27 +0000
+++ b/sql/ha_partition.cc	2008-11-25 09:56:21 +0000
@@ -552,14 +552,15 @@ int ha_partition::create(const char *nam
 			 HA_CREATE_INFO *create_info)
 {
   char t_name[FN_REFLEN];
+  int error;
   DBUG_ENTER("ha_partition::create");
 
   strmov(t_name, name);
   DBUG_ASSERT(*fn_rext((char*)name) == '\0');
-  if (del_ren_cre_table(t_name, NULL, table_arg, create_info))
+  if ((error= del_ren_cre_table(t_name, NULL, table_arg, create_info)))
   {
     handler::delete_table(t_name);
-    DBUG_RETURN(1);
+    DBUG_RETURN(error);
   }
   DBUG_RETURN(0);
 }

=== modified file 'sql/lex.h'
--- a/sql/lex.h	2008-07-09 07:12:43 +0000
+++ b/sql/lex.h	2008-11-17 09:57:51 +0000
@@ -389,6 +389,7 @@ static SYMBOL symbols[] = {
   { "OUT",              SYM(OUT_SYM)},
   { "OUTER",		SYM(OUTER)},
   { "OUTFILE",		SYM(OUTFILE)},
+  { "OVERWRITE",		SYM(OVERWRITE_SYM)},
   { "OWNER",		SYM(OWNER_SYM)},
   { "PACK_KEYS",	SYM(PACK_KEYS_SYM)},
   { "PARSER",           SYM(PARSER_SYM)},

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2008-11-13 09:46:39 +0000
+++ b/sql/mysqld.cc	2008-11-17 11:17:59 +0000
@@ -8278,7 +8278,7 @@ mysqld_get_one_option(int optid,
   {
     if (!argument || !argument[0])
     {
-      log_backup_output_options= LOG_FILE;
+      log_backup_output_options= LOG_TABLE;
       log_backup_output_str= log_output_typelib.type_names[1];
     }
     else

=== modified file 'sql/share/errmsg.txt'
--- a/sql/share/errmsg.txt	2008-11-13 08:40:43 +0000
+++ b/sql/share/errmsg.txt	2008-11-19 22:08:05 +0000
@@ -6423,7 +6423,7 @@ ER_BACKUP_PURGE_DATETIME
 ER_BACKUP_LOGS_DELETED
   eng "Backup log entries deleted: "
 ER_BACKUP_LOGS_TRUNCATED
-  eng "All backup logs entries have been deleted"
+  eng "All backup log entries have been deleted"
 ER_MASTER_BLOCKING_SLAVES
   eng "The master is not allowing slave connections."
 ER_RESTORE_ON_MASTER
@@ -6432,6 +6432,7 @@ ER_RESTORE_ON_SLAVE
   eng "A restore operation was attempted on a slave during replication. You must stop the slave prior to running a restore."
 ER_NONUNIQ_DB 42000 S1009
         eng "Not unique database: '%-.192s'"
+ER_RESTORE_DB_EXISTS
+  eng "Database \'%-.64s\' already exists. Use OVERWRITE flag to overwrite."
 ER_QUERY_CACHE_DISABLED
 	eng "Query cache is disabled; restart the server with query_cache_type=1 to enable it"
-

=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc	2008-11-13 08:40:43 +0000
+++ b/sql/sql_parse.cc	2008-11-17 09:57:51 +0000
@@ -43,7 +43,7 @@
   @defgroup Runtime_Environment Runtime Environment
   @{
 */
-int execute_backup_command(THD*, LEX*, String*);
+int execute_backup_command(THD*, LEX*, String*, bool);
 
 /* Used in error handling only */
 #define SP_TYPE_STRING(LP) \
@@ -2312,11 +2312,29 @@ mysql_execute_command(THD *thd)
                         sys_var_backupdir.value_length);
     backupdir.length(sys_var_backupdir.value_length);
 
+    /* Used to specify if RESTORE should overwrite existing db with same name */
+    bool overwrite_restore= false;
+
+    Item *it= (Item *)lex->value_list.head();
+
+    // Item only set for RESTORE in sql_yacc.yy, no error checking of
+    // item necessary
+    if (it)
+    {
+      /*
+        it is OK to only emulate fix_fields, because we need only
+        value of constant
+      */
+      it->quick_fix_field();
+
+      if ((int8)it->val_int() == 1)
+        overwrite_restore= true;
+    }
     /*
       Note: execute_backup_command() sends a correct response to the client
       (either ok, result set or error message).
      */ 
-    if (execute_backup_command(thd, lex, &backupdir))
+    if (execute_backup_command(thd, lex, &backupdir, overwrite_restore))
       goto error;
     break;
   }

=== modified file 'sql/sql_yacc.yy'
--- a/sql/sql_yacc.yy	2008-11-13 08:40:43 +0000
+++ b/sql/sql_yacc.yy	2008-11-17 09:57:51 +0000
@@ -974,6 +974,7 @@ bool my_yyoverflow(short **a, YYSTYPE **
 %token  OUTER
 %token  OUTFILE
 %token  OUT_SYM                       /* SQL-2003-R */
+%token  OVERWRITE_SYM
 %token  OWNER_SYM
 %token  PACK_KEYS_SYM
 %token  PAGE_SYM
@@ -6433,12 +6434,32 @@ restore:
             lex->clear_db_list();
           }
           FROM
-          TEXT_STRING_sys
+          TEXT_STRING_sys 
+          opt_overwrite
           {
             Lex->backup_dir = $4; 
           }
         ;
 
+opt_overwrite:
+          /* empty */ 
+          {         
+            LEX *lex= Lex;
+            Item *it= new Item_int((int8) 0);
+
+            lex->value_list.empty();
+            lex->value_list.push_front(it);
+          }
+        | OVERWRITE_SYM 
+          {
+            LEX *lex= Lex;
+            Item *it= new Item_int((int8) 1);
+
+            lex->value_list.empty();
+            lex->value_list.push_front(it);
+           }
+         ;
+
 backup:   
           BACKUP_SYM 
           {

=== modified file 'storage/falcon/Configuration.cpp'
--- a/storage/falcon/Configuration.cpp	2008-10-22 12:01:16 +0000
+++ b/storage/falcon/Configuration.cpp	2008-11-20 17:05:50 +0000
@@ -144,8 +144,8 @@ Configuration::Configuration(const char 
 	recordMemoryMax				= getMemorySize(RECORD_MEMORY_UPPER);
 	recordScavengeThresholdPct	= 67;
 	recordScavengeFloorPct		= 33;
-	recordScavengeThreshold		= (recordMemoryMax * 100) / recordScavengeThresholdPct;
-	recordScavengeFloor			= (recordMemoryMax * 100) / recordScavengeFloorPct;
+	recordScavengeThreshold		= (recordMemoryMax * recordScavengeThresholdPct) / 100;
+	recordScavengeFloor			= (recordMemoryMax * recordScavengeFloorPct) / 100;
 	serialLogWindows			= 10;	// same as SRL_MIN_WINDOWS
 	allocationExtent			= 10;
 	pageCacheSize				= getMemorySize(PAGE_CACHE_MEMORY);

=== modified file 'storage/falcon/Database.cpp'
--- a/storage/falcon/Database.cpp	2008-10-29 23:25:13 +0000
+++ b/storage/falcon/Database.cpp	2008-11-20 17:05:50 +0000
@@ -279,20 +279,20 @@ static const char *createDomains = 
 	"create table Domains ("
 			"domainName varchar (128) not null,"
 			"schema varchar (128) not null,"
-		    "dataType int,"
-		    "length int,"
-		    "scale int,"
-		    "remarks text,"
+			"dataType int,"
+			"length int,"
+			"scale int,"
+			"remarks text,"
 			"primary key (domainName, schema));";
 
 //static const char *createOds3Domains = 
 //	"create table Domains ("
 //			"domainName varchar (128) not null,"
 //			"schema varchar (128) not null,"
-//		    "dataType int,"
-//		    "length int,"
-//		    "scale int,"
-//		    "remarks text,"
+//			"dataType int,"
+//			"length int,"
+//			"scale int,"
+//			"remarks text,"
 //			"primary key (domainName, schema));";
 
 static const char *createView_tables = 
@@ -1944,7 +1944,7 @@ const char* Database::getString(const ch
 void Database::upgradeSystemTables()
 {
 	Sync syncDDL(&syncSysDDL, "Database::upgradeSystemTables");
-	syncDDL.lock(Shared);
+	syncDDL.lock(Exclusive);
 
 	for (const char **tableName = changedTables; *tableName; ++tableName)
 		{

=== modified file 'storage/falcon/IO.cpp'
--- a/storage/falcon/IO.cpp	2008-10-31 00:29:13 +0000
+++ b/storage/falcon/IO.cpp	2008-11-20 17:05:50 +0000
@@ -946,4 +946,3 @@ uint16 IO::computeChecksum(Page *page, s
 	return (uint16) sum;
 
 }
-

=== modified file 'storage/falcon/IndexRootPage.cpp'
--- a/storage/falcon/IndexRootPage.cpp	2008-10-31 15:42:42 +0000
+++ b/storage/falcon/IndexRootPage.cpp	2008-11-20 17:05:50 +0000
@@ -184,7 +184,7 @@ bool IndexRootPage::addIndexEntry(Dbb * 
 			}
 
 		/* Node didn't fit.  Split the page and propogate the
-		   split upward.  Sooner or laster we'll go back and re-try
+		   split upward.  Sooner or later we'll go back and re-try
 		   the original insertion */
 
 		if (splitIndexPage (dbb, indexId, bdb, transId, result, key, recordNumber))

=== modified file 'storage/falcon/IndexWalker.cpp'
--- a/storage/falcon/IndexWalker.cpp	2008-07-29 11:12:34 +0000
+++ b/storage/falcon/IndexWalker.cpp	2008-11-20 17:05:50 +0000
@@ -136,17 +136,15 @@ Record* IndexWalker::getValidatedRecord(
 	else if (recordId == lastRecordNumber)
 		return NULL;
 
-
-
 	// Fetch record.  If it doesn't exist, that's ok.
-	
+
 	Record *candidate = table->fetch(recordId);
 
 	if (!candidate)
 		return NULL;
-	
+
 	// Get the correct version.  If this is select for update, get a lock record
-			
+
 	Record *record = (lockForUpdate) 
 				    ? table->fetchForUpdate(transaction, candidate, true)
 				    : candidate->fetchVersion(transaction);

=== modified file 'storage/falcon/Log.h'
--- a/storage/falcon/Log.h	2008-11-13 13:27:13 +0000
+++ b/storage/falcon/Log.h	2008-11-20 17:05:50 +0000
@@ -46,7 +46,7 @@ typedef void (Listener) (int, const char
 
 struct LogListener {
 	int			mask;
-    Listener	*listener;
+	Listener	*listener;
 	void		*arg;
 	LogListener	*next;
 	};

=== modified file 'storage/falcon/PageInventoryPage.cpp'
--- a/storage/falcon/PageInventoryPage.cpp	2008-06-17 17:41:54 +0000
+++ b/storage/falcon/PageInventoryPage.cpp	2008-11-14 02:30:11 +0000
@@ -31,6 +31,8 @@
 #include "Transaction.h"
 #include "Log.h"
 #include "SQLError.h"
+#include "SerialLog.h"
+#include "Database.h"
 
 #ifdef _DEBUG
 #undef THIS_FILE
@@ -80,6 +82,8 @@ Bdb* PageInventoryPage::createInventoryP
 
 Bdb* PageInventoryPage::allocPage(Dbb * dbb, PageType pageType, TransId transId)
 {
+	SerialLog *serialLog = dbb->database->serialLog;
+	ASSERT(!(serialLog->recovering && (serialLog->recoveryPhase ==2)));
 	for (int32 pip = dbb->lastPageAllocated / dbb->pagesPerPip;; ++pip)
 		{
 		int32 pipPageNumber = (pip == 0) ? PIP_PAGE : pip * dbb->pagesPerPip - 1;

=== modified file 'storage/falcon/SRLBlobDelete.h'
--- a/storage/falcon/SRLBlobDelete.h	2007-09-20 15:44:25 +0000
+++ b/storage/falcon/SRLBlobDelete.h	2008-11-14 02:30:11 +0000
@@ -29,8 +29,7 @@ public:
 	void pass2(void);
 	void redo(void);
 	void print(void);
-	
-	int		tableSpaceId;
+
 	int32	locatorPage;
 	int		locatorLine;
 	int32	dataPage;

=== modified file 'storage/falcon/SRLBlobUpdate.h'
--- a/storage/falcon/SRLBlobUpdate.h	2007-09-20 15:44:25 +0000
+++ b/storage/falcon/SRLBlobUpdate.h	2008-11-14 02:30:11 +0000
@@ -39,7 +39,6 @@ public:
 	virtual void	pass2(void);
 	virtual void	redo(void);
 
-	int			tableSpaceId;
 	int32		sectionId;
 	int32		locatorPage;
 	int			locatorLine;

=== modified file 'storage/falcon/SRLCreateIndex.h'
--- a/storage/falcon/SRLCreateIndex.h	2007-09-20 15:44:25 +0000
+++ b/storage/falcon/SRLCreateIndex.h	2008-11-14 02:30:11 +0000
@@ -38,7 +38,6 @@ public:
 	virtual void	read();
 	virtual void	commit(void);
 
-	int			tableSpaceId;
 	int32		indexId;
 	int			indexVersion;
 };

=== modified file 'storage/falcon/SRLCreateSection.h'
--- a/storage/falcon/SRLCreateSection.h	2007-09-20 15:44:25 +0000
+++ b/storage/falcon/SRLCreateSection.h	2008-11-14 02:30:11 +0000
@@ -39,7 +39,6 @@ public:
 	SRLCreateSection();
 	virtual ~SRLCreateSection();
 
-	int		tableSpaceId;
 	int		sectionId;
 };
 

=== modified file 'storage/falcon/SRLCreateTableSpace.cpp'
--- a/storage/falcon/SRLCreateTableSpace.cpp	2008-07-17 13:52:17 +0000
+++ b/storage/falcon/SRLCreateTableSpace.cpp	2008-11-14 02:30:11 +0000
@@ -85,14 +85,14 @@ void SRLCreateTableSpace::read()
 
 void SRLCreateTableSpace::pass1()
 {
-	TableSpaceInit tsInit;
-	tsInit.comment		= comment;
-	log->database->tableSpaceManager->redoCreateTableSpace(tableSpaceId, nameLength, name, filenameLength, filename, type, &tsInit);
+
 }
 
 void SRLCreateTableSpace::pass2()
 {
-
+	TableSpaceInit tsInit;
+	tsInit.comment		= comment;
+	log->database->tableSpaceManager->redoCreateTableSpace(tableSpaceId, nameLength, name, filenameLength, filename, type, &tsInit);
 }
 
 void SRLCreateTableSpace::commit()

=== modified file 'storage/falcon/SRLCreateTableSpace.h'
--- a/storage/falcon/SRLCreateTableSpace.h	2008-07-17 13:52:17 +0000
+++ b/storage/falcon/SRLCreateTableSpace.h	2008-11-14 02:30:11 +0000
@@ -44,7 +44,6 @@ public:
 
 	const char	*name;
 	const char	*filename;
-	int			tableSpaceId;
 	int			nameLength;
 	int			filenameLength;
 	int			type;

=== modified file 'storage/falcon/SRLData.h'
--- a/storage/falcon/SRLData.h	2007-10-16 19:40:17 +0000
+++ b/storage/falcon/SRLData.h	2008-11-14 02:30:11 +0000
@@ -44,7 +44,6 @@ public:
 	
 	void			append(Dbb *dbb, Transaction *transaction, int32 sectionId, int32 recordId, Stream *stream);
 
-	int			tableSpaceId;
 	int32		sectionId;
 	int32		recordId;
 	int32		length;

=== modified file 'storage/falcon/SRLDelete.h'
--- a/storage/falcon/SRLDelete.h	2007-09-20 15:44:25 +0000
+++ b/storage/falcon/SRLDelete.h	2008-11-14 02:30:11 +0000
@@ -40,7 +40,6 @@ public:
 	SRLDelete();
 	virtual ~SRLDelete();
 
-	int			tableSpaceId;
 	int32		sectionId;
 	int32		recordId;
 	int32		length;

=== modified file 'storage/falcon/SRLDeleteIndex.cpp'
--- a/storage/falcon/SRLDeleteIndex.cpp	2008-07-15 18:57:27 +0000
+++ b/storage/falcon/SRLDeleteIndex.cpp	2008-11-14 02:30:11 +0000
@@ -72,8 +72,14 @@ void SRLDeleteIndex::read()
 void SRLDeleteIndex::pass1()
 {
 	log->bumpIndexIncarnation(indexId, tableSpaceId, objDeleted);
-	Dbb *dbb = log->findDbb(tableSpaceId);
+}
+
+void SRLDeleteIndex::redo()
+{
+	if (!log->bumpIndexIncarnation(indexId, tableSpaceId, objDeleted))
+		return;
 
+	Dbb *dbb = log->findDbb(tableSpaceId);
 	if (!dbb)
 		return;
 		
@@ -92,12 +98,6 @@ void SRLDeleteIndex::pass1()
 		}
 }
 
-void SRLDeleteIndex::redo()
-{
-	if (!log->bumpIndexIncarnation(indexId, tableSpaceId, objDeleted))
-		return;
-}
-
 void SRLDeleteIndex::print()
 {
 	logPrint("Delete Index %d\n", indexId);

=== modified file 'storage/falcon/SRLDeleteIndex.h'
--- a/storage/falcon/SRLDeleteIndex.h	2007-09-20 15:44:25 +0000
+++ b/storage/falcon/SRLDeleteIndex.h	2008-11-14 02:30:11 +0000
@@ -38,7 +38,6 @@ public:
 	void			append(Dbb *dbb, TransId transId, int indexId, int idxVersion);
 	void			print();
 
-	int		tableSpaceId;
 	int32	indexId;
 	int		indexVersion;
 };

=== modified file 'storage/falcon/SRLDropTableSpace.cpp'
--- a/storage/falcon/SRLDropTableSpace.cpp	2008-06-08 22:12:35 +0000
+++ b/storage/falcon/SRLDropTableSpace.cpp	2008-11-14 02:30:11 +0000
@@ -63,14 +63,16 @@ void SRLDropTableSpace::read()
 		transactionId = 0;
 }
 
+
 void SRLDropTableSpace::pass1()
 {
-
+	log->setTableSpaceDropped(tableSpaceId);
 }
 
 void SRLDropTableSpace::pass2()
 {
 
+	log->tableSpaceManager->expungeTableSpace(tableSpaceId);
 }
 
 void SRLDropTableSpace::commit()
@@ -80,5 +82,4 @@ void SRLDropTableSpace::commit()
 
 void SRLDropTableSpace::redo()
 {
-	log->tableSpaceManager->expungeTableSpace(tableSpaceId);
 }

=== modified file 'storage/falcon/SRLDropTableSpace.h'
--- a/storage/falcon/SRLDropTableSpace.h	2007-09-20 15:44:25 +0000
+++ b/storage/falcon/SRLDropTableSpace.h	2008-11-14 02:30:11 +0000
@@ -42,7 +42,6 @@ public:
 	virtual void read();
 	void append (TableSpace *tableSpace, Transaction *transaction);
 
-	int		tableSpaceId;
 };
 
 #endif // !defined(AFX_SRLDROPTABLESPACE_H__3A416C47_6B8F_49CC_9471_B9F75D024B12__INCLUDED_)

=== modified file 'storage/falcon/SRLFreePage.h'
--- a/storage/falcon/SRLFreePage.h	2007-09-20 15:44:25 +0000
+++ b/storage/falcon/SRLFreePage.h	2008-11-14 02:30:11 +0000
@@ -41,7 +41,6 @@ public:
 	
 	void			append (Dbb *dbb, int32 pageNumber);
 
-	int			tableSpaceId;
 	int32		pageNumber;
 	int			incarnation;
 };

=== modified file 'storage/falcon/SRLIndexAdd.h'
--- a/storage/falcon/SRLIndexAdd.h	2007-09-20 15:44:25 +0000
+++ b/storage/falcon/SRLIndexAdd.h	2008-11-14 02:30:11 +0000
@@ -39,7 +39,6 @@ public:
 	SRLIndexAdd();
 	virtual ~SRLIndexAdd();
 
-	int			tableSpaceId;
 	int32		indexId;
 	int32		recordId;
 	int32		length;

=== modified file 'storage/falcon/SRLIndexDelete.h'
--- a/storage/falcon/SRLIndexDelete.h	2007-09-20 15:44:25 +0000
+++ b/storage/falcon/SRLIndexDelete.h	2008-11-14 02:30:11 +0000
@@ -38,7 +38,6 @@ public:
 	SRLIndexDelete();
 	virtual ~SRLIndexDelete();
 
-	int			tableSpaceId;
 	int32		indexId;
 	int32		recordId;
 	int32		length;

=== modified file 'storage/falcon/SRLIndexPage.h'
--- a/storage/falcon/SRLIndexPage.h	2008-02-13 18:45:15 +0000
+++ b/storage/falcon/SRLIndexPage.h	2008-11-14 02:30:11 +0000
@@ -38,7 +38,6 @@ public:
 	SRLIndexPage();
 	virtual ~SRLIndexPage();
 
-	int			tableSpaceId;
 	int			indexVersion;
 	int32		pageNumber;
 	int32		parent;

=== modified file 'storage/falcon/SRLInversionPage.h'
--- a/storage/falcon/SRLInversionPage.h	2007-09-20 15:44:25 +0000
+++ b/storage/falcon/SRLInversionPage.h	2008-11-14 02:30:11 +0000
@@ -38,7 +38,6 @@ public:
 	SRLInversionPage();
 	virtual ~SRLInversionPage();
 
-	int			tableSpaceId;
 	int32		pageNumber;
 	int32		parent;
 	int32		prior;

=== modified file 'storage/falcon/SRLOverflowPages.h'
--- a/storage/falcon/SRLOverflowPages.h	2007-09-20 15:44:25 +0000
+++ b/storage/falcon/SRLOverflowPages.h	2008-11-14 02:30:11 +0000
@@ -32,7 +32,6 @@ public:
 	virtual void	redo(void);
 	virtual void	print(void);
 	
-	int				tableSpaceId;
 	int				dataLength;
 	const UCHAR*	data;
 };

=== modified file 'storage/falcon/SRLRecordLocator.h'
--- a/storage/falcon/SRLRecordLocator.h	2007-09-20 15:44:25 +0000
+++ b/storage/falcon/SRLRecordLocator.h	2008-11-14 02:30:11 +0000
@@ -39,7 +39,6 @@ public:
 	SRLRecordLocator();
 	virtual ~SRLRecordLocator();
 
-	int		tableSpaceId;
 	int		sectionId;
 	int		sequence;
 	int32	pageNumber;

=== modified file 'storage/falcon/SRLRecordStub.h'
--- a/storage/falcon/SRLRecordStub.h	2007-09-20 15:44:25 +0000
+++ b/storage/falcon/SRLRecordStub.h	2008-11-14 02:30:11 +0000
@@ -37,7 +37,6 @@ public:
 	SRLRecordStub();
 	virtual ~SRLRecordStub();
 
-	int		tableSpaceId;
 	int32	sectionId;
 	int32	recordId;
 

=== modified file 'storage/falcon/SRLSectionLine.h'
--- a/storage/falcon/SRLSectionLine.h	2007-09-20 15:44:25 +0000
+++ b/storage/falcon/SRLSectionLine.h	2008-11-14 02:30:11 +0000
@@ -31,7 +31,6 @@ public:
 	virtual void redo(void);
 	virtual void print(void);
 
-	int		tableSpaceId;
 	int32	pageNumber;
 	int32	dataPageNumber;
 };

=== modified file 'storage/falcon/SRLSectionPage.h'
--- a/storage/falcon/SRLSectionPage.h	2007-09-20 15:44:25 +0000
+++ b/storage/falcon/SRLSectionPage.h	2008-11-14 02:30:11 +0000
@@ -38,7 +38,6 @@ public:
 	SRLSectionPage();
 	virtual ~SRLSectionPage();
 
-	int		tableSpaceId;
 	int32	parentPage;
 	int32	pageNumber;
 	int		sectionSlot;

=== modified file 'storage/falcon/SRLSectionPromotion.h'
--- a/storage/falcon/SRLSectionPromotion.h	2007-09-20 15:44:25 +0000
+++ b/storage/falcon/SRLSectionPromotion.h	2008-11-14 02:30:11 +0000
@@ -30,7 +30,6 @@ public:
 	virtual void	pass2(void);
 	virtual void	redo(void);
 	
-	int			tableSpaceId;
 	int			sectionId;
 	int			length;
 	int32		rootPageNumber;

=== modified file 'storage/falcon/SRLSequencePage.h'
--- a/storage/falcon/SRLSequencePage.h	2007-09-20 15:44:25 +0000
+++ b/storage/falcon/SRLSequencePage.h	2008-11-14 02:30:11 +0000
@@ -30,7 +30,6 @@ public:
 	virtual void redo(void);
 	
 	int		pageSequence;
-	int		tableSpaceId;
 	int32	pageNumber;
 	virtual void print(void);
 };

=== modified file 'storage/falcon/SRLUpdateBlob.h'
--- a/storage/falcon/SRLUpdateBlob.h	2007-10-16 19:40:17 +0000
+++ b/storage/falcon/SRLUpdateBlob.h	2008-11-14 02:30:11 +0000
@@ -35,7 +35,6 @@ public:
 	
 	const UCHAR		*data;
 	int			recordNumber;
-	int			tableSpaceId;
 	int			length;
 	int			sectionId;
 };

=== modified file 'storage/falcon/SRLUpdateIndex.h'
--- a/storage/falcon/SRLUpdateIndex.h	2007-09-20 15:44:25 +0000
+++ b/storage/falcon/SRLUpdateIndex.h	2008-11-14 02:30:11 +0000
@@ -39,7 +39,6 @@ public:
 	void			append(DeferredIndex* deferredIndex);
 	void			thaw(DeferredIndex* deferredIndex);
 
-	int				tableSpaceId;
 	int				indexId;
 	const UCHAR		*data;
 	const UCHAR		*ptr;

=== modified file 'storage/falcon/SRLUpdateRecords.cpp'
--- a/storage/falcon/SRLUpdateRecords.cpp	2008-11-14 15:38:44 +0000
+++ b/storage/falcon/SRLUpdateRecords.cpp	2008-11-19 17:00:02 +0000
@@ -87,10 +87,10 @@ int SRLUpdateRecords::thaw(RecordVersion
 	// Get section id, record id and data length written. Input pointer will be at
 	// beginning of record data.
 
-	int tableSpaceId = 0;
+	int recordTableSpaceId = 0;
 	
 	if (control->version >= srlVersion8)
-		tableSpaceId = control->getInt();
+		recordTableSpaceId = control->getInt();
 		
 	control->getInt();			// sectionId
 	int recordNumber = control->getInt();
@@ -183,7 +183,7 @@ void SRLUpdateRecords::append(Transactio
 				break;
 	
 			Table *table = record->format->table;
-			tableSpaceId = table->dbb->tableSpaceId;
+			int recordTableSpaceId = table->dbb->tableSpaceId;
 			Stream stream;
 			
 			// A non-zero virtual offset indicates that the record was previously
@@ -231,7 +231,7 @@ void SRLUpdateRecords::append(Transactio
 			// Ensure record fits within current window
 
 			if (log->writePtr + 
-				 byteCount(tableSpaceId) + 
+				 byteCount(recordTableSpaceId) + 
 				 byteCount(table->dataSectionId) + 
 				 byteCount(record->recordNumber) + 
 				 byteCount(stream.totalLength) + stream.totalLength >= end)
@@ -244,9 +244,9 @@ void SRLUpdateRecords::append(Transactio
 
 			record->setVirtualOffset(log->writeWindow->currentLength + log->writeWindow->virtualOffset);
 			uint32 sectionId = table->dataSectionId;
-			log->updateSectionUseVector(sectionId, tableSpaceId, 1);
+			log->updateSectionUseVector(sectionId, recordTableSpaceId, 1);
 			
-			putInt(tableSpaceId);
+			putInt(recordTableSpaceId);
 			putInt(record->getPriorVersion() ? sectionId : -(int) sectionId - 1);
 			putInt(record->recordNumber);
 			putStream(&stream);
@@ -307,23 +307,25 @@ void SRLUpdateRecords::redo(void)
 	if (transaction->state == sltCommitted)
 		for (const UCHAR *p = data, *end = data + dataLength; p < end;)
 			{
+			int recordTableSpaceId;
 			if (control->version >= srlVersion8)
-				tableSpaceId = getInt(&p);
+				recordTableSpaceId = getInt(&p);
 			else
-				tableSpaceId = 0;
+				recordTableSpaceId = 0;
 		
 			int id = getInt(&p);
 			uint sectionId = (id >= 0) ? id : -id - 1;
 			int recordNumber = getInt(&p);
 			int length = getInt(&p);
-			log->updateSectionUseVector(sectionId, tableSpaceId, -1);
+			log->updateSectionUseVector(sectionId, recordTableSpaceId, -1);
 
 			if (log->traceRecord && recordNumber == log->traceRecord)
 				print();
 					
-			if (log->bumpSectionIncarnation(sectionId, tableSpaceId, objInUse))
+			if (log->bumpSectionIncarnation(sectionId, recordTableSpaceId, objInUse)
+				&& (!log->isTableSpaceDropped(recordTableSpaceId)))
 				{
-				Dbb *dbb = log->getDbb(tableSpaceId);
+				Dbb *dbb = log->getDbb(recordTableSpaceId);
 				
 				if (length)
 					{
@@ -350,16 +352,20 @@ void SRLUpdateRecords::pass1(void)
 
 	for (const UCHAR *p = data, *end = data + dataLength; p < end;)
 		{
+		int recordTableSpaceId;
 		if (control->version >= srlVersion8)
-			tableSpaceId = getInt(&p);
+			recordTableSpaceId = getInt(&p);
 		else
-			tableSpaceId = 0;
-			
+			recordTableSpaceId = 0;
+
 		int id = getInt(&p);
 		uint sectionId = (id >= 0) ? id : -id - 1;
 		getInt(&p);			// recordNumber
 		int length = getInt(&p);
-		log->bumpSectionIncarnation(sectionId, tableSpaceId, objInUse);
+
+		if (!log->isTableSpaceDropped(recordTableSpaceId))
+			log->bumpSectionIncarnation(sectionId, recordTableSpaceId, objInUse);
+
 		p += length;
 		}
 }
@@ -384,20 +390,21 @@ void SRLUpdateRecords::commit(void)
 	
 	for (const UCHAR *p = data, *end = data + dataLength; p < end;)
 		{
+		int recordTableSpaceId;
 		if (control->version >= srlVersion8)
-			tableSpaceId = getInt(&p);
+			recordTableSpaceId = getInt(&p);
 		else
-			tableSpaceId = 0;
+			recordTableSpaceId = 0;
 			
 		int id = getInt(&p);
 		uint sectionId = (id >= 0) ? id : -id - 1;
 		int recordNumber = getInt(&p);
 		int length = getInt(&p);
-		log->updateSectionUseVector(sectionId, tableSpaceId, -1);
+		log->updateSectionUseVector(sectionId, recordTableSpaceId, -1);
 		
-		if (log->isSectionActive(sectionId, tableSpaceId))
+		if (log->isSectionActive(sectionId, recordTableSpaceId))
 			{
-			Dbb *dbb = log->getDbb(tableSpaceId);
+			Dbb *dbb = log->getDbb(recordTableSpaceId);
 
 			if (length)
 				{
@@ -419,10 +426,11 @@ void SRLUpdateRecords::print(void)
 	
 	for (const UCHAR *p = data, *end = data + dataLength; p < end;)
 		{
+		int recordTableSpaceId;
 		if (control->version >= srlVersion8)
-			tableSpaceId = getInt(&p);
+			recordTableSpaceId = getInt(&p);
 		else
-			tableSpaceId = 0;
+			recordTableSpaceId = 0;
 
 		int id = getInt(&p);
 		uint sectionId = (id >= 0) ? id : -id - 1;
@@ -430,7 +438,7 @@ void SRLUpdateRecords::print(void)
 		int length = getInt(&p);
 		char temp[40];
 		Log::debug("   rec %d, len %d to section %d/%d %s\n", 
-					recordNumber, length, sectionId, tableSpaceId, format(length, p, sizeof(temp), temp));
+					recordNumber, length, sectionId, recordTableSpaceId, format(length, p, sizeof(temp), temp));
 		p += length;
 		}
 }

=== modified file 'storage/falcon/SRLUpdateRecords.h'
--- a/storage/falcon/SRLUpdateRecords.h	2008-02-14 21:06:10 +0000
+++ b/storage/falcon/SRLUpdateRecords.h	2008-11-14 02:30:11 +0000
@@ -37,7 +37,6 @@ public:
 	int				thaw(RecordVersion *record, bool *thawed);
 	
 	const UCHAR		*data;
-	int				tableSpaceId;
 	int				savepointId;
 	int				dataLength;
 };

=== modified file 'storage/falcon/SerialLog.cpp'
--- a/storage/falcon/SerialLog.cpp	2008-11-14 15:38:44 +0000
+++ b/storage/falcon/SerialLog.cpp	2008-11-20 17:05:50 +0000
@@ -345,7 +345,8 @@ void SerialLog::recover()
 	// Next, make a second pass to reallocate any necessary pages
 
 	while ( (record = control.nextRecord()) )
-		record->pass2();
+		if (!isTableSpaceDropped(record->tableSpaceId) || record->type == srlDropTableSpace)
+			record->pass2();
 
 	recoveryPages->reset();
 	recoveryIndexes->reset();
@@ -363,8 +364,10 @@ void SerialLog::recover()
 	// Make a third pass doing things
 
 	while ( (record = control.nextRecord()) )
-		record->redo();
-		
+		if (!isTableSpaceDropped(record->tableSpaceId))
+			record->redo();
+
+
 	for (SerialLogTransaction *action, **ptr = &running.first; (action = *ptr);)
 		if (action->completedRecovery())
 			{
@@ -401,6 +404,7 @@ void SerialLog::recover()
 	recoveryPages = NULL;
 	recoveryIndexes = NULL;
 	recoverySections = NULL;
+	droppedTablespaces.clear();
 	
 	for (window = firstWindow; window; window = window->next)
 		if (!(window->inUse == 0 || window == writeWindow))
@@ -1153,7 +1157,7 @@ bool SerialLog::bumpPageIncarnation(int3
 
 	bool ret = recoveryPages->bumpIncarnation(pageNumber, tableSpaceId, state, pass1);
 	
-	if (ret && pass1)
+	if (ret && recoveryPhase==2)
 		{
 		Dbb *dbb = getDbb(tableSpaceId);
 		dbb->reallocPage(pageNumber);
@@ -1288,6 +1292,18 @@ void SerialLog::setIndexInactive(int id,
 	recoveryIndexes->setInactive(id, tableSpaceId);
 }
 
+void SerialLog::setTableSpaceDropped(int tableSpaceId)
+{
+	ASSERT(recovering);
+	droppedTablespaces.set(tableSpaceId);
+}
+
+bool SerialLog::isTableSpaceDropped(int tableSpaceId)
+{
+	ASSERT(recovering);
+	return droppedTablespaces.isSet(tableSpaceId);
+}
+
 bool SerialLog::sectionInUse(int sectionId, int tableSpaceId)
 {
 	TableSpaceInfo *info = getTableSpaceInfo(tableSpaceId);
@@ -1323,7 +1339,7 @@ void SerialLog::setPhysicalBlock(TransId
 
 void SerialLog::reportStatistics(void)
 {
-	if (!Log::isActive(LogInfo))
+	if (!Log::isActive(LogInfo) || !writeBlock)
 		return;
 		
 	Sync sync(&pending.syncObject, "SerialLog::reportStatistics");
@@ -1464,6 +1480,7 @@ void SerialLog::printWindows(void)
 
 Dbb* SerialLog::getDbb(int tableSpaceId)
 {
+	ASSERT(recoveryPhase != 1);
 	if (tableSpaceId == 0)
 		return defaultDbb;
 		
@@ -1472,6 +1489,7 @@ Dbb* SerialLog::getDbb(int tableSpaceId)
 
 Dbb* SerialLog::findDbb(int tableSpaceId)
 {
+	ASSERT(recoveryPhase != 1);
 	if (tableSpaceId == 0)
 		return defaultDbb;
 	

=== modified file 'storage/falcon/SerialLog.h'
--- a/storage/falcon/SerialLog.h	2008-11-14 15:38:44 +0000
+++ b/storage/falcon/SerialLog.h	2008-11-19 17:00:02 +0000
@@ -29,6 +29,7 @@
 #include "Stack.h"
 #include "DenseArray.h"
 #include "Queue.h"
+#include "Bitmap.h"
 
 static const unsigned int altLogFlag	= 0x80000000;
 static const int srlSignature			= 123456789;
@@ -126,6 +127,8 @@ public:
 	void			setSectionInactive(int id, int tableSpaceId);
 	void			setIndexActive(int id, int tableSpaceId);
 	void			setIndexInactive(int id, int tableSpaceId);
+	void			setTableSpaceDropped(int tableSpaceId);
+	bool			isTableSpaceDropped(int tableSpaceId);
 	void			updateSectionUseVector(uint sectionId, int tableSpaceId, int delta);
 	void			updateIndexUseVector(uint indexId, int tableSpaceId, int delta);
 	bool			sectionInUse(int sectionId, int tableSpaceId);
@@ -170,6 +173,7 @@ public:
 	RecoveryObjects		*recoveryPages;
 	RecoveryObjects		*recoverySections;
 	RecoveryObjects		*recoveryIndexes;
+	Bitmap				droppedTablespaces;
 	Dbb					*defaultDbb;
 	Gopher				*gophers;
 	Thread				*srlQueue;

=== modified file 'storage/falcon/SerialLogRecord.cpp'
--- a/storage/falcon/SerialLogRecord.cpp	2008-11-11 22:33:27 +0000
+++ b/storage/falcon/SerialLogRecord.cpp	2008-11-20 17:05:50 +0000
@@ -100,6 +100,7 @@ int init()
 SerialLogRecord::SerialLogRecord()
 {
 	transactionId = 0;
+	tableSpaceId = 0;
 	type = 0;
 }
 

=== modified file 'storage/falcon/SerialLogRecord.h'
--- a/storage/falcon/SerialLogRecord.h	2008-11-11 22:33:27 +0000
+++ b/storage/falcon/SerialLogRecord.h	2008-11-14 02:30:11 +0000
@@ -111,6 +111,7 @@ public:
 	SerialLog			*log;
 	SerialLogControl	*control;
 	TransId				transactionId;
+	int					tableSpaceId;
 	UCHAR				type;
 };
 

=== modified file 'storage/falcon/StorageVersion.h'
--- a/storage/falcon/StorageVersion.h	2008-11-14 16:02:16 +0000
+++ b/storage/falcon/StorageVersion.h	2008-11-27 06:08:03 +0000
@@ -14,5 +14,5 @@
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
 
-#define FALCON_VERSION	"T1.3-5"
-#define FALCON_DATE		"14 November, 2008"
+#define FALCON_VERSION	"T1.3-6"
+#define FALCON_DATE		"27 November, 2008"

=== modified file 'storage/falcon/Table.cpp'
--- a/storage/falcon/Table.cpp	2008-10-24 05:35:38 +0000
+++ b/storage/falcon/Table.cpp	2008-11-20 17:05:50 +0000
@@ -2553,9 +2553,9 @@ bool Table::checkUniqueRecordVersion(int
 
 		if (!dup->hasRecord())
 			{
-			// If the record is locked or being unlocked keep looking for a dup.
+			// If the record is a lock record, keep looking for a dup.
 
-			if ((dup->state == recLock) || (dup->state == recUnlocked))
+			if (dup->state == recLock)
 				continue;  // Next record version.
 
 			// The record has been deleted.
@@ -3158,8 +3158,6 @@ void Table::update(Transaction * transac
 				attachment->preUpdate(this, record);
 		END_FOR;
 
-
-
 		//updateInversion(record, transaction);
 		scavenge.lock(Shared);
 		
@@ -3191,18 +3189,18 @@ void Table::update(Transaction * transac
 		if (updated)
 			{
 			transaction->removeRecord(record);
-			
+
 			if (!insert(oldRecord, record, record->recordNumber))
 				Log::debug("record backout failed after failed update\n");
 			}
-			
+
 		garbageCollect(record, oldRecord, transaction, true);
-	
+
 		if (record)
 			{
 			if (record->getPriorVersion())
 				record->getPriorVersion()->setSuperceded(false);
-								
+
 			if (record->state == recLock)
 				record->deleteData();
 
@@ -3436,26 +3434,23 @@ void Table::unlockRecord(int recordNumbe
 	if (record)
 		{
 		if (record->state == recLock)
-			unlockRecord((RecordVersion*) record, true);
+			unlockRecord((RecordVersion*) record);
 		
 		record->release();
 		}
 }
 
-void Table::unlockRecord(RecordVersion* record, bool remove)
+void Table::unlockRecord(RecordVersion* record)
 {
 	//int uc = record->useCount;
 	ASSERT(record->getPriorVersion());
-	
-	if (record->state == recLock)
-		{
-		record->state = recUnlocked;
 
+	// A lock record that has superceded=true is already unlocked
+
+	if ((record->state == recLock) && !record->isSuperceded())
+		{
 		if (insert(record->getPriorVersion(), record, record->recordNumber))
-			{
-			if (remove && record->transaction)
-				record->transaction->removeRecord(record);
-			}
+			record->setSuperceded(true);
 		else
 			Log::debug("Table::unlockRecord: record lock not in record tree\n");
 		}

=== modified file 'storage/falcon/Table.h'
--- a/storage/falcon/Table.h	2008-10-24 05:35:38 +0000
+++ b/storage/falcon/Table.h	2008-11-20 05:32:18 +0000
@@ -208,7 +208,7 @@ public:
 	Record*			fetchForUpdate(Transaction* transaction, Record* record, bool usingIndex);
 //	RecordVersion*	lockRecord(Record* record, Transaction* transaction);
 	void			unlockRecord(int recordNumber);
-	void			unlockRecord(RecordVersion* record, bool remove);
+	void			unlockRecord(RecordVersion* record);
 
 	void			insert (Transaction *transaction, int count, Field **fields, Value **values);
 	uint			insert (Transaction *transaction, Stream *stream);

=== modified file 'storage/falcon/Transaction.cpp'
--- a/storage/falcon/Transaction.cpp	2008-11-07 01:09:04 +0000
+++ b/storage/falcon/Transaction.cpp	2008-11-20 17:05:50 +0000
@@ -422,7 +422,7 @@ void Transaction::rollback()
 		record->nextInTrans = NULL;
 
 		if (record->state == recLock)
-			record->format->table->unlockRecord(record, false);
+			record->format->table->unlockRecord(record);
 		else
 			record->rollback(this);
 		
@@ -1225,7 +1225,7 @@ void Transaction::releaseSavepoints(void
 void Transaction::rollbackSavepoint(int savePointId)
 {
 	//validateRecords();
-	Sync sync(&syncSavepoints, "Transaction::rollbackSavepoints");
+	Sync sync(&syncSavepoints, "Transaction::rollbackSavepoint");
 	SavePoint *savePoint;
 
 	// System transactions require an exclusive lock for concurrent access
@@ -1353,19 +1353,19 @@ bool Transaction::isXidEqual(int testLen
 
 void Transaction::releaseRecordLocks(void)
 {
-	RecordVersion **ptr;
-	RecordVersion *record;
-
 	Sync syncRec(&syncRecords,"Transaction::releaseRecordLocks");
 	syncRec.lock(Exclusive);
-	for (ptr = &firstRecord; (record = *ptr);)
+
+	for (RecordVersion *record = firstRecord; record; record = record->nextInTrans)
 		if (record->state == recLock)
 			{
-			record->format->table->unlockRecord(record, false);
-			removeRecord(record);
+			record->format->table->unlockRecord(record);
+
+			// Don't do  removeRecord(record); now.  Other threads might be 
+			// pointing to it and need the transaction pointer to determine 
+			// its relative state
 			}
-		else
-			ptr = &record->nextInTrans;
+
 	syncRec.unlock();
 }
 

=== modified file 'storage/falcon/Value.cpp'
--- a/storage/falcon/Value.cpp	2008-04-28 20:47:43 +0000
+++ b/storage/falcon/Value.cpp	2008-11-24 08:56:29 +0000
@@ -366,13 +366,25 @@ int Value::compare(Value * value)
 				if (scale != value->scale)
 					break;
 
-				return data.smallInt - value->data.smallInt;
+				if (data.smallInt > value->data.smallInt)
+					return 1;
+				
+				if (data.smallInt < value->data.smallInt)
+					return -1;
+
+				return 0;
 
 			case Int32:
 				if (scale != value->scale)
 					break;
 
-				return data.integer - value->data.integer;
+				if (data.integer > value->data.integer)
+					return 1;
+
+				if (data.integer < value->data.integer)
+					return -1;
+
+				return 0;
 
 			case Double:
 				if (data.dbl > value->data.dbl)
@@ -480,15 +492,34 @@ int Value::compare(Value * value)
 
 		case Double:
 		case Float:
-			return (int) (getDouble() - value->getDouble());
+			{
+			double v1 = getDouble();
+			double v2 = value->getDouble();
+
+			if (v1 > v2)
+				return 1;
+
+			if (v1 < v2)
+				return -1;
+
+			return 0;
+			}
 
 		case Int64:
 			{
 			int s1 = getScale();
 			int s2 = value->getScale();
 			int maxScale = MAX(s1, s2);
+			int64 v1 = getQuad(maxScale);
+			int64 v2 = value->getQuad(maxScale);
+ 
+			if (v1 > v2)
+				return 1;
+
+			if (v1 < v2)
+				return -1;
 
-			return (int) (getQuad(maxScale) - value->getQuad(maxScale));
+			return 0;
 			}
 
 		case Short:
@@ -497,8 +528,16 @@ int Value::compare(Value * value)
 			int s1 = getScale();
 			int s2 = value->getScale();
 			int maxScale = MAX(s1, s2);
+			int v1 = getInt(maxScale);
+			int v2 = value->getInt(maxScale);
+
+			if (v1 > v2)
+				return 1;
 
-			return (int) (getInt(maxScale) - value->getInt(maxScale));
+			if (v1 < v2)
+				return -1;
+
+				return 0;
 			}
 
 		case Date:

=== modified file 'storage/falcon/ha_falcon.cpp'
--- a/storage/falcon/ha_falcon.cpp	2008-11-13 13:27:13 +0000
+++ b/storage/falcon/ha_falcon.cpp	2008-11-25 13:38:06 +0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 2006, 2007 MySQL AB
+/* Copyright (C) 2006, 2007 MySQL AB, 2008 Sun Microsystems, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -46,6 +46,11 @@
 #include "ScaledBinary.h"
 #include "BigInt.h"
 
+/* Verify that the compiler options have enabled C++ exception support */
+#if (defined(__GNUC__) && !defined(__EXCEPTIONS)) || (defined (_MSC_VER) && !defined (_CPPUNWIND))
+#error Falcon needs to be compiled with support for C++ exceptions. Please check your compiler settings.
+#endif
+
 //#define NO_OPTIMIZE
 #define VALIDATE
 //#define DEBUG_BACKLOG
@@ -182,8 +187,8 @@ int StorageInterface::falcon_init(void *
 
 	if (!checkExceptionSupport()) 
 		{
-		sql_print_error("Falcon must be compiled with C++ exceptions enabled to work");
-		DBUG_RETURN(1);
+		sql_print_error("Falcon must be compiled with C++ exceptions enabled to work. Please adjust your compile flags.");
+		FATAL("Falcon exiting process.\n");
 		}
 
 	StorageHandler::setDataDirectory(mysql_real_data_home);

=== modified file 'storage/falcon/plug.in'
--- a/storage/falcon/plug.in	2008-11-26 16:25:23 +0000
+++ b/storage/falcon/plug.in	2008-11-27 08:45:16 +0000
@@ -106,9 +106,6 @@ MYSQL_PLUGIN_ACTIONS(falcon,[
     )
   ])
 
-  CXXFLAGS=$ac_save_CXXFLAGS
-  AC_LANG_POP([C++])
-
   # Falcon uses exceptions and STL.
   CXXLDFLAGS="$CXXLDFLAGS $falcon_cv_cxx_enable_stl"
   FALCON_CXXFLAGS="$falcon_cv_cxx_no_invalid_offsetof $falcon_cv_cxx_enable_implicit_templates $falcon_cv_cxx_enable_exceptions"
@@ -119,6 +116,34 @@ MYSQL_PLUGIN_ACTIONS(falcon,[
 
   AC_SUBST([FALCON_CXXFLAGS])
 
+  # Check that C++ exceptions works in an executable by actually running a
+  # compiled program and throwing and catching an exception
+  CXXFLAGS=$FALCON_CXXFLAGS
+  AC_CACHE_CHECK([if compiler and compiler options support C++ exceptions for Falcon],
+	            falcon_supported_by_compiler,[
+  AC_TRY_RUN([
+    int main() {
+      try {
+        throw 1;
+      }
+      catch (int) {
+        return 0;
+      }
+      return -1; 
+    }
+  ], falcon_supported_by_compiler="yes",
+     falcon_supported_by_compiler="no", )
+  ])
+
+  if test "$falcon_supported_by_compiler" != "yes"; then
+    echo "Falcon must be compiled with support for C++ exceptions enabled."
+    echo "Please adjust your compiler flags or disable support for Falcon (--without-plugin-falcon)."
+    exit 1
+  fi
+
+  CXXFLAGS=$ac_save_CXXFLAGS
+  AC_LANG_POP([C++])
+
   # When compiling with Sun Studio compiler on SPARC assembly code for
   # Interlock operations needs to be included. This has been implemented
   # as "inline templates" in a separate file

Thread
bzr commit into mysql-6.0-falcon branch (hky:2921) Hakan Kuecuekyilmaz27 Nov