List:Commits« Previous MessageNext Message »
From:Christopher Powers Date:August 27 2008 9:11am
Subject:bzr push into mysql-6.0-falcon branch (cpowers:2802)
View as plain text  
 2802 Christopher Powers	2008-08-27 [merge]
      (no message)

=== modified file 'storage/falcon/RecordVersion.cpp'
--- a/storage/falcon/RecordVersion.cpp	2008-07-15 18:57:27 +0000
+++ b/storage/falcon/RecordVersion.cpp	2008-08-27 07:08:18 +0000
@@ -416,11 +416,9 @@ int RecordVersion::thaw()
 			}
 		}
 		
-	if (bytesRestored <= 0)
-		Log::debug("RecordVersion::thaw: writePending %d, was %d, recordFetched %d, data %p\n",
-					trans->writePending, wasWritePending, recordFetched, data.record);
-
-	ASSERT(bytesRestored > 0 || data.record == NULL);
+	if (state == recChilled)
+		ASSERT(bytesRestored > 0 || data.record == NULL);
+		
 	state = recData;
 		
 	return bytesRestored;

=== modified file 'storage/falcon/SRLUpdateRecords.cpp'
--- a/storage/falcon/SRLUpdateRecords.cpp	2008-04-09 08:23:51 +0000
+++ b/storage/falcon/SRLUpdateRecords.cpp	2008-08-27 07:08:18 +0000
@@ -84,34 +84,39 @@ int SRLUpdateRecords::thaw(RecordVersion
 	// Get section id, record id and data length written. Input pointer will be at
 	// beginning of record data.
 
-	int tableSpaceId;
+	int tableSpaceId = 0;
 	
 	if (control->version >= srlVersion8)
 		tableSpaceId = control->getInt();
-	else
-		tableSpaceId = 0;
 		
 	control->getInt();			// sectionId
 	int recordNumber = control->getInt();
 	int dataLength   = control->getInt();
-	ASSERT(recordNumber == record->recordNumber);
-	int bytesReallocated = record->setRecordData(control->input, dataLength);
+	int bytesReallocated = 0;
+	
+	// setRecordData() handles race conditions with an interlocked compare and exchange,
+	// but check the state and record number anyway
 
-	if (bytesReallocated > 0)
-		bytesReallocated = record->getEncodedSize();
+	if (record->state == recChilled && recordNumber == record->recordNumber)
+		bytesReallocated = record->setRecordData(control->input, dataLength);
 
 	window->deactivateWindow();
 
-	if (log->chilledRecords > 0)
-		log->chilledRecords--;
+	if (bytesReallocated > 0)
+		{
+		ASSERT(recordNumber == record->recordNumber);
+		bytesReallocated = record->getEncodedSize();
+		*thawed = true;
+
+		if (log->chilledRecords > 0)
+			log->chilledRecords--;
 		
-	if (log->chilledBytes > uint64(bytesReallocated))
-		log->chilledBytes -= bytesReallocated;
-	else
-		log->chilledBytes = 0;
-	
-	*thawed = true;
-	
+		if (log->chilledBytes > uint64(bytesReallocated))
+			log->chilledBytes -= bytesReallocated;
+		else
+			log->chilledBytes = 0;
+		}
+
 	return bytesReallocated;
 }
 

Thread
bzr push into mysql-6.0-falcon branch (cpowers:2802) Christopher Powers27 Aug