List:Commits« Previous MessageNext Message »
From:Jim Starkey Date:January 28 2008 9:40pm
Subject:bk commit into 6.0 tree (jas:1.2790)
View as plain text  
Below is the list of changes that have just been committed into a local
6.0 repository of jas. When jas 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, 2008-01-28 15:40:27-05:00, jas@stripped +6 -0
  Track down transient record chain bug.

  storage/falcon/Record.h@stripped, 2008-01-28 15:40:23-05:00, jas@stripped
+5 -0
    Add record states to track down bug.

  storage/falcon/RecordVersion.cpp@stripped, 2008-01-28 15:40:24-05:00,
jas@stripped +7 -1
    Armor code to track down Table::validateUpdate bug.

  storage/falcon/SerialLog.cpp@stripped, 2008-01-28 15:40:24-05:00,
jas@stripped +2 -0
    Add bugcheck if serial log window can't be found.

  storage/falcon/Table.cpp@stripped, 2008-01-28 15:40:24-05:00, jas@stripped
+21 -1
    Add additional record states for debugging.

  storage/falcon/TransactionManager.cpp@stripped, 2008-01-28 15:40:24-05:00,
jas@stripped +2 -2
    Use interlocked increments to computer next transaction id.

  storage/falcon/TransactionManager.h@stripped, 2008-01-28 15:40:24-05:00,
jas@stripped +1 -1
    Redefine TransactionManager::transactionSequence to be
    compatible with interlocked instructions.

diff -Nrup a/storage/falcon/Record.h b/storage/falcon/Record.h
--- a/storage/falcon/Record.h	2007-11-27 13:08:20 -05:00
+++ b/storage/falcon/Record.h	2008-01-28 15:40:23 -05:00
@@ -46,6 +46,11 @@ static const int recChilled	= 2;		// rec
 static const int recOnDisk	= 3;		// record is on disk and must be read
 static const int recLock	= 4;		// this is a "record lock" and not a record
 static const int recNoChill = 5;		// record is in use and should not be chilled
+static const int recRollback = 6;		// record is being rolled back
+static const int recUnlocked = 7;		// record is being unlocked
+static const int recDeleting = 8;		// record is being physically deleted
+static const int recPruning	 = 9;		// record is being pruned
+static const int recEndChain = 10;		// end of chain for garbage collection
 
 class Format;
 class Table;
diff -Nrup a/storage/falcon/RecordVersion.cpp b/storage/falcon/RecordVersion.cpp
--- a/storage/falcon/RecordVersion.cpp	2007-10-31 02:41:05 -04:00
+++ b/storage/falcon/RecordVersion.cpp	2008-01-28 15:40:24 -05:00
@@ -58,6 +58,7 @@ RecordVersion::RecordVersion(Table *tbl,
 
 RecordVersion::~RecordVersion()
 {
+	state = recDeleting;
 	Record *prior = priorVersion;
 	priorVersion = NULL;
 
@@ -183,6 +184,7 @@ void RecordVersion::scavenge(TransId tar
 		rec->active = false;
 #endif
 		Transaction *trans = rec->getTransaction();
+
 		if (trans)
 			trans->removeRecord( (RecordVersion*) rec);
 		}
@@ -197,7 +199,8 @@ void RecordVersion::scavenge(TransId tar
 	Record *prior = priorVersion;
 	prior->addRef();
 	setPriorVersion(rec);
-	ptr->setPriorVersion(NULL);
+	//ptr->setPriorVersion(NULL);
+	ptr->state = recEndChain;
 	format->table->garbageCollect(prior, this, transaction, false);
 	prior->release();
 }
@@ -225,7 +228,10 @@ bool RecordVersion::isSuperceded()
 void RecordVersion::setPriorVersion(Record *oldVersion)
 {
 	if (oldVersion)
+		{
+		ASSERT(oldVersion->state != recLock);
 		oldVersion->addRef();
+		}
 
 	if (priorVersion)
 		priorVersion->release();
diff -Nrup a/storage/falcon/SerialLog.cpp b/storage/falcon/SerialLog.cpp
--- a/storage/falcon/SerialLog.cpp	2008-01-24 15:00:01 -05:00
+++ b/storage/falcon/SerialLog.cpp	2008-01-28 15:40:24 -05:00
@@ -788,6 +788,8 @@ SerialLogWindow* SerialLog::findWindowGi
 			}
 
 	Log::debug("SerialLog::findWindowGivenOffset -- can't find window\n");
+	printWindows();
+	ASSERT(false);
 
 	return NULL;
 }
diff -Nrup a/storage/falcon/Table.cpp b/storage/falcon/Table.cpp
--- a/storage/falcon/Table.cpp	2008-01-22 15:04:02 -05:00
+++ b/storage/falcon/Table.cpp	2008-01-28 15:40:24 -05:00
@@ -892,6 +892,8 @@ Record* Table::rollbackRecord(RecordVers
 	recordToRollback->active = false;
 #endif
 
+	recordToRollback->state = recRollback;
+
 	// Find the record that will become the current version.
 
 	Record *priorRecord = recordToRollback->priorVersion;
@@ -1785,6 +1787,7 @@ bool Table::insert(Record * record, Reco
 
 void Table::expungeRecordVersions(RecordVersion *record, RecordScavenge *recordScavenge)
 {
+	ASSERT(record->state != recLock);
 	Record *prior = record->priorVersion;
 	record->priorVersion = NULL;
 	
@@ -3281,8 +3284,12 @@ void Table::unlockRecord(int recordNumbe
 void Table::unlockRecord(RecordVersion* record, bool remove)
 {
 	//int uc = record->useCount;
+	ASSERT(record->priorVersion);
 	
 	if (record->state == recLock)
+		{
+		record->state = recUnlocked;
+
 		if (insert(record->priorVersion, record, record->recordNumber))
 			{
 			if (remove && record->transaction)
@@ -3290,6 +3297,7 @@ void Table::unlockRecord(RecordVersion* 
 			}
 		else
 			Log::debug("Table::unlockRecord: record lock not in record tree\n");
+		}
 }
 
 void Table::checkAncestor(Record* current, Record* oldRecord)
@@ -3389,7 +3397,7 @@ Record* Table::fetchForUpdate(Transactio
 			
 			case Deadlock:
 				record->release();
-				throw SQLError(DEADLOCK, "Deadlock on table %s.%s", schemaName, name);
+				throw SQLError(DEADLOCK, "Deadlock on table %s.%s, tid %d", schemaName, name,
transaction->transactionId);
 				
 			case WasActive:
 			case RolledBack:
@@ -3522,6 +3530,7 @@ bool Table::validateUpdate(int32 recordN
 		return false;
 
 	Record *record = fetch(recordNumber);
+	Record *initial = record;
 	
 	while (record)
 		{
@@ -3542,6 +3551,17 @@ bool Table::validateUpdate(int32 recordN
 			}
 		
 		Record *next = record->getPriorVersion();
+
+		if (!next)
+			{
+			Log::debug("Table::validateUpdate: bad record\n");
+			initial->print();
+			Record *newRecord = fetch(recordNumber);
+			Log::debug("Table::validateUpdate: currentRecord\n");
+			newRecord->print();
+			ASSERT(false);
+			}
+
 		next->addRef();
 		record->release();
 		record = next;
diff -Nrup a/storage/falcon/TransactionManager.cpp b/storage/falcon/TransactionManager.cpp
--- a/storage/falcon/TransactionManager.cpp	2008-01-22 17:41:00 -05:00
+++ b/storage/falcon/TransactionManager.cpp	2008-01-28 15:40:24 -05:00
@@ -107,7 +107,7 @@ Transaction* TransactionManager::startTr
 			if (COMPARE_EXCHANGE(&transaction->state, Available, Initializing))
 				{
 				//syncInit.lock(Exclusive);
-				transaction->initialize(connection, ++transactionSequence);
+				transaction->initialize(connection, INTERLOCKED_INCREMENT(transactionSequence));
 				
 				return transaction;
 				}
@@ -115,7 +115,7 @@ Transaction* TransactionManager::startTr
 	sync.unlock();
 	sync.lock(Exclusive);
 	//syncInit.lock(Exclusive);
-	transaction = new Transaction (connection, ++transactionSequence);
+	transaction = new Transaction (connection, INTERLOCKED_INCREMENT(transactionSequence));
 	activeTransactions.append(transaction);
 	//syncInit.unlock();
 
diff -Nrup a/storage/falcon/TransactionManager.h b/storage/falcon/TransactionManager.h
--- a/storage/falcon/TransactionManager.h	2008-01-22 17:41:00 -05:00
+++ b/storage/falcon/TransactionManager.h	2008-01-28 15:40:24 -05:00
@@ -51,7 +51,7 @@ public:
 	void			printBlockage(void);
 	void			printBlocking(Transaction* transaction, int level);
 	
-	TransId			transactionSequence;
+	INTERLOCK_TYPE	transactionSequence;
 	Database		*database;
 	SyncObject		syncObject;
 	//SyncObject	syncInitialize;
Thread
bk commit into 6.0 tree (jas:1.2790)Jim Starkey28 Jan