List:Commits« Previous MessageNext Message »
From:U-ROWVWADEjas Date:November 30 2007 7:46pm
Subject:bk commit into 6.0 tree (jas:1.2708)
View as plain text  
Below is the list of changes that have just been committed into a local
6.0 repository of . When  does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-11-30 14:45:50-05:00, jas@rowvwade. +6 -0
  Move truncate lock from StorageTable to StorageTableShare where
  it can do some good.

  storage/falcon/Section.h@stripped, 2007-11-30 14:45:32-05:00, jas@rowvwade. +15 -15
    Aesthetic restructuring.

  storage/falcon/StorageTable.cpp@stripped, 2007-11-30 14:45:33-05:00, jas@rowvwade. +0 -29
    Move truncate lock from StorageTable to StorageTableShare where
    it can do some good.

  storage/falcon/StorageTable.h@stripped, 2007-11-30 14:45:33-05:00, jas@rowvwade. +1 -5
    Move truncate lock from StorageTable to StorageTableShare where
    it can do some good.

  storage/falcon/StorageTableShare.cpp@stripped, 2007-11-30 14:45:34-05:00, jas@rowvwade. +28 -0
    Move truncate lock from StorageTable to StorageTableShare where
    it can do some good.

  storage/falcon/StorageTableShare.h@stripped, 2007-11-30 14:45:34-05:00, jas@rowvwade. +4 -0
    Move truncate lock from StorageTable to StorageTableShare where
    it can do some good.

  storage/falcon/ha_falcon.cpp@stripped, 2007-11-30 14:45:34-05:00, jas@rowvwade. +10 -10
    Move truncate lock from StorageTable to StorageTableShare where
    it can do some good.

diff -Nrup a/storage/falcon/Section.h b/storage/falcon/Section.h
--- a/storage/falcon/Section.h	2007-10-24 12:30:38 -04:00
+++ b/storage/falcon/Section.h	2007-11-30 14:45:32 -05:00
@@ -46,21 +46,21 @@ public:
 	Section(Dbb *dbb, int32 id, TransId transId);
 	virtual ~Section();
 
-	void	reInsertStub(int32 recordNumber, TransId transId);
-	void	markFull (bool isFull, int sequence, TransId transId);
-	void	expungeRecord (int32 recordNumber);
-	void	analyze (SectionAnalysis *analysis, int pageNumber);
-	int		storeTail (Stream *stream, int maxLength, int *pLength, TransId transId, bool earlyWrite);
-	int32	findNextRecord (int32 startingRecord, Stream *stream);
-	int32	findNextRecord (int32 pageNumber, int32 startingRecord, Stream *stream);
-	bool	fetchRecord (int32 recordNumber, Stream *stream, TransId transId);
-	void	storeRecord (RecordLocatorPage *recordLocatorPage, int32 indexPageNumber, RecordIndex *index, Stream *stream, TransId transId, bool earlyWrite);
-	int		deleteLine (Bdb *bdb, int line, int32 sectionPageNumber, TransId transId, RecordLocatorPage *locatorPage, int locatorLine);
-	void	updateRecord (int32 recordId, Stream *stream, TransId transId, bool earlyWrite);
-	int32	insertStub (TransId transId);
-	int32	getSectionRoot();
-	Bdb*	getSectionPage(int sequence, LockType lockType, TransId transId);
-	Bdb*	fetchLocatorPage (int32 root, int32 recordNumber, LockType lockType, TransId transId);
+	void		reInsertStub(int32 recordNumber, TransId transId);
+	void		markFull (bool isFull, int sequence, TransId transId);
+	void		expungeRecord (int32 recordNumber);
+	void		analyze (SectionAnalysis *analysis, int pageNumber);
+	int			storeTail (Stream *stream, int maxLength, int *pLength, TransId transId, bool earlyWrite);
+	int32		findNextRecord (int32 startingRecord, Stream *stream);
+	int32		findNextRecord (int32 pageNumber, int32 startingRecord, Stream *stream);
+	bool		fetchRecord (int32 recordNumber, Stream *stream, TransId transId);
+	void		storeRecord (RecordLocatorPage *recordLocatorPage, int32 indexPageNumber, RecordIndex *index, Stream *stream, TransId transId, bool earlyWrite);
+	int			deleteLine (Bdb *bdb, int line, int32 sectionPageNumber, TransId transId, RecordLocatorPage *locatorPage, int locatorLine);
+	void		updateRecord (int32 recordId, Stream *stream, TransId transId, bool earlyWrite);
+	int32		insertStub (TransId transId);
+	int32		getSectionRoot();
+	Bdb*		getSectionPage(int sequence, LockType lockType, TransId transId);
+	Bdb*		fetchLocatorPage (int32 root, int32 recordNumber, LockType lockType, TransId transId);
 
 	static void		redoSectionPromotion(Dbb* dbb, int sectionId, int32 rootPageNumber, int pageLength, const UCHAR* pageData, int32 newPageNumber);
 	void			redoRecordLocatorPage(int sequence, int32 pageNumber, bool isPostFlush);
diff -Nrup a/storage/falcon/StorageTable.cpp b/storage/falcon/StorageTable.cpp
--- a/storage/falcon/StorageTable.cpp	2007-11-29 12:41:45 -05:00
+++ b/storage/falcon/StorageTable.cpp	2007-11-30 14:45:33 -05:00
@@ -49,16 +49,10 @@ StorageTable::StorageTable(StorageConnec
 	upperBound = lowerBound = NULL;
 	record = NULL;
 	recordLocked = false;
-	haveTruncateLock = false;
-	syncTruncate = new SyncObject;
-	syncTruncate->setName("StorageTable::syncTruncate");
 }
 
 StorageTable::~StorageTable(void)
 {
-	clearTruncateLock();
-	delete syncTruncate;
-	
 	if (bitmap)
 		((Bitmap*) bitmap)->release();
 
@@ -80,8 +74,6 @@ int StorageTable::open(void)
 
 int StorageTable::deleteTable(void)
 {
-	clearTruncateLock();
-	
 	int ret = share->deleteTable(storageConnection);
 	
 	if (ret == 0)
@@ -92,31 +84,10 @@ int StorageTable::deleteTable(void)
 
 int StorageTable::truncateTable(void)
 {
-	Sync sync(syncTruncate, "StorageTable::truncateTable");
-	sync.lock(Exclusive);
-	
 	clearRecord();
 	int ret = share->truncateTable(storageConnection);
 	
 	return ret;
-}
-
-void StorageTable::clearTruncateLock(void)
-{
-	if (haveTruncateLock)
-		{
-		syncTruncate->unlock();
-		haveTruncateLock = false;
-		}
-}
-
-void StorageTable::setTruncateLock()
-{
-	if (!haveTruncateLock)
-		{
-		syncTruncate->lock(NULL, Shared);
-		haveTruncateLock = true;
-		}
 }
 
 int StorageTable::insert(void)
diff -Nrup a/storage/falcon/StorageTable.h b/storage/falcon/StorageTable.h
--- a/storage/falcon/StorageTable.h	2007-11-29 12:41:45 -05:00
+++ b/storage/falcon/StorageTable.h	2007-11-30 14:45:33 -05:00
@@ -61,9 +61,7 @@ public:
 	void			clearAlter(void);
 	bool			setAlter(void);
 	
-	void			clearTruncateLock(void);
-	void			setTruncateLock();
-	
+
 	virtual void	setConnection(StorageConnection* connection);
 	virtual void	clearIndexBounds(void);
 	virtual void	clearRecord(void);
@@ -104,7 +102,6 @@ public:
 	virtual int		optimize(void);
 	virtual void	setLocalTable(StorageInterface* handler);
 
-	SyncObject			*syncTruncate;
 	JString				name;
 	StorageTable		*collision;
 	StorageConnection	*storageConnection;
@@ -122,7 +119,6 @@ public:
 	Stream				insertStream;
 	int					searchFlags;
 	bool				recordLocked;
-	bool				haveTruncateLock;
 };
 
 #endif
diff -Nrup a/storage/falcon/StorageTableShare.cpp b/storage/falcon/StorageTableShare.cpp
--- a/storage/falcon/StorageTableShare.cpp	2007-11-13 17:09:36 -05:00
+++ b/storage/falcon/StorageTableShare.cpp	2007-11-30 14:45:34 -05:00
@@ -57,12 +57,16 @@ StorageTableShare::StorageTableShare(Sto
 	storageDatabase = NULL;
 	impure = new UCHAR[lockSize];
 	initialized = false;
+	haveTruncateLock = false;
 	table = NULL;
 	indexes = NULL;
 	syncObject = new SyncObject;
+	syncObject->setName("StorageTableShare::syncObject");
 	sequence = NULL;
 	tempTable = tempTbl;
 	setPath(path);
+	syncTruncate = new SyncObject;
+	syncTruncate->setName("StorageTableShare::syncTruncate");
 	
 	if (tempTable)
 		tableSpace = TEMPORARY_TABLESPACE;
@@ -74,7 +78,9 @@ StorageTableShare::StorageTableShare(Sto
 
 StorageTableShare::~StorageTableShare(void)
 {
+	clearTruncateLock();
 	delete syncObject;
+	delete syncTruncate;
 	delete [] impure;
 	
 	if (storageDatabase)
@@ -127,6 +133,7 @@ int StorageTableShare::create(StorageCon
 
 int StorageTableShare::deleteTable(StorageConnection *storageConnection)
 {
+	clearTruncateLock();
 	int res = storageDatabase->deleteTable(storageConnection, this);
 	
 	if (res == 0 || res == StorageErrorTableNotFound)
@@ -144,9 +151,30 @@ int StorageTableShare::deleteTable(Stora
 
 int StorageTableShare::truncateTable(StorageConnection *storageConnection)
 {
+	Sync sync(syncTruncate, "StorageTable::truncateTable");
+	sync.lock(Exclusive);
+	
 	int res = storageDatabase->truncateTable(storageConnection, this);
 	
 	return res;
+}
+
+void StorageTableShare::clearTruncateLock(void)
+{
+	if (haveTruncateLock)
+		{
+		syncTruncate->unlock();
+		haveTruncateLock = false;
+		}
+}
+
+void StorageTableShare::setTruncateLock()
+{
+	if (!haveTruncateLock)
+		{
+		syncTruncate->lock(NULL, Shared);
+		haveTruncateLock = true;
+		}
 }
 
 void StorageTableShare::cleanupFieldName(const char* name, char* buffer, int bufferLength)
diff -Nrup a/storage/falcon/StorageTableShare.h b/storage/falcon/StorageTableShare.h
--- a/storage/falcon/StorageTableShare.h	2007-11-28 12:20:54 -05:00
+++ b/storage/falcon/StorageTableShare.h	2007-11-30 14:45:34 -05:00
@@ -121,6 +121,8 @@ public:
 	uint64				estimateCardinality(void);
 	bool				tableExists(void);
 	JString				lookupPathName(void);
+	void				clearTruncateLock(void);
+	void				setTruncateLock();
 
 	static const char*	getDefaultRoot(void);
 	static const char*	cleanupTableName(const char* name, char* buffer, int bufferLength, char *schema, int schemaLength);
@@ -135,6 +137,7 @@ public:
 	unsigned char		*impure;
 	int					initialized;
 	SyncObject			*syncObject;
+	SyncObject			*syncTruncate;
 	StorageDatabase		*storageDatabase;
 	StorageHandler		*storageHandler;
 	Table				*table;
@@ -142,6 +145,7 @@ public:
 	Sequence			*sequence;
 	int					numberIndexes;
 	bool				tempTable;
+	bool				haveTruncateLock;
 };
 
 #endif
diff -Nrup a/storage/falcon/ha_falcon.cpp b/storage/falcon/ha_falcon.cpp
--- a/storage/falcon/ha_falcon.cpp	2007-11-29 16:00:50 -05:00
+++ b/storage/falcon/ha_falcon.cpp	2007-11-30 14:45:34 -05:00
@@ -1131,8 +1131,8 @@ void StorageInterface::startTransaction(
 		{
 		storageConnection->startTransaction(isolation_levels[thd_tx_isolation(mySqlThread)]);
 		
-		if (storageTable)
-			storageTable->setTruncateLock();
+		if (storageShare)
+			storageShare->setTruncateLock();
 				
 		trans_register_ha(mySqlThread, true, falcon_hton);
 		}
@@ -1716,8 +1716,8 @@ int StorageInterface::external_lock(THD 
 
 		if (!thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))
 			{
-			if (storageTable)
-				storageTable->clearTruncateLock();
+			if (storageShare)
+				storageShare->clearTruncateLock();
 		
 			storageConnection->endImplicitTransaction();
 			}
@@ -1749,8 +1749,8 @@ int StorageInterface::external_lock(THD 
 
 				if (ret)
 					{
-					if (storageTable)
-						storageTable->clearTruncateLock();
+					if (storageShare)
+						storageShare->clearTruncateLock();
 						
 					DBUG_RETURN(error(ret));
 					}
@@ -1769,8 +1769,8 @@ int StorageInterface::external_lock(THD 
 			{
 			if (storageConnection->startTransaction(isolation_levels[thd_tx_isolation(thd)]))
 				{
-				if (!isTruncate && storageTable)
-					storageTable->setTruncateLock();
+				if (!isTruncate && storageShare)
+					storageShare->setTruncateLock();
 				
 				trans_register_ha(thd, true, falcon_hton);
 				}
@@ -1782,8 +1782,8 @@ int StorageInterface::external_lock(THD 
 			{
 			if (storageConnection->startImplicitTransaction(isolation_levels[thd_tx_isolation(thd)]))
 				{
-				if (!isTruncate && storageTable)
-					storageTable->setTruncateLock();
+				if (!isTruncate && storageShare)
+					storageShare->setTruncateLock();
 				
 				trans_register_ha(thd, false, falcon_hton);
 				}
Thread
bk commit into 6.0 tree (jas:1.2708)U-ROWVWADEjas30 Nov