List:Commits« Previous MessageNext Message »
From:Kevin Lewis Date:June 12 2009 6:17pm
Subject:bzr commit into mysql-6.0-falcon-team branch (kevin.lewis:2729)
Bug#43554
View as plain text  
#At file:///C:/Work/bzr/Merge/mysql-6.0-falcon-team/ based on revid:lars-erik.bjork@stripped

 2729 Kevin Lewis	2009-06-12
      Bug#43554 - This is an unorthodox, special case fix for a bug that originates from different assumptions about how a storage enginge keeps track of locks.  Falcon will reuse a record lock if it is asked for again within the same transaction.  MySQL server assumes that the storage engine can lock a record twice and unlock it once, leaving it locked for the future of that transaction.  Falcon will not unlock a record if it was locked at an earlier savepoint.  But the server, in the test case for this bug, locks the record twice at the same savepoint.  To make up for this bad assumption in the server, this patch will lower the savepoint ID by 1 if a lock request comes in a second time at the same savepoint.  This will hold a lock slightly longer within the transaction, which if there is a condition where it is not intended, is not as bad as giving up an intended lock.

    modified:
      storage/falcon/Table.cpp
=== modified file 'storage/falcon/Table.cpp'
--- a/storage/falcon/Table.cpp	2009-06-03 21:01:11 +0000
+++ b/storage/falcon/Table.cpp	2009-06-12 18:17:19 +0000
@@ -3520,6 +3520,26 @@ Record* Table::fetchForUpdate(Transactio
 
 		Record *prior = source->getPriorVersion();
 		prior->addRef(REC_HISTORY);
+
+		// If the source lockRecord is locked by at the same savepoint, 
+		// then the first lock MUST be a longer lasting lock.  
+		// Temporary locks can occur with sequential access.  
+		// They will either be converted to an updated record
+		// or immediately unlocked if they do not match the update 
+		// criteria.  So if it is already locked at this savepoint, 
+		// push it up  to the next higher savepoint so that it will 
+		// not be unlocked inadvertently.  The server assumes that 
+		// storage engines use multiple recursive locks, but falcon 
+		// re-uses lockRecords.
+
+		ASSERT(source->isVersion());
+		RecordVersion* lockRecord = (RecordVersion*) source;
+		if (   lockRecord->savePointId > 0 
+			&& lockRecord->savePointId == transaction->curSavePointId)
+			{
+			lockRecord->savePointId--;
+			}
+
 		source->release(REC_HISTORY);
 
 		return prior;


Attachment: [text/bzr-bundle] bzr/kevin.lewis@sun.com-20090612181719-ho9zfrs5tzcxoht8.bundle
Thread
bzr commit into mysql-6.0-falcon-team branch (kevin.lewis:2729)Bug#43554Kevin Lewis12 Jun