List:Commits« Previous MessageNext Message »
From:Alexander Nozdrin Date:April 3 2009 2:47pm
Subject:bzr push into mysql-6.0 branch (alik:2734)
View as plain text  
 2734 Guilhem Bichot	2009-04-02 [merge]
      merge of 6.0-main in 6.0-maria

    added:
      mysql-test/include/UnicodeData.txt
      mysql-test/suite/falcon/r/falcon_bug_40950.result
      mysql-test/suite/falcon/r/falcon_bug_43452.result
      mysql-test/suite/falcon/t/falcon_bug_40950.test
      mysql-test/suite/falcon/t/falcon_bug_43452.test
      storage/falcon/CycleLock.cpp
      storage/falcon/CycleLock.h
      storage/falcon/CycleManager.cpp
      storage/falcon/CycleManager.h
      storage/falcon/ErrorInjector.cpp
      storage/falcon/ErrorInjector.h
      storage/falcon/TransactionState.cpp
      storage/falcon/TransactionState.h
    renamed:
      mysql-test/suite/falcon_team/r/falcon_bug_36294-big.result => mysql-test/suite/falcon/r/falcon_bug_36294-big.result
      mysql-test/suite/falcon_team/t/falcon_bug_36294-big.test => mysql-test/suite/falcon/t/falcon_bug_36294-big.test
    modified:
      .bzr-mysql/default.conf
      mysql-test/lib/My/CoreDump.pm
      mysql-test/suite/backup/include/backup_client_regex_output.inc
      mysql-test/suite/backup/r/backup_client_binlog.result
      mysql-test/suite/falcon/r/falcon_options.result
      mysql-test/suite/falcon/r/falcon_options2.result
      mysql-test/suite/falcon/r/falcon_unicode-big.result
      mysql-test/suite/falcon/t/disabled.def
      mysql-test/suite/falcon/t/falcon_unicode-big.test
      mysql-test/suite/falcon_team/r/falcon_deadlock.result
      mysql-test/suite/falcon_team/t/falcon_bug_34174.test
      mysql-test/suite/falcon_team/t/falcon_deadlock.test
      mysql-test/suite/falcon_team/t/test2bug.def
      sql/handler.cc
      storage/falcon/BDB.cpp
      storage/falcon/BDB.h
      storage/falcon/BackLog.cpp
      storage/falcon/BigInt.cpp
      storage/falcon/BigInt.h
      storage/falcon/CMakeLists.txt
      storage/falcon/Cache.cpp
      storage/falcon/Cache.h
      storage/falcon/CmdGen.cpp
      storage/falcon/Configuration.cpp
      storage/falcon/Connection.cpp
      storage/falcon/Context.cpp
      storage/falcon/Database.cpp
      storage/falcon/Database.h
      storage/falcon/Dbb.cpp
      storage/falcon/Dbb.h
      storage/falcon/Debug.cpp
      storage/falcon/EncodedRecord.cpp
      storage/falcon/FsbSort.cpp
      storage/falcon/IO.cpp
      storage/falcon/ImageManager.cpp
      storage/falcon/Index.cpp
      storage/falcon/Index.h
      storage/falcon/Index2Page.cpp
      storage/falcon/IndexPage.cpp
      storage/falcon/IndexPage.h
      storage/falcon/IndexRootPage.cpp
      storage/falcon/IndexRootPage.h
      storage/falcon/IndexWalker.cpp
      storage/falcon/JString.cpp
      storage/falcon/JString.h
      storage/falcon/Makefile.am
      storage/falcon/MemControl.cpp
      storage/falcon/MemControl.h
      storage/falcon/MemMgr.cpp
      storage/falcon/MemMgr.h
      storage/falcon/MemoryManager.h
      storage/falcon/PageInventoryPage.cpp
      storage/falcon/Record.cpp
      storage/falcon/Record.h
      storage/falcon/RecordLeaf.cpp
      storage/falcon/RecordLocatorPage.cpp
      storage/falcon/RecordScavenge.cpp
      storage/falcon/RecordVersion.cpp
      storage/falcon/RecordVersion.h
      storage/falcon/Repository.cpp
      storage/falcon/Repository.h
      storage/falcon/RepositoryVolume.cpp
      storage/falcon/RepositoryVolume.h
      storage/falcon/SQLError.cpp
      storage/falcon/SQLError.h
      storage/falcon/SRLIndexPage.cpp
      storage/falcon/SRLIndexPage.h
      storage/falcon/SRLUpdateRecords.cpp
      storage/falcon/SRLVersion.h
      storage/falcon/SavePoint.cpp
      storage/falcon/Scavenger.cpp
      storage/falcon/Schedule.cpp
      storage/falcon/Section.cpp
      storage/falcon/SerialLog.cpp
      storage/falcon/SerialLogRecord.h
      storage/falcon/SortRecord.cpp
      storage/falcon/Statement.cpp
      storage/falcon/StorageDatabase.cpp
      storage/falcon/StorageHandler.cpp
      storage/falcon/StorageTable.cpp
      storage/falcon/StorageTable.h
      storage/falcon/StorageTableShare.h
      storage/falcon/StorageVersion.h
      storage/falcon/SyncObject.cpp
      storage/falcon/Table.cpp
      storage/falcon/Table.h
      storage/falcon/TableSpaceManager.cpp
      storage/falcon/Thread.cpp
      storage/falcon/Thread.h
      storage/falcon/Transaction.cpp
      storage/falcon/Transaction.h
      storage/falcon/TransactionManager.cpp
      storage/falcon/Value.cpp
      storage/falcon/WalkIndex.cpp
      storage/falcon/ha_falcon.cpp
=== modified file 'client/mysqltest.cc'
--- a/client/mysqltest.cc	2009-03-19 12:16:36 +0000
+++ b/client/mysqltest.cc	2009-04-01 21:36:07 +0000
@@ -6916,14 +6916,6 @@ end:
     dynstr_free(&ds_execute_warnings);
   }
 
-
-  /* Close the statement if - no reconnect, need new prepare */
-  if (mysql->reconnect)
-  {
-    mysql_stmt_close(stmt);
-    cur_con->stmt= NULL;
-  }
-
   /*
     We save the return code (mysql_stmt_errno(stmt)) from the last call sent
     to the server into the mysqltest builtin variable $mysql_errno. This
@@ -6932,6 +6924,13 @@ end:
 
   var_set_errno(mysql_stmt_errno(stmt));
 
+  /* Close the statement if reconnect, need new prepare */
+  if (mysql->reconnect)
+  {
+    mysql_stmt_close(stmt);
+    cur_con->stmt= NULL;
+  }
+
   DBUG_VOID_RETURN;
 }
 

=== modified file 'include/lf.h'
--- a/include/lf.h	2009-02-13 16:30:54 +0000
+++ b/include/lf.h	2009-03-31 15:30:19 +0000
@@ -115,10 +115,10 @@ typedef struct {
   uint32 purgatory_count;
   uint32 volatile link;
 /* we want sizeof(LF_PINS) to be 128 to avoid false sharing */
-  char pad[128-sizeof(uint32)*2
-              -sizeof(LF_PINBOX *)
-              -sizeof(void*)
-              -sizeof(void *)*(LF_PINBOX_PINS+1)];
+  char pad[64-sizeof(uint32)*2
+             -sizeof(LF_PINBOX *)
+             -sizeof(void*)
+             -sizeof(void *)*(LF_PINBOX_PINS+1)];
 } LF_PINS;
 
 /*

=== modified file 'include/my_sys.h'
--- a/include/my_sys.h	2009-03-18 21:09:40 +0000
+++ b/include/my_sys.h	2009-04-01 21:36:07 +0000
@@ -246,6 +246,16 @@ extern ulong my_thread_stack_size;
 extern const char *(*proc_info_hook)(void *, const char *, const char *,
                                      const char *, const unsigned int);
 
+#if defined(ENABLED_DEBUG_SYNC)
+extern void (*debug_sync_C_callback_ptr)(const char *, size_t);
+#define DEBUG_SYNC_C(_sync_point_name_) do {                            \
+    if (debug_sync_C_callback_ptr != NULL)                              \
+      (*debug_sync_C_callback_ptr)(STRING_WITH_LEN(_sync_point_name_)); } \
+  while(0)
+#else
+#define DEBUG_SYNC_C(_sync_point_name_)
+#endif /* defined(ENABLED_DEBUG_SYNC) */
+
 #ifdef HAVE_LARGE_PAGES
 extern my_bool my_use_large_pages;
 extern uint    my_large_page_size;

=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl	2009-03-18 21:09:40 +0000
+++ b/mysql-test/mysql-test-run.pl	2009-04-01 21:36:07 +0000
@@ -4831,13 +4831,9 @@ sub gdb_arguments {
   else
   {
     # write init file for mysqld
-    mtr_tofile($gdb_init_file,
-	       "set args $str\n" .
-	       "break mysql_parse\n" .
-	       "commands 1\n" .
-	       "disable 1\n" .
-	       "end\n" .
-	       "run");
+    mtr_tofile($gdb_init_file, <<EOGDB );
+set args $str
+EOGDB
   }
 
   if ( $opt_manual_gdb )

=== modified file 'mysql-test/suite/backup/t/backup_maria_other_instance.test'
--- a/mysql-test/suite/backup/t/backup_maria_other_instance.test	2009-02-13 12:40:13 +0000
+++ b/mysql-test/suite/backup/t/backup_maria_other_instance.test	2009-04-01 20:48:42 +0000
@@ -6,12 +6,12 @@
 --source include/have_maria.inc
 
 let $MARIA_LOG=.;
-let $MYSQLD_DATADIR= `select @@datadir`;
+let $MYSQLD_BACKUPDIR= `select @@backupdir`;
 
 --disable_warnings
 drop database if exists mysqltest;
 --error 0,1
-remove_file $MYSQLD_DATADIR/test.ba;
+remove_file $MYSQLD_BACKUPDIR/test.ba;
 --enable_warnings
 create database mysqltest;
 let $mms_tname=t;
@@ -44,7 +44,7 @@ check table t1 extended;
 flush table t1;
 
 # Check that table is auto-zerofilled, movable
---exec $MARIA_CHK -dv $MYSQLD_DATADIR/mysqltest/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt
+--exec $MARIA_CHK -dv $MYSQLD_BACKUPDIR/mysqltest/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt
 perl;
     use strict;
     use warnings;
@@ -62,7 +62,7 @@ check table t1 extended;
 flush table t1;
 
 # Check that table is not zerofilled, not movable
---exec $MARIA_CHK -dv $MYSQLD_DATADIR/mysqltest/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt
+--exec $MARIA_CHK -dv $MYSQLD_BACKUPDIR/mysqltest/t1 >$MYSQLTEST_VARDIR/tmp/mariachk.txt
 perl;
     use strict;
     use warnings;
@@ -75,4 +75,4 @@ perl;
 EOF
 
 drop database mysqltest;
-remove_file $MYSQLD_DATADIR/test.ba;
+remove_file $MYSQLD_BACKUPDIR/test.ba;

=== modified file 'mysql-test/suite/backup/t/disabled.def'
--- a/mysql-test/suite/backup/t/disabled.def	2009-03-26 12:16:07 +0000
+++ b/mysql-test/suite/backup/t/disabled.def	2009-04-01 20:48:42 +0000
@@ -12,4 +12,3 @@
 backup_no_engine              : Bug#36021 2008-04-13 rsomla server crashes when openning table with unknown storage engine
 backup_triggers_and_events    : Bug#37762 2008-07-01 rafal Test fails on remove_file for unknown reasons
 backup_no_data                : Bug#42756 2009-02-11 jorgen Test db state not preserved 
-backup_maria_other_instance   : Bug#42924 2009-02-17 serg

=== modified file 'mysql-test/suite/maria/r/maria-recovery-bitmap.result'
--- a/mysql-test/suite/maria/r/maria-recovery-bitmap.result	2008-10-01 12:13:39 +0000
+++ b/mysql-test/suite/maria/r/maria-recovery-bitmap.result	2009-03-17 14:53:45 +0000
@@ -9,7 +9,7 @@ flush table t1;
 * copied t1 for comparison
 insert into t1 values ("bbbbbbb");
 delete from t1 limit 1;
-set session debug="+d,info,enter,exit,maria_over_alloc_bitmap";
+set session debug="+d,maria_over_alloc_bitmap";
 insert into t1 values ("aaaaaaaaa");
 set global maria_checkpoint_interval=1;
 SET SESSION debug="+d,maria_crash";

=== modified file 'mysql-test/suite/maria/r/maria-recovery2.result'
--- a/mysql-test/suite/maria/r/maria-recovery2.result	2009-02-13 16:30:54 +0000
+++ b/mysql-test/suite/maria/r/maria-recovery2.result	2009-03-17 14:53:45 +0000
@@ -28,7 +28,7 @@ ok
 use mysqltest;
 drop table t1;
 * TEST of checkpoint
-set global debug="+d,info,query,enter,exit,loop,maria_checkpoint_indirect";
+set global debug="+d,maria_checkpoint_indirect";
 set global maria_checkpoint_interval=10000;
 create table t1(a int, b varchar(10), index(a,b)) engine=maria;
 insert into t1 values(1,"a"),(2,"b"),(3,"c");

=== modified file 'mysql-test/suite/maria/r/maria.result'
--- a/mysql-test/suite/maria/r/maria.result	2009-02-13 16:30:54 +0000
+++ b/mysql-test/suite/maria/r/maria.result	2009-03-13 14:10:43 +0000
@@ -574,6 +574,7 @@ commit;
 select straight_join * from t1,t2 force index (primary) where t1.a=t2.a;
 a	a	b
 1	1	1
+2	2	1
 unlock tables;
 drop table t1,t2;
 set autocommit=1;

=== added file 'mysql-test/suite/maria/r/maria4.result'
--- a/mysql-test/suite/maria/r/maria4.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/maria/r/maria4.result	2009-03-13 14:10:43 +0000
@@ -0,0 +1,253 @@
+set global storage_engine=Maria;
+set session storage_engine=Maria;
+create table t1 (a int);
+insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table t2 (a int, filler char(200), key(a));
+insert into t2 select C.a*2,   'no'  from t1 A, t1 B, t1 C;
+insert into t2 select C.a*2+1, 'yes' from t1 C;
+select * from t2 where a NOT IN (0, 2,4,6,8,10,12,14,16,18);
+a	filler
+1	yes
+11	yes
+13	yes
+15	yes
+17	yes
+19	yes
+3	yes
+5	yes
+7	yes
+9	yes
+drop table t1,t2;
+CREATE TABLE t1 (a varchar(32), b char(3), UNIQUE KEY a (a,b), KEY b (b));
+INSERT INTO t1 (a, b) VALUES
+( 'ppfcz1', 'DE'), ( 'ppfcz1', 'FR');
+CREATE TABLE t2 (a varchar(32), b int(11), c float, d double, 
+UNIQUE KEY a (a,b,c));
+INSERT INTO t2 (a, b, c, d) VALUES
+( 'ppfcz1', 14, 5, 48.5), ( 'ppfcz1', 14, 6, 52.5);
+SELECT t1.a,t2.a,t2.c,t2.d FROM t1, t2
+WHERE t2.b=14 AND t2.a=t1.a AND 5.1<t2.c AND t1.b='DE';
+a	a	c	d
+ppfcz1	ppfcz1	6	52.5
+drop table t1,t2;
+CREATE TABLE t1(c1 FLOAT(10,5) UNSIGNED NOT NULL, c2 FLOAT(10,5) SIGNED NULL, c3 FLOAT, c4 INT, UNIQUE INDEX idx(c1,c2));
+INSERT INTO t1 VALUES('00100.05000','-00100.05000','00100.05000',1);
+INSERT INTO t1(c1) VALUES('12345.000009');
+INSERT INTO t1 VALUES('99999.99999','-99999.99999','99999.99999',3);
+DELETE FROM t1 WHERE c1='100000.00000' AND c2='-100000.00000';
+INSERT INTO t1 VALUES('100000.000002','-100000.000002','100000.000002',5);
+Warnings:
+Warning	1264	Out of range value for column 'c1' at row 1
+Warning	1264	Out of range value for column 'c2' at row 1
+insert into t1 values ("0.0","0.0","0.0",7),("01.0","01.0","01.0",10);
+insert into t1 values ("-.1","-.1","-.1",13);
+Warnings:
+Warning	1264	Out of range value for column 'c1' at row 1
+insert into t1 values ("+111111111.11","+111111111.11","+111111111.11",19);
+Warnings:
+Warning	1264	Out of range value for column 'c1' at row 1
+Warning	1264	Out of range value for column 'c2' at row 1
+SELECT * FROM t1;
+c1	c2	c3	c4
+0.00000	-0.10000	-0.1	13
+0.00000	0.00000	0	7
+1.00000	1.00000	1	10
+100.05000	-100.05000	100.05	1
+100000.00000	-100000.00000	100000	5
+100000.00000	100000.00000	111111000	19
+12345.00000	NULL	NULL	NULL
+SELECT * FROM t1 WHERE c2 >= '-99999.99999' AND c2 < '0.0' AND c1 = '99999.99999' ORDER BY c1,c2;
+c1	c2	c3	c4
+SELECT * FROM t1 WHERE c2 >= '-99999.99999' AND c2 < '0.0' AND c1 = '99999.99999' ORDER BY c1,c2 LIMIT 2;
+c1	c2	c3	c4
+SELECT * FROM t1 WHERE c2 >= '-99999.99999' AND c2 < '0.0' AND c1 = '99999.99999' ORDER BY c1,c2 DESC;
+c1	c2	c3	c4
+SELECT * FROM t1 WHERE c2 >= '-99999.99999' AND c2 < '0.0' AND c1 = '99999.99999' ORDER BY c1,c2 DESC LIMIT 2;
+c1	c2	c3	c4
+DROP TABLE t1;
+CREATE TABLE t1(c1 DATE NOT NULL, c2 DATE NULL, c3 DATETIME, c4 TIMESTAMP, PRIMARY KEY(c1), UNIQUE INDEX(c2));
+CREATE TABLE t2(c1 DATE NOT NULL, c2 DATE NULL, c3 DATETIME, c4 TIMESTAMP, PRIMARY KEY(c1,c2));
+CREATE TABLE t3(c1 DATE NOT NULL, c2 DATE NULL, c3 DATETIME, c4 TIMESTAMP, UNIQUE INDEX idx(c1,c2));
+INSERT INTO t1 VALUES('98-12-31 11:30:45','98.12.31 11+30+45','98-12-31 11:30:45','98.12.31 11+30+45'),('98/12/30 11*30*45','98@12@30 11^30^45','98/12/30 11*30*45','98@12@30 11^30^45'),('98-12-29','98.12.29','98-12-29','98.12.29'),('98/12/28','98@12@28','98/12/28','98@12@28');
+Warnings:
+Note	1265	Data truncated for column 'c1' at row 1
+Note	1265	Data truncated for column 'c2' at row 1
+Note	1265	Data truncated for column 'c1' at row 2
+Note	1265	Data truncated for column 'c2' at row 2
+INSERT INTO t2 VALUES('98-12-31 11:30:45','98.12.31 11+30+45','98-12-31 11:30:45','98.12.31 11+30+45'),('98/12/30 11*30*45','98@12@30 11^30^45','98/12/30 11*30*45','98@12@30 11^30^45'),('98-12-29','98.12.29','98-12-29','98.12.29'),('98/12/28','98@12@28','98/12/28','98@12@28');
+Warnings:
+Note	1265	Data truncated for column 'c1' at row 1
+Note	1265	Data truncated for column 'c2' at row 1
+Note	1265	Data truncated for column 'c1' at row 2
+Note	1265	Data truncated for column 'c2' at row 2
+INSERT INTO t3 VALUES('98-12-31 11:30:45','98.12.31 11+30+45','98-12-31 11:30:45','98.12.31 11+30+45'),('98/12/30 11*30*45','98@12@30 11^30^45','98/12/30 11*30*45','98@12@30 11^30^45'),('98-12-29','98.12.29','98-12-29','98.12.29'),('98/12/28','98@12@28','98/12/28','98@12@28');
+Warnings:
+Note	1265	Data truncated for column 'c1' at row 1
+Note	1265	Data truncated for column 'c2' at row 1
+Note	1265	Data truncated for column 'c1' at row 2
+Note	1265	Data truncated for column 'c2' at row 2
+INSERT INTO t1 VALUES('20070523091528','070523091528','20070524091528','070524091528'),('20070525','070525','20070526','070526');
+Warnings:
+Note	1265	Data truncated for column 'c1' at row 1
+Note	1265	Data truncated for column 'c2' at row 1
+INSERT INTO t2 VALUES('20070523091528','070523091528','20070524091528','070524091528'),('20070525','070525','20070526','070526');
+Warnings:
+Note	1265	Data truncated for column 'c1' at row 1
+Note	1265	Data truncated for column 'c2' at row 1
+INSERT INTO t3 VALUES('20070523091528','070523091528','20070524091528','070524091528'),('20070525','070525','20070526','070526');
+Warnings:
+Note	1265	Data truncated for column 'c1' at row 1
+Note	1265	Data truncated for column 'c2' at row 1
+INSERT INTO t1 VALUES(19830905132800,830905132800,19830906132800,830906132800),(19830907,830907,19830908,830908);
+Warnings:
+Note	1265	Data truncated for column 'c1' at row 1
+Note	1265	Data truncated for column 'c2' at row 1
+INSERT INTO t2 VALUES(19830905132800,830905132800,19830906132800,830906132800),(19830907,830907,19830908,830908);
+Warnings:
+Note	1265	Data truncated for column 'c1' at row 1
+Note	1265	Data truncated for column 'c2' at row 1
+INSERT INTO t3 VALUES(19830905132800,830905132800,19830906132800,830906132800),(19830907,830907,19830908,830908);
+Warnings:
+Note	1265	Data truncated for column 'c1' at row 1
+Note	1265	Data truncated for column 'c2' at row 1
+SET TIMESTAMP=1233216687;
+INSERT INTO t1 VALUES(NOW(),CURRENT_DATE,NOW(),CURRENT_DATE);
+Warnings:
+Note	1265	Data truncated for column 'c1' at row 1
+INSERT INTO t2 VALUES(NOW(),CURRENT_DATE,NOW(),CURRENT_DATE);
+Warnings:
+Note	1265	Data truncated for column 'c1' at row 1
+INSERT INTO t3 VALUES(NOW(),CURRENT_DATE,NOW(),CURRENT_DATE);
+Warnings:
+Note	1265	Data truncated for column 'c1' at row 1
+INSERT INTO t2 VALUES('98-12-31 11:30:45','98@12@30 11^30^45','98-12-31 11:30:45','98.12.31 11+30+45'),('98-12-29','98@12@30 11^30^45','98/12/30 11*30*45','98@12@30 11^30^45');
+Warnings:
+Note	1265	Data truncated for column 'c1' at row 1
+Note	1265	Data truncated for column 'c2' at row 1
+Note	1265	Data truncated for column 'c2' at row 2
+INSERT INTO t3 VALUES('98-12-31 11:30:45','98@12@30 11^30^45','98-12-31 11:30:45','98.12.31 11+30+45'),('98-12-29','98@12@30 11^30^45','98/12/30 11*30*45','98@12@30 11^30^45');
+Warnings:
+Note	1265	Data truncated for column 'c1' at row 1
+Note	1265	Data truncated for column 'c2' at row 1
+Note	1265	Data truncated for column 'c2' at row 2
+INSERT INTO t1 VALUES('2008-01-01',NULL,'08-01-02','08/01/03');
+INSERT INTO t3 VALUES('2008-01-01',NULL,'08-01-02','08/01/03');
+INSERT INTO t1(c1,c2) VALUES('08/01/17',NULL);
+DELETE FROM t1 WHERE c1='08/01/17' AND c2 IS NULL;
+INSERT INTO t1 VALUES('','','08-01-04','08/01/05') /* Inserts zero dates for '' strings */;
+Warnings:
+Warning	1265	Data truncated for column 'c1' at row 1
+Warning	1265	Data truncated for column 'c2' at row 1
+INSERT INTO t2 VALUES('2008-04-31','2008-04-31','08-01-06','08/01/07') /* Inserts zero dates for invalid dates */;
+Warnings:
+Warning	1265	Data truncated for column 'c1' at row 1
+Warning	1265	Data truncated for column 'c2' at row 1
+INSERT INTO t3 VALUES('10:45:15','10:45:15','08-01-08','08/1/9') /* Inserts zero dates for invalid dates */;
+Warnings:
+Warning	1265	Data truncated for column 'c1' at row 1
+Warning	1265	Data truncated for column 'c2' at row 1
+INSERT INTO t2 VALUES('0000-00-00','08-01-06','08-01-06','08/01/07');
+INSERT INTO t3 VALUES('08-01-06','00-00-00','08-01-08','08/1/9');
+SELECT * FROM t1;
+c1	c2	c3	c4
+0000-00-00	0000-00-00	2008-01-04 00:00:00	2008-01-05 00:00:00
+1983-09-05	1983-09-05	1983-09-06 13:28:00	1983-09-06 13:28:00
+1983-09-07	1983-09-07	1983-09-08 00:00:00	1983-09-08 00:00:00
+1998-12-28	1998-12-28	1998-12-28 00:00:00	1998-12-28 00:00:00
+1998-12-29	1998-12-29	1998-12-29 00:00:00	1998-12-29 00:00:00
+1998-12-30	1998-12-30	1998-12-30 11:30:45	1998-12-30 11:30:45
+1998-12-31	1998-12-31	1998-12-31 11:30:45	1998-12-31 11:30:45
+2007-05-23	2007-05-23	2007-05-24 09:15:28	2007-05-24 09:15:28
+2007-05-25	2007-05-25	2007-05-26 00:00:00	2007-05-26 00:00:00
+2008-01-01	NULL	2008-01-02 00:00:00	2008-01-03 00:00:00
+2009-01-29	2009-01-29	2009-01-29 11:11:27	2009-01-29 00:00:00
+SELECT * FROM t2;
+c1	c2	c3	c4
+0000-00-00	0000-00-00	2008-01-06 00:00:00	2008-01-07 00:00:00
+0000-00-00	2008-01-06	2008-01-06 00:00:00	2008-01-07 00:00:00
+1983-09-05	1983-09-05	1983-09-06 13:28:00	1983-09-06 13:28:00
+1983-09-07	1983-09-07	1983-09-08 00:00:00	1983-09-08 00:00:00
+1998-12-28	1998-12-28	1998-12-28 00:00:00	1998-12-28 00:00:00
+1998-12-29	1998-12-29	1998-12-29 00:00:00	1998-12-29 00:00:00
+1998-12-29	1998-12-30	1998-12-30 11:30:45	1998-12-30 11:30:45
+1998-12-30	1998-12-30	1998-12-30 11:30:45	1998-12-30 11:30:45
+1998-12-31	1998-12-30	1998-12-31 11:30:45	1998-12-31 11:30:45
+1998-12-31	1998-12-31	1998-12-31 11:30:45	1998-12-31 11:30:45
+2007-05-23	2007-05-23	2007-05-24 09:15:28	2007-05-24 09:15:28
+2007-05-25	2007-05-25	2007-05-26 00:00:00	2007-05-26 00:00:00
+2009-01-29	2009-01-29	2009-01-29 11:11:27	2009-01-29 00:00:00
+SELECT * FROM t3;
+c1	c2	c3	c4
+0000-00-00	0000-00-00	2008-01-08 00:00:00	2008-01-09 00:00:00
+1983-09-05	1983-09-05	1983-09-06 13:28:00	1983-09-06 13:28:00
+1983-09-07	1983-09-07	1983-09-08 00:00:00	1983-09-08 00:00:00
+1998-12-28	1998-12-28	1998-12-28 00:00:00	1998-12-28 00:00:00
+1998-12-29	1998-12-29	1998-12-29 00:00:00	1998-12-29 00:00:00
+1998-12-29	1998-12-30	1998-12-30 11:30:45	1998-12-30 11:30:45
+1998-12-30	1998-12-30	1998-12-30 11:30:45	1998-12-30 11:30:45
+1998-12-31	1998-12-30	1998-12-31 11:30:45	1998-12-31 11:30:45
+1998-12-31	1998-12-31	1998-12-31 11:30:45	1998-12-31 11:30:45
+2007-05-23	2007-05-23	2007-05-24 09:15:28	2007-05-24 09:15:28
+2007-05-25	2007-05-25	2007-05-26 00:00:00	2007-05-26 00:00:00
+2008-01-01	NULL	2008-01-02 00:00:00	2008-01-03 00:00:00
+2008-01-06	0000-00-00	2008-01-08 00:00:00	2008-01-09 00:00:00
+2009-01-29	2009-01-29	2009-01-29 11:11:27	2009-01-29 00:00:00
+SELECT * FROM t1 WHERE c1 > '1998-12-31 11:30:45' ORDER BY c1;
+c1	c2	c3	c4
+2007-05-23	2007-05-23	2007-05-24 09:15:28	2007-05-24 09:15:28
+2007-05-25	2007-05-25	2007-05-26 00:00:00	2007-05-26 00:00:00
+2008-01-01	NULL	2008-01-02 00:00:00	2008-01-03 00:00:00
+2009-01-29	2009-01-29	2009-01-29 11:11:27	2009-01-29 00:00:00
+SELECT * FROM t1 WHERE c1 > '1998-12-31 11:30:45' ORDER BY c1 LIMIT 2;
+c1	c2	c3	c4
+2007-05-23	2007-05-23	2007-05-24 09:15:28	2007-05-24 09:15:28
+2007-05-25	2007-05-25	2007-05-26 00:00:00	2007-05-26 00:00:00
+SELECT * FROM t1 WHERE c1 >= '1998-12-31 11:30:45' ORDER BY c1;
+c1	c2	c3	c4
+2007-05-23	2007-05-23	2007-05-24 09:15:28	2007-05-24 09:15:28
+2007-05-25	2007-05-25	2007-05-26 00:00:00	2007-05-26 00:00:00
+2008-01-01	NULL	2008-01-02 00:00:00	2008-01-03 00:00:00
+2009-01-29	2009-01-29	2009-01-29 11:11:27	2009-01-29 00:00:00
+SELECT * FROM t1 WHERE c1 >= '1998-12-31 11:30:45' ORDER BY c1 LIMIT 2;
+c1	c2	c3	c4
+2007-05-23	2007-05-23	2007-05-24 09:15:28	2007-05-24 09:15:28
+2007-05-25	2007-05-25	2007-05-26 00:00:00	2007-05-26 00:00:00
+SELECT * FROM t1 WHERE c2 > '1998-12-30 11:30:45' ORDER BY c2;
+c1	c2	c3	c4
+1998-12-31	1998-12-31	1998-12-31 11:30:45	1998-12-31 11:30:45
+2007-05-23	2007-05-23	2007-05-24 09:15:28	2007-05-24 09:15:28
+2007-05-25	2007-05-25	2007-05-26 00:00:00	2007-05-26 00:00:00
+2009-01-29	2009-01-29	2009-01-29 11:11:27	2009-01-29 00:00:00
+SELECT * FROM t1 WHERE c2 > '1998-12-30 11:30:45' ORDER BY c2 LIMIT 2;
+c1	c2	c3	c4
+1998-12-31	1998-12-31	1998-12-31 11:30:45	1998-12-31 11:30:45
+2007-05-23	2007-05-23	2007-05-24 09:15:28	2007-05-24 09:15:28
+SELECT * FROM t1 WHERE c2 >= '1998-12-30 11:30:45' ORDER BY c2;
+c1	c2	c3	c4
+1998-12-31	1998-12-31	1998-12-31 11:30:45	1998-12-31 11:30:45
+2007-05-23	2007-05-23	2007-05-24 09:15:28	2007-05-24 09:15:28
+2007-05-25	2007-05-25	2007-05-26 00:00:00	2007-05-26 00:00:00
+2009-01-29	2009-01-29	2009-01-29 11:11:27	2009-01-29 00:00:00
+SELECT * FROM t1 WHERE c2 >= '1998-12-30 11:30:45' ORDER BY c2 LIMIT 2;
+c1	c2	c3	c4
+1998-12-31	1998-12-31	1998-12-31 11:30:45	1998-12-31 11:30:45
+2007-05-23	2007-05-23	2007-05-24 09:15:28	2007-05-24 09:15:28
+SELECT * FROM t2 WHERE c1 > '1998-12-29 00:00:00' ORDER BY c1,c2 LIMIT 2;
+c1	c2	c3	c4
+1998-12-30	1998-12-30	1998-12-30 11:30:45	1998-12-30 11:30:45
+1998-12-31	1998-12-30	1998-12-31 11:30:45	1998-12-31 11:30:45
+SELECT * FROM t3 WHERE c1 > '1998-12-28 00:00:00' ORDER BY c1,c2 LIMIT 2;
+c1	c2	c3	c4
+1998-12-29	1998-12-29	1998-12-29 00:00:00	1998-12-29 00:00:00
+1998-12-29	1998-12-30	1998-12-30 11:30:45	1998-12-30 11:30:45
+SELECT * FROM t3 WHERE c1 BETWEEN '1998-12-31 11:30:45' AND '2008-01-06 00:00:00' ORDER BY c1,c2;
+c1	c2	c3	c4
+2007-05-23	2007-05-23	2007-05-24 09:15:28	2007-05-24 09:15:28
+2007-05-25	2007-05-25	2007-05-26 00:00:00	2007-05-26 00:00:00
+2008-01-01	NULL	2008-01-02 00:00:00	2008-01-03 00:00:00
+2008-01-06	0000-00-00	2008-01-08 00:00:00	2008-01-09 00:00:00
+SELECT * FROM t3 WHERE c1 BETWEEN '1998-12-31 11:30:45' AND '2008-01-06 00:00:00' ORDER BY c1,c2 LIMIT 2;
+c1	c2	c3	c4
+2007-05-23	2007-05-23	2007-05-24 09:15:28	2007-05-24 09:15:28
+2007-05-25	2007-05-25	2007-05-26 00:00:00	2007-05-26 00:00:00
+DROP TABLE t1,t2,t3;

=== modified file 'mysql-test/suite/maria/t/disabled.def'
--- a/mysql-test/suite/maria/t/disabled.def	2009-02-17 10:45:58 +0000
+++ b/mysql-test/suite/maria/t/disabled.def	2009-03-05 21:42:16 +0000
@@ -1 +0,0 @@
-maria-recovery-bitmap : BUG#42180

=== added file 'mysql-test/suite/maria/t/maria-autozerofill-master.opt'
--- a/mysql-test/suite/maria/t/maria-autozerofill-master.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/maria/t/maria-autozerofill-master.opt	2009-03-17 14:53:45 +0000
@@ -0,0 +1 @@
+--loose-skip-falcon

=== added file 'mysql-test/suite/maria/t/maria-no-logging-master.opt'
--- a/mysql-test/suite/maria/t/maria-no-logging-master.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/maria/t/maria-no-logging-master.opt	2009-03-17 14:53:45 +0000
@@ -0,0 +1 @@
+--loose-skip-falcon

=== modified file 'mysql-test/suite/maria/t/maria-recovery-bitmap.test'
--- a/mysql-test/suite/maria/t/maria-recovery-bitmap.test	2008-10-20 09:16:47 +0000
+++ b/mysql-test/suite/maria/t/maria-recovery-bitmap.test	2009-03-17 14:53:45 +0000
@@ -44,7 +44,7 @@ insert into t1 values ("bbbbbbb");
 # test).
 insert into t1 values ("bbbbbbb");
 delete from t1 limit 1;
-set session debug="+d,info,enter,exit,maria_over_alloc_bitmap";
+set session debug="+d,maria_over_alloc_bitmap";
 send insert into t1 values ("aaaaaaaaa");
 connection admin;
 # Leave time for INSERT to block after modifying bitmap;

=== modified file 'mysql-test/suite/maria/t/maria-recovery2.test'
--- a/mysql-test/suite/maria/t/maria-recovery2.test	2009-02-13 16:30:54 +0000
+++ b/mysql-test/suite/maria/t/maria-recovery2.test	2009-03-17 14:53:45 +0000
@@ -62,7 +62,7 @@ drop table t1;
 # A basic checkpoint test
 --echo * TEST of checkpoint
 # Don't take a full checkpoints, we want to test checkpoint vs dirty pages
-set global debug="+d,info,query,enter,exit,loop,maria_checkpoint_indirect";
+set global debug="+d,maria_checkpoint_indirect";
 # restart checkpoint thread for it to notice the above
 set global maria_checkpoint_interval=10000;
 create table t1(a int, b varchar(10), index(a,b)) engine=maria;

=== added file 'mysql-test/suite/maria/t/maria4.test'
--- a/mysql-test/suite/maria/t/maria4.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/maria/t/maria4.test	2009-03-13 14:10:43 +0000
@@ -0,0 +1,138 @@
+-- source include/have_maria.inc
+
+let $engine_type= Maria;
+let $default_engine=`select @@global.storage_engine`;
+eval set global storage_engine=$engine_type;
+eval set session storage_engine=$engine_type;
+
+# We start with tests for problems which were due to the Index Condition
+# Pushdown implementation.
+
+# BUG#42297 func_in.test failing with engine=maria
+create table t1 (a int);
+insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); 
+create table t2 (a int, filler char(200), key(a));
+
+insert into t2 select C.a*2,   'no'  from t1 A, t1 B, t1 C;
+insert into t2 select C.a*2+1, 'yes' from t1 C;
+--sorted_result
+select * from t2 where a NOT IN (0, 2,4,6,8,10,12,14,16,18);
+
+drop table t1,t2;
+
+# BUG#42298 "SELECT with join returns no rows"
+
+# Reduced testcase used to give 1030: Got error 176 from
+# storage engine
+CREATE TABLE t1 (a varchar(32), b char(3), UNIQUE KEY a (a,b), KEY b (b));
+INSERT INTO t1 (a, b) VALUES
+( 'ppfcz1', 'DE'), ( 'ppfcz1', 'FR');
+CREATE TABLE t2 (a varchar(32), b int(11), c float, d double, 
+  UNIQUE KEY a (a,b,c));
+INSERT INTO t2 (a, b, c, d) VALUES
+( 'ppfcz1', 14, 5, 48.5), ( 'ppfcz1', 14, 6, 52.5);
+--sorted_result
+SELECT t1.a,t2.a,t2.c,t2.d FROM t1, t2
+WHERE t2.b=14 AND t2.a=t1.a AND 5.1<t2.c AND t1.b='DE';
+drop table t1,t2;
+
+# BUG#43552 Maria returned wrong rows with range access on float
+
+CREATE TABLE t1(c1 FLOAT(10,5) UNSIGNED NOT NULL, c2 FLOAT(10,5) SIGNED NULL, c3 FLOAT, c4 INT, UNIQUE INDEX idx(c1,c2));
+INSERT INTO t1 VALUES('00100.05000','-00100.05000','00100.05000',1);
+INSERT INTO t1(c1) VALUES('12345.000009');
+INSERT INTO t1 VALUES('99999.99999','-99999.99999','99999.99999',3);
+DELETE FROM t1 WHERE c1='100000.00000' AND c2='-100000.00000';
+INSERT INTO t1 VALUES('100000.000002','-100000.000002','100000.000002',5);
+insert into t1 values ("0.0","0.0","0.0",7),("01.0","01.0","01.0",10);
+insert into t1 values ("-.1","-.1","-.1",13);
+insert into t1 values ("+111111111.11","+111111111.11","+111111111.11",19);
+--sorted_result
+SELECT * FROM t1;
+--sorted_result
+SELECT * FROM t1 WHERE c2 >= '-99999.99999' AND c2 < '0.0' AND c1 = '99999.99999' ORDER BY c1,c2;
+--sorted_result
+SELECT * FROM t1 WHERE c2 >= '-99999.99999' AND c2 < '0.0' AND c1 = '99999.99999' ORDER BY c1,c2 LIMIT 2;
+--sorted_result
+SELECT * FROM t1 WHERE c2 >= '-99999.99999' AND c2 < '0.0' AND c1 = '99999.99999' ORDER BY c1,c2 DESC;
+--sorted_result
+SELECT * FROM t1 WHERE c2 >= '-99999.99999' AND c2 < '0.0' AND c1 = '99999.99999' ORDER BY c1,c2 DESC LIMIT 2;
+DROP TABLE t1;
+
+# BUG#43623 Maria returns no rows with date index on range access >,
+# >=, BETWEEN
+
+CREATE TABLE t1(c1 DATE NOT NULL, c2 DATE NULL, c3 DATETIME, c4 TIMESTAMP, PRIMARY KEY(c1), UNIQUE INDEX(c2));
+CREATE TABLE t2(c1 DATE NOT NULL, c2 DATE NULL, c3 DATETIME, c4 TIMESTAMP, PRIMARY KEY(c1,c2));
+CREATE TABLE t3(c1 DATE NOT NULL, c2 DATE NULL, c3 DATETIME, c4 TIMESTAMP, UNIQUE INDEX idx(c1,c2));
+
+# As a string in either 'YYYY-MM-DD HH:MM:SS', 'YY-MM-DD HH:MM:SS', 'YYYY-MM-DD' or 'YY-MM-DD' format
+INSERT INTO t1 VALUES('98-12-31 11:30:45','98.12.31 11+30+45','98-12-31 11:30:45','98.12.31 11+30+45'),('98/12/30 11*30*45','98@12@30 11^30^45','98/12/30 11*30*45','98@12@30 11^30^45'),('98-12-29','98.12.29','98-12-29','98.12.29'),('98/12/28','98@12@28','98/12/28','98@12@28');
+INSERT INTO t2 VALUES('98-12-31 11:30:45','98.12.31 11+30+45','98-12-31 11:30:45','98.12.31 11+30+45'),('98/12/30 11*30*45','98@12@30 11^30^45','98/12/30 11*30*45','98@12@30 11^30^45'),('98-12-29','98.12.29','98-12-29','98.12.29'),('98/12/28','98@12@28','98/12/28','98@12@28');
+INSERT INTO t3 VALUES('98-12-31 11:30:45','98.12.31 11+30+45','98-12-31 11:30:45','98.12.31 11+30+45'),('98/12/30 11*30*45','98@12@30 11^30^45','98/12/30 11*30*45','98@12@30 11^30^45'),('98-12-29','98.12.29','98-12-29','98.12.29'),('98/12/28','98@12@28','98/12/28','98@12@28');
+
+# As a string with no delimiters in either 'YYYYMMDDHHMMSS', 'YYMMDDHHMMSS', 'YYYYMMDD' or 'YYMMDD'  format
+INSERT INTO t1 VALUES('20070523091528','070523091528','20070524091528','070524091528'),('20070525','070525','20070526','070526');
+INSERT INTO t2 VALUES('20070523091528','070523091528','20070524091528','070524091528'),('20070525','070525','20070526','070526');
+INSERT INTO t3 VALUES('20070523091528','070523091528','20070524091528','070524091528'),('20070525','070525','20070526','070526');
+
+# As a number in either YYYYMMDDHHMMSS, YYMMDDHHMMSS, YYYYMMDD or YYMMDD format
+INSERT INTO t1 VALUES(19830905132800,830905132800,19830906132800,830906132800),(19830907,830907,19830908,830908);
+INSERT INTO t2 VALUES(19830905132800,830905132800,19830906132800,830906132800),(19830907,830907,19830908,830908);
+INSERT INTO t3 VALUES(19830905132800,830905132800,19830906132800,830906132800),(19830907,830907,19830908,830908);
+
+# As the result of a function
+SET TIMESTAMP=1233216687; # 2009-01-29 13:41:27 
+INSERT INTO t1 VALUES(NOW(),CURRENT_DATE,NOW(),CURRENT_DATE);
+INSERT INTO t2 VALUES(NOW(),CURRENT_DATE,NOW(),CURRENT_DATE);
+INSERT INTO t3 VALUES(NOW(),CURRENT_DATE,NOW(),CURRENT_DATE);
+
+# Insert duplicates for parts of the clustered key/unique index
+INSERT INTO t2 VALUES('98-12-31 11:30:45','98@12@30 11^30^45','98-12-31 11:30:45','98.12.31 11+30+45'),('98-12-29','98@12@30 11^30^45','98/12/30 11*30*45','98@12@30 11^30^45');
+INSERT INTO t3 VALUES('98-12-31 11:30:45','98@12@30 11^30^45','98-12-31 11:30:45','98.12.31 11+30+45'),('98-12-29','98@12@30 11^30^45','98/12/30 11*30*45','98@12@30 11^30^45');
+ 
+# Insert permissible NULLs 
+INSERT INTO t1 VALUES('2008-01-01',NULL,'08-01-02','08/01/03'); 
+INSERT INTO t3 VALUES('2008-01-01',NULL,'08-01-02','08/01/03'); 
+
+# Insert duplicate NULLs to unique column
+INSERT INTO t1(c1,c2) VALUES('08/01/17',NULL);
+DELETE FROM t1 WHERE c1='08/01/17' AND c2 IS NULL;
+ 
+# Insert empty string '', would be converted to zero value of the appropriate type 
+INSERT INTO t1 VALUES('','','08-01-04','08/01/05') /* Inserts zero dates for '' strings */;
+
+# Insert invalid dates, would be converted to zero value of the appropriate type
+INSERT INTO t2 VALUES('2008-04-31','2008-04-31','08-01-06','08/01/07') /* Inserts zero dates for invalid dates */;
+INSERT INTO t3 VALUES('10:45:15','10:45:15','08-01-08','08/1/9') /* Inserts zero dates for invalid dates */;
+
+# Insert zero dates
+INSERT INTO t2 VALUES('0000-00-00','08-01-06','08-01-06','08/01/07');
+INSERT INTO t3 VALUES('08-01-06','00-00-00','08-01-08','08/1/9');
+
+--sorted_result
+SELECT * FROM t1;
+--sorted_result
+SELECT * FROM t2;
+--sorted_result
+SELECT * FROM t3;
+
+SELECT * FROM t1 WHERE c1 > '1998-12-31 11:30:45' ORDER BY c1;
+SELECT * FROM t1 WHERE c1 > '1998-12-31 11:30:45' ORDER BY c1 LIMIT 2;
+SELECT * FROM t1 WHERE c1 >= '1998-12-31 11:30:45' ORDER BY c1;
+SELECT * FROM t1 WHERE c1 >= '1998-12-31 11:30:45' ORDER BY c1 LIMIT 2;
+SELECT * FROM t1 WHERE c2 > '1998-12-30 11:30:45' ORDER BY c2;
+SELECT * FROM t1 WHERE c2 > '1998-12-30 11:30:45' ORDER BY c2 LIMIT 2;
+SELECT * FROM t1 WHERE c2 >= '1998-12-30 11:30:45' ORDER BY c2;
+SELECT * FROM t1 WHERE c2 >= '1998-12-30 11:30:45' ORDER BY c2 LIMIT 2;
+SELECT * FROM t2 WHERE c1 > '1998-12-29 00:00:00' ORDER BY c1,c2 LIMIT 2;
+SELECT * FROM t3 WHERE c1 > '1998-12-28 00:00:00' ORDER BY c1,c2 LIMIT 2;
+SELECT * FROM t3 WHERE c1 BETWEEN '1998-12-31 11:30:45' AND '2008-01-06 00:00:00' ORDER BY c1,c2;
+SELECT * FROM t3 WHERE c1 BETWEEN '1998-12-31 11:30:45' AND '2008-01-06 00:00:00' ORDER BY c1,c2 LIMIT 2;
+DROP TABLE t1,t2,t3;
+
+--disable_result_log
+--disable_query_log
+eval set global storage_engine=$default_engine;
+--enable_result_log
+--enable_query_log

=== modified file 'mysys/lf_alloc-pin.c'
--- a/mysys/lf_alloc-pin.c	2009-01-15 21:27:36 +0000
+++ b/mysys/lf_alloc-pin.c	2009-03-31 15:30:19 +0000
@@ -116,7 +116,7 @@ void lf_pinbox_init(LF_PINBOX *pinbox, u
                     lf_pinbox_free_func *free_func, void *free_func_arg)
 {
   DBUG_ASSERT(free_ptr_offset % sizeof(void *) == 0);
-  compile_time_assert(sizeof(LF_PINS) == 128);
+  compile_time_assert(sizeof(LF_PINS) == 64);
   lf_dynarray_init(&pinbox->pinarray, sizeof(LF_PINS));
   pinbox->pinstack_top_ver= 0;
   pinbox->pins_in_array= 0;

=== modified file 'mysys/my_static.c'
--- a/mysys/my_static.c	2009-02-26 13:07:12 +0000
+++ b/mysys/my_static.c	2009-04-01 20:48:42 +0000
@@ -108,6 +108,14 @@ static const char *proc_info_dummy(void 
 const char *(*proc_info_hook)(void *, const char *, const char *, const char *,
                               const unsigned int)= proc_info_dummy;
 
+#if defined(ENABLED_DEBUG_SYNC)
+/**
+  Global pointer to be set if callback function is defined
+  (e.g. in mysqld). See sql/debug_sync.cc.
+*/
+void (*debug_sync_C_callback_ptr)(const char *, size_t);
+#endif /* defined(ENABLED_DEBUG_SYNC) */
+
 #ifdef __WIN__
 /* from my_getsystime.c */
 ulonglong query_performance_frequency, query_performance_offset;

=== modified file 'mysys/tests/testhash.c'
--- a/mysys/tests/testhash.c	2008-04-25 06:32:23 +0000
+++ b/mysys/tests/testhash.c	2009-04-02 09:40:44 +0000
@@ -31,9 +31,9 @@ static uint testflag=0,recant=10000,recl
 static uint16 key1[1000];
 
 #ifdef DBUG_OFF
-#define hash_check(A) 0
+#define my_hash_check(A) 0
 #else
-my_bool hash_check(HASH *hash);
+my_bool my_hash_check(HASH *hash);
 #endif
 
 void free_record(void *record);
@@ -73,7 +73,7 @@ static int do_test()
   bzero((char*) key1,sizeof(key1[0])*1000);
 
   printf("- Creating hash\n");
-  if (hash_init(&hash, default_charset_info, recant/2, 0, 6, 0, free_record, 0))
+  if (my_hash_init(&hash, default_charset_info, recant/2, 0, 6, 0, free_record, 0))
     goto err;
   printf("- Writing records:\n");
 
@@ -91,7 +91,7 @@ static int do_test()
     key_check+=n1;
     write_count++;
   }
-  if (hash_check(&hash))
+  if (my_hash_check(&hash))
   {
     puts("Heap keys crashed");
     goto err;
@@ -103,7 +103,7 @@ static int do_test()
     if (j != 0)
     {
       sprintf(key,"%6d",j);
-      if (!(recpos=hash_search(&hash,key,0)))
+      if (!(recpos=my_hash_search(&hash,key,0)))
       {
 	printf("can't find key1: \"%s\"\n",key);
 	goto err;
@@ -111,20 +111,20 @@ static int do_test()
       key1[atoi(recpos)]--;
       key_check-=atoi(recpos);
       memcpy(oldrecord,recpos,reclength);
-      if (hash_delete(&hash,recpos))
+      if (my_hash_delete(&hash,recpos))
       {
 	printf("error: %d; can't delete record: \"%s\"\n", my_errno,oldrecord);
 	goto err;
       }
       delete++;
-      if (testflag == 2 && hash_check(&hash))
+      if (testflag == 2 && my_hash_check(&hash))
       {
 	puts("Heap keys crashed");
 	goto err;
       }
     }
   }
-  if (hash_check(&hash))
+  if (my_hash_check(&hash))
   {
     puts("Hash keys crashed");
     goto err;
@@ -138,7 +138,7 @@ static int do_test()
     if (j)
     {
       sprintf(key,"%6d",j);
-      if (!(recpos=hash_search(&hash,key,0)))
+      if (!(recpos=my_hash_search(&hash,key,0)))
       {
 	printf("can't find key1: \"%s\"\n",key);
 	goto err;
@@ -148,19 +148,19 @@ static int do_test()
       key1[n1]++;
       sprintf(recpos,"%6d:%4d:%8d:XXX: %4d      ",n1,n2,n3,update);
       update++;
-      if (hash_update(&hash,recpos,key,0))
+      if (my_hash_update(&hash,recpos,key,0))
       {
 	printf("can't update key1: \"%s\"\n",key);
 	goto err;
       }
-      if (testflag == 3 && hash_check(&hash))
+      if (testflag == 3 && my_hash_check(&hash))
       {
 	printf("Heap keys crashed for %d update\n",update);
 	goto err;
       }
     }
   }
-  if (hash_check(&hash))
+  if (my_hash_check(&hash))
   {
     puts("Heap keys crashed");
     goto err;
@@ -175,12 +175,12 @@ static int do_test()
     printf("- Testing identical read\n");
     sprintf(key,"%6d",j);
     pos=1;
-    if (!(recpos= hash_first(&hash, key, 0, &state)))
+    if (!(recpos= my_hash_first(&hash, key, 0, &state)))
     {
       printf("can't find key1: \"%s\"\n",key);
       goto err;
     }
-    while (hash_next(&hash, key, 0, &state) && pos < (ulong) (key1[j]+10))
+    while (my_hash_next(&hash, key, 0, &state) && pos < (ulong) (key1[j]+10))
       pos++;
     if (pos != (ulong) key1[j])
     {
@@ -189,12 +189,12 @@ static int do_test()
     }
   }
   printf("- Creating output heap-file 2\n");
-  if (hash_init(&hash2, default_charset_info, hash.records, 0, 0, hash2_key, free_record,0))
+  if (my_hash_init(&hash2, default_charset_info, hash.records, 0, 0, hash2_key, free_record,0))
     goto err;
 
   printf("- Copying and removing records\n");
   pos=0;
-  while ((recpos=hash_element(&hash,0)))
+  while ((recpos=my_hash_element(&hash,0)))
   {
     record=(uchar*) my_malloc(reclength,MYF(MY_FAE));
     memcpy(record,recpos,reclength);
@@ -206,14 +206,14 @@ static int do_test()
     }
     key_check-=atoi(record);
     write_count++;
-    if (hash_delete(&hash,recpos))
+    if (my_hash_delete(&hash,recpos))
     {
       printf("Got error when deleting record: %*s",reclength,recpos);
       goto err;
     }
     if (testflag==4)
     {
-      if (hash_check(&hash) || hash_check(&hash2))
+      if (my_hash_check(&hash) || my_hash_check(&hash2))
       {
 	puts("Hash keys crashed");
 	goto err;
@@ -221,7 +221,7 @@ static int do_test()
     }
     pos++;
   }
-  if (hash_check(&hash) || hash_check(&hash2))
+  if (my_hash_check(&hash) || my_hash_check(&hash2))
   {
     puts("Hash keys crashed");
     goto err;
@@ -234,7 +234,7 @@ static int do_test()
   printf("\nFollowing test have been made:\n");
   printf("Write records: %d\nUpdate records: %d\nDelete records: %d\n", write_count,
 	 update,delete);
-  hash_free(&hash); hash_free(&hash2);
+  my_hash_free(&hash); my_hash_free(&hash2);
   my_end(MY_GIVE_INFO);
   DBUG_RETURN(0);
 err:

=== modified file 'mysys/thr_lock.c'
--- a/mysys/thr_lock.c	2009-02-16 21:18:45 +0000
+++ b/mysys/thr_lock.c	2009-03-11 17:17:00 +0000
@@ -409,15 +409,6 @@ static inline my_bool have_specific_lock
 
 static void wake_up_waiters(THR_LOCK *lock);
 
-#if defined(ENABLED_DEBUG_SYNC)
-/**
-  Global pointer to be set if callback function is defined
-  (e.g. in mysqld). See debug_sync.cc.
-*/
-void (*debug_sync_wait_for_lock_callback_ptr)(void);
-#endif /* defined(ENABLED_DEBUG_SYNC) */
-
-
 static enum enum_thr_lock_result
 wait_for_lock(struct st_lock_list *wait, THR_LOCK_DATA *data,
               my_bool in_wait_list)
@@ -430,14 +421,27 @@ wait_for_lock(struct st_lock_list *wait,
   const char *old_proc_info;
   DBUG_ENTER("wait_for_lock");
 
-#if defined(ENABLED_DEBUG_SYNC)
   /*
     One can use this to signal when a thread is going to wait for a lock.
     See debug_sync.cc.
+
+    Beware of waiting for a signal here. The lock has aquired its mutex.
+    While waiting on a signal here, the locking thread could not aquire
+    the mutex to release the lock. One could lock up the table
+    completely.
+
+    In detail it works so: When thr_lock() tries to acquire a table
+    lock, it locks the lock->mutex, checks if it can have the lock, and
+    if not, it calls wait_for_lock(). Here it unlocks the table lock
+    while waiting on a condition. The sync point is located before this
+    wait for condition. If we have a waiting action here, we hold the
+    the table locks mutex all the time. Any attempt to look at the table
+    lock by another thread blocks it immediately on lock->mutex. This
+    can easily become an unexpected and unobvious blockage. So be
+    warned: Do not request a WAIT_FOR action for the 'wait_for_lock'
+    sync point unless you really know what you do.
   */
-  if (debug_sync_wait_for_lock_callback_ptr)
-    (*debug_sync_wait_for_lock_callback_ptr)();
-#endif /* defined(ENABLED_DEBUG_SYNC) */
+  DEBUG_SYNC_C("wait_for_lock");
 
   if (!in_wait_list)
   {

=== modified file 'sql/debug_sync.cc'
--- a/sql/debug_sync.cc	2009-02-26 11:19:29 +0000
+++ b/sql/debug_sync.cc	2009-04-01 20:48:42 +0000
@@ -377,20 +377,20 @@ struct st_debug_sync_globals
 static st_debug_sync_globals debug_sync_global; /* All globals in one object */
 
 /**
-  Callback pointer from thr_lock.c
+  Callback pointer for C files.
 */
-extern "C" void (*debug_sync_wait_for_lock_callback_ptr)(void);
+extern "C" void (*debug_sync_C_callback_ptr)(const char *, size_t);
 
 
 /**
-  Callback from wait_for_lock() for debug sync. See thr_lock.c.
+  Callback for debug sync, to be used by C files. See thr_lock.c for example.
 
   @description
-    One can use this to signal when a thread is going to wait for a lock.
 
-    We cannot place a sync point directly in thr_lock.c. It is C code
-    and does not include mysql_priv.h. So it does not know the macro
-    DEBUG_SYNC(thd, sync_point_name). The macro needs a 'thd' argument.
+    We cannot place a sync point directly in C files (like those in mysys or
+    certain storage engines written mostly in C like MyISAM or Maria). Because
+    they are C code and do not include mysql_priv.h. So they do not know the
+    macro DEBUG_SYNC(thd, sync_point_name). The macro needs a 'thd' argument.
     Hence it cannot be used in files outside of the sql/ directory.
 
     The workaround is to call back simple functions like this one from
@@ -409,30 +409,15 @@ extern "C" void (*debug_sync_wait_for_lo
     of the MySQL server anyway.
 
   @note
-    Beware of waiting for a signal here. The lock has aquired its mutex.
-    While waiting on a signal here, the locking thread could not aquire
-    the mutex to release the lock. One could lock up the table
-    completely.
-
-    In detail it works so: When thr_lock() tries to acquire a table
-    lock, it locks the lock->mutex, checks if it can have the lock, and
-    if not, it calls wait_for_lock(). Here it unlocks the table lock
-    while waiting on a condition. The sync point is located before this
-    wait for condition. If we have a waiting action here, we hold the
-    the table locks mutex all the time. Any attempt to look at the table
-    lock by another thread blocks it immediately on lock->mutex. This
-    can easily become an unexpected and unobvious blockage. So be
-    warned: Do not request a WAIT_FOR action for the 'wait_for_lock'
-    sync point unless you really know what you do.
-
-  @note
-    The callback pointer in thr_lock.c is set only if debug sync is
+    The callback pointer in C files is set only if debug sync is
     initialized. And this is done only if opt_debug_sync_timeout is set.
 */
 
-static void debug_sync_wait_for_lock_callback(void)
+static void debug_sync_C_callback(const char *sync_point_name,
+                                  size_t name_len)
 {
-  DEBUG_SYNC(current_thd, "wait_for_lock");
+  if (unlikely(opt_debug_sync_timeout))                            
+    debug_sync(current_thd, sync_point_name, name_len);   
 }
 
 
@@ -459,9 +444,8 @@ int debug_sync_init(void)
                                 MY_MUTEX_INIT_FAST)))
       DBUG_RETURN(rc);
 
-    /* Set the call back pointer in thr_lock.c. */
-    debug_sync_wait_for_lock_callback_ptr=
-      debug_sync_wait_for_lock_callback;
+    /* Set the call back pointer in C files. */
+    debug_sync_C_callback_ptr= debug_sync_C_callback;
   }
 
   DBUG_RETURN(0);
@@ -480,10 +464,10 @@ void debug_sync_end(void)
   DBUG_ENTER("debug_sync_end");
 
   /* End the facility only if it had been initialized. */
-  if (debug_sync_wait_for_lock_callback_ptr)
+  if (debug_sync_C_callback_ptr)
   {
-    /* Clear the call back pointer in thr_lock.c. */
-    debug_sync_wait_for_lock_callback_ptr= NULL;
+    /* Clear the call back pointer in C files. */
+    debug_sync_C_callback_ptr= NULL;
 
     /* Destroy the global variables. */
     debug_sync_global.ds_signal.free();

=== modified file 'sql/log.cc'
--- a/sql/log.cc	2009-03-23 12:46:20 +0000
+++ b/sql/log.cc	2009-04-01 21:36:07 +0000
@@ -4803,7 +4803,7 @@ int MYSQL_BIN_LOG::purge_first_log(Relay
   /* Store where we are in the new file for the execution thread */
   flush_relay_log_info(rli);
 
-  DBUG_EXECUTE_IF("crash_before_purge_logs", abort(););
+  DBUG_EXECUTE_IF("crash_before_purge_logs", DBUG_ABORT(););
 
   pthread_mutex_lock(&rli->log_space_lock);
   rli->relay_log.purge_logs(to_purge_if_included, included,
@@ -4957,7 +4957,7 @@ int MYSQL_BIN_LOG::purge_logs(const char
     goto err;
   }
 
-  DBUG_EXECUTE_IF("crash_after_update_index", abort(););
+  DBUG_EXECUTE_IF("crash_after_update_index", DBUG_ABORT(););
 
   /* Switch purge_temp for read. */
   if ((error=reinit_io_cache(&purge_temp, READ_CACHE, 0, 0, 0)))

=== modified file 'storage/maria/ha_maria.cc'
--- a/storage/maria/ha_maria.cc	2009-02-16 21:18:45 +0000
+++ b/storage/maria/ha_maria.cc	2009-04-01 21:36:07 +0000
@@ -2105,6 +2105,10 @@ int ha_maria::extra(enum ha_extra_functi
 {
   if ((specialflag & SPECIAL_SAFE_MODE) && operation == HA_EXTRA_KEYREAD)
     return 0;
+#ifdef NOT_USED
+  if (operation == HA_EXTRA_MMAP && !opt_maria_use_mmap)
+    return 0;
+#endif
 
   /*
     We have to set file->trn here because in some cases we call

=== modified file 'storage/maria/ma_examine_non_trans_log.c'
--- a/storage/maria/ma_examine_non_trans_log.c	2009-02-10 14:51:40 +0000
+++ b/storage/maria/ma_examine_non_trans_log.c	2009-04-01 20:48:42 +0000
@@ -83,6 +83,20 @@ struct st_access_param
 
 #define NO_FILEPOS HA_OFFSET_ERROR
 
+/*
+  Error injection. Built on DBUG.
+  This is similar to error injection in the server.
+  In case that one becomes globally available, we undefine it first.
+*/
+#ifdef ERROR_INJECT
+#undef ERROR_INJECT
+#endif
+#define ERROR_INJECT(_keyword_, _action_) \
+  DBUG_EXECUTE_IF((_keyword_), fflush(stdout); \
+                  fprintf(stderr, "ERROR_INJECT(\"%s\")\n", (_keyword_)); \
+                  fflush(stderr); DBUG_PRINT("maria_non_trans_log", \
+                  ("ERROR_INJECT(\"%s\")\n", (_keyword_))); _action_)
+
 void ma_examine_log_param_init(MA_EXAMINE_LOG_PARAM *param);
 int ma_examine_log(MA_EXAMINE_LOG_PARAM *param);
 static int read_string(IO_CACHE *file,uchar* *to,uint length);
@@ -93,7 +107,7 @@ static int test_when_accessed(struct fil
 			      struct st_access_param *access_param);
 static void file_info_free(struct file_info *info);
 static int close_some_file(TREE *tree);
-static int reopen_closed_file(TREE *tree,struct file_info *file_info);
+static int reopen_closed_file(struct file_info *file_info);
 static int mi_close_care_state(MARIA_HA *info);
 static void printf_log(uint verbose, ulong isamlog_process,
                        my_off_t isamlog_filepos, const char *format,...);
@@ -136,7 +150,7 @@ int ma_examine_log(MA_EXAMINE_LOG_PARAM 
   my_off_t filepos;
   char isam_file_name[FN_REFLEN], llbuff[21];
   uchar head[20], *head_ptr;
-  uchar	*buff;
+  uchar	*buff= NULL;
   struct test_if_open_param open_param;
   IO_CACHE cache;
   File log_file;
@@ -147,6 +161,10 @@ int ma_examine_log(MA_EXAMINE_LOG_PARAM 
     { { 11, 14 }, { 11, 14 }, { 9, 16 }, { 9, 16 }, { 7, 12 }, { 7, 12 } };
   uint has_pid_and_result[]= {1, 1, 0, 0, 0, 0};
   DBUG_ENTER("ma_examine_log");
+  DBUG_PRINT("maria_non_trans_log", ("max_files: %u  update: %u",
+                           mi_exl->max_files, mi_exl->update));
+  ERROR_INJECT("ma_examine_log_files0", mi_exl->max_files= 0;);
+  ERROR_INJECT("ma_examine_log_files1", mi_exl->max_files= 1;);
 
   compile_time_assert((sizeof(ma_log_command_name) /
                        sizeof(ma_log_command_name[0]) ==
@@ -176,6 +194,14 @@ int ma_examine_log(MA_EXAMINE_LOG_PARAM 
   init_tree(&tree,0,0,sizeof(file_info),(qsort_cmp2) file_info_compare,1,
 	    (tree_element_free) file_info_free, NULL);
 
+  /*
+    Initialize members of file_info that are used for pointing to
+    allocated memory. At the error labels we want to be able to free it.
+  */
+  file_info.name= NULL;
+  file_info.show_name= NULL;
+  file_info.record= NULL;
+
   files_open=0; access_time=0;
   while (access_time++ != mi_exl->number_of_commands &&
 	 !my_b_read(&cache, head, 1))
@@ -184,6 +210,19 @@ int ma_examine_log(MA_EXAMINE_LOG_PARAM 
     head_ptr= head;
     command=(uint) head_ptr[0];
     command-= (big_numbers= (command & MA_LOG_BIG_NUMBERS));
+    /*
+      'command' is a number that is used to index arrays. Better check
+      it for range.
+    */
+    ERROR_INJECT("ma_examine_log_command", command= MA_LOG_END_SENTINEL;);
+    if (command >= MA_LOG_END_SENTINEL)
+    {
+      fflush(stdout);
+      fprintf(stderr,"Unknown command %u in logfile at position %s\n",
+              command, llstr(isamlog_filepos, llbuff));
+      fflush(stderr);
+      goto end;
+    }
     if (big_numbers != 0)
       big_numbers= 1;
     if (my_b_read(&cache, head, head_len[command][big_numbers] - 1))
@@ -209,24 +248,68 @@ int ma_examine_log(MA_EXAMINE_LOG_PARAM 
     }
     else
       isamlog_process= file_info.process= result= 0;
+
+    /*
+      Try to find the file with file_info.process and file_info.filenr
+      in the file tree. The search function, as registered with
+      init_tree() is file_info_compare(). If the file does not exist in
+      the tree, most commands will be ignored for this file.
+    */
     if ((curr_file_info=(struct file_info*) tree_search(&tree, &file_info,
 							tree.custom_arg)))
     {
       curr_file_info->accessed=access_time;
-      if (mi_exl->update && curr_file_info->used && curr_file_info->closed)
+      /*
+        If the file has been closed due to lack of file descriptors,
+        re-open it to execute the command.
+        No need to re-open for the MA_LOG_CLOSE command.
+      */
+      if (mi_exl->update && curr_file_info->used && curr_file_info->closed &&
+          (command != MA_LOG_CLOSE))
       {
-	if (reopen_closed_file(&tree,curr_file_info))
-	{
-	  command=sizeof(mi_exl->com_count)/sizeof(mi_exl->com_count[0][0])/3;
-	  result=0;
-	  goto com_err;
-	}
+        /*
+          We found a closed file. It can only be closed due to a lack
+          of file descriptors. When a file is explicitly closed, its
+          information is removed from the tree and freed.
+          But this does not mean that there are still open files in
+          the tree. All other files could have been explicitly closed
+          meanwhile. So close a file only if there is still a lack of
+          file descriptors.
+        */
+        if (files_open >= mi_exl->max_files)
+        {
+          ERROR_INJECT("ma_examine_log_close_extra",
+                       close_some_file(&tree); my_errno= -1;);
+          if (close_some_file(&tree))
+          {
+            DBUG_PRINT("maria_non_trans_log", ("failed to close some file"));
+            goto com_err; /* No file to close */
+          }
+          files_open--;
+        }
+        if (reopen_closed_file(curr_file_info))
+        {
+          DBUG_PRINT("maria_non_trans_log", ("failed to reopen closed file"));
+          command=sizeof(mi_exl->com_count)/sizeof(mi_exl->com_count[0][0])/3;
+          result=0;
+          goto com_err;
+        }
+        files_open++;
         mi_exl->re_open_count++;
       }
     }
-    DBUG_PRINT("info",("command: %u curr_file_info: 0x%lx used: %u",
-                       command, (ulong)curr_file_info,
-                       curr_file_info ? curr_file_info->used : 0));
+    if (!curr_file_info)
+      DBUG_PRINT("maria_non_trans_log",
+                 ("command: %u '%s'  info: 0x0",
+                  command, ma_log_command_name[command]));
+    else
+      DBUG_PRINT("maria_non_trans_log",
+                 ("command: %u '%s'  info: 0x%lx  proc: %ld  "
+                  "fno: %d  file: '%s'  used: %d  closed: %d",
+                  command, ma_log_command_name[command],
+                  (ulong) curr_file_info, curr_file_info->process,
+                  curr_file_info->filenr, curr_file_info->name,
+                  curr_file_info->used, curr_file_info->closed));
     /*
       We update our statistic (how many commands issued, per command type),
       if this is a valid command about a file we want to include.
@@ -249,9 +332,14 @@ int ma_examine_log(MA_EXAMINE_LOG_PARAM 
 	printf("\nWarning: %s is opened with same process and filenumber\n"
                "Maybe you should use the -P option ?\n",
 	       curr_file_info->show_name);
-      file_info.name=0;
-      file_info.show_name=0;
-      file_info.record=0;
+      /*
+        These file_info members should be non-null only during an open
+        operation. Initially and after open they should be nulled.
+        That way we can free them in case of a jump to an error label.
+      */
+      DBUG_ASSERT(!file_info.name);
+      DBUG_ASSERT(!file_info.show_name);
+      DBUG_ASSERT(!file_info.record);
       length= big_numbers ? mi_uint4korr(head_ptr) : mi_uint2korr(head_ptr);
       if (read_string(&cache, (uchar **)&file_info.name, length))
 	goto err;
@@ -263,6 +351,7 @@ int ma_examine_log(MA_EXAMINE_LOG_PARAM 
 	for (pos=file_info.name; (pos=strchr(pos,'\\')) ; pos++)
 	  *pos= '/';
 
+        DBUG_PRINT("maria_non_trans_log", ("prefix_remove: %u", mi_exl->prefix_remove));
 	pos=file_info.name;
 	for (i=0 ; i < mi_exl->prefix_remove ; i++)
 	{
@@ -271,10 +360,18 @@ int ma_examine_log(MA_EXAMINE_LOG_PARAM 
 	    break;
 	  pos=next+1;
 	}
+        DBUG_PRINT("maria_non_trans_log", ("pos: '%s'", pos));
+        DBUG_PRINT("maria_non_trans_log", ("filepath: '%s'", mi_exl->filepath));
 	to=isam_file_name;
-	if (mi_exl->filepath)
+        /* Include filepath if pos is not an absolute path. */
+	if (mi_exl->filepath &&
+#ifdef FN_DEVCHAR
+            !strrchr(pos, FN_DEVCHAR) &&
+#endif
+            (*pos != '/'))
 	  to=convert_dirname(isam_file_name,mi_exl->filepath,NullS);
 	strmov(to,pos);
+        DBUG_PRINT("maria_non_trans_log", ("isam_file_name: '%s'", isam_file_name));
 	fn_ext(isam_file_name)[0]=0;	/* Remove extension */
       }
       open_param.name=file_info.name;
@@ -321,7 +418,12 @@ int ma_examine_log(MA_EXAMINE_LOG_PARAM 
 	files_open++;
 	file_info.closed=0;
       }
-      (void) tree_insert(&tree, (uchar*) &file_info, 0, tree.custom_arg);
+      if (!tree_insert(&tree, (uchar*) &file_info, 0, tree.custom_arg))
+      {
+        /* tree_insert() (my_malloc()) should have written an error message. */
+        goto end; /* purecov: inspected */
+      }
+
       if (file_info.used)
       {
 	if (mi_exl->verbose && !mi_exl->record_pos_file)
@@ -332,6 +434,21 @@ int ma_examine_log(MA_EXAMINE_LOG_PARAM 
 	if (result)
 	  mi_exl->com_count[command][1]++;
       }
+
+      DBUG_PRINT("maria_non_trans_logop",
+                 ("open  proc: %ld  fno: %d  file: '%s'  used: %d  closed: %d",
+                  file_info.process, file_info.filenr, file_info.name,
+                  file_info.used, file_info.closed));
+      /*
+        tree_insert() copied file_info (copied pointers). If not
+        NULL-ed, they would not be freed while in use: the my_free() at
+        the end of the program would rather double-free them, because
+        file_info_free() (called via delete_tree()) would already have
+        freed them.
+      */
+      file_info.name= NULL;
+      file_info.show_name= NULL;
+      file_info.record= NULL;
       break;
     case MA_LOG_CLOSE:
       if (mi_exl->verbose && !mi_exl->record_pos_file &&
@@ -342,6 +459,12 @@ int ma_examine_log(MA_EXAMINE_LOG_PARAM 
                    ma_log_command_name[command],result);
       if (curr_file_info)
       {
+        DBUG_PRINT("maria_non_trans_logop",
+                   ("close proc: %ld  fno: %d  file: '%s'  "
+                    "used: %d  closed: %d",
+                    curr_file_info->process,
+                    curr_file_info->filenr, curr_file_info->name,
+                    curr_file_info->used, curr_file_info->closed));
 	if (!curr_file_info->closed)
 	  files_open--;
 	(void) tree_delete(&tree, (uchar*) curr_file_info, 0, tree.custom_arg);
@@ -361,7 +484,6 @@ int ma_examine_log(MA_EXAMINE_LOG_PARAM 
         head_ptr+= 4;
         length= mi_uint2korr(head_ptr);
       }
-      buff=0;
       if (read_string(&cache, &buff, length))
         goto err;
       if ((!mi_exl->record_pos_file ||
@@ -392,6 +514,7 @@ int ma_examine_log(MA_EXAMINE_LOG_PARAM 
           goto com_err;
       }
       my_free(buff,MYF(0));
+      buff= NULL;
       break;
     case MA_LOG_CHSIZE_MAD:
     case MA_LOG_CHSIZE_MAI:
@@ -432,6 +555,8 @@ int ma_examine_log(MA_EXAMINE_LOG_PARAM 
       goto end;
     }
   }
+  DBUG_PRINT("maria_non_trans_log", ("end loop access_time: %lu  cmd_cnt: %lu",
+                           access_time, mi_exl->number_of_commands));
   delete_tree(&tree);
   (void) end_io_cache(&cache);
   (void) my_close(log_file,MYF(0));
@@ -439,23 +564,32 @@ int ma_examine_log(MA_EXAMINE_LOG_PARAM 
     DBUG_RETURN(1);
   DBUG_RETURN(0);
 
+  /* purecov: begin inspected */
  err:
+  DBUG_PRINT("maria_non_trans_log", ("err label"));
   fflush(stdout);
   fprintf(stderr,"Got error %d when reading from logfile\n",my_errno);
   fflush(stderr);
   goto end;
+  /* purecov: end */
  com_err:
+  DBUG_PRINT("maria_non_trans_log", ("com_err label"));
   fflush(stdout);
   fprintf(stderr,"Got error %d, expected %d on command %s at %s\n",
           my_errno,result,ma_log_command_name[command],
           llstr(isamlog_filepos,llbuff));
   fflush(stderr);
  end:
+  DBUG_PRINT("maria_non_trans_log", ("end label"));
   delete_tree(&tree);
   (void) end_io_cache(&cache);
   (void) my_close(log_file,MYF(0));
   if (write_file)
     (void) my_fclose(write_file,MYF(MY_WME));
+  my_free(file_info.name, MYF(MY_ALLOW_ZERO_PTR));
+  my_free(file_info.show_name, MYF(MY_ALLOW_ZERO_PTR));
+  my_free(file_info.record, MYF(MY_ALLOW_ZERO_PTR));
+  my_free(buff, MYF(MY_ALLOW_ZERO_PTR));
   DBUG_RETURN(1);
 }
 
@@ -476,6 +610,7 @@ static int read_string(IO_CACHE *file, r
     DBUG_RETURN(1);
   }
   *((char*) *to+length)= '\0';
+  DBUG_PRINT("maria_non_trans_log", ("string: '%s'", *to));
   DBUG_RETURN (0);
 }				/* read_string */
 
@@ -522,6 +657,8 @@ static int test_when_accessed (struct fi
 static void file_info_free(struct file_info *fileinfo)
 {
   DBUG_ENTER("file_info_free");
+  DBUG_PRINT("maria_non_trans_log", ("freeing info: 0x%lx  file: '%s'",
+                           (long) fileinfo, fileinfo->name));
   /* The 2 conditions below can be true only if 'update' */
   if (!fileinfo->closed)
     (void) mi_close_care_state(fileinfo->isam);
@@ -543,8 +680,12 @@ static int close_some_file(TREE *tree)
 
   (void) tree_walk(tree,(tree_walk_action) test_when_accessed,
                    (void*) &access_param,left_root_right);
+  ERROR_INJECT("close_some_file_none", access_param.found= 0; my_errno= -1;);
   if (!access_param.found)
     return 1;			/* No open file that is possibly to close */
+  DBUG_PRINT("maria_non_trans_log", ("closing info: 0x%lx  file: '%s'",
+                           (long) access_param.found,
+                           access_param.found->name));
   if (mi_close_care_state(access_param.found->isam))
     return 1;
   access_param.found->closed=1;
@@ -552,20 +693,21 @@ static int close_some_file(TREE *tree)
 }
 
 
-static int reopen_closed_file(TREE *tree, struct file_info *fileinfo)
+static int reopen_closed_file(struct file_info *fileinfo)
 {
   char name[FN_REFLEN];
-  if (close_some_file(tree))
-    return 1;				/* No file to close */
+  DBUG_ENTER("reopen_closed_file");
+
   strmov(name,fileinfo->show_name);
   if (fileinfo->id > 1)
     *strrchr(name,'<')='\0';		/* Remove "<id>" */
 
+  ERROR_INJECT("reopen_closed_file_name", strcpy(name, "/non/existent/file"););
   if (!(fileinfo->isam= maria_open(name, O_RDWR,
                                 HA_OPEN_FOR_REPAIR | HA_OPEN_WAIT_IF_LOCKED)))
-    return 1;
+    DBUG_RETURN(1);
   fileinfo->closed=0;
-  return 0;
+  DBUG_RETURN(0);
 }
 
 

=== modified file 'storage/maria/ma_key.c'
--- a/storage/maria/ma_key.c	2009-01-25 16:59:07 +0000
+++ b/storage/maria/ma_key.c	2009-03-13 14:10:43 +0000
@@ -628,6 +628,7 @@ static int _ma_put_key_in_record(registe
   DBUG_RETURN(0);
 
 err:
+  DBUG_PRINT("info",("error"));
   DBUG_RETURN(1);				/* Crashed row */
 } /* _ma_put_key_in_record */
 

=== modified file 'storage/maria/ma_locking.c'
--- a/storage/maria/ma_locking.c	2009-02-13 16:30:54 +0000
+++ b/storage/maria/ma_locking.c	2009-04-01 20:48:42 +0000
@@ -210,7 +210,7 @@ int maria_lock_database(MARIA_HA *info, 
      */
     if( info->owned_by_merge && (info->s)->kfile.file < 0 )
     {
-      error = HA_ERR_NO_SUCH_TABLE;
+      my_errno= error= HA_ERR_NO_SUCH_TABLE;
     }
   }
 #endif

=== modified file 'storage/maria/ma_loghandler.c'
--- a/storage/maria/ma_loghandler.c	2009-02-13 16:30:54 +0000
+++ b/storage/maria/ma_loghandler.c	2009-03-05 21:42:16 +0000
@@ -6150,6 +6150,7 @@ my_bool translog_write_record(LSN *lsn,
     LSN dummy_lsn;
     LEX_CUSTRING log_array[TRANSLOG_INTERNAL_PARTS + 1];
     uchar log_data[6];
+    DBUG_ASSERT(trn->undo_lsn == LSN_IMPOSSIBLE);
     int6store(log_data, trn->trid);
     log_array[TRANSLOG_INTERNAL_PARTS + 0].str=    log_data;
     log_array[TRANSLOG_INTERNAL_PARTS + 0].length= sizeof(log_data);

=== modified file 'storage/maria/ma_non_trans_log.c'
--- a/storage/maria/ma_non_trans_log.c	2009-02-24 09:50:47 +0000
+++ b/storage/maria/ma_non_trans_log.c	2009-04-01 20:48:42 +0000
@@ -248,9 +248,13 @@ void _maria_log_command(IO_CACHE *log, e
   File file= share->kfile.file;
   int old_errno=my_errno, headerlen;
   DBUG_ENTER("_maria_log_command");
-  DBUG_PRINT("enter", ("command: %u share->open_file_name.str '%s'",
-                       command, share->open_file_name.str));
+  DBUG_PRINT("enter", ("command: %u '%s' share->open_file_name.str '%s'"
+                       " buffert: '%.*s'  result: %d",
+                       command, ma_log_command_name[command],
+                       share->open_file_name.str,
+                       length, buffert, result));
   DBUG_ASSERT(command == MA_LOG_OPEN  || command == MA_LOG_CLOSE);
+  DBUG_ASSERT(!share->temporary);
 
   DBUG_ASSERT(((uint)result) <= UINT_MAX16);
   if (file >= UINT_MAX16 || length >= UINT_MAX16)

=== modified file 'storage/maria/ma_recovery.c'
--- a/storage/maria/ma_recovery.c	2009-02-13 16:30:54 +0000
+++ b/storage/maria/ma_recovery.c	2009-03-05 21:42:16 +0000
@@ -2031,7 +2031,8 @@ prototype_redo_exec_hook(DEBUG_INFO)
   data= log_record_buffer.str + 1;
   switch (debug_info) {
   case LOGREC_DEBUG_INFO_QUERY:
-    tprint(tracef, "Query: %s\n", (char*) data);
+    tprint(tracef, "Query: %.*s\n", rec->record_length - 1,
+           (char*) data);
     break;
   default:
     DBUG_ASSERT(0);

=== modified file 'storage/maria/ma_rkey.c'
--- a/storage/maria/ma_rkey.c	2008-09-05 06:10:12 +0000
+++ b/storage/maria/ma_rkey.c	2009-03-13 14:10:43 +0000
@@ -113,7 +113,7 @@ int maria_rkey(MARIA_HA *info, uchar *bu
         not satisfied with an out-of-range condition.
       */
       if ((*share->row_is_visible)(info) && 
-          (icp_res= ma_check_index_cond(info, inx, buf) != 0))
+          ((icp_res= ma_check_index_cond(info, inx, buf)) != 0))
         break;
 
       /* The key references a concurrently inserted record. */
@@ -158,7 +158,7 @@ int maria_rkey(MARIA_HA *info, uchar *bu
         }
 
       } while (!(*share->row_is_visible)(info) || 
-               (icp_res= ma_check_index_cond(info, inx, buf) == 0));
+               ((icp_res= ma_check_index_cond(info, inx, buf)) == 0));
     }
   }
   if (share->lock_key_trees)
@@ -166,6 +166,11 @@ int maria_rkey(MARIA_HA *info, uchar *bu
 
   if (info->cur_row.lastpos == HA_OFFSET_ERROR || (icp_res != 1))
   {
+    if (icp_res == 2)
+    {
+      info->cur_row.lastpos= HA_OFFSET_ERROR;
+      my_errno= HA_ERR_KEY_NOT_FOUND;
+    }
     fast_ma_writeinfo(info);
     goto err;
   }

=== modified file 'storage/maria/ma_test_force_start.pl'
--- a/storage/maria/ma_test_force_start.pl	2008-07-03 21:02:13 +0000
+++ b/storage/maria/ma_test_force_start.pl	2009-03-05 13:46:45 +0000
@@ -42,7 +42,8 @@ my $sql_name= "./var/tmp/create_table.sq
 my $error_log_name= "./var/log/master.err";
 my @cmd_output;
 my $whatever; # garbage data
-my $base_server_cmd= "perl mysql-test-run.pl --mysqld=--maria-force-start-after-recovery-failures=$force_after maria-recover ";
+$ENV{MTR_VERSION} = 1; # MTR2 does not have --start-and-exit
+my $base_server_cmd= "perl mysql-test-run.pl --mysqld=--maria-force-start-after-recovery-failures=$force_after --suite=maria maria.maria-recover ";
 if ($^O =~ /^mswin/i)
   {
     print <<EOF;

=== modified file 'storage/maria/maria_chk.c'
--- a/storage/maria/maria_chk.c	2009-01-28 11:08:55 +0000
+++ b/storage/maria/maria_chk.c	2009-04-01 21:36:07 +0000
@@ -429,6 +429,7 @@ static void usage(void)
   -#, --debug=...     Output debug log. Often this is 'd:t:o,filename'.\n");
 #endif
   printf("\
+  -H, --HELP          Display this help and exit.\n\
   -?, --help          Display this help and exit.\n\
   -O, --set-variable var=option.\n\
                       Change the value of a variable. Please note that\n\

=== modified file 'storage/maria/maria_non_trans_log.c'
--- a/storage/maria/maria_non_trans_log.c	2009-01-28 11:08:55 +0000
+++ b/storage/maria/maria_non_trans_log.c	2009-04-01 20:48:42 +0000
@@ -64,8 +64,14 @@ int main(int argc, char **argv)
     mi_exl.table_selection_hook= matches_list_of_tables;
   }
 
-  /* Number of Maria files we can have open at one time */
-  mi_exl.max_files= (my_set_max_open_files(max(mi_exl.max_files,8))-6)/2;
+  /*
+    Despite its name, max_files is not the number of Maria files we can
+    have open at one time, but the number of Maria tables. Some
+    operating systems do not increase the limit above the input argument
+    of my_set_max_open_files(). So don't start too low.
+  */
+  mi_exl.max_files=
+    (my_set_max_open_files(max(mi_exl.max_files * 2, MY_NFILE)) - 6) / 2;
 
   /*
     Program must work in all conditions: support symbolic links.
@@ -86,6 +92,7 @@ int main(int argc, char **argv)
   }
 
   error= ma_examine_log(&mi_exl);
+  DBUG_PRINT("maria_non_trans_log", ("error from ma_examine_log: %d", error));
 
   if (mi_exl.update && ! error)
     puts("Tables updated successfully");
@@ -267,6 +274,17 @@ static void get_options(register int *ar
 #include <help_end.h>
 	break;
       default:
+        if (*pos == '-')
+        {
+          /* Long option */
+          if (!strncmp(pos + 1, "debug=", 6))
+          {
+            pos+= 7;
+            DBUG_PUSH(pos);
+            pos= " "; /* Skip rest of arg */
+            break;
+          }
+        }
 	printf("illegal option: \"-%c\"\n",*pos);
 	break;
       }
@@ -286,8 +304,8 @@ static void get_options(register int *ar
   }
   return;
  err:
-  (void) fprintf(stderr,"option \"%c\" used without or with wrong argument\n",
-	       option);
+  fflush(stdout);
+  fprintf(stderr,"option \"%c\" used without or with wrong argument\n", option);
   exit(1);
 }
 

=== modified file 'storage/maria/trnman.c'
--- a/storage/maria/trnman.c	2009-01-16 16:18:17 +0000
+++ b/storage/maria/trnman.c	2009-03-05 13:46:45 +0000
@@ -712,11 +712,6 @@ my_bool trnman_collect_transactions(LEX_
   ptr+= TRANSID_SIZE;
   for (trn= active_list_min.next; trn != &active_list_max; trn= trn->next)
   {
-    /*
-      trns with a short trid of 0 are not even initialized, we can ignore
-      them. trns with undo_lsn==0 have done no writes, we can ignore them
-      too. XID not needed now.
-    */
     uint sid;
     LSN rec_lsn, undo_lsn, first_undo_lsn;
     pthread_mutex_lock(&trn->state_lock);
@@ -732,16 +727,24 @@ my_bool trnman_collect_transactions(LEX_
       */
       continue;
     }
-      /* needed for low-water mark calculation */
+    /* needed for low-water mark calculation */
     if (((rec_lsn= lsn_read_non_atomic(trn->rec_lsn)) > 0) &&
         (cmp_translog_addr(rec_lsn, minimum_rec_lsn) < 0))
       minimum_rec_lsn= rec_lsn;
     /*
-      trn may have logged REDOs but not yet UNDO, that's why we read rec_lsn
-      before deciding to ignore if undo_lsn==0.
+      If trn has not logged LOGREC_LONG_TRANSACTION_ID, this trn will be
+      discovered when seeing that log record which is for sure located after
+      checkpoint_start_log_horizon.
     */
-    if  ((undo_lsn= trn->undo_lsn) == 0) /* trn can be forgotten */
+    if ((LSN_WITH_FLAGS_TO_FLAGS(trn->first_undo_lsn) &
+         TRANSACTION_LOGGED_LONG_ID) == 0)
       continue;
+    /*
+      On the other hand, if undo_lsn is LSN_IMPOSSIBLE, trn may later log
+      records; so we must include trn in the checkpoint now, because we cannot
+      count on LOGREC_LONG_TRANSACTION_ID (as we are already past it).
+    */
+    undo_lsn= trn->undo_lsn;
     stored_transactions++;
     int2store(ptr, sid);
     ptr+= 2;

=== modified file 'unittest/mysys/CMakeLists.txt'
--- a/unittest/mysys/CMakeLists.txt	2008-11-12 01:37:42 +0000
+++ b/unittest/mysys/CMakeLists.txt	2009-03-11 17:20:26 +0000
@@ -26,3 +26,9 @@ TARGET_LINK_LIBRARIES(base64-t mytap mys
 
 ADD_EXECUTABLE(my_atomic-t my_atomic-t.c)
 TARGET_LINK_LIBRARIES(my_atomic-t mytap mysys dbug strings)
+
+ADD_EXECUTABLE(lf-t lf-t.c)
+TARGET_LINK_LIBRARIES(lf-t mytap mysys dbug strings)
+
+ADD_EXECUTABLE(waiting_threads-t waiting_threads-t.c)
+TARGET_LINK_LIBRARIES(waiting_threads-t mytap mysys dbug strings)

=== modified file 'unittest/mysys/waiting_threads-t.c'
--- a/unittest/mysys/waiting_threads-t.c	2009-02-12 10:06:03 +0000
+++ b/unittest/mysys/waiting_threads-t.c	2009-04-02 09:40:44 +0000
@@ -181,7 +181,7 @@ void do_one_test()
 void do_tests()
 {
   DBUG_ENTER("do_tests");
-  plan(14);
+  plan(12);
   compile_time_assert(THREADS >= 4);
 
   DBUG_PRINT("wt", ("================= initialization ==================="));
@@ -257,15 +257,20 @@ void do_tests()
 #define test_kill_strategy(X)                   \
   diag("kill strategy: " #X);                   \
   DBUG_EXECUTE("reset_file",                    \
-               { rewind(DBUG_FILE); ftruncate(fileno(DBUG_FILE), 0); }); \
+               { rewind(DBUG_FILE); my_chsize(fileno(DBUG_FILE), 0, 0, MYF(0)); }); \
   DBUG_PRINT("info", ("kill strategy: " #X));   \
   kill_strategy=X;                              \
   do_one_test();
 
   test_kill_strategy(LATEST);
   test_kill_strategy(RANDOM);
-  test_kill_strategy(YOUNGEST);
-  test_kill_strategy(LOCKS);
+  /*
+    these two take looong time on sol10-amd64-a
+    the server doesn't use this code now, so we disable these tests
+
+    test_kill_strategy(YOUNGEST);
+    test_kill_strategy(LOCKS);
+  */
 
   DBUG_PRINT("wt", ("================= cleanup ==================="));
   for (cnt=0; cnt < THREADS; cnt++)


Attachment: [text/bzr-bundle] bzr/guilhem@mysql.com-20090402210815-lu17n4kj8c73cfe8.bundle
Thread
bzr push into mysql-6.0 branch (alik:2734)Alexander Nozdrin3 Apr