List:Commits« Previous MessageNext Message »
From:Kevin Lewis Date:June 25 2009 10:48pm
Subject:bzr commit into mysql-6.0-falcon-team branch (kevin.lewis:2746)
Bug#45701
View as plain text  
#At file:///C:/Work/bzr/Merge/mysql-6.0-falcon-team/ based on revid:kevin.lewis@stripped

 2746 Kevin Lewis	2009-06-25
      Bug#45701 - If a table has two foreign key relationships with one other table, an alter table that drops one of the FKs will call external_lock twice for each table. And if a table has a foreign key relationship with another table, an alter that creates another foreign key relationship between the two tables will also call external_lock twice for each table.
      
      So it is necessary for Falcon to support multiple calls to external_lock by the same connection to the same table.  This was not needed before the Foriegn Key implementation.  
      
      So the current Connection pointer is sent into Table::SetAlter() and stored in Table::alterConnection.   And alterIsActive is now an int instead of a boolean.  If the same connection locks the table a second time, alterIsActive is incremented and alterConnection remains set.  It is not set to NULL until alterIsActive is decremented to zero.

    modified:
      storage/falcon/StorageTable.cpp
      storage/falcon/Table.cpp
      storage/falcon/Table.h
=== modified file 'storage/falcon/StorageTable.cpp'
--- a/storage/falcon/StorageTable.cpp	2009-05-14 05:16:08 +0000
+++ b/storage/falcon/StorageTable.cpp	2009-06-25 22:48:40 +0000
@@ -643,7 +643,7 @@ void StorageTable::clearAlter(void)
 
 bool StorageTable::setAlter(void)
 {
-	return share->table->setAlter();
+	return share->table->setAlter(storageConnection->connection);
 }
 
 int StorageTable::alterCheck(void)

=== modified file 'storage/falcon/Table.cpp'
--- a/storage/falcon/Table.cpp	2009-06-23 21:16:25 +0000
+++ b/storage/falcon/Table.cpp	2009-06-25 22:48:40 +0000
@@ -917,7 +917,8 @@ void Table::init(int id, const char *sch
 	debugThawedBytes = 0;
 	cardinality = 0;
 	priorCardinality = 0;
-	alterIsActive = false;
+	alterIsActive = 0;
+	alterConnection  = NULL;
 	syncObject.setName("Table::syncObject");
 	syncTriggers.setName("Table::syncTriggers");
 	syncAlter.setName("Table::syncAlter");
@@ -1774,7 +1775,8 @@ void Table::truncate(Transaction *transa
 	ageGroup = database->currentGeneration;
 	debugThawedRecords = 0;
 	debugThawedBytes = 0;
-	alterIsActive = false;
+	alterIsActive = 0;
+	alterConnection  = NULL;
 	deleting = false;
 }
 
@@ -3695,19 +3697,21 @@ void Table::clearAlter(void)
 		{
 		Sync sync(&syncAlter, "Table::clearAlter");
 		sync.lock(Exclusive);
-		alterIsActive = false;
+		if (--alterIsActive == 0)
+			alterConnection  = NULL;
 		}
 }
 
-bool Table::setAlter(void)
+bool Table::setAlter(Connection* connection)
 {
 	Sync sync(&syncAlter, "Table::setAlter");
 	sync.lock(Exclusive);
 
-	if (alterIsActive)
+	if (alterIsActive && (connection != alterConnection))
 		return false;
 
-	alterIsActive = true;
+	alterIsActive++;
+	alterConnection = connection;
 	
 	return true;
 }

=== modified file 'storage/falcon/Table.h'
--- a/storage/falcon/Table.h	2009-06-02 15:25:59 +0000
+++ b/storage/falcon/Table.h	2009-06-25 22:48:40 +0000
@@ -127,7 +127,7 @@ public:
 	int			nextColumnId (int previous);
 	void		loadStuff();
 	void		clearAlter(void);
-	bool		setAlter(void);
+	bool		setAlter(Connection* connection);
 	
 	void		addTrigger (Trigger *trigger);
 	void		dropTrigger (Trigger *trigger);
@@ -271,7 +271,8 @@ public:
 	bool			changed;
 	bool			eof;
 	bool			markedForDelete;
-	bool			alterIsActive;
+	int				alterIsActive;
+	Connection*		alterConnection;			// The connection currintly doing an alter.
 	bool			deleting;					// dropping or truncating.
 	int32			recordBitmapHighWater;
 	int32			ageGroup;


Attachment: [text/bzr-bundle] bzr/kevin.lewis@sun.com-20090625224840-ww8dfcqf3k8wmm03.bundle
Thread
bzr commit into mysql-6.0-falcon-team branch (kevin.lewis:2746)Bug#45701Kevin Lewis26 Jun