MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:cpowers Date:February 20 2008 9:16pm
Subject:bk commit into 6.0 tree (cpowers:1.2819) BUG#34567
View as plain text  
Below is the list of changes that have just been committed into a local
6.0 repository of cpowers. When cpowers 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-02-20 15:16:05-06:00, cpowers@stripped +5 -0
  Bug#34567 - Falcon deadlock between ALTERs of temporary and non-temporary tables
  
  Added Database::syncDDL to serialize DDL operations. 

  storage/falcon/Database.cpp@stripped, 2008-02-20 15:16:03-06:00, cpowers@stripped +4 -1
    Added syncDDL to serialize DDL operations.
    
    Also extended the shared lock on syncTables in ::dropTable to include
    Table::drop. This ensures that syncSysConnection will be locked after
    syncTables.
    
    Previously, Database::dropTable unlocked syncTables prior to calling Table::drop,
    however, syncTables must always be locked before syncSysConnection. A
    deadlock can occur if another thread locks syncTables before Table::drop can
    lock syncSysConnection.

  storage/falcon/Database.h@stripped, 2008-02-20 15:16:03-06:00, cpowers@stripped +1 -0
    Added syncDDL.

  storage/falcon/Statement.cpp@stripped, 2008-02-20 15:16:03-06:00, cpowers@stripped +3 -0
    Statement::executeDDL() now gets an exclusive lock on Database::syncDDL.

  storage/falcon/StorageDatabase.cpp@stripped, 2008-02-20 15:16:03-06:00, cpowers@stripped +9 -3
    Exclusively lock syncDDL in StorageDatabase::renameTable().

  storage/falcon/Table.cpp@stripped, 2008-02-20 15:16:03-06:00, cpowers@stripped +3 -2
    Relax syncSysConnection locking in Table::drop. Now that 
    DDL operations are serialized, a shared lock is sufficient.

diff -Nrup a/storage/falcon/Database.cpp b/storage/falcon/Database.cpp
--- a/storage/falcon/Database.cpp	2008-02-15 16:43:53 -06:00
+++ b/storage/falcon/Database.cpp	2008-02-20 15:16:03 -06:00
@@ -476,6 +476,7 @@ Database::Database(const char *dbName, C
 	syncResultSets.setName("Database::syncResultSets");
 	syncConnectionStatements.setName("Database::syncConnectionStatements");
 	syncScavenge.setName("Database::syncScavenge");
+	syncDDL.setName("Database::syncDDL");
 }
 
 
@@ -1377,6 +1378,7 @@ void Database::dropTable(Table * table, 
 	// OK, now make sure any records are purged out of committed transactions as well
 	
 	transactionManager->dropTable(table, transaction);
+
 	Sync sync (&syncTables, "Database::dropTable");
 	sync.lock (Exclusive);
 
@@ -1413,8 +1415,9 @@ void Database::dropTable(Table * table, 
 
 	sync.unlock();
 	
-	invalidateCompiledStatements(table);
+	sync.lock(Shared);
 	
+	invalidateCompiledStatements(table);
 	table->drop(transaction);
 	table->expunge(getSystemTransaction());
 	delete table;
diff -Nrup a/storage/falcon/Database.h b/storage/falcon/Database.h
--- a/storage/falcon/Database.h	2008-02-15 16:29:49 -06:00
+++ b/storage/falcon/Database.h	2008-02-20 15:16:03 -06:00
@@ -263,6 +263,7 @@ public:
 	SyncObject			syncResultSets;
 	SyncObject			syncConnectionStatements;
 	SyncObject			syncScavenge;
+	SyncObject			syncDDL;
 	PriorityScheduler	*ioScheduler;
 	Threads				*threads;
 	Scheduler			*scheduler;
diff -Nrup a/storage/falcon/Statement.cpp b/storage/falcon/Statement.cpp
--- a/storage/falcon/Statement.cpp	2008-02-10 13:38:56 -06:00
+++ b/storage/falcon/Statement.cpp	2008-02-20 15:16:03 -06:00
@@ -711,6 +711,9 @@ void Statement::executeDDL()
 	Syntax *syntax = statement->syntax;
 	ASSERT (syntax);
 	Syntax *child;
+	
+	Sync sync(&database->syncDDL, "Statement::executeDDL");
+	sync.lock(Exclusive);
 
 	switch (syntax->type)
 		{
diff -Nrup a/storage/falcon/StorageDatabase.cpp b/storage/falcon/StorageDatabase.cpp
--- a/storage/falcon/StorageDatabase.cpp	2007-12-26 22:15:31 -06:00
+++ b/storage/falcon/StorageDatabase.cpp	2008-02-20 15:16:03 -06:00
@@ -684,10 +684,14 @@ int StorageDatabase::renameTable(Storage
 			++numberIndexes;
 			}
 
+		Sync syncDDL (&database->syncDDL, "StorageDatabase::renameTable");
+		syncDDL.lock(Exclusive);
+		
 		Sync syncTables (&database->syncTables, "StorageDatabase::renameTable");
 		syncTables.lock (Exclusive);
-		Sync sync(&database->syncSysConnection, "StorageDatabase::renameTable");
-		sync.lock(Exclusive);
+		
+		Sync syncSysConn(&database->syncSysConnection, "StorageDatabase::renameTable");
+		syncSysConn.lock(Exclusive);
 
 		for (int n = firstIndex; n < numberIndexes; ++n)
 			{
@@ -707,8 +711,10 @@ int StorageDatabase::renameTable(Storage
 		if (sequence)
 			sequence->rename(tableName);
 
-		sync.unlock();
+		syncSysConn.unlock();
 		syncTables.unlock();
+		syncDDL.unlock();
+		
 		database->commitSystemTransaction();
 
 		return 0;
diff -Nrup a/storage/falcon/Table.cpp b/storage/falcon/Table.cpp
--- a/storage/falcon/Table.cpp	2008-02-15 16:32:10 -06:00
+++ b/storage/falcon/Table.cpp	2008-02-20 15:16:03 -06:00
@@ -1481,8 +1481,8 @@ void Table::drop(Transaction *transactio
 
 
 	Sync sync(&database->syncSysConnection, "Table::drop");
-	//sync.lock(Shared);
-	sync.lock(Exclusive);
+	sync.lock(Shared);
+	
 	Transaction *sysTransaction = database->getSystemTransaction();
 
 	for (Index *index = indexes; index; index = index->next)
@@ -1517,6 +1517,7 @@ void Table::drop(Transaction *transactio
 		view->drop(database);
 			
 	sync.unlock();
+	
 	database->commitSystemTransaction();
 }
 
Thread
bk commit into 6.0 tree (cpowers:1.2819) BUG#34567cpowers20 Feb