List:Commits« Previous MessageNext Message »
From:Vladislav Vaintroub Date:August 22 2008 11:42am
Subject:bzr push into mysql-6.0 branch (vvaintroub:2779)
View as plain text  
 2779 Vladislav Vaintroub	2008-08-21 [merge]
      merge 6.0->6.0-falcon
added:
  mysql-test/r/subselect_nulls.result
  mysql-test/t/subselect_nulls.test
modified:
  .bzr-mysql/default.conf
  configure.in
  mysql-test/r/constraints.result
  mysql-test/r/sp-error.result
  mysql-test/r/subselect.result
  mysql-test/r/subselect_no_mat.result
  mysql-test/r/subselect_no_opts.result
  mysql-test/r/subselect_no_semijoin.result
  mysql-test/r/subselect_sj.result
  mysql-test/r/subselect_sj2.result
  mysql-test/t/constraints.test
  mysql-test/t/disabled.def
  mysql-test/t/sp-error.test
  mysql-test/t/subselect.test
  mysql-test/t/subselect_sj.test
  mysql-test/t/subselect_sj2.test
  sql/handler.cc
  sql/handler.h
  sql/mysql_priv.h
  sql/mysqld.cc
  sql/sp_pcontext.cc
  sql/sql_select.cc
  sql/sql_select.h
  sql/sql_yacc.yy
  sql/structs.h

=== modified file '.bzr-mysql/default.conf'
--- a/.bzr-mysql/default.conf	2008-08-16 15:22:47 +0000
+++ b/.bzr-mysql/default.conf	2008-08-21 08:18:48 +0000
@@ -1,5 +1,5 @@
 [MYSQL]
-tree_location = bzr+ssh://bk-internal.mysql.com/bzrroot/server/mysql-6.0-opt/
+tree_location = bzr+ssh://bk-internal.mysql.com/bzrroot/server/mysql-6.0
 post_commit_to = commits@stripped
 post_push_to = commits@stripped
-tree_name = "mysql-6.0-opt"
+tree_name = mysql-6.0

=== modified file 'configure.in'
--- a/configure.in	2008-08-20 10:34:46 +0000
+++ b/configure.in	2008-08-21 08:18:48 +0000
@@ -846,6 +846,7 @@ AC_CHECK_HEADERS(fcntl.h fenv.h float.h 
  execinfo.h)
 
 AC_CHECK_HEADERS([xfs/xfs.h])
+AC_CHECK_HEADERS([valgrind/memcheck.h])
 
 #--------------------------------------------------------------------
 # Check for system libraries. Adds the library to $LIBS

=== renamed file 'mysql-test/suite/falcon_team/r/falcon_bug_22165.result' =>
'mysql-test/suite/falcon/r/falcon_bug_22165.result'
--- a/mysql-test/suite/falcon_team/r/falcon_bug_22165.result	2008-08-04 09:21:20 +0000
+++ b/mysql-test/suite/falcon/r/falcon_bug_22165.result	2008-08-04 15:53:52 +0000
@@ -1,11 +1,8 @@
 *** Bug #22165 ***
 SET @@storage_engine = 'Falcon';
-DROP PROCEDURE IF EXISTS db1.p1;
-DROP EVENT IF EXISTS db1.e1;
-DROP EVENT IF EXISTS db1.e2;
-DROP DATABASE IF EXISTS db1;
-CREATE DATABASE db1;
-USE db1;
+DROP TABLE IF EXISTS t1;
+DROP PROCEDURE IF EXISTS p1;
+CREATE TABLE t1 (a bigint, b varchar(1000), c timestamp);
 CREATE PROCEDURE p1 ()
 begin
 declare v int default 0;
@@ -23,13 +20,5 @@ COMMIT;
 SET v = v + 1;
 end while;
 end//
-CREATE TABLE t1 (a bigint, b varchar(1000), c timestamp);
-CREATE EVENT e1 ON SCHEDULE EVERY 1 second DO CALL db1.p1();
-CREATE EVENT e2 ON SCHEDULE EVERY 1 second DO CALL db1.p1();
-SET GLOBAL event_scheduler = 1;
-SET GLOBAL event_scheduler = 0;
-USE test;
-DROP EVENT db1.e1;
-DROP EVENT db1.e2;
-DROP PROCEDURE db1.p1;
-DROP DATABASE db1;
+DROP PROCEDURE p1;
+DROP TABLE t1;

=== renamed file 'mysql-test/suite/falcon_team/r/falcon_bug_22173.result' =>
'mysql-test/suite/falcon/r/falcon_bug_22173.result'
=== renamed file 'mysql-test/suite/falcon_team/r/falcon_bug_22173a.result' =>
'mysql-test/suite/falcon/r/falcon_bug_22173a.result'
--- a/mysql-test/suite/falcon_team/r/falcon_bug_22173a.result	2008-04-20 08:30:43 +0000
+++ b/mysql-test/suite/falcon/r/falcon_bug_22173a.result	2008-08-04 15:53:52 +0000
@@ -12,6 +12,7 @@ begin declare v1 int default 0;
 declare v2 int;
 declare continue handler for 1020 begin end;
 declare continue handler for 1213 begin end;
+declare continue handler for 1015 begin end;
 while v1 < 2500 do
 /* SELECT 'insert', v1; */
 INSERT INTO t1 VALUES (v1);

=== modified file 'mysql-test/suite/falcon/r/falcon_options.result'
--- a/mysql-test/suite/falcon/r/falcon_options.result	2008-07-17 13:52:17 +0000
+++ b/mysql-test/suite/falcon/r/falcon_options.result	2008-08-14 11:24:18 +0000
@@ -1,4 +1,4 @@
-SHOW VARIABLES LIKE 'falcon_%';
+SHOW VARIABLES where variable_name LIKE 'falcon_%' and variable_name
<>'falcon_serial_log_dir';
 Variable_name	Value
 falcon_checkpoint_schedule	7 * * * * *
 falcon_checksums	ON
@@ -21,7 +21,6 @@ falcon_record_scavenge_threshold	67
 falcon_scavenge_schedule	15,45 * * * * *
 falcon_serial_log_block_size	0
 falcon_serial_log_buffers	20
-falcon_serial_log_dir	
 falcon_serial_log_file_size	10485760
 falcon_serial_log_priority	1
 falcon_support_xa	OFF
@@ -33,9 +32,6 @@ SELECT @@GLOBAL.falcon_debug_server;
 0
 SET GLOBAL falcon_debug_server = TRUE;
 ERROR HY000: Variable 'falcon_debug_server' is a read only variable
-SELECT @@GLOBAL.falcon_serial_log_dir;
-@@GLOBAL.falcon_serial_log_dir
-NULL
 SET GLOBAL falcon_serial_log_dir = '/foo';
 ERROR HY000: Variable 'falcon_serial_log_dir' is a read only variable
 SELECT @@GLOBAL.falcon_page_cache_size;
@@ -80,7 +76,7 @@ SELECT @@GLOBAL.falcon_record_chill_thre
 @@GLOBAL.falcon_record_chill_threshold
 1073741824
 SELECT * FROM INFORMATION_SCHEMA.global_variables
-WHERE variable_name LIKE 'falcon%';
+WHERE variable_name LIKE 'falcon%' and variable_name <> 'falcon_serial_log_dir';
 VARIABLE_NAME	VARIABLE_VALUE
 FALCON_CHECKPOINT_SCHEDULE	7 * * * * *
 FALCON_CHECKSUMS	ON
@@ -103,7 +99,6 @@ FALCON_RECORD_SCAVENGE_THRESHOLD	67
 FALCON_SCAVENGE_SCHEDULE	15,45 * * * * *
 FALCON_SERIAL_LOG_BLOCK_SIZE	0
 FALCON_SERIAL_LOG_BUFFERS	20
-FALCON_SERIAL_LOG_DIR	
 FALCON_SERIAL_LOG_FILE_SIZE	10485760
 FALCON_SERIAL_LOG_PRIORITY	1
 FALCON_SUPPORT_XA	OFF

=== modified file 'mysql-test/suite/falcon/r/falcon_options2.result'
--- a/mysql-test/suite/falcon/r/falcon_options2.result	2008-07-17 13:52:17 +0000
+++ b/mysql-test/suite/falcon/r/falcon_options2.result	2008-08-14 11:24:18 +0000
@@ -1,5 +1,5 @@
 SELECT * FROM INFORMATION_SCHEMA.global_variables
-WHERE variable_name LiKE 'falcon_%';
+WHERE variable_name LiKE 'falcon_%' AND variable_name <> 'falcon_serial_log_dir';
 VARIABLE_NAME	VARIABLE_VALUE
 FALCON_CHECKPOINT_SCHEDULE	7 * * * * *
 FALCON_CHECKSUMS	ON
@@ -22,7 +22,6 @@ FALCON_RECORD_SCAVENGE_THRESHOLD	67
 FALCON_SCAVENGE_SCHEDULE	15,45 * * * * *
 FALCON_SERIAL_LOG_BLOCK_SIZE	0
 FALCON_SERIAL_LOG_BUFFERS	20
-FALCON_SERIAL_LOG_DIR	
 FALCON_SERIAL_LOG_FILE_SIZE	10485760
 FALCON_SERIAL_LOG_PRIORITY	1
 FALCON_SUPPORT_XA	OFF
@@ -89,9 +88,6 @@ SELECT @@falcon_serial_log_block_size;
 SELECT @@falcon_serial_log_buffers;
 @@falcon_serial_log_buffers
 20
-SELECT @@falcon_serial_log_dir;
-@@falcon_serial_log_dir
-NULL
 SELECT @@falcon_serial_log_priority;
 @@falcon_serial_log_priority
 1

=== renamed file 'mysql-test/suite/falcon_team/t/falcon_bug_22165.test' =>
'mysql-test/suite/falcon/t/falcon_bug_22165.test'
--- a/mysql-test/suite/falcon_team/t/falcon_bug_22165.test	2008-07-22 13:19:24 +0000
+++ b/mysql-test/suite/falcon/t/falcon_bug_22165.test	2008-08-04 15:53:52 +0000
@@ -11,14 +11,11 @@ let $engine = 'Falcon';
 eval SET @@storage_engine = $engine;
 
 --disable_warnings
-DROP PROCEDURE IF EXISTS db1.p1;
-DROP EVENT IF EXISTS db1.e1;
-DROP EVENT IF EXISTS db1.e2;
-DROP DATABASE IF EXISTS db1;
+DROP TABLE IF EXISTS t1;
+DROP PROCEDURE IF EXISTS p1;
 --enable_warnings
+CREATE TABLE t1 (a bigint, b varchar(1000), c timestamp);
 
-CREATE DATABASE db1;
-USE db1;
 delimiter //;
 CREATE PROCEDURE p1 ()
 begin
@@ -39,18 +36,31 @@ begin
 end//
 delimiter ;//
 
-CREATE TABLE t1 (a bigint, b varchar(1000), c timestamp);
+connect (conn1,localhost,root,,);
+connect (conn2,localhost,root,,);
+
 
-CREATE EVENT e1 ON SCHEDULE EVERY 1 second DO CALL db1.p1();
-CREATE EVENT e2 ON SCHEDULE EVERY 1 second DO CALL db1.p1();
 
 # ----------------------------------------------------- #
 # --- Test                                          --- #
 # ----------------------------------------------------- #
-SET GLOBAL event_scheduler = 1;
---sleep 60
-SET GLOBAL event_scheduler = 0;
-
+--disable_query_log
+let $i=150;
+while ($i)
+{
+  connection conn1;
+  --send call p1();
+  connection conn2;
+  --send call p1();
+  
+  connection conn1;
+  --reap
+  connection conn2;
+  --reap
+  
+  dec $i;
+}
+--enable_query_log
 # ----------------------------------------------------- #
 # --- Check                                         --- #
 # ----------------------------------------------------- #
@@ -60,8 +70,9 @@ SET GLOBAL event_scheduler = 0;
 # ----------------------------------------------------- #
 # --- Final cleanup                                 --- #
 # ----------------------------------------------------- #
-USE test;
-DROP EVENT db1.e1;
-DROP EVENT db1.e2;
-DROP PROCEDURE db1.p1;
-DROP DATABASE db1;
+connection default;
+disconnect conn1;
+disconnect conn2;
+DROP PROCEDURE p1;
+DROP TABLE t1;
+

=== renamed file 'mysql-test/suite/falcon_team/t/falcon_bug_22173.test' =>
'mysql-test/suite/falcon/t/falcon_bug_22173.test'
=== renamed file 'mysql-test/suite/falcon_team/t/falcon_bug_22173a.test' =>
'mysql-test/suite/falcon/t/falcon_bug_22173a.test'
--- a/mysql-test/suite/falcon_team/t/falcon_bug_22173a.test	2008-04-20 08:30:43 +0000
+++ b/mysql-test/suite/falcon/t/falcon_bug_22173a.test	2008-08-04 15:53:52 +0000
@@ -31,6 +31,7 @@ begin declare v1 int default 0;
 declare v2 int;
 declare continue handler for 1020 begin end;
 declare continue handler for 1213 begin end;
+declare continue handler for 1015 begin end;
 while v1 < 2500 do
   /* SELECT 'insert', v1; */
   INSERT INTO t1 VALUES (v1);
@@ -52,7 +53,6 @@ delimiter ;//
 
 --echo # Switch to connection conn1
 connection conn1;
---real_sleep 1
 call p1();
 
 --echo # Switch to connection default

=== modified file 'mysql-test/suite/falcon/t/falcon_bug_22179.test'
--- a/mysql-test/suite/falcon/t/falcon_bug_22179.test	2007-09-29 04:30:42 +0000
+++ b/mysql-test/suite/falcon/t/falcon_bug_22179.test	2008-08-12 08:46:11 +0000
@@ -1,4 +1,5 @@
 --source include/have_falcon.inc
+--source include/have_ucs2.inc
 #
 # Bug #22179: UCS2 searches fail if index exists	
 #

=== modified file 'mysql-test/suite/falcon/t/falcon_bug_22845.test'
--- a/mysql-test/suite/falcon/t/falcon_bug_22845.test	2008-01-31 00:07:54 +0000
+++ b/mysql-test/suite/falcon/t/falcon_bug_22845.test	2008-08-12 08:46:11 +0000
@@ -1,4 +1,5 @@
 --source include/have_falcon.inc
+--source include/have_partition.inc
 #
 # Bug #22845: Falcon: hang on partition drop
 #

=== modified file 'mysql-test/suite/falcon/t/falcon_bug_23818_I.test'
--- a/mysql-test/suite/falcon/t/falcon_bug_23818_I.test	2007-09-29 04:30:42 +0000
+++ b/mysql-test/suite/falcon/t/falcon_bug_23818_I.test	2008-08-12 08:46:11 +0000
@@ -1,4 +1,5 @@
 --source include/have_falcon.inc
+--source include/have_ucs2.inc
 SET @@storage_engine = Falcon;
 #
 # Bug #23818 Falcon: crash with random updates of long varchar columns

=== modified file 'mysql-test/suite/falcon/t/falcon_bug_24858.test'
--- a/mysql-test/suite/falcon/t/falcon_bug_24858.test	2007-09-29 04:30:42 +0000
+++ b/mysql-test/suite/falcon/t/falcon_bug_24858.test	2008-08-12 08:46:11 +0000
@@ -1,4 +1,5 @@
 --source include/have_falcon.inc
+--source include/have_ucs2.inc
 SET storage_engine = Falcon;
 #
 # Bug #24858: Falcon: searches fail if partial index on utf8 column

=== modified file 'mysql-test/suite/falcon/t/falcon_bug_33081.test'
--- a/mysql-test/suite/falcon/t/falcon_bug_33081.test	2007-12-10 10:58:37 +0000
+++ b/mysql-test/suite/falcon/t/falcon_bug_33081.test	2008-08-12 08:46:11 +0000
@@ -1,4 +1,5 @@
 --source include/have_falcon.inc
+--source include/have_ucs2.inc
 #
 # Bug #33081: Falcon: crash and database corruption when altering indexed ucs2 column
 #

=== modified file 'mysql-test/suite/falcon/t/falcon_bug_37080.test'
--- a/mysql-test/suite/falcon/t/falcon_bug_37080.test	2008-07-16 17:52:19 +0000
+++ b/mysql-test/suite/falcon/t/falcon_bug_37080.test	2008-08-14 12:08:37 +0000
@@ -1,48 +1,50 @@
---source include/have_falcon.inc
-
-#
-# Bug#37080: Falcon deadlock on parallel TRUNCATE  and INSERT
-#
---echo *** Bug #37080 ***
-
-# ----------------------------------------------------- #
-# --- Initialisation                                --- #
-# ----------------------------------------------------- #
-let $engine = 'Falcon';
-eval SET @@storage_engine = $engine;
-
---disable_warnings
-DROP TABLE IF EXISTS t1;
---enable_warnings
-
-CREATE TABLE t1(a int);
-connect (conn1,localhost,root,,);
-
-# ----------------------------------------------------- #
-# --- Test                                          --- #
-# ----------------------------------------------------- #
-
-let $num=10000;
---disable_query_log
-while ($num)
-{
-   connection conn1;
-   --send insert into t1 values(1), (3), (5), (7) , (11);
-   connection default;
-   --send truncate table t1;
-   connection conn1;
-   --reap
-   connection default;
-   --reap 
-   dec $num;
-}
---enable_query_log
-
-# ----------------------------------------------------- #
-# --- Check                                         --- #
-# ----------------------------------------------------- #
-
-# ----------------------------------------------------- #
-# --- Final cleanup                                 --- #
-# ----------------------------------------------------- #
-DROP TABLE t1;
+--source include/have_falcon.inc
+
+#
+# Bug#37080: Falcon deadlock on parallel TRUNCATE  and INSERT
+#
+--echo *** Bug #37080 ***
+
+# ----------------------------------------------------- #
+# --- Initialisation                                --- #
+# ----------------------------------------------------- #
+let $engine = 'Falcon';
+eval SET @@storage_engine = $engine;
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1(a int);
+connect (conn1,localhost,root,,);
+
+# ----------------------------------------------------- #
+# --- Test                                          --- #
+# ----------------------------------------------------- #
+
+let $num=1000;
+--disable_query_log
+while ($num)
+{
+   connection conn1;
+   --send insert into t1 values(1), (3), (5), (7) , (11);
+   connection default;
+   --send truncate table t1;
+   connection conn1;
+   --error 0,ER_CANT_LOCK
+   --reap
+   connection default;
+   --error 0,ER_CANT_LOCK
+   --reap 
+   dec $num;
+}
+--enable_query_log
+
+# ----------------------------------------------------- #
+# --- Check                                         --- #
+# ----------------------------------------------------- #
+
+# ----------------------------------------------------- #
+# --- Final cleanup                                 --- #
+# ----------------------------------------------------- #
+DROP TABLE t1;

=== modified file 'mysql-test/suite/falcon/t/falcon_bugs2.test'
--- a/mysql-test/suite/falcon/t/falcon_bugs2.test	2007-10-05 12:21:31 +0000
+++ b/mysql-test/suite/falcon/t/falcon_bugs2.test	2008-08-12 08:46:11 +0000
@@ -4,6 +4,7 @@ DROP TABLE IF EXISTS t2;
 --enable_warnings
 
 --source include/have_falcon.inc
+--source include/have_ucs2.inc
 SET storage_engine=falcon;
 
 # Verify that setting storage engine worked

=== modified file 'mysql-test/suite/falcon/t/falcon_options.test'
--- a/mysql-test/suite/falcon/t/falcon_options.test	2008-07-03 11:24:12 +0000
+++ b/mysql-test/suite/falcon/t/falcon_options.test	2008-08-14 11:24:18 +0000
@@ -1,8 +1,6 @@
 --source include/have_falcon.inc
 
-SHOW VARIABLES LIKE 'falcon_%';
-
---real_sleep 1
+SHOW VARIABLES where variable_name LIKE 'falcon_%' and variable_name
<>'falcon_serial_log_dir';
 
 # Test that these server variables are READ ONLY.
 
@@ -10,7 +8,6 @@ SELECT @@GLOBAL.falcon_debug_server;
 --error ER_INCORRECT_GLOBAL_LOCAL_VAR
 SET GLOBAL falcon_debug_server = TRUE;
 
-SELECT @@GLOBAL.falcon_serial_log_dir;
 --error ER_INCORRECT_GLOBAL_LOCAL_VAR
 SET GLOBAL falcon_serial_log_dir = '/foo';
 
@@ -49,7 +46,7 @@ SELECT @@GLOBAL.falcon_record_chill_thre
 # Test INFORMATION_SCHEMA access to variables.
 --sorted_result
 SELECT * FROM INFORMATION_SCHEMA.global_variables
-  WHERE variable_name LIKE 'falcon%';
+  WHERE variable_name LIKE 'falcon%' and variable_name <> 'falcon_serial_log_dir';
 
 # Final cleanup.
 SET GLOBAL falcon_debug_mask = @previous_falcon_debug_mask;

=== modified file 'mysql-test/suite/falcon/t/falcon_options2.test'
--- a/mysql-test/suite/falcon/t/falcon_options2.test	2008-07-17 13:52:17 +0000
+++ b/mysql-test/suite/falcon/t/falcon_options2.test	2008-08-14 11:24:18 +0000
@@ -4,7 +4,7 @@
 
 --sorted_result
 SELECT * FROM INFORMATION_SCHEMA.global_variables
-         WHERE variable_name LiKE 'falcon_%';
+         WHERE variable_name LiKE 'falcon_%' AND variable_name <>
'falcon_serial_log_dir';
 
 SELECT @@falcon_checkpoint_schedule;
 SELECT @@falcon_consistent_read;
@@ -26,7 +26,6 @@ SELECT @@falcon_record_scavenge_threshol
 SELECT @@falcon_scavenge_schedule;
 SELECT @@falcon_serial_log_block_size;
 SELECT @@falcon_serial_log_buffers;
-SELECT @@falcon_serial_log_dir;
 SELECT @@falcon_serial_log_priority;
 SELECT @@falcon_use_deferred_index_hash;
 SELECT @@falcon_use_sectorcache;

=== modified file 'storage/falcon/Database.cpp'
--- a/storage/falcon/Database.cpp	2008-07-17 13:52:17 +0000
+++ b/storage/falcon/Database.cpp	2008-08-11 13:22:53 +0000
@@ -2282,6 +2282,11 @@ bool Database::hasUncommittedRecords(Tab
 	return transactionManager->hasUncommittedRecords(table, transaction);
 }
 
+void Database::waitForWriteComplete(Table *table)
+{
+	transactionManager->waitForWriteComplete(table);
+}
+
 void Database::commitByXid(int xidLength, const UCHAR* xid)
 {
 	serialLog->commitByXid(xidLength, xid);

=== modified file 'storage/falcon/Database.h'
--- a/storage/falcon/Database.h	2008-05-09 19:58:50 +0000
+++ b/storage/falcon/Database.h	2008-08-11 13:22:53 +0000
@@ -200,6 +200,7 @@ public:
 	virtual void	createDatabase (const char *filename);
 	void			renameTable(Table* table, const char* newSchema, const char* newName);
 	bool			hasUncommittedRecords(Table* table, Transaction *transaction);
+	void			waitForWriteComplete(Table *table);
 	void			validateCache(void);
 	int				recoverGetNextLimbo(int xidSize, unsigned char *xid);
 	void			commitByXid(int xidLength, const UCHAR* xid);

=== modified file 'storage/falcon/Dbb.cpp'
--- a/storage/falcon/Dbb.cpp	2008-07-24 08:45:03 +0000
+++ b/storage/falcon/Dbb.cpp	2008-08-07 21:11:55 +0000
@@ -369,6 +369,8 @@ void Dbb::expungeRecord(Section *section
 
 Section* Dbb::findSection(int32 sectionId)
 {
+	ASSERT(sectionId != Section::INVALID_SECTION_ID);
+
 	int slot = sectionId % SECTION_HASH_SIZE;
 	Section *section;
 

=== modified file 'storage/falcon/IO.cpp'
--- a/storage/falcon/IO.cpp	2008-07-24 08:45:03 +0000
+++ b/storage/falcon/IO.cpp	2008-08-14 16:34:43 +0000
@@ -113,6 +113,7 @@ static int simulateDiskFull = SIMULATE_D
 #endif
 	
 static FILE	*traceFile;
+static char baseDir[PATH_MAX+1]={0};
 
 #ifdef _DEBUG
 #undef THIS_FILE
@@ -142,9 +143,42 @@ IO::~IO()
 	closeFile();
 }
 
+static bool isAbsolutePath(const char *name)
+{
+#ifdef _WIN32
+	size_t len = strlen(name);
+	if(len < 2)
+		return false;
+	return (name[0]=='\\' || name[1]==':');
+#else
+	return (name[0]=='/');
+#endif
+}
+
+void IO::setBaseDirectory(const char *directory)
+{
+
+	strncpy(baseDir, directory, PATH_MAX);
+	size_t len = strlen(baseDir);
+	// Append path separator
+	if (baseDir[len-1] != SEPARATOR)
+	{
+		baseDir[len] = SEPARATOR;
+		baseDir[len+1] = 0;
+	}
+
+}
+
+static JString getPath(const char *filename)
+{
+	if(baseDir[0] == 0 || isAbsolutePath(filename))
+		return JString(filename);
+	return JString(baseDir) + filename;
+}
+
 bool IO::openFile(const char * name, bool readOnly)
 {
-	fileName = name;
+	fileName = getPath(name);
 	
 	for (int attempt = 0; attempt < 3; ++attempt)
 		{
@@ -189,7 +223,7 @@ bool IO::createFile(const char *name)
 {
 	Log::debug("IO::createFile: creating file \"%s\"\n", name);
 
-	fileName = name;
+	fileName = getPath(name);
 	
 	for (int attempt = 0; attempt < 3; ++attempt)
 		{
@@ -380,10 +414,11 @@ void IO::declareFatalError()
 void IO::createPath(const char *fileName)
 {
 	// First, better make sure directories exists
+	JString fname = getPath(fileName);
 
 	char directory [256], *q = directory;
 
-	for (const char *p = fileName; *p;)
+	for (const char *p = fname.getString(); *p;)
 		{
 		char c = *p++;
 		
@@ -393,7 +428,8 @@ void IO::createPath(const char *fileName
 			
 			if (q > directory && q [-1] != ':')
 				if (MKDIR (directory) && errno != EEXIST)
-					throw SQLError (IO_ERROR, "can't create directory \"%s\"\n", directory);
+					throw SQLError (IO_ERROR, 
+					"can't create directory \"%s\"\n", directory);
 			}
 		*q++ = c;
 		}
@@ -409,6 +445,9 @@ void IO::expandFileName(const char *file
 {
 	char expandedName[PATH_MAX+1];
 	const char *path;
+	JString fname = getPath(fileName);
+	fileName = fname.getString();
+
 #ifdef _WIN32
 	char *base;
 	
@@ -465,7 +504,8 @@ bool IO::doesFileExist(const char *fileN
 int IO::fileStat(const char *fileName, struct stat *fileStats, int *errnum)
 {
 	struct stat stats;
-	int retCode = stat(fileName, &stats);
+	JString path = getPath(fileName);
+	int retCode = stat(path.getString(), &stats);
 	
 	if (fileStats)
 		*fileStats = stats;
@@ -621,7 +661,8 @@ void IO::sync(void)
 
 void IO::deleteFile(const char* fileName)
 {
-	unlink(fileName);
+	JString path = getPath(fileName);
+	unlink(path.getString());
 }
 
 void IO::tracePage(Bdb* bdb)
@@ -753,4 +794,3 @@ uint16 IO::computeChecksum(Page *page, s
 	return (uint16) sum;
 
 }
-

=== modified file 'storage/falcon/IOx.h'
--- a/storage/falcon/IOx.h	2008-07-18 08:15:54 +0000
+++ b/storage/falcon/IOx.h	2008-08-14 11:24:18 +0000
@@ -64,6 +64,7 @@ public:
 	void	writePages(int32 pageNumber, int length, const UCHAR* data, int type);
 	void	readPage (Bdb *page);
 	bool	createFile (const char *name);
+	static	void setBaseDirectory(const char *path);
 	bool	openFile (const char *name, bool readOnly);
 	void	longSeek(int64 offset);
 	void	read(int64 offset, int length, UCHAR* buffer);

=== modified file 'storage/falcon/MemMgr.cpp'
--- a/storage/falcon/MemMgr.cpp	2008-08-07 14:19:54 +0000
+++ b/storage/falcon/MemMgr.cpp	2008-08-12 22:21:35 +0000
@@ -37,8 +37,13 @@
 #include "MemControl.h"
 
 #ifdef HAVE_purify
+#ifdef HAVE_CONFIG
+#include <config.h> 
+#endif
+#ifdef HAVE_VALGRIND_MEMCHECK_H
 #include <valgrind/memcheck.h>
 #endif
+#endif
 
 #ifndef VALGRIND_MAKE_MEM_UNDEFINED
 #define VALGRIND_MAKE_MEM_DEFINED(address, length)
@@ -72,8 +77,9 @@ static const int guardBytes = sizeof(lon
 const int validateMinutia	= 16;
 
 // Nominal memory limits at startup--final values set during initialization
+bool memoryManagerAlive;
 
-static MemMgr		memoryManager(defaultRounding, FREE_OBJECTS_SIZE, HEAP_SIZE);
+static MemMgr		memoryManager(defaultRounding, FREE_OBJECTS_SIZE,
HEAP_SIZE,&memoryManagerAlive);
 static MemMgr		recordManager(defaultRounding, 2, HEAP_SIZE);
 //static MemMgr		recordObjectManager (defaultRounding, sizeof(RecordVersion) + 100,
HEAP_SIZE);
 static MemControl	memControl;
@@ -121,6 +127,9 @@ struct Client {
 
 	void* MemMgrAllocateDebug (unsigned int s, const char *file, int line)
 	{
+		if(!memoryManagerAlive)
+			return malloc(s);
+
 		void *object = memoryManager.allocateDebug(s, file, line);
 
 		if (object == stopAddress)
@@ -134,6 +143,11 @@ struct Client {
 
 	void MemMgrRelease (void *object)
 	{
+		if (!memoryManagerAlive)
+			{
+			free(object);
+			return;
+			}
 		/***
 		if (object == stopAddress)
 			printf ("MemMgrRelease at %p\n", stopAddress);
@@ -162,12 +176,18 @@ struct Client {
 
 	void* MemMgrAllocate (unsigned int s)
 	{
-		return memoryManager.allocate (s);
+		if(!memoryManagerAlive)
+			return malloc(s);
+		else
+			return memoryManager.allocate (s);
 	}
 
 	void MemMgrRelease (void *object)
 	{
-		memoryManager.release (object);
+		if(!memoryManagerAlive)
+			free(object);
+		else
+			memoryManager.release (object);
 	}
 
 	void* MemMgrRecordAllocate (int size, const char *file, int line)
@@ -269,7 +289,7 @@ void MemMgrLogDump()
 }
 
 
-MemMgr::MemMgr(int rounding, int cutoff, int minAlloc)
+MemMgr::MemMgr(int rounding, int cutoff, int minAlloc, bool *alive)
 {
 	signature = defaultSignature;
 	roundingSize = rounding;
@@ -293,6 +313,11 @@ MemMgr::MemMgr(int rounding, int cutoff,
 	//freeBlocks.nextLarger = freeBlocks.priorSmaller = &freeBlocks;
 	//freeBlockTree = NULL;
 	junk.larger = junk.smaller = &junk;
+	isAlive = alive;
+	if(alive)
+	{
+		*alive = true;
+	}
 }
 
 
@@ -317,6 +342,8 @@ MemMgr::~MemMgr(void)
 		bigHunks = bigHunk->nextHunk;
 		releaseRaw (bigHunk);
 		}
+	if (isAlive)
+		*isAlive = false;
 }
 
 MemBlock* MemMgr::alloc(int length)
@@ -500,19 +527,11 @@ void* MemMgr::allocate(int size)
 	int length = ROUNDUP(size, roundingSize) + OFFSET(MemBlock*, body) + guardBytes;
 	MemBlock *memory;
 
-	if (signature)
-		{
-		length = ROUNDUP(length, sizeof (double));
-		memory = alloc (length);
-		memory->pool = this;
-		}
-	else
-		{
-		length = ROUNDUP(size, defaultRounding) + OFFSET(MemBlock*, body) + sizeof(long);
-		memory = (MemBlock*) allocRaw(length);
-		memory->pool = NULL;
-		memory->length = length;
-		}
+	ASSERT(signature == defaultSignature);
+	length = ROUNDUP(length, sizeof (double));
+	memory = alloc (length);
+	memory->pool = this;
+	
 
 #ifdef MEM_DEBUG
 	memset (&memory->body, INIT_BYTE, size);
@@ -533,20 +552,10 @@ void* MemMgr::allocateDebug(int size, co
 	int length = ROUNDUP(size, roundingSize) + OFFSET(MemBlock*, body) + guardBytes;
 	MemBlock *memory;
 
-	if (signature)
-		{
-		length = ROUNDUP(length, sizeof (double));
-		memory = alloc (length);
-		memory->pool = this;
-		}
-	else
-		{
-		length = ROUNDUP(size, defaultRounding) + OFFSET(MemBlock*, body) + sizeof(long);
-		memory = (MemBlock*) allocRaw(length);
-		memory->length = length;
-		memory->pool = NULL;
-		memory->length = length;
-		}
+	ASSERT(signature == defaultSignature);
+	length = ROUNDUP(length, sizeof (double));
+	memory = alloc (length);
+	memory->pool = this;
 
 #ifdef MEM_DEBUG
 	memory->fileName = fileName;

=== modified file 'storage/falcon/MemMgr.h'
--- a/storage/falcon/MemMgr.h	2008-05-14 18:39:57 +0000
+++ b/storage/falcon/MemMgr.h	2008-08-06 11:53:21 +0000
@@ -106,7 +106,8 @@ public:
 class MemMgr
 {
 public:
-	MemMgr(int rounding=defaultRounding, int cutoff=defaultCutoff, int
minAllocation=defaultAllocation);
+	MemMgr(int rounding=defaultRounding, int cutoff=defaultCutoff, 
+		int minAllocation=defaultAllocation, bool *alive = NULL);
 	MemMgr(void* arg1, void* arg2);
 	virtual ~MemMgr(void);
 
@@ -129,6 +130,7 @@ public:
 	uint64			activeMemory;
 	int				blocksAllocated;
 	int				blocksActive;
+	bool			*isAlive;
 
 	friend void  MemMgrLogDump();
 

=== modified file 'storage/falcon/Section.h'
--- a/storage/falcon/Section.h	2008-03-11 16:15:47 +0000
+++ b/storage/falcon/Section.h	2008-08-07 21:11:55 +0000
@@ -43,6 +43,7 @@ struct SectionAnalysis;
 class Section  
 {
 public:
+	static const int INVALID_SECTION_ID = -1;
 	void redoDataPage (int32 pageNumber, int32 locatorPageNumber);
 	Section(Dbb *dbb, int32 id, TransId transId);
 	virtual ~Section();

=== modified file 'storage/falcon/StorageHandler.cpp'
--- a/storage/falcon/StorageHandler.cpp	2008-07-31 08:52:32 +0000
+++ b/storage/falcon/StorageHandler.cpp	2008-08-14 11:24:18 +0000
@@ -37,6 +37,7 @@
 #include "Dbb.h"
 #include "Database.h"
 #include "TableSpaceManager.h"
+#include "IOx.h"
 
 #define DICTIONARY_ACCOUNT		"mysql"
 #define DICTIONARY_PW			"mysql"
@@ -112,6 +113,10 @@ StorageHandler*	getFalconStorageHandler(
 	return storageHandler;
 }
 
+void StorageHandler::setDataDirectory(const char *directory)
+{
+	IO::setBaseDirectory(directory);
+}
 
 StorageHandler::StorageHandler(int lockSize)
 {
@@ -488,9 +493,9 @@ int StorageHandler::createTablespace(con
 	TableSpaceManager *tableSpaceManager = 
 		dictionaryConnection->database->tableSpaceManager;
 
-	if (!tableSpaceManager->waitForPendingDrop(tableSpaceName, 10))
+	if (!tableSpaceManager->waitForPendingDrop(filename, 10))
 		// file still exists after waiting for 10 seconds
-		return  StorageErrorTableSpaceExist;
+		return  StorageErrorTableSpaceDataFileExist;
 
 	try
 		{

=== modified file 'storage/falcon/StorageHandler.h'
--- a/storage/falcon/StorageHandler.h	2008-07-29 10:45:39 +0000
+++ b/storage/falcon/StorageHandler.h	2008-08-14 11:24:18 +0000
@@ -141,6 +141,7 @@ public:
 	Connection			*dictionaryConnection;
 	int					mySqlLockSize;
 	bool				initialized;
+	static void			setDataDirectory(const char *directory);
 };
 
 #endif

=== modified file 'storage/falcon/StorageTable.cpp'
--- a/storage/falcon/StorageTable.cpp	2008-05-02 22:09:28 +0000
+++ b/storage/falcon/StorageTable.cpp	2008-08-11 13:22:53 +0000
@@ -56,8 +56,6 @@ StorageTable::StorageTable(StorageConnec
 
 StorageTable::~StorageTable(void)
 {
-	clearTruncateLock();
-	
 	if (bitmap)
 		((Bitmap*) bitmap)->release();
 
@@ -85,7 +83,6 @@ int StorageTable::open(void)
 
 int StorageTable::deleteTable(void)
 {
-	clearTruncateLock();
 	int ret = share->deleteTable(storageConnection);
 	
 	if (ret == 0)
@@ -96,32 +93,12 @@ int StorageTable::deleteTable(void)
 
 int StorageTable::truncateTable(void)
 {
-	clearTruncateLock();
-	Sync sync(share->syncTruncate, "StorageTable::truncateTable");
-	sync.lock(Exclusive);
 	clearRecord();
 	int ret = share->truncateTable(storageConnection);
-	
 	return ret;
 }
 
-void StorageTable::clearTruncateLock(void)
-{
-	if (haveTruncateLock)
-		{
-		share->clearTruncateLock();
-		haveTruncateLock = false;
-		}
-}
 
-void StorageTable::setTruncateLock()
-{
-	if (!haveTruncateLock)
-		{
-		share->setTruncateLock();
-		haveTruncateLock = true;
-		}
-}
 
 int StorageTable::insert(void)
 {
@@ -586,6 +563,11 @@ int StorageTable::alterCheck(void)
 		return StorageErrorUncommittedUpdates;
 
 	return 0;
+}
+
+void StorageTable::waitForWriteComplete(void)
+{
+	share->table->waitForWriteComplete();
 }
 
 void StorageTable::unlockRow(void)

=== modified file 'storage/falcon/StorageTable.h'
--- a/storage/falcon/StorageTable.h	2008-05-02 22:09:28 +0000
+++ b/storage/falcon/StorageTable.h	2008-08-11 13:22:53 +0000
@@ -61,11 +61,11 @@ public:
 	void			transactionEnded(void);
 	void			setRecord(Record* record, bool locked);
 	int				alterCheck(void);
+	void			waitForWriteComplete();
 	void			clearAlter(void);
 	bool			setAlter(void);
 	
-	void			clearTruncateLock(void);
-	void			setTruncateLock();
+
 	
 	virtual void	setConnection(StorageConnection* connection);
 	virtual void	clearIndexBounds(void);

=== modified file 'storage/falcon/StorageTableShare.cpp'
--- a/storage/falcon/StorageTableShare.cpp	2008-07-15 18:57:27 +0000
+++ b/storage/falcon/StorageTableShare.cpp	2008-08-04 15:53:52 +0000
@@ -70,10 +70,7 @@ StorageTableShare::StorageTableShare(Sto
 	sequence = NULL;
 	tempTable = tempTbl;
 	setPath(path);
-	syncTruncate = new SyncObject;
-	syncTruncate->setName("StorageTableShare::syncTruncate");
-	truncateLockCount = 0;
-	
+
 	if (tempTable)
 		tableSpace = TEMPORARY_TABLESPACE;
 	else if (tableSpaceName && tableSpaceName[0])
@@ -84,11 +81,7 @@ StorageTableShare::StorageTableShare(Sto
 
 StorageTableShare::~StorageTableShare(void)
 {
-	while (truncateLockCount > 0)
-		clearTruncateLock();
-
 	delete syncObject;
-	delete syncTruncate;
 	delete [] impure;
 	
 	if (storageDatabase)
@@ -605,21 +598,6 @@ JString StorageTableShare::lookupPathNam
 	return path;
 }
 
-void StorageTableShare::setTruncateLock(void)
-{
-	INTERLOCKED_INCREMENT(truncateLockCount);
-	syncTruncate->lock(NULL, Shared);
-}
-
-void StorageTableShare::clearTruncateLock(void)
-{
-	if (truncateLockCount > 0)
-		{
-		INTERLOCKED_DECREMENT(truncateLockCount);
-		syncTruncate->unlock();
-//		syncTruncate->unlock(NULL, Shared);
-		}
-}
 
 int StorageTableShare::getFieldId(const char* fieldName)
 {

=== modified file 'storage/falcon/StorageTableShare.h'
--- a/storage/falcon/StorageTableShare.h	2008-07-09 04:38:02 +0000
+++ b/storage/falcon/StorageTableShare.h	2008-08-04 15:53:52 +0000
@@ -126,8 +126,6 @@ public:
 	uint64				estimateCardinality(void);
 	bool				tableExists(void);
 	JString				lookupPathName(void);
-	void				setTruncateLock(void);
-	void				clearTruncateLock(void);
 
 	static const char*	getDefaultRoot(void);
 	static const char*	cleanupTableName(const char* name, char* buffer, int bufferLength,
char *schema, int schemaLength);
@@ -142,7 +140,6 @@ public:
 	unsigned char		*impure;
 	int					initialized;
 	SyncObject			*syncObject;
-	SyncObject			*syncTruncate;
 	StorageDatabase		*storageDatabase;
 	StorageHandler		*storageHandler;
 	Table				*table;
@@ -150,7 +147,6 @@ public:
 	Sequence			*sequence;
 	Format				*format;						// format for insertion
 	int					numberIndexes;
-	volatile INTERLOCK_TYPE	truncateLockCount;
 	bool				tempTable;
 	int getFieldId(const char* fieldName);
 };

=== modified file 'storage/falcon/Table.cpp'
--- a/storage/falcon/Table.cpp	2008-08-01 17:56:28 +0000
+++ b/storage/falcon/Table.cpp	2008-08-13 10:18:40 +0000
@@ -794,8 +794,8 @@ void Table::init(int id, const char *sch
 	fields = NULL;
 	indexes = NULL;
 	fieldCount = 0;
-	blobSectionId = 0;
-	dataSectionId = 0;
+	blobSectionId = Section::INVALID_SECTION_ID;
+	dataSectionId = Section::INVALID_SECTION_ID;
 	blobSection = NULL;
 	dataSection = NULL;
 	backloggedRecords = NULL;
@@ -1371,7 +1371,7 @@ void Table::reIndexInversion(Transaction
 
 bool Table::isCreated()
 {
-	return dataSectionId != 0;
+	return dataSectionId != Section::INVALID_SECTION_ID;
 }
 
 Index* Table::getPrimaryKey()
@@ -3232,13 +3232,17 @@ void Table::expunge(Transaction *transac
 	if (transaction)
 		transaction->hasUpdates = true;
 
-	if (dataSectionId || blobSectionId)
+	if (dataSectionId != Section::INVALID_SECTION_ID)
 		{
 		dbb->deleteSection(dataSectionId, TRANSACTION_ID(transaction));
-		dataSectionId = 0;
+		dataSectionId = Section::INVALID_SECTION_ID;
 		dataSection = NULL;
+		}
+
+	if (blobSectionId != Section::INVALID_SECTION_ID)
+		{
 		dbb->deleteSection(blobSectionId, TRANSACTION_ID(transaction));
-		blobSectionId = 0;
+		blobSectionId = Section::INVALID_SECTION_ID;
 		blobSection = NULL;
 		}
 }
@@ -3327,6 +3331,11 @@ bool Table::hasUncommittedRecords(Transa
 	return database->hasUncommittedRecords(this, transaction);
 }
 
+void Table::waitForWriteComplete()
+{
+	database->waitForWriteComplete(this);
+}
+
 RecordVersion* Table::lockRecord(Record* record, Transaction* transaction)
 {
 	Record *current = fetch(record->recordNumber);
@@ -3641,14 +3650,21 @@ Format* Table::getCurrentFormat(void)
 
 void Table::findSections(void)
 {
+	ASSERT(dataSectionId != Section::INVALID_SECTION_ID && 
+		blobSectionId != Section::INVALID_SECTION_ID);
+
 	if (!dataSection)
 		{
 		dataSection = dbb->findSection(dataSectionId);
 		dataSection->table = this;
 		}
+	ASSERT(dataSection->sectionId == dataSectionId);
 
 	if (!blobSection)
+		{
 		blobSection = dbb->findSection(blobSectionId);
+		}
+	ASSERT(blobSection->sectionId == blobSectionId);
 }
 
 bool Table::validateUpdate(int32 recordNumber, TransId transactionId)

=== modified file 'storage/falcon/Table.h'
--- a/storage/falcon/Table.h	2008-04-22 21:10:23 +0000
+++ b/storage/falcon/Table.h	2008-08-11 13:22:53 +0000
@@ -185,6 +185,7 @@ public:
 	int			getFormatVersion();
 	void		validateAndInsert(Transaction *transaction, RecordVersion *record);
 	bool		hasUncommittedRecords(Transaction* transaction);
+	void		waitForWriteComplete();
 	void		checkAncestor(Record* current, Record* oldRecord);
 	int64		estimateCardinality(void);
 	void		optimize(Connection *connection);

=== modified file 'storage/falcon/Transaction.cpp'
--- a/storage/falcon/Transaction.cpp	2008-07-31 10:04:30 +0000
+++ b/storage/falcon/Transaction.cpp	2008-08-20 15:01:21 +0000
@@ -275,38 +275,45 @@ void Transaction::commit()
 		releaseRecordLocks();
 
 	database->serialLog->preCommit(this);
-	state = Committed;
 	syncActive.unlock();
 
+	
+
 	for (RecordVersion *record = firstRecord; record; record = record->nextInTrans)
-		if (!record->isSuperceded() && record->state != recLock)
-			record->format->table->updateRecord (record);
+	{
+		Table * table = record->format->table;
 
-	if (commitTriggers)
-		for (RecordVersion *record = firstRecord; record; record = record->nextInTrans)
-			if (!record->isSuperceded() && record->state != recLock)
-				record->format->table->postCommit (this, record);
+		if (!record->isSuperceded() && record->state != recLock)
+			{
+			table->updateRecord (record);
+			if (commitTriggers)
+				table->postCommit (this, record);
+			}
 
+		if (!record->getPriorVersion())
+			++table->cardinality;
+		if (record->state == recDeleted && table->cardinality > 0)
+			--table->cardinality;
+	}
+	
 	releaseDependencies();
 	database->flushInversion(this);
 
-	Sync syncCommitted(&transactionManager->committedTransactions.syncObject,
"Transaction::commit(2)");
-	syncCommitted.lock(Exclusive);
+	// Transfer transaction from active list to committed list, set committed state
 
+	Sync syncCommitted(&transactionManager->committedTransactions.syncObject,
"Transaction::commit(2)");
 	Sync syncActiveTransactions(&transactionManager->activeTransactions.syncObject,
"Transaction::commit(3)");
+
 	syncActiveTransactions.lock(Exclusive);
+	syncCommitted.lock(Exclusive);
+
 	transactionManager->activeTransactions.remove(this);
-	syncActiveTransactions.unlock();
-	
-	for (RecordVersion *record = firstRecord; record; record = record->nextInTrans)
-		{
-		if (!record->getPriorVersion())
-			++record->format->table->cardinality;
-		if (record->state == recDeleted &&
record->format->table->cardinality > 0)
-			--record->format->table->cardinality;
-		}
 	transactionManager->committedTransactions.append(this);
+	state = Committed;
+
 	syncCommitted.unlock();
+	syncActiveTransactions.unlock();
+
 	database->commit(this);
 
 	delete [] xid;
@@ -778,7 +785,8 @@ void Transaction::releaseDependencies()
 
 			if (COMPARE_EXCHANGE_POINTER(&state->transaction, transaction, NULL))
 				{
-				ASSERT(transaction->transactionId == state->transactionId ||
transaction->state == Available);
+				ASSERT(transaction->transactionId == state->transactionId ||
transaction->transactionId == 0);
+				ASSERT(transaction->state != Initializing);
 				transaction->releaseDependency();
 				}
 			}
@@ -925,8 +933,11 @@ void Transaction::truncateTable(Table* t
 			ptr = &rec->nextInTrans;
 }
 
-bool Transaction::hasUncommittedRecords(Table* table)
+bool Transaction::hasRecords(Table* table)
 {
+	// This lock is to avoid race with writeComplete
+	Sync sync(&syncIndexes, "Transaction::hasRecords");
+	sync.lock(Exclusive);
 	for (RecordVersion *rec = firstRecord; rec; rec = rec->nextInTrans)
 		if (rec->format->table == table)
 			return true;

=== modified file 'storage/falcon/Transaction.h'
--- a/storage/falcon/Transaction.h	2008-07-24 08:45:03 +0000
+++ b/storage/falcon/Transaction.h	2008-08-11 13:22:53 +0000
@@ -105,7 +105,7 @@ public:
 	State		waitForTransaction (Transaction *transaction, TransId transId, bool *deadlock);
 	void		dropTable(Table* table);
 	void		truncateTable(Table* table);
-	bool		hasUncommittedRecords(Table* table);
+	bool		hasRecords(Table* table);
 	void		writeComplete(void);
 	void		releaseDependency(void);
 	int			createSavepoint();

=== modified file 'storage/falcon/TransactionManager.cpp'
--- a/storage/falcon/TransactionManager.cpp	2008-07-24 08:45:03 +0000
+++ b/storage/falcon/TransactionManager.cpp	2008-08-14 12:08:37 +0000
@@ -27,6 +27,7 @@
 #include "Log.h"
 #include "LogLock.h"
 #include "Synchronize.h"
+#include "Thread.h"
 
 static const int EXTRA_TRANSACTIONS = 10;
 
@@ -168,12 +169,40 @@ bool TransactionManager::hasUncommittedR
 	syncTrans.lock (Shared);
 	
 	for (Transaction *trans = activeTransactions.first; trans; trans = trans->next)
-		if (trans != transaction && trans->isActive() &&
trans->hasUncommittedRecords(table))
+		if (trans != transaction && trans->isActive() &&
trans->hasRecords(table))
 			return true;
 
 	return false;
 }
 
+// Wait until all committed records for a table are purged by gophers
+// (their transaction become write complete)
+void TransactionManager::waitForWriteComplete(Table* table)
+{
+	for(;;)
+		{
+		bool again = false;
+		Sync committedTrans (&committedTransactions.syncObject,
+			"TransactionManager::waitForWriteComplete");
+		committedTrans.lock (Shared);
+
+		for (Transaction *trans = committedTransactions.first; trans; 
+			 trans = trans->next)
+			{
+				if (trans->hasRecords(table)&& trans->writePending)
+				{
+				again = true;
+				break;
+				}
+			}
+
+		if(!again)
+			return;
+
+		committedTrans.unlock();
+		Thread::getThread("TransactionManager::waitForWriteComplete")->sleep(10);
+		}
+}
 void TransactionManager::commitByXid(int xidLength, const UCHAR* xid)
 {
 	Sync sync (&activeTransactions.syncObject, "TransactionManager::commitByXid");

=== modified file 'storage/falcon/TransactionManager.h'
--- a/storage/falcon/TransactionManager.h	2008-04-24 17:26:34 +0000
+++ b/storage/falcon/TransactionManager.h	2008-08-11 13:22:53 +0000
@@ -35,6 +35,7 @@ public:
 	void			dropTable(Table* table, Transaction* transaction);
 	void			truncateTable(Table* table, Transaction* transaction);
 	bool			hasUncommittedRecords(Table* table, Transaction* transaction);
+	void			waitForWriteComplete(Table *table);
 	void			commitByXid(int xidLength, const UCHAR* xid);
 	void			rollbackByXid(int xidLength, const UCHAR* xid);
 	void			print(void);

=== modified file 'storage/falcon/ha_falcon.cpp'
--- a/storage/falcon/ha_falcon.cpp	2008-08-07 14:19:54 +0000
+++ b/storage/falcon/ha_falcon.cpp	2008-08-14 11:24:18 +0000
@@ -162,9 +162,11 @@ int StorageInterface::falcon_init(void *
 	falcon_hton = (handlerton *)p;
 	my_bool error = false;
 
+	StorageHandler::setDataDirectory(mysql_real_data_home);
+
 	if (!storageHandler)
 		storageHandler = getFalconStorageHandler(sizeof(THR_LOCK));
-
+	
 	falcon_hton->state = SHOW_OPTION_YES;
 	falcon_hton->db_type = DB_TYPE_FALCON;
 	falcon_hton->savepoint_offset = sizeof(void*);
@@ -177,6 +179,8 @@ int StorageInterface::falcon_init(void *
 	falcon_hton->create = falcon_create_handler;
 	falcon_hton->drop_database  = StorageInterface::dropDatabase;
 	falcon_hton->panic  = StorageInterface::panic;
+
+
 #if 0
 	falcon_hton->alter_table_flags  = StorageInterface::alter_table_flags;
 #endif
@@ -420,9 +424,6 @@ StorageInterface::StorageInterface(handl
 
 StorageInterface::~StorageInterface(void)
 {
-	if (storageTable)
-		storageTable->clearTruncateLock();
-
 	if (activeBlobs)
 		freeActiveBlobs();
 
@@ -534,10 +535,6 @@ StorageConnection* StorageInterface::get
 int StorageInterface::close(void)
 {
 	DBUG_ENTER("StorageInterface::close");
-
-	if (storageTable)
-		storageTable->clearTruncateLock();
-
 	unmapFields();
 
 	// Temporarily comment out DTrace probes in Falcon, see bug #36403
@@ -917,7 +914,9 @@ THR_LOCK_DATA **StorageInterface::store_
 		if (    (lock_type >= TL_WRITE_CONCURRENT_INSERT && lock_type <=
TL_WRITE)
 		    && !(thd_in_lock_tables(thd) && sql_command == SQLCOM_LOCK_TABLES)
 		    && !(thd_tablespace_op(thd))
-		  //  &&  (sql_command != SQLCOM_TRUNCATE)
+		    &&  (sql_command != SQLCOM_ALTER_TABLE)
+		    &&  (sql_command != SQLCOM_DROP_TABLE)
+		    &&  (sql_command != SQLCOM_TRUNCATE)
 		    &&  (sql_command != SQLCOM_OPTIMIZE)
 		    &&  (sql_command != SQLCOM_CREATE_TABLE)
 		   )
@@ -1020,7 +1019,7 @@ int StorageInterface::delete_all_rows()
 	if (!storageTable)
 		storageTable = storageConnection->getStorageTable(storageShare);
 		
-	storageTable->truncateTable();
+	ret = storageTable->truncateTable();
 		
 	DBUG_RETURN(ret);
 }
@@ -1262,10 +1261,6 @@ void StorageInterface::startTransaction(
 	if (!storageConnection->transactionActive)
 		{
 		storageConnection->startTransaction(isolation);
-		
-		if (storageTable)
-			storageTable->setTruncateLock();
-				
 		trans_register_ha(mySqlThread, true, falcon_hton);
 		}
 
@@ -1873,12 +1868,7 @@ int StorageInterface::external_lock(THD 
 		storageConnection->setCurrentStatement(NULL);
 
 		if (!thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))
-			{
-			if (storageTable)
-				storageTable->clearTruncateLock();
-		
 			storageConnection->endImplicitTransaction();
-			}
 		else
 			storageConnection->releaseVerb();
 
@@ -1891,10 +1881,11 @@ int StorageInterface::external_lock(THD 
 			storageConnection->setCurrentStatement(thd->query);
 
 		insertCount = 0;
-		bool isTruncate = false;
-		
+
 		switch (thd_sql_command(thd))
 			{
+			case SQLCOM_TRUNCATE:
+			case SQLCOM_DROP_TABLE:
 			case SQLCOM_ALTER_TABLE:
 			case SQLCOM_DROP_INDEX:
 			case SQLCOM_CREATE_INDEX:
@@ -1903,18 +1894,11 @@ int StorageInterface::external_lock(THD 
 
 				if (ret)
 					{
-					if (storageTable)
-						storageTable->clearTruncateLock();
-						
 					DBUG_RETURN(error(ret));
 					}
 				}
+				storageTable->waitForWriteComplete();
 				break;
-
-			case SQLCOM_TRUNCATE:
-				isTruncate = true;
-				break;
-				
 			default:
 				break;
 			}
@@ -1927,9 +1911,6 @@ int StorageInterface::external_lock(THD 
 			
 			if (storageConnection->startTransaction(isolation))
 				{
-				if (!isTruncate && storageTable)
-					storageTable->setTruncateLock();
-				
 				trans_register_ha(thd, true, falcon_hton);
 				}
 
@@ -1942,9 +1923,6 @@ int StorageInterface::external_lock(THD 
 			
 			if (storageConnection->startImplicitTransaction(isolation))
 				{
-				if (!isTruncate && storageTable)
-					storageTable->setTruncateLock();
-				
 				trans_register_ha(thd, false, falcon_hton);
 				}
 			}
@@ -3551,7 +3529,7 @@ void StorageInterface::unmapFields(void)
 static MYSQL_SYSVAR_STR(serial_log_dir, falcon_serial_log_dir,
   PLUGIN_VAR_RQCMDARG| PLUGIN_VAR_READONLY | PLUGIN_VAR_MEMALLOC,
   "Falcon serial log file directory.",
-  NULL, NULL, NULL);
+  NULL, NULL, mysql_real_data_home);
 
 static MYSQL_SYSVAR_STR(checkpoint_schedule, falcon_checkpoint_schedule,
   PLUGIN_VAR_RQCMDARG| PLUGIN_VAR_READONLY | PLUGIN_VAR_MEMALLOC,

=== modified file 'storage/falcon/plug.in'
--- a/storage/falcon/plug.in	2008-07-25 12:31:16 +0000
+++ b/storage/falcon/plug.in	2008-08-12 21:50:50 +0000
@@ -9,6 +9,7 @@ AC_CACHE_CHECK([if Falcon Storage Engine
   			   falcon_supported_by_machine,[
   case "$BASE_MACHINE_TYPE" in
     i386)   falcon_supported_by_machine="yes" ;;
+    amd64)  falcon_supported_by_machine="yes" ;;
     x86_64) falcon_supported_by_machine="yes" ;;
     powerpc)falcon_supported_by_machine="yes" ;;
     sparc)

Thread
bzr push into mysql-6.0 branch (vvaintroub:2779) Vladislav Vaintroub22 Aug