List:Commits« Previous MessageNext Message »
From:Vladislav Vaintroub Date:April 20 2009 7:28pm
Subject:bzr push into mysql-6.0-falcon-team branch (vvaintroub:3128 to 3129)
Bug#36993
View as plain text  
 3129 Vladislav Vaintroub	2009-04-19
      Bug #36993 Falcon reports Index SCHEDULE..PRIMARY_KEY in SYSTEM.SCHEDULE 
      damaged
      
      The problem here is that mysqld was killed before database was completely created 
      (i.e before all data dictionary was completely written to the disk). Falcon cannot
       handle such sutuations gracefully yet, recovery after such point is not guaranteed
      to succeed.
      
      The patch improves the sutation a little bit, disabling  user queiries until database is
      fully created and written to the disk. 
      
      Also, this patch introduces a clean Falcon shutdown : waiting for background theads
      to complete  their work , followed by flushing the page cache. This will  eliminate the
      need for recovery after  a clean shutdown.

    modified:
      storage/falcon/Database.cpp
      storage/falcon/StorageHandler.cpp
      storage/falcon/TransactionManager.cpp
 3128 Kevin Lewis	2009-04-16
      Bug#38568 - This patch may help to fix this bug.  Needs testing.
      
      All changes to Record::priorVersion are now done using 
      COMPARE_EXCHANGE_POINTER instead of direct assignments so that 
      we can be assured that a pointer was not lost.  If this fails, there are several 
      new FATAL errors, which is better than continuing with a race condition.  
      The only direct assignments left are in the RecordVersion constructors.
      
      When pruning, a call is made to clearPriorVersion and the following code 
      may or may not actually prune those records.  If not, they need to be 
      re-attached with setPriorVersion.  That was a possible but very rare 
      memory leak.
      
      In clearPriorVersion, instead of crashing with FATAL if the CAS fails,
      it will just return NULL so the pruning for that record will be skipped.
      This change in behavior might prevent a race condition.

    modified:
      storage/falcon/Record.cpp
      storage/falcon/Record.h
      storage/falcon/RecordLeaf.cpp
      storage/falcon/RecordVersion.cpp
      storage/falcon/RecordVersion.h
=== modified file 'storage/falcon/Database.cpp'
--- a/storage/falcon/Database.cpp	2009-04-09 15:40:11 +0000
+++ b/storage/falcon/Database.cpp	2009-04-19 20:21:00 +0000
@@ -1640,6 +1640,9 @@ void Database::shutdown()
 	if (shuttingDown)
 		return;
 
+	// Wait for all gophers to finish.
+	waitForWriteComplete(NULL);
+
 	if (updateCardinality)
 		{
 		updateCardinality->close();

=== modified file 'storage/falcon/StorageHandler.cpp'
--- a/storage/falcon/StorageHandler.cpp	2009-03-31 18:19:17 +0000
+++ b/storage/falcon/StorageHandler.cpp	2009-04-19 20:21:00 +0000
@@ -1035,6 +1035,11 @@ void StorageHandler::createDatabase(void
 		statement->executeUpdate(*ddl);
 	statement->close();
 	dictionaryConnection->commit();
+
+	Database *database = dictionaryConnection->database;
+	database->waitForWriteComplete(NULL);
+	database->flush((int64)0);
+
 	inCreateDatabase = false;
 }
 

=== modified file 'storage/falcon/TransactionManager.cpp'
--- a/storage/falcon/TransactionManager.cpp	2009-04-06 12:33:12 +0000
+++ b/storage/falcon/TransactionManager.cpp	2009-04-19 20:21:00 +0000
@@ -177,6 +177,8 @@ bool TransactionManager::hasUncommittedR
 
 // Wait until all committed records for a table are purged by gophers
 // (their transaction become write complete)
+// If table is NULL pointer, the functions wait for all transactions to
+// become write complete
 void TransactionManager::waitForWriteComplete(Table* table)
 {
 	for(;;)
@@ -189,11 +191,18 @@ void TransactionManager::waitForWriteCom
 		for (Transaction *trans = committedTransactions.first; trans; 
 			 trans = trans->next)
 			{
-				if (trans->hasRecords(table)&& trans->writePending)
-				{
-				again = true;
-				break;
-				}
+				if (table)
+					{
+					if (trans->hasRecords(table)&& trans->writePending)
+						again = true;
+					}
+				else
+					{
+					if(trans->writePending)
+						again = true;
+					}
+				if (again)
+					break;
 			}
 
 		if(!again)


Attachment: [text/bzr-bundle] bzr/vvaintroub@mysql.com-20090419202100-zj974pnh2cwwb1n1.bundle
Thread
bzr push into mysql-6.0-falcon-team branch (vvaintroub:3128 to 3129)Bug#36993Vladislav Vaintroub20 Apr