MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Olav Sandstaa Date:June 20 2008 8:06am
Subject:commit into mysql-6.0-falcon branch (olav:2713)
View as plain text  
#At bzr+ssh://bk-internal.mysql.com/bzrroot/server/mysql-6.0-falcon/

 2713 Olav Sandstaa	2008-06-20 [merge]
      Commiting into my local repository after merging.
added:
  mysql-test/suite/falcon/r/falcon_bug_33397.result
  mysql-test/suite/falcon/r/falcon_bug_33723.result
  mysql-test/suite/falcon/r/falcon_bug_34048.result
  mysql-test/suite/falcon/t/falcon_bug_33397.test
  mysql-test/suite/falcon/t/falcon_bug_33723.test
  mysql-test/suite/falcon/t/falcon_bug_34048.test
modified:
  mysql-test/suite/falcon/r/falcon_bug_34617.result
  mysql-test/suite/falcon/t/falcon_bug_34617.test
  storage/falcon/AsciiBlob.cpp
  storage/falcon/BinaryBlob.cpp
  storage/falcon/Bitmap.cpp
  storage/falcon/BlobReference.cpp
  storage/falcon/BlobReference.h
  storage/falcon/CMakeLists.txt
  storage/falcon/DateTime.cpp
  storage/falcon/Decompress.cpp
  storage/falcon/Engine.h
  storage/falcon/Error.cpp
  storage/falcon/Event.cpp
  storage/falcon/License.cpp
  storage/falcon/Makefile.am
  storage/falcon/MemMgr.cpp
  storage/falcon/PriorityScheduler.cpp
  storage/falcon/Protocol.cpp
  storage/falcon/SQLError.cpp
  storage/falcon/Socket.cpp
  storage/falcon/Socket.h
  storage/falcon/Stream.cpp
  storage/falcon/Stream.h
  storage/falcon/StreamSegment.cpp
  storage/falcon/SyncObject.cpp
  storage/falcon/SyncObject.h
  storage/falcon/SyncTest.cpp
  storage/falcon/SyncTest.h
  storage/falcon/Synchronize.cpp
  storage/falcon/Synchronize.h
  storage/falcon/Thread.cpp
  storage/falcon/Thread.h
  storage/falcon/Types.h


=== added file 'mysql-test/suite/falcon/r/falcon_bug_33397.result'
--- a/mysql-test/suite/falcon/r/falcon_bug_33397.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/falcon/r/falcon_bug_33397.result	2008-06-19 10:22:23 +0000
@@ -0,0 +1,7 @@
+*** Bug 33397 ***
+SET @@storage_engine = 'Falcon';
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1(a INT);
+ALTER TABLE t1 TABLESPACE nosuchtablespace;
+ERROR HY000: Tablespace 'nosuchtablespace' doesn't exist
+DROP TABLE t1;

=== added file 'mysql-test/suite/falcon/r/falcon_bug_33723.result'
--- a/mysql-test/suite/falcon/r/falcon_bug_33723.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/falcon/r/falcon_bug_33723.result	2008-06-19 10:22:23 +0000
@@ -0,0 +1,10 @@
+*** Bug 33723 ***
+SET @@storage_engine = 'Falcon';
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1(a INT);
+CREATE TABLESPACE ts1 add datafile 'ts1.fts' Engine='Falcon';
+ALTER TABLE t1 TABLESPACE nosuchtablespace;
+ERROR HY000: Tablespace 'nosuchtablespace' doesn't exist
+ALTER TABLE t1 TABLESPACE ts1;
+DROP TABLE t1;
+DROP TABLESPACE ts1 Engine='Falcon';

=== added file 'mysql-test/suite/falcon/r/falcon_bug_34048.result'
--- a/mysql-test/suite/falcon/r/falcon_bug_34048.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/falcon/r/falcon_bug_34048.result	2008-06-19 10:22:23 +0000
@@ -0,0 +1,7 @@
+*** Bug #34048 ***
+SET @@storage_engine = 'Falcon';
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1(a INT) TABLESPACE nosuchtablespace;
+ERROR HY000: Tablespace 'nosuchtablespace' doesn't exist
+CREATE TABLE t1(a INT);
+DROP TABLE t1;

=== modified file 'mysql-test/suite/falcon/r/falcon_bug_34617.result'
--- a/mysql-test/suite/falcon/r/falcon_bug_34617.result	2008-04-23 08:21:28 +0000
+++ b/mysql-test/suite/falcon/r/falcon_bug_34617.result	2008-06-19 10:22:23 +0000
@@ -1,6 +1,7 @@
-CREATE TABLE t1(a INT) ENGINE=Falcon TABLESPACE nosuchtablespace;
-ERROR HY000: Tablespace 'nosuchtablespace' doesn't exist
-CREATE TABLE t1(a INT) ENGINE=Falcon;
+*** Bug 34617 ***
+SET @@storage_engine = 'Falcon';
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1(a INT);
 ALTER TABLE t1 TABLESPACE nosuchtablespace;
 ERROR HY000: Tablespace 'nosuchtablespace' doesn't exist
 ALTER TABLE t1 TABLESPACE nosuchtablespace;

=== added file 'mysql-test/suite/falcon/t/falcon_bug_33397.test'
--- a/mysql-test/suite/falcon/t/falcon_bug_33397.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/falcon/t/falcon_bug_33397.test	2008-06-19 10:22:23 +0000
@@ -0,0 +1,31 @@
+--source include/have_falcon.inc
+
+#
+# Bug #33397: ALTER TABLE into non-existing Falcon tablespace causes vague error
+#
+
+--echo *** Bug 33397 ***
+
+# ----------------------------------------------------- #
+# --- Initialisation                                --- #
+# ----------------------------------------------------- #
+let $engine = 'Falcon';
+eval SET @@storage_engine = $engine;
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1(a INT);
+
+# ----------------------------------------------------- #
+# --- Test                                          --- #
+# ----------------------------------------------------- #
+
+--error ER_NO_SUCH_TABLESPACE
+ALTER TABLE t1 TABLESPACE nosuchtablespace;
+
+# ----------------------------------------------------- #
+# --- Final cleanup                                 --- #
+# ----------------------------------------------------- #
+DROP TABLE t1;

=== added file 'mysql-test/suite/falcon/t/falcon_bug_33723.test'
--- a/mysql-test/suite/falcon/t/falcon_bug_33723.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/falcon/t/falcon_bug_33723.test	2008-06-19 10:22:23 +0000
@@ -0,0 +1,41 @@
+--source include/have_falcon.inc
+
+#
+# Bug #33723: ALTER TABLE into non-existing Falcon tablespace blocks further ALTERs
+#
+# See also: falcon_bug_33397.test,
+#           falcon_bug_34048.test,
+#           falcon_bug_34617.test
+#
+
+--echo *** Bug 33723 ***
+
+# ----------------------------------------------------- #
+# --- Initialisation                                --- #
+# ----------------------------------------------------- #
+let $engine = 'Falcon';
+eval SET @@storage_engine = $engine;
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1(a INT);
+
+## CREATE TABLESPACE requires explicit Engine
+eval CREATE TABLESPACE ts1 add datafile 'ts1.fts' Engine=$engine;
+
+# ----------------------------------------------------- #
+# --- Test                                          --- #
+# ----------------------------------------------------- #
+
+--error ER_NO_SUCH_TABLESPACE
+ALTER TABLE t1 TABLESPACE nosuchtablespace;
+ALTER TABLE t1 TABLESPACE ts1;
+
+# ----------------------------------------------------- #
+# --- Final cleanup                                 --- #
+# ----------------------------------------------------- #
+DROP TABLE t1;
+## DROP TABLESPACE requires explicit Engine
+eval DROP TABLESPACE ts1 Engine=$engine;

=== added file 'mysql-test/suite/falcon/t/falcon_bug_34048.test'
--- a/mysql-test/suite/falcon/t/falcon_bug_34048.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/falcon/t/falcon_bug_34048.test	2008-06-19 10:22:23 +0000
@@ -0,0 +1,29 @@
+--source include/have_falcon.inc
+
+#
+# Bug #34048: Falcon: after error with tablespace, I can't create table
+#
+--echo *** Bug #34048 ***
+
+# ----------------------------------------------------- #
+# --- Initialisation                                --- #
+# ----------------------------------------------------- #
+let $engine = 'Falcon';
+eval SET @@storage_engine = $engine;
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+# ----------------------------------------------------- #
+# --- Test                                          --- #
+# ----------------------------------------------------- #
+
+--error ER_NO_SUCH_TABLESPACE
+CREATE TABLE t1(a INT) TABLESPACE nosuchtablespace;
+CREATE TABLE t1(a INT);
+
+# ----------------------------------------------------- #
+# --- Final cleanup                                 --- #
+# ----------------------------------------------------- #
+DROP TABLE t1;

=== modified file 'mysql-test/suite/falcon/t/falcon_bug_34617.test'
--- a/mysql-test/suite/falcon/t/falcon_bug_34617.test	2008-04-23 08:21:28 +0000
+++ b/mysql-test/suite/falcon/t/falcon_bug_34617.test	2008-06-19 10:22:23 +0000
@@ -1,16 +1,42 @@
 --source include/have_falcon.inc
 
 #
-# BUG#33723 - ALTER TABLE into non-existing Falcon tablespace blocks
-#             further ALTERs
-# BUG#34048 - Falcon: after error with tablespace, I can't create table
-# BUG#34617 - Falcon assertion in StorageHandler::addTable, line 622
-#
---error ER_NO_SUCH_TABLESPACE
-CREATE TABLE t1(a INT) ENGINE=Falcon TABLESPACE nosuchtablespace;
-CREATE TABLE t1(a INT) ENGINE=Falcon;
---error ER_NO_SUCH_TABLESPACE
-ALTER TABLE t1 TABLESPACE nosuchtablespace;
---error ER_NO_SUCH_TABLESPACE
-ALTER TABLE t1 TABLESPACE nosuchtablespace;
+# Bug #34617: Falcon assertion in StorageHandler::addTable, line 622
+# Bug #36927: Falcon: crash altering table's tablespace
+#
+# NOTE: #36927 is a duplicate.
+#
+# See also falcon_bug_33723.test
+# (ALTER TABLE into non-existing Falcon tablespace blocks further ALTERs)
+#
+
+--echo *** Bug 34617 ***
+
+# ----------------------------------------------------- #
+# --- Initialisation                                --- #
+# ----------------------------------------------------- #
+let $engine = 'Falcon';
+eval SET @@storage_engine = $engine;
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1(a INT);
+
+# ----------------------------------------------------- #
+# --- Test                                          --- #
+# ----------------------------------------------------- #
+
+## Should fail gracefully
+--error ER_NO_SUCH_TABLESPACE
+ALTER TABLE t1 TABLESPACE nosuchtablespace;
+
+## Should fail with same error as above
+--error ER_NO_SUCH_TABLESPACE
+ALTER TABLE t1 TABLESPACE nosuchtablespace;
+
+# ----------------------------------------------------- #
+# --- Final cleanup                                 --- #
+# ----------------------------------------------------- #
 DROP TABLE t1;

=== modified file 'storage/falcon/AsciiBlob.cpp'
--- a/storage/falcon/AsciiBlob.cpp	2007-09-20 15:44:25 +0000
+++ b/storage/falcon/AsciiBlob.cpp	2008-06-19 15:09:45 +0000
@@ -28,7 +28,7 @@
 #include "SQLException.h"
 #include "Dbb.h"
 
-#ifdef ENGINE
+#ifdef FALCONDB
 #include "Dbb.h"
 #include "Repository.h"
 #include "Section.h"
@@ -74,7 +74,7 @@
 	copy (clob);
 }
 
-#ifdef ENGINE
+#ifdef FALCONDB
 AsciiBlob::AsciiBlob(Dbb * db, int32 recNumber, Section *blobSection)
 {
 	init (false);
@@ -160,7 +160,7 @@
 
 	populated = true;
 
-#ifdef ENGINE
+#ifdef FALCONDB
 	if (repository && isBlobReference())
 		try
 			{

=== modified file 'storage/falcon/BinaryBlob.cpp'
--- a/storage/falcon/BinaryBlob.cpp	2007-09-20 15:44:25 +0000
+++ b/storage/falcon/BinaryBlob.cpp	2008-06-19 15:09:45 +0000
@@ -28,7 +28,7 @@
 #include "SQLException.h"
 #include "Dbb.h"
 
-#ifdef ENGINE
+#ifdef FALCONDB
 #include "Dbb.h"
 #include "Repository.h"
 #include "Section.h"
@@ -55,7 +55,7 @@
 	init (true);
 }
 
-#ifdef ENGINE
+#ifdef FALCONDB
 BinaryBlob::BinaryBlob(Dbb * db, int32 recNumber, Section *blobSection)
 {
 	init (false);
@@ -165,7 +165,7 @@
 
 	populated = true;
 
-#ifdef ENGINE
+#ifdef FALCONDB
 	if (repository && isBlobReference())
 		try
 			{

=== modified file 'storage/falcon/Bitmap.cpp'
--- a/storage/falcon/Bitmap.cpp	2008-03-11 16:15:47 +0000
+++ b/storage/falcon/Bitmap.cpp	2008-06-19 15:09:45 +0000
@@ -21,7 +21,7 @@
 #include "Engine.h"
 #include "Bitmap.h"
 
-#ifndef ENGINE
+#ifndef FALCONDB
 #define ASSERT(n)
 #endif
 

=== modified file 'storage/falcon/BlobReference.cpp'
--- a/storage/falcon/BlobReference.cpp	2008-05-14 18:39:57 +0000
+++ b/storage/falcon/BlobReference.cpp	2008-06-19 15:09:45 +0000
@@ -20,7 +20,7 @@
 #include "Engine.h"
 #include "BlobReference.h"
 
-#ifdef ENGINE
+#ifdef FALCONDB
 #include "Stream.h"
 #endif
 
@@ -62,7 +62,7 @@
 }
 
 
-#ifdef ENGINE
+#ifdef FALCONDB
 void BlobReference::getReference(Stream *stream)
 {
 	stream->putSegment ((const char*) repositoryName);

=== modified file 'storage/falcon/BlobReference.h'
--- a/storage/falcon/BlobReference.h	2007-09-20 15:44:25 +0000
+++ b/storage/falcon/BlobReference.h	2008-06-19 15:09:45 +0000
@@ -44,7 +44,7 @@
 	void setReference (int length, UCHAR *buffer);
 	int getReferenceLength();
 	void copy(BlobReference *source);
-#ifdef ENGINE
+#ifdef FALCONDB
 	virtual Stream* getStream();
 	void getReference (Stream *stream);
 	void setReference (int length, Stream *stream);

=== modified file 'storage/falcon/CMakeLists.txt'
--- a/storage/falcon/CMakeLists.txt	2008-06-06 19:20:10 +0000
+++ b/storage/falcon/CMakeLists.txt	2008-06-19 15:09:45 +0000
@@ -14,7 +14,7 @@
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 ADD_DEFINITIONS(-D_REENTRANT
-                -DENGINE -DSTORAGE_ENGINE -DMEM_DEBUG
+                -DFALCONDB -DSTORAGE_ENGINE -DMEM_DEBUG
                 -DNAMESPACE=Nfs
                 -DMYSQL_SERVER)
 INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include

=== modified file 'storage/falcon/DateTime.cpp'
--- a/storage/falcon/DateTime.cpp	2008-05-14 18:39:57 +0000
+++ b/storage/falcon/DateTime.cpp	2008-06-19 15:09:45 +0000
@@ -32,7 +32,7 @@
 #include "SQLError.h"
 #include "Log.h"
 
-#ifdef ENGINE
+#ifdef FALCONDB
 #include "Thread.h"
 #endif
 
@@ -354,7 +354,7 @@
 	for (Alias *alias = aliasData; alias->alias; ++alias)
 		{
 		alias->timeZone = DateTime::findTimeZone (alias->name);
-#ifdef ENGINE
+#ifdef FALCONDB
 		ASSERT (alias->timeZone);
 #endif
 		int slot = JString::hash (alias->alias, HASH_SIZE);
@@ -1163,7 +1163,7 @@
 
 const TimeZone* DateTime::getDefaultTimeZone()
 {
-#ifdef ENGINE
+#ifdef FALCONDB
 	Thread *thread = Thread::findThread();
 
 	if (thread)

=== modified file 'storage/falcon/Decompress.cpp'
--- a/storage/falcon/Decompress.cpp	2007-09-20 15:44:25 +0000
+++ b/storage/falcon/Decompress.cpp	2008-06-19 15:09:45 +0000
@@ -26,7 +26,7 @@
 #include "zlib.h"
 #include "zutil.h"
 
-#ifdef ENGINE
+#ifdef FALCONDB
 #include "JavaArchiveFile.h"
 #endif
 
@@ -85,7 +85,7 @@
 
 	err2 = inflateEnd(&stream);
 
-#ifdef ENGINE
+#ifdef FALCONDB
 	ASSERT (compressedSize == (int) stream.total_in);
 	ASSERT (uncompressedSize == (int) stream.total_out);
 #endif
@@ -226,7 +226,7 @@
 
 int Decompress::skipCompressed(JavaArchiveFile * archive)
 {
-#ifdef ENGINE
+#ifdef FALCONDB
 	Bytef input [1024], output [1024];
 	z_stream stream;
 	memset (&stream, 0, sizeof (stream));

=== modified file 'storage/falcon/Engine.h'
--- a/storage/falcon/Engine.h	2008-05-30 15:40:29 +0000
+++ b/storage/falcon/Engine.h	2008-06-19 15:09:45 +0000
@@ -22,7 +22,7 @@
 
 #include <time.h>
 
-#ifdef ENGINE
+#ifdef FALCONDB
 #define MEMORY_MANAGER
 #endif
 
@@ -136,7 +136,7 @@
 #define INTERLOCK_TYPE	int
 #endif
 
-#ifdef ENGINE
+#ifdef FALCONDB
 #include "Error.h"
 #endif
 

=== modified file 'storage/falcon/Error.cpp'
--- a/storage/falcon/Error.cpp	2008-06-17 00:37:04 +0000
+++ b/storage/falcon/Error.cpp	2008-06-19 17:24:09 +0000
@@ -59,11 +59,11 @@
 	if (vsnprintf (buffer, sizeof (buffer) - 1, string, args) < 0)
 		buffer [sizeof (buffer) - 1] = 0;
 
-#ifdef ENGINE
+#ifdef FALCONDB
 
 	// Always write unrecoverable error info to the error log
+
 	fprintf (stderr, "[Falcon] Error: %s\n", buffer);
-
 	Log::logBreak ("Bugcheck: %s\n", buffer);
 	//MemMgrLogDump();
 #endif
@@ -97,7 +97,7 @@
 
 void Error::notYetImplemented(const char *fileName, int line)
 {
-#ifdef ENGINE
+#ifdef FALCONDB
 	Log::logBreak ("feature not yet implemented at line %d in file %s\n", line, fileName);
 #endif
 

=== modified file 'storage/falcon/Event.cpp'
--- a/storage/falcon/Event.cpp	2007-09-20 15:44:25 +0000
+++ b/storage/falcon/Event.cpp	2008-06-11 18:24:29 +0000
@@ -45,7 +45,7 @@
 	Thread *thread = Thread::getThread("Event::wait");
 	Sync sync(&mutex, "Event::wait");
 	sync.lock(Exclusive);
-	thread->que = (Thread*) waiters;
+	thread->queue = (Thread*) waiters;
 	waiters = thread;
 	sync.unlock();
 
@@ -70,7 +70,7 @@
 		{
 		Sync sync(&mutex, "Event::post");
 		sync.lock(Exclusive);
-		for (Thread *waiter = (Thread*) waiters; waiter; waiter = waiter->que)
+		for (Thread *waiter = (Thread*) waiters; waiter; waiter = waiter->queue)
 			waiter->wake();
 		}
 }
@@ -94,10 +94,10 @@
 	Sync sync(&mutex, "Event::removeWaiter");
 	sync.lock(Exclusive);
 
-	for (Thread **ptr = (Thread**) &waiters; *ptr; ptr = &(*ptr)->que)
+	for (Thread **ptr = (Thread**) &waiters; *ptr; ptr = &(*ptr)->queue)
 		if (*ptr == thread)
 			{
-			*ptr = thread->que;
+			*ptr = thread->queue;
 			return;
 			}
 }

=== modified file 'storage/falcon/License.cpp'
--- a/storage/falcon/License.cpp	2007-09-20 15:44:25 +0000
+++ b/storage/falcon/License.cpp	2008-06-19 15:09:45 +0000
@@ -42,7 +42,7 @@
 #include "TransformUtil.h"
 #include "KeyGen.h"
 
-#ifdef ENGINE
+#ifdef FALCONDB
 #include "Log.h"
 #endif
 
@@ -424,7 +424,7 @@
 
 bool License::invalidLicense(const char *why)
 {
-#ifdef ENGINE
+#ifdef FALCONDB
 	Log::log ("License %s invalid: %s\n", (const char*) id, why);
 #endif
 

=== modified file 'storage/falcon/Makefile.am'
--- a/storage/falcon/Makefile.am	2008-06-06 19:26:53 +0000
+++ b/storage/falcon/Makefile.am	2008-06-19 15:09:45 +0000
@@ -19,7 +19,7 @@
 MYSQL_EXTRA_CXXFLAGS = @FALCON_CXXFLAGS@
 
 DEFS= @DEFS@ \
-      -D_REENTRANT -D_PTHREADS -DENGINE -DSTORAGE_ENGINE -DNAMESPACE=Nfs
+      -D_REENTRANT -D_PTHREADS -DFALCONDB -DSTORAGE_ENGINE -DNAMESPACE=Nfs
 
 INCLUDES= -I$(top_srcdir)/include -I$(top_builddir)/include \
 	  -I$(top_srcdir)/regex -I$(top_srcdir)/sql \

=== modified file 'storage/falcon/MemMgr.cpp'
--- a/storage/falcon/MemMgr.cpp	2008-05-14 18:39:57 +0000
+++ b/storage/falcon/MemMgr.cpp	2008-06-19 15:09:45 +0000
@@ -45,7 +45,7 @@
 #define VALGRIND_MAKE_MEM_UNDEFINED(address, length)
 #endif
 
-#ifdef ENGINE
+#ifdef FALCONDB
 #include "Log.h"
 #include "LogStream.h"
 #endif
@@ -262,7 +262,7 @@
 
 void MemMgrLogDump()
 {
-#ifdef ENGINE
+#ifdef FALCONDB
 	LogStream stream;
 	MemMgrAnalyze (0, &stream);
 #endif
@@ -678,7 +678,7 @@
 
 void MemMgr::corrupt(const char* text)
 {
-#ifdef ENGINE
+#ifdef FALCONDB
 	Log::logBreak ("Memory pool corrupted: %s\n", text);
 #endif
 
@@ -688,7 +688,7 @@
 
 void* MemMgr::memoryIsExhausted(void)
 {
-#ifdef ENGINE
+#ifdef FALCONDB
 	Log::logBreak ("Memory is exhausted\n");
 #endif
 
@@ -969,7 +969,7 @@
 
 				if (!client || client >= endClients)
 					{
-#ifdef ENGINE
+#ifdef FALCONDB
 					Log::debugBreak ("MemMgr::analyze: analysis space exhausted");
 #endif
 					free (memory);
@@ -1028,7 +1028,7 @@
 
 					if (client >= endClients)
 						{
-#ifdef ENGINE
+#ifdef FALCONDB
 						Log::debugBreak ("MemMgr::analyze: analysis space exhausted");
 #endif
 						free (memory);

=== modified file 'storage/falcon/PriorityScheduler.cpp'
--- a/storage/falcon/PriorityScheduler.cpp	2007-11-02 22:11:54 +0000
+++ b/storage/falcon/PriorityScheduler.cpp	2008-06-11 18:24:29 +0000
@@ -51,7 +51,7 @@
 		}
 	
 	Thread *thread = Thread::getThread("PriorityScheduler::schedule");
-	thread->que = waitingThreads[priority];
+	thread->queue = waitingThreads[priority];
 	waitingThreads[priority] = thread;
 	thread->wakeupType = None;
 	sync.unlock();
@@ -83,7 +83,7 @@
 			for (Thread *thread; (thread = waitingThreads[currentPriority]);)
 				{
 				++count;
-				waitingThreads[currentPriority] = thread->que;
+				waitingThreads[currentPriority] = thread->queue;
 				thread->wakeupType = Exclusive;
 				thread->wake();
 				}

=== modified file 'storage/falcon/Protocol.cpp'
--- a/storage/falcon/Protocol.cpp	2007-09-20 15:44:25 +0000
+++ b/storage/falcon/Protocol.cpp	2008-06-19 15:09:45 +0000
@@ -247,7 +247,7 @@
 			}
 			break;
 			
-#ifdef ENGINE
+#ifdef FALCONDB
 		default:
 			ASSERT (false);
 #endif
@@ -389,7 +389,7 @@
 			}
 			break;
 			
-#ifdef ENGINE
+#ifdef FALCONDB
 		default:
 			ASSERT (false);
 #endif

=== modified file 'storage/falcon/SQLError.cpp'
--- a/storage/falcon/SQLError.cpp	2008-04-09 01:36:46 +0000
+++ b/storage/falcon/SQLError.cpp	2008-06-19 15:09:45 +0000
@@ -177,7 +177,7 @@
 
 void SQLError::error(const char *string)
 {
-#ifdef ENGINE
+#ifdef FALCONDB
 	LogLock logLock;
 	Log::log(LogException, "Exception: %s\n", string);
 #endif

=== modified file 'storage/falcon/Socket.cpp'
--- a/storage/falcon/Socket.cpp	2007-09-20 15:44:25 +0000
+++ b/storage/falcon/Socket.cpp	2008-06-19 15:09:45 +0000
@@ -32,7 +32,7 @@
 #include <errno.h>
 #include "Log.h"
 
-#ifdef ENGINE
+#ifdef FALCONDB
 #include "SyncObject.h"
 #include "Sync.h"
 #endif
@@ -71,7 +71,7 @@
 
 static int foo = Socket::initialize();
 
-#ifdef ENGINE
+#ifdef FALCONDB
 SyncObject	hostSyncObject;
 #endif
 
@@ -121,7 +121,7 @@
 
 void Socket::bind(int ipAddress, int port)
 {
-#ifdef ENGINE
+#ifdef FALCONDB
 	ASSERT (INADDR_ANY == 0);
 #endif
 	create();
@@ -139,7 +139,7 @@
 
 }
 
-#ifndef ENGINE
+#ifndef FALCONDB
 Socket* Socket::acceptSocket()
 {
 	struct sockaddr_in	address;
@@ -343,13 +343,13 @@
 	address.sin_family = AF_INET;
 	address.sin_port = htons (portNumber);
 
-#ifdef ENGINE
+#ifdef FALCONDB
 	Sync sync (&hostSyncObject, "Socket::connect");
 #endif
 
 	if (host)
 		{
-#ifdef ENGINE
+#ifdef FALCONDB
 		sync.lock (Exclusive);
 #endif
 		struct hostent	*hp = gethostbyname (hostname);
@@ -608,7 +608,7 @@
 
 JString Socket::getLocalName()
 {
-#ifdef ENGINE
+#ifdef FALCONDB
 	Sync sync (&hostSyncObject, "Socket::getLocalName");
 	sync.lock (Exclusive);
 #endif
@@ -635,7 +635,7 @@
 
 int32 Socket::translateAddress(const char *hostname)
 {
-#ifdef ENGINE
+#ifdef FALCONDB
 	Sync sync (&hostSyncObject, "Socket::translateAddress");
 	sync.lock (Exclusive);
 #endif

=== modified file 'storage/falcon/Socket.h'
--- a/storage/falcon/Socket.h	2008-03-11 16:15:47 +0000
+++ b/storage/falcon/Socket.h	2008-06-19 15:09:45 +0000
@@ -81,7 +81,7 @@
 	bool getBoolean();
 	void putBoolean (bool value);
 
-#ifdef ENGINE
+#ifdef FALCONDB
 	Protocol* acceptProtocol();
 #else
 	Socket*		acceptSocket();

=== modified file 'storage/falcon/Stream.cpp'
--- a/storage/falcon/Stream.cpp	2008-04-09 01:36:46 +0000
+++ b/storage/falcon/Stream.cpp	2008-06-19 15:09:45 +0000
@@ -33,7 +33,7 @@
 #include "Blob.h"
 #include "Log.h"
 
-#ifdef ENGINE
+#ifdef FALCONDB
 #include "Record.h"
 #else
 #undef ASSERT
@@ -246,7 +246,7 @@
 	return string;
 }
 
-#ifdef ENGINE
+#ifdef FALCONDB
 void Stream::compress(int length, void * address)
 {
 	//printShorts ("Original data", (length + 1) / 2, (short*) address);
@@ -328,7 +328,7 @@
 		while (p < end)
 			{
 			short n = *p++;
-//#ifdef ENGINE
+//#ifdef FALCONDB
 			if (n == 0 && run == 0)
 				{
 				Log::log ("corrupted record (zero run), table %d, record %d\n", tableId,
recordNumber);
@@ -350,7 +350,7 @@
 				
 				if (q + run > limit)
 					{
-//#ifdef ENGINE
+//#ifdef FALCONDB
 					Log::log ("corrupted record (overrun), table %d, record %d\n", tableId,
recordNumber);
 					printShorts ("Compressed", (segment->length + 1)/2, (short*)
segment->address);
 					printChars ("Compressed", segment->length, segment->address);
@@ -538,7 +538,7 @@
 
 	if (seg.remaining > 0)
 		seg.copy (alloc (seg.remaining), seg.remaining);
-#ifdef ENGINE
+#ifdef FALCONDB
 	else if (seg.remaining < 0)
 		Log::debug ("Stream::putSegment: apparent blob overflow\n");
 #endif

=== modified file 'storage/falcon/Stream.h'
--- a/storage/falcon/Stream.h	2007-09-20 15:44:25 +0000
+++ b/storage/falcon/Stream.h	2008-06-19 15:09:45 +0000
@@ -71,7 +71,7 @@
 	Segment*		allocSegment (int tail);
 	void			setMinSegment (int length);
 
-#ifdef ENGINE
+#ifdef FALCONDB
 	char*			decompress(int tableId, int recordNumber);
 	void			compress (int length, void *address);
 	void			printShorts (const char *msg, int length, short *data);

=== modified file 'storage/falcon/StreamSegment.cpp'
--- a/storage/falcon/StreamSegment.cpp	2007-09-20 15:44:25 +0000
+++ b/storage/falcon/StreamSegment.cpp	2008-06-19 15:09:45 +0000
@@ -22,7 +22,7 @@
 #include "StreamSegment.h"
 #include "Stream.h"
 
-#ifndef ENGINE
+#ifndef FALCONDB
 #undef ASSERT
 #define ASSERT(a)
 #endif

=== modified file 'storage/falcon/SyncObject.cpp'
--- a/storage/falcon/SyncObject.cpp	2008-05-14 22:31:23 +0000
+++ b/storage/falcon/SyncObject.cpp	2008-06-19 15:09:45 +0000
@@ -28,7 +28,7 @@
 #undef TRACE
 #endif
 
-#ifdef ENGINE
+#ifdef FALCONDB
 #define TRACE
 #else
 #define ASSERT(b)
@@ -47,6 +47,7 @@
 #include "Stream.h"
 #include "InfoTable.h"
 
+#define FAST_SHARED
 //#define STALL_THRESHOLD	1000
 
 #define BACKOFF	\
@@ -102,9 +103,10 @@
 
 SyncObject::SyncObject()
 {
+	readers = 0;
 	waiters = 0;
 	lockState = 0;
-	que = NULL;
+	queue = NULL;
 	monitorCount = 0;
 	stalls = 0;
 	exclusiveThread = NULL;
@@ -137,6 +139,7 @@
 #endif
 }
 
+#ifdef FAST_SHARED
 void SyncObject::lock(Sync *sync, LockType type, int timeout)
 {
 	Thread *thread;
@@ -146,10 +149,177 @@
 		where = sync->where;
 #endif
 	
+	// Shared case
+	
 	if (type == Shared)
 		{
 		thread = NULL;
 		BUMP_INTERLOCKED(sharedCount);
+		INTERLOCKED_INCREMENT(readers);
+		
+		// If there aren't any writers, we've got the lock.  Ducky.
+		
+		if (lockState == 0)
+			{
+			DEBUG_FREEZE;
+			
+			return;
+			}
+
+		// See if we have already have the lock, in which case bump the monitor and get going
+		
+		if (!thread)
+			thread = Thread::getThread("SyncObject::lock");
+
+		if (thread == exclusiveThread)
+			{
+			INTERLOCKED_DECREMENT(readers);
+			++monitorCount;
+			DEBUG_FREEZE;
+			
+			return;
+			}
+
+		// We have contention.  Get the mutex and prepare the wait, but
+		// maybe we'll get lucky
+					
+		mutex.lock();
+
+		if (lockState == 0)
+			{
+			DEBUG_FREEZE;
+			
+			return;
+			}
+
+		// If there isn't an exclusive thread or the exclusive thread is stalled, we've got the
lock
+		
+		if (!exclusiveThread || exclusiveThread == queue)
+			{
+			DEBUG_FREEZE;
+			
+			return;
+			}
+		
+		// There is an outstanding exclusive lock; wait
+		
+		INTERLOCKED_DECREMENT(readers);
+		bumpWaiters(1);
+		wait(type, thread, sync, timeout);
+		DEBUG_FREEZE;
+		
+		return;
+		}
+	
+	// Exclusive case
+	
+	thread = Thread::getThread("SyncObject::lock");
+	thread->backoff = BACKOFF_INTERVAL;
+	ASSERT(thread);
+
+	// If we're already the exclusive thread, just bump the monitor count and we're done
+	
+	if (thread == exclusiveThread)
+		{
+		++monitorCount;
+		BUMP(exclusiveCount);
+		DEBUG_FREEZE;
+		
+		return;
+		}
+
+	// If nothing is pending, go for the lock.
+	
+	while (readers == 0 && waiters == 0)
+		{
+		INTERLOCK_TYPE oldState = lockState;
+		
+		if (oldState != 0)
+			break;
+			
+		if (COMPARE_EXCHANGE(&lockState, oldState, -1))
+			{
+			exclusiveThread = thread;
+
+			if (readers)
+				{
+				mutex.lock();
+				
+				if (readers)
+					{
+					if (queue && queue->lockType == Shared)
+						BUMP(exclusiveCount);
+					bumpWaiters(1);
+					wait(type, thread, sync, timeout);
+					}
+				
+				}
+				
+			BUMP(exclusiveCount);
+			DEBUG_FREEZE;
+			
+			return; 
+			}
+		
+		BACKOFF;
+		}
+		
+	mutex.lock();
+	bumpWaiters(1);
+	BUMP(exclusiveCount);
+	
+	while (readers == 0 && queue == NULL)
+		{
+		INTERLOCK_TYPE oldState = lockState;
+		
+		if (oldState != 0)
+			break;
+			
+		if (COMPARE_EXCHANGE(&lockState, oldState, -1))
+			{
+			exclusiveThread = thread;
+
+			if (readers)
+				{
+				wait(type, thread, sync, timeout);
+				DEBUG_FREEZE;
+				
+				return;
+				}
+
+			bumpWaiters(-1);
+			mutex.release();
+			DEBUG_FREEZE;
+			
+			return;
+			}
+		
+		BACKOFF;
+		}
+
+	// mutex is held going into wait() It is released before coming out.
+
+	wait(type, thread, sync, timeout);
+	DEBUG_FREEZE;
+}
+
+#else	// FAST_SHARED
+
+// Old (aka working) version
+
+void SyncObject::lock(Sync *sync, LockType type, int timeout)
+{
+	Thread *thread;
+
+#ifdef TRACE_SYNC_OBJECTS
+	if (sync)
+		where = sync->where;
+#endif
+	
+	if (type == Shared)
+		{
+		thread = NULL;
+		//BUMP_INTERLOCKED(sharedCount);
 
 		for(;;)
 			{
@@ -245,7 +415,7 @@
 		bumpWaiters(1);
 		BUMP(exclusiveCount);
 		
-		while (que == NULL)
+		while (queue == NULL)
 			{
 			INTERLOCK_TYPE oldState = lockState;
 			
@@ -271,7 +441,57 @@
 	wait(type, thread, sync, timeout);
 	DEBUG_FREEZE;
 }
-
+#endif // FAST_SHARED
+
+#ifdef FAST_SHARED
+void SyncObject::unlock(Sync *sync, LockType type)
+{
+	if (monitorCount)
+		{
+		//ASSERT (monitorCount > 0);
+		--monitorCount;
+		DEBUG_FREEZE;
+
+		return;
+		}
+	
+	if (type == Shared)
+		{
+		ASSERT(readers > 0);
+		
+		if (INTERLOCKED_DECREMENT(readers) == 0 && waiters)
+			grantLocks();
+			
+		return;
+		}
+	
+	ASSERT(lockState == -1 && exclusiveThread != queue);
+	Thread *thread = NULL;
+	
+	for (;;)
+		{
+		//ASSERT (type == Exclusive && lockState == -1);
+		long oldState = lockState;
+		long newState = (type == Shared) ? oldState - 1 : 0;
+		exclusiveThread = NULL;
+		
+		if (COMPARE_EXCHANGE(&lockState, oldState, newState))
+			{
+			DEBUG_FREEZE;
+
+			if (waiters)
+				grantLocks();
+				
+			return;
+			}
+			
+		BACKOFF;
+		}
+
+	DEBUG_FREEZE;
+}
+
+#else // FAST_SHARED
 void SyncObject::unlock(Sync *sync, LockType type)
 {
 	//ASSERT(lockState != 0);
@@ -309,6 +529,31 @@
 
 	DEBUG_FREEZE;
 }
+#endif
+
+#ifdef FAST_SHARED
+
+void SyncObject::downGrade(LockType type)
+{
+	ASSERT (monitorCount == 0);
+	ASSERT (type == Shared);
+	ASSERT (lockState == -1);
+	INTERLOCKED_INCREMENT(readers);
+	
+	for (;;)
+		if (COMPARE_EXCHANGE(&lockState, -1, 0))
+			{
+			exclusiveThread = NULL;
+			DEBUG_FREEZE;
+			
+			if (waiters)
+				grantLocks();
+
+			return;
+			}
+}
+
+#else // FAST_SHARED
 
 void SyncObject::downGrade(LockType type)
 {
@@ -328,6 +573,7 @@
 			return;
 			}
 }
+#endif //FAST_SHARED
 
 void SyncObject::wait(LockType type, Thread *thread, Sync *sync, int timeout)
 {
@@ -343,7 +589,7 @@
 
 	Thread *volatile *ptr;
 	
-	for (ptr = &que; *ptr; ptr = &(*ptr)->que)
+	for (ptr = &queue; *ptr; ptr = &(*ptr)->queue)
 		{
 		BUMP(queueLength);
 		
@@ -351,7 +597,7 @@
 			{
 			LOG_DEBUG ("Apparent single thread deadlock for thread %d (%x)\n",
thread->threadId, thread);
 			
-			for (Thread *thread = que; thread; thread = thread->que)
+			for (Thread *thread = queue; thread; thread = thread->queue)
 				thread->print();
 				
 			mutex.release();
@@ -359,7 +605,7 @@
 			}
 		}
 
-	thread->que = NULL;
+	thread->queue = NULL;
 	thread->lockType = type;
 	*ptr = thread;
 	thread->lockGranted = false;
@@ -378,10 +624,10 @@
 				return;
 				}
 			
-			for (ptr = &que; *ptr; ptr = &(*ptr)->que)
+			for (ptr = &queue; *ptr; ptr = &(*ptr)->queue)
 				if (*ptr == thread)
 					{
-					*ptr = thread->que;
+					*ptr = thread->queue;
 					--waiters;
 					break;
 					}
@@ -393,7 +639,6 @@
 				}
 			}
 		
-		
 	while (!thread->lockGranted)
 		{
 		wokeup = thread->sleep (10000, &mutex);
@@ -455,10 +700,10 @@
 #ifdef TRACE
 	if (syncObjects.appendUnique(this))
 		{
-		if (exclusiveThread)
+		if (exclusiveThread && exclusiveThread != queue)
 			exclusiveThread->findLocks(threads, syncObjects);
 
-		for (Thread *thread = que; thread; thread = thread->que)
+		for (Thread *thread = queue; thread; thread = thread->queue)
 			thread->findLocks(threads, syncObjects);
 		}
 #endif
@@ -467,13 +712,13 @@
 void SyncObject::print()
 {
 #ifdef TRACE
-	LOG_DEBUG ("  SyncObject %lx: state %d, monitor %d, waiters %d\n", 
-				this, lockState, monitorCount, waiters);
+	LOG_DEBUG ("  SyncObject %lx: state %d, readers %d, monitor %d, waiters %d\n", 
+				this, lockState, readers, monitorCount, waiters);
 
 	if (exclusiveThread)
 		exclusiveThread->print ("    Exclusive thread");
 
-	for (Thread *volatile thread = que; thread; thread = thread->que)
+	for (Thread *volatile thread = queue; thread; thread = thread->queue)
 		thread->print ("    Waiting thread");
 #endif
 }
@@ -501,18 +746,88 @@
 			}
 }
 
-void SyncObject::grantLocks(void)
-{
-	mutex.lock();
-	ASSERT ((waiters && que) || (!waiters && !que));
-	const char *description = NULL;
-	Thread *thread = NULL;
-	
-	for (Thread *waiter = que, *prior = NULL, *next; waiter; waiter = next)
-		{
-		description = waiter->description;
-		bool granted = false;
-		next = waiter->que;
+#ifdef FAST_SHARED
+void SyncObject::grantLocks(void)
+{
+	mutex.lock();
+	ASSERT ((waiters && queue) || (!waiters && !queue));
+	const char *description = NULL;
+	Thread *thread = NULL;
+	
+	for (Thread *waiter = queue, *prior = NULL, *next; waiter; waiter = next)
+		{
+		description = waiter->description;
+		bool granted = false;
+		next = waiter->queue;
+				
+		if (waiter->lockType == Shared)
+			{
+			INTERLOCKED_INCREMENT(readers);
+			granted = true;
+			}
+		else
+			{
+			ASSERT(waiter->lockType == Exclusive);
+			
+			if (exclusiveThread == waiter)
+				{
+				ASSERT(lockState == -1);
+				granted = true;
+				}
+			else
+				while (lockState == 0)
+					{
+					if (COMPARE_EXCHANGE(&lockState, 0, -1))
+						{
+						granted = true;
+						exclusiveThread = waiter;
+						break;
+						}
+					
+					BACKOFF;
+					}
+			}
+		
+		if (granted)
+			{
+			if (prior)
+				prior->queue = next;
+			else
+				queue = next;
+			
+			bool shutdownInProgress = waiter->shutdownInProgress;
+			
+			if (shutdownInProgress)
+				Thread::lockExitMutex();
+					
+			bumpWaiters(-1);
+			--waiter->activeLocks;
+			waiter->grantLock (this);
+			
+			if (shutdownInProgress)
+				Thread::unlockExitMutex();
+			}
+		else
+			prior = waiter;
+		}
+			
+	mutex.release();
+}
+
+#else // FAST_SHARED
+
+void SyncObject::grantLocks(void)
+{
+	mutex.lock();
+	ASSERT ((waiters && queue) || (!waiters && !queue));
+	const char *description = NULL;
+	Thread *thread = NULL;
+	
+	for (Thread *waiter = queue, *prior = NULL, *next; waiter; waiter = next)
+		{
+		description = waiter->description;
+		bool granted = false;
+		next = waiter->queue;
 				
 		if (waiter->lockType == Shared)
 			for (int oldState; (oldState = lockState) >= 0;)
@@ -548,9 +863,9 @@
 		if (granted)
 			{
 			if (prior)
-				prior->que = next;
+				prior->queue = next;
 			else
-				que = next;
+				queue = next;
 			
 			bool shutdownInProgress = waiter->shutdownInProgress;
 			
@@ -570,12 +885,38 @@
 			
 	mutex.release();
 }
+#endif // FAST_SHARED
 
 int SyncObject::getState(void)
 {
 	return lockState;
 }
 
+#ifdef FAST_SHARED
+
+void SyncObject::validate(LockType lockType)
+{
+	switch (lockType)
+		{
+		case None:
+			ASSERT (lockState == 0 && readers == 0);
+			break;
+		
+		case Shared:
+			ASSERT (readers > 0 && !(exclusiveThread && exclusiveThread !=
queue));
+			break;
+		
+		case Exclusive:
+			ASSERT (lockState == -1 && (readers == 0 || queue != NULL));
+			break;
+		
+		case Invalid:
+			break;
+		}
+}
+
+#else
+
 void SyncObject::validate(LockType lockType)
 {
 	switch (lockType)
@@ -596,6 +937,20 @@
 			break;
 		}
 }
+#endif // FAST_SHARED
+
+#ifdef FAST_SHARED
+void SyncObject::unlock(void)
+{
+	if (exclusiveThread && exclusiveThread != queue)
+		unlock(NULL, Exclusive);
+	else if (readers > 0)
+		unlock (NULL, Shared);
+	else
+		ASSERT(false);
+}
+
+#else //FAST_SHARED
 
 void SyncObject::unlock(void)
 {
@@ -606,6 +961,7 @@
 	else
 		ASSERT(false);
 }
+#endif //FAST_SHARED
 
 bool SyncObject::ourExclusiveLock(void)
 {
@@ -617,7 +973,7 @@
 
 void SyncObject::frequentStaller(Thread *thread, Sync *sync)
 {
-	Thread *threadQue = thread->que;
+	Thread *threadQue = thread->queue;
 	LockType lockType = thread->lockType;
 	bool lockGranted = thread->lockGranted;
 	Sync *lockPending = thread->lockPending;
@@ -627,7 +983,7 @@
 	else
 		LOG_DEBUG("Frequent stall from unknown\n");
 		
-	thread->que = threadQue;
+	thread->queue = threadQue;
 	thread->lockType = lockType;
 	thread->lockGranted = lockGranted;
 	thread->lockPending = lockPending;

=== modified file 'storage/falcon/SyncObject.h'
--- a/storage/falcon/SyncObject.h	2008-05-14 19:49:03 +0000
+++ b/storage/falcon/SyncObject.h	2008-06-19 15:09:45 +0000
@@ -86,19 +86,20 @@
 	static void		getSyncInfo(InfoTable* infoTable);
 	static void		dump(void);
 
-	inline Thread* getExclusiveThread()
+	inline Thread*	getExclusiveThread()
 		{ return exclusiveThread; };
 
 protected:
-	void wait(LockType type, Thread *thread, Sync *sync, int timeout);
+	void			wait(LockType type, Thread *thread, Sync *sync, int timeout);
 
-	int32				monitorCount;
-	Mutex				mutex;
-	Thread				*volatile que;
-	Thread				*volatile exclusiveThread;
-	volatile INTERLOCK_TYPE		waiters;
-	volatile INTERLOCK_TYPE		lockState;
-	int					stalls;
+	int32					monitorCount;
+	Mutex					mutex;
+	Thread					*volatile queue;
+	Thread					*volatile exclusiveThread;
+	volatile INTERLOCK_TYPE	readers;
+	volatile INTERLOCK_TYPE	waiters;
+	volatile INTERLOCK_TYPE	lockState;
+	int						stalls;
 
 #ifdef TRACE_SYNC_OBJECTS
 	int					objectId;

=== modified file 'storage/falcon/SyncTest.cpp'
--- a/storage/falcon/SyncTest.cpp	2008-05-14 22:31:23 +0000
+++ b/storage/falcon/SyncTest.cpp	2008-06-12 16:43:53 +0000
@@ -78,7 +78,7 @@
 			}
 			
 		sync.unlock();
-		Thread::sleep(5000);
+		Thread::sleep(1000);
 		stop = true;
 		threadBarn->waitForAll();
 		int total = 0;
@@ -86,8 +86,12 @@
 		for (thd = 0; thd < n; ++thd)
 			total += threads[thd].count;
 		
-		grandTotal += total;
-		printf("%d threads, %d cycles, %d collisions\n", n, total,
syncObject.getCollisionCount() - collisions);
+		if (n != 1)
+			grandTotal += total;
+			
+		printf("%d threads, %s cycles, %s collisions\n", n, 
+				(const char*) format(total), 
+				(const char*) format(syncObject.getCollisionCount() - collisions));
 
 		/***
 		for (thd = 0; thd < n; ++thd)
@@ -97,7 +101,7 @@
 		***/
 		}
 	
-	printf ("Average cycles %d\n", grandTotal / MAX_THREADS);
+	printf ("Average cycles %s\n", (const char*) format(grandTotal / (MAX_THREADS - 1)));
 	threadBarn->shutdownAll();
 	threadBarn->waitForAll();
 	threadBarn->release();
@@ -123,3 +127,40 @@
 		sync.unlock();
 		}
 }
+
+JString SyncTest::format(long num)
+{
+	char temp[32];
+	long number = num;
+	char *p = temp + sizeof(temp);
+	*--p = 0;
+	
+	if (number == 0)
+		{
+		*--p = '0';
+		
+		return p;
+		}
+	
+	bool neg = false;
+	
+	if (number < 0)
+		{
+		neg = true;
+		number = -number;
+		}
+		
+	for (int n = 1; number; ++n)
+		{
+		*--p = (char) (number % 10) + '0';
+		number /= 10;
+				
+		if (number && (n % 3 == 0))
+			*--p = ',';
+		}
+	
+	if (neg)
+		*--p = '-';
+		
+	return JString(p);
+}

=== modified file 'storage/falcon/SyncTest.h'
--- a/storage/falcon/SyncTest.h	2007-09-20 15:44:25 +0000
+++ b/storage/falcon/SyncTest.h	2008-06-12 16:43:53 +0000
@@ -32,6 +32,7 @@
 	static void testThread(void* parameter);
 	void		test();
 	void		testThread(void);
+	JString		format(long number);
 	
 	bool		stop;
 	bool		ready;
@@ -41,7 +42,6 @@
 	SyncTest	*parent;
 	SyncObject	starter;
 	SyncObject	syncObject;
-	
 };
 
 #endif

=== modified file 'storage/falcon/Synchronize.cpp'
--- a/storage/falcon/Synchronize.cpp	2008-04-24 17:26:34 +0000
+++ b/storage/falcon/Synchronize.cpp	2008-06-19 15:09:45 +0000
@@ -36,7 +36,7 @@
 #include "Interlock.h"
 #include "Mutex.h"
 
-#ifdef ENGINE
+#ifdef FALCONDB
 #include "Log.h"
 #define CHECK_RET(text,code)	if (ret) Error::error (text,code)
 #else
@@ -200,7 +200,7 @@
 			}
 			
 		if (!wakeup)
-#ifdef ENGINE
+#ifdef FALCONDB
 			Log::debug ("Synchronize::sleep(milliseconds): unexpected wakeup, ret %d\n", ret);
 #else
 			printf ("Synchronize::sleep(milliseconds): unexpected wakeup, ret %d\n", ret);

=== modified file 'storage/falcon/Synchronize.h'
--- a/storage/falcon/Synchronize.h	2008-03-27 06:27:57 +0000
+++ b/storage/falcon/Synchronize.h	2008-06-19 15:09:45 +0000
@@ -39,7 +39,7 @@
 #define DEBUG_FREEZE
 #endif
 
-#ifdef ENGINE
+#ifdef FALCONDB
 #define LOG_DEBUG	Log::debug
 #define DEBUG_BREAK	Log::debugBreak
 #else

=== modified file 'storage/falcon/Thread.cpp'
--- a/storage/falcon/Thread.cpp	2008-05-14 19:49:03 +0000
+++ b/storage/falcon/Thread.cpp	2008-06-19 15:09:45 +0000
@@ -123,7 +123,7 @@
 
 Thread::~Thread()
 {
-#ifdef ENGINE
+#ifdef FALCONDB
 	//Log::log ("deleting thread %x: %s\n", threadId, description);
 #endif
 
@@ -195,7 +195,7 @@
 		}
 	catch (SQLException& exception)
 		{
-#ifdef ENGINE
+#ifdef FALCONDB
 		Log::log ("Thread::thread: thread %d: %s\n", threadId, exception.getText());
 #endif
 		release();
@@ -203,7 +203,7 @@
 		}
 	catch (...)
 		{
-#ifdef ENGINE
+#ifdef FALCONDB
 		Log::log ("Thread::thread: unexpected exception, rethrowing, thread %d\n", threadId);
 #endif
 		release();
@@ -213,7 +213,7 @@
 	if (threadBarn)
 		setThreadBarn (NULL);
 
-#ifdef ENGINE
+#ifdef FALCONDB
 	if (shutdownInProgress)
 		; //Log::log ("Thread::thread: %x exitting\n", threadId);
 	else
@@ -352,7 +352,7 @@
 		if (threadBarn)
 			threadBarn->print();
 			
-#ifdef ENGINE
+#ifdef FALCONDB
 		MemMgrLogDump();
 #endif
 

=== modified file 'storage/falcon/Thread.h'
--- a/storage/falcon/Thread.h	2008-05-14 19:49:03 +0000
+++ b/storage/falcon/Thread.h	2008-06-11 18:24:29 +0000
@@ -92,7 +92,7 @@
 	Threads			*threadBarn;
 	Thread			*next;				// next thread in "thread barn"
 	Thread			*prior;				// next thread in "thread barn"
-	Thread			*que;				// next thread in wait que (see SyncObject)
+	Thread			*queue;				// next thread in wait que (see SyncObject)
 	Thread			*srlQueue;			// serial log queue
 	LockType		lockType;			// requested lock type (see SyncObject)
 	LockType		wakeupType;			// used by SerialLog::flush

=== modified file 'storage/falcon/Types.h'
--- a/storage/falcon/Types.h	2007-09-20 15:44:25 +0000
+++ b/storage/falcon/Types.h	2008-06-19 15:09:45 +0000
@@ -43,7 +43,7 @@
 	Biginteger		// 17
 	};
 
-#ifdef ENGINE
+#ifdef FALCONDB
 #define JDBC_TYPES
 #endif
 

Thread
commit into mysql-6.0-falcon branch (olav:2713) Olav Sandstaa20 Jun