List:Commits« Previous MessageNext Message »
From:U-ROWVWADEjas Date:June 7 2007 8:30pm
Subject:bk commit into 6.0-falcon tree (jas:1.2556)
View as plain text  
Below is the list of changes that have just been committed into a local
6.0-falcon 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-06-07 16:30:06-04:00, jas@rowvwade. +5 -0
  Extended serial log index and section use tracking to multiple
  table spaces.

  storage/falcon/Dbb.cpp@stripped, 2007-06-07 16:29:55-04:00, jas@rowvwade. +2 -2
    Extended serial log index and section use tracking to multiple
    table spaces.

  storage/falcon/SRLUpdateIndex.cpp@stripped, 2007-06-07 16:29:56-04:00, jas@rowvwade. +5 -8
    Extended serial log index and section use tracking to multiple
    table spaces.

  storage/falcon/SRLUpdateRecords.cpp@stripped, 2007-06-07 16:29:56-04:00, jas@rowvwade. +3 -11
    Extended serial log index and section use tracking to multiple
    table spaces.

  storage/falcon/SerialLog.cpp@stripped, 2007-06-07 16:29:56-04:00, jas@rowvwade. +72 -10
    Extended serial log index and section use tracking to multiple
    table spaces.

  storage/falcon/SerialLog.h@stripped, 2007-06-07 16:29:57-04:00, jas@rowvwade. +24 -10
    Extended serial log index and section use tracking to multiple
    table spaces.

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	jas
# Host:	rowvwade.
# Root:	D:/MySQL/mysql-5.1-falcon

--- 1.31/storage/falcon/SRLUpdateIndex.cpp	2007-06-07 16:30:28 -04:00
+++ 1.32/storage/falcon/SRLUpdateIndex.cpp	2007-06-07 16:30:28 -04:00
@@ -43,22 +43,19 @@
 	DeferredIndexWalker walker(deferredIndex, NULL);
 	uint indexId = deferredIndex->index->indexId;
 	int idxVersion = deferredIndex->index->indexVersion;
-
+	int tableSpaceId = deferredIndex->index->dbb->tableSpaceId;
+	
 	// Remember where this is logged.
 	deferredIndex->virtualOffset = log->writeWindow->getNextVirtualOffset();
 
 	for (DINode *node = walker.next(); node;)
 		{
 		START_RECORD(srlUpdateIndex, "SRLUpdateIndex::append");
-		
-		if (indexId >= log->indexUseVector.length)
-			log->extendIndexVector(indexId + 10);
-		
-		++log->indexUseVector.vector[indexId];
+		log->updateIndexUseVector(indexId, tableSpaceId, 1);
 		SerialLogTransaction *srlTrans = log->getTransaction(transaction->transactionId);
 		srlTrans->transaction = transaction;
 		ASSERT(transaction->writePending);
-		putInt(deferredIndex->index->dbb->tableSpaceId);
+		putInt(tableSpaceId);
 		putInt(transaction->transactionId);
 		putInt(indexId);
 		putInt(idxVersion);
@@ -142,7 +139,7 @@
 {
 	Sync sync(&log->syncIndexes, "SRLUpdateIndex::commit");
 	sync.lock(Shared);
-	--log->indexUseVector.vector[indexId];
+	log->updateIndexUseVector(indexId, tableSpaceId, -1);
 	execute();
 	log->setPhysicalBlock(transactionId);
 }

--- 1.36/storage/falcon/SRLUpdateRecords.cpp	2007-06-07 16:30:28 -04:00
+++ 1.37/storage/falcon/SRLUpdateRecords.cpp	2007-06-07 16:30:28 -04:00
@@ -198,11 +198,7 @@
 			ASSERT(log->writePtr > (UCHAR *)log->writeWindow->buffer);
 			record->setVirtualOffset(log->writeWindow->currentLength + log->writeWindow->virtualOffset);
 			uint32 sectionId = table->dataSectionId;
-			
-			if (sectionId >= log->sectionUseVector.length)
-				log->extendSectionVector(sectionId + 10);
-			
-			++log->sectionUseVector.vector[sectionId];
+			log->updateSectionUseVector(sectionId, tableSpaceId, 1);
 			putInt(tableSpaceId);
 			putInt((record->priorVersion) ? sectionId : -(int) sectionId - 1);
 			putInt(record->recordNumber);
@@ -269,9 +265,7 @@
 			uint sectionId = (id >= 0) ? id : -id - 1;
 			int recordNumber = getInt(&p);
 			int length = getInt(&p);
-			
-			if (sectionId < log->sectionUseVector.length)
-				--log->sectionUseVector.vector[sectionId];
+			log->updateSectionUseVector(sectionId, tableSpaceId, -1);
 			
 			if (log->bumpSectionIncarnation(sectionId, tableSpaceId, objInUse))
 				{
@@ -337,9 +331,7 @@
 		uint sectionId = (id >= 0) ? id : -id - 1;
 		int recordNumber = getInt(&p);
 		int length = getInt(&p);
-		
-		if (sectionId < log->sectionUseVector.length)
-			--log->sectionUseVector.vector[sectionId];
+		log->updateSectionUseVector(sectionId, tableSpaceId, -1);
 		
 		if (log->isSectionActive(sectionId, tableSpaceId))
 			{

--- 1.71/storage/falcon/Dbb.cpp	2007-06-07 16:30:28 -04:00
+++ 1.72/storage/falcon/Dbb.cpp	2007-06-07 16:30:28 -04:00
@@ -1189,12 +1189,12 @@
 
 bool Dbb::sectionInUse(int sectionId)
 {
-	return serialLog->sectionInUse(sectionId);
+	return serialLog->sectionInUse(sectionId, tableSpaceId);
 }
 
 bool Dbb::indexInUse(int indexId)
 {
-	return serialLog->indexInUse(indexId);
+	return serialLog->indexInUse(indexId, tableSpaceId);
 }
 
 void Dbb::analyzeSection(int sectionId, const char *sectionName, int indentation, Stream *stream)

--- 1.78/storage/falcon/SerialLog.cpp	2007-06-07 16:30:28 -04:00
+++ 1.79/storage/falcon/SerialLog.cpp	2007-06-07 16:30:28 -04:00
@@ -97,6 +97,8 @@
 	priorWindowReads = 0;
 	maxWindows = 0;
 	windowBuffers = MAX(database->configuration->serialLogWindows, 10);
+	tableSpaceInfo = NULL;
+	memset(tableSpaces, 0, sizeof(tableSpaces));
 }
 
 SerialLog::~SerialLog()
@@ -124,6 +126,13 @@
 		buffers.pop();
 		
 	delete [] bufferSpace;
+	
+	while (tableSpaceInfo)
+		{
+		TableSpaceInfo *info = tableSpaceInfo;
+		tableSpaceInfo = info->next;
+		delete info;
+		}
 }
 
 
@@ -371,8 +380,13 @@
 		
 	defaultDbb->setRecovering(false);
 	checkpoint(true);
-	sectionUseVector.zap();
-	indexUseVector.zap();
+	
+	for (TableSpaceInfo *info = tableSpaceInfo; info; info = info->next)
+		{
+		info->sectionUseVector.zap();
+		info->indexUseVector.zap();
+		}
+		
 	Log::log("Recovery complete\n");
 }
 
@@ -1171,24 +1185,33 @@
 	recoveryIndexes->setInactive(id, tableSpaceId);
 }
 
-void SerialLog::extendSectionVector(int newLength)
+/***
+void SerialLog::extendSectionVector(int newLength, int tableSpaceId)
 {
-	sectionUseVector.extend(newLength);
+	TableSpaceInfo *info = getTableSpaceInfo(tableSpaceId);
+	info->sectionUseVector.extend(newLength);
 }
+***/
 
-bool SerialLog::sectionInUse(int sectionId)
+bool SerialLog::sectionInUse(int sectionId, int tableSpaceId)
 {
-	return sectionUseVector.get(sectionId) > 0;
+	TableSpaceInfo *info = getTableSpaceInfo(tableSpaceId);
+
+	return info->sectionUseVector.get(sectionId) > 0;
 }
 
-void SerialLog::extendIndexVector(int newLength)
+/***
+void SerialLog::extendIndexVector(int newLength, int tableSpaceId)
 {
-	indexUseVector.extend(newLength);
+	TableSpaceInfo *info = getTableSpaceInfo(tableSpaceId);
+	info->indexUseVector.extend(newLength);
 }
+***/
 
-bool SerialLog::indexInUse(int indexId)
+bool SerialLog::indexInUse(int indexId, int tableSpaceId)
 {
-	return indexUseVector.get(indexId) > 0;
+	TableSpaceInfo *info = getTableSpaceInfo(tableSpaceId);
+	return info->indexUseVector.get(indexId) > 0;
 }
 
 int SerialLog::getPageState(int32 pageNumber, int tableSpaceId)
@@ -1350,4 +1373,43 @@
 		return defaultDbb;
 		
 	return tableSpaceManager->getTableSpace(tableSpaceId)->dbb;
+}
+
+TableSpaceInfo* SerialLog::getTableSpaceInfo(int tableSpaceId)
+{
+	TableSpaceInfo *info;
+	int slot = tableSpaceId %SLT_HASH_SIZE;
+	
+	for (info = tableSpaces[slot]; info; info = info->collision)
+		if (info->tableSpaceId == tableSpaceId)
+			return info;
+	
+	info = new TableSpaceInfo;
+	info->tableSpaceId = tableSpaceId;
+	info->collision = tableSpaces[slot];
+	tableSpaces[slot] = info;
+	info->next = tableSpaceInfo;
+	tableSpaceInfo = info;
+	
+	return info;
+}
+
+void SerialLog::updateSectionUseVector(uint sectionId, int tableSpaceId, int delta)
+{
+	TableSpaceInfo *info = getTableSpaceInfo(tableSpaceId);
+	
+	if (sectionId >= info->sectionUseVector.length)
+		info->sectionUseVector.extend(sectionId + 10);
+	
+	info->sectionUseVector.vector[sectionId] += delta;
+}
+
+void SerialLog::updateIndexUseVector(uint indexId, int tableSpaceId, int delta)
+{
+	TableSpaceInfo *info = getTableSpaceInfo(tableSpaceId);
+	
+	if (indexId >= info->indexUseVector.length)
+		info->indexUseVector.extend(indexId + 10);
+	
+	info->indexUseVector.vector[indexId] += delta;
 }

--- 1.39/storage/falcon/SerialLog.h	2007-06-07 16:30:28 -04:00
+++ 1.40/storage/falcon/SerialLog.h	2007-06-07 16:30:28 -04:00
@@ -50,6 +50,15 @@
 	UCHAR	data[1];
 };
 
+struct TableSpaceInfo
+{
+	int						tableSpaceId;
+	TableSpaceInfo			*collision;
+	TableSpaceInfo			*next;
+	DenseArray<int, 200>	sectionUseVector;
+	DenseArray<int, 200>	indexUseVector;
+};
+
 class SerialLogFile;
 class Database;
 class Dbb;
@@ -114,8 +123,10 @@
 	void			setSectionInactive(int id, int tableSpaceId);
 	void			setIndexActive(int id, int tableSpaceId);
 	void			setIndexInactive(int id, int tableSpaceId);
-	void			extendSectionVector(int newLength);
-	bool			sectionInUse(int sectionId);
+	//void			extendSectionVector(int newLength, int tableSpaceId);
+	void			updateSectionUseVector(uint sectionId, int tableSpaceId, int delta);
+	void			updateIndexUseVector(uint indexId, int tableSpaceId, int delta);
+	bool			sectionInUse(int sectionId, int tableSpaceId);
 	bool			bumpIndexIncarnation(int indexId, int tableSpaceId, int state);
 	bool			bumpSectionIncarnation (int sectionId, int tableSpaceId, int state);
 	bool			bumpPageIncarnation (int32 pageNumber, int tableSpaceId, int state);
@@ -123,8 +134,8 @@
 	int				getPageState(int32 pageNumber, int tableSpaceId);
 	void			redoFreePage(int32 pageNumber, int tableSpaceId);
 	
-	void			extendIndexVector(int newLength);
-	bool			indexInUse(int indexId);
+	//void			extendIndexVector(int newLength, int tableSpaceId);
+	bool			indexInUse(int indexId, int tableSpaceId);
 	void			overflowFlush(void);
 	void			createNewWindow(void);
 	void			setPhysicalBlock(TransId transactionId);
@@ -133,6 +144,10 @@
 	void			commitByXid(int xidLength, const UCHAR* xid);
 	void			rollbackByXid(int xidLength, const UCHAR* xid);
 	void			preCommit(Transaction* transaction);
+	void			printWindows(void);
+	void			endRecord(void);
+	Dbb*			getDbb(int tableSpaceId);
+	TableSpaceInfo	*getTableSpaceInfo(int tableSpaceId);
 	
 	static void		gopherThread(void *arg);
 
@@ -188,18 +203,17 @@
 	uint32				chilledRecords;
 	uint64				chilledBytes;
 	
-	DenseArray<int, 200>	sectionUseVector;
-	DenseArray<int, 200>	indexUseVector;
+	//DenseArray<int, 200>	sectionUseVector;
+	//DenseArray<int, 200>	indexUseVector;
+	TableSpaceInfo		*tableSpaces[SLT_HASH_SIZE];
+	TableSpaceInfo		*tableSpaceInfo;
+	
 	Queue<SerialLogTransaction>	pending;
 	Queue<SerialLogTransaction>	inactions;
 	Queue<SerialLogTransaction>	running;
 	
 private:
 	Thread *volatile	writer;
-public:
-	void printWindows(void);
-	void endRecord(void);
-	Dbb* getDbb(int tableSpaceId);
 };
 
 #endif // !defined(AFX_SERIALLOG_H__D2A71E6B_A3B0_41C8_9C73_628DA067F722__INCLUDED_)
Thread
bk commit into 6.0-falcon tree (jas:1.2556)U-ROWVWADEjas8 Jun