#At file:///home/os136802/mysql/develop/repo/falcon-newdeps4-commitnoupdates/ based on revid:olav@stripped
2742 Olav Sandstaa 2008-12-08
WL#4654 New transaction dependency manager for Falcon
Patch 1 for optimization of read-only transactions: re-enable the call to
Transaction::commitNoUpdates(). The transaction object is deleted at the
end of Transaction::commitNoUpdates() and that no re-use of transaction objects
is implemented yet.
modified:
storage/falcon/Transaction.cpp
per-file messages:
storage/falcon/Transaction.cpp
Re-enable call to commitNoUpdates(). Added code for deleting the transaction object since
no re-use is implemented yet.
=== modified file 'storage/falcon/Transaction.cpp'
=== modified file 'storage/falcon/Transaction.cpp'
--- a/storage/falcon/Transaction.cpp 2008-12-08 11:28:35 +0000
+++ b/storage/falcon/Transaction.cpp 2008-12-08 12:22:08 +0000
@@ -209,15 +209,11 @@
releaseSavepoints();
- // NOTE: temporary disabled the optimization for read only transactions.
- // This will be included in a follow up patch
-
- //if (!hasUpdates)
- // {
- // commitNoUpdates();
- //
- // return;
- // }
+ if (!hasUpdates)
+ {
+ commitNoUpdates();
+ return;
+ }
TransactionManager *transactionManager = database->transactionManager;
addRef();
@@ -246,13 +242,7 @@
if (hasLocks)
releaseRecordLocks();
- // NOTE: The if test can be removed when the handling of read-only
- // transactions has been re-implemented
-
- if (hasUpdates)
- database->serialLog->preCommit(this);
- else
- writePending = false;
+ database->serialLog->preCommit(this);
Sync syncRec(&syncRecords,"Transaction::commit(1.5)");
syncRec.lock(Shared);
@@ -322,9 +312,6 @@
void Transaction::commitNoUpdates(void)
{
- // NOTE: This method is not in use by the new dependency manager.
- // It will be re-enabled in a follow-up patch
-
TransactionManager *transactionManager = database->transactionManager;
addRef();
ASSERT(!deferredIndexes);
@@ -337,8 +324,11 @@
if (hasLocks)
releaseRecordLocks();
+ // NOTE: Temporarily upgraded from using Shared to Exclusive locking.
+ // See explanation further down
+
Sync syncActiveTransactions(&transactionManager->activeTransactions.syncObject, "Transaction::commitNoUpdates(2)");
- syncActiveTransactions.lock(Shared);
+ syncActiveTransactions.lock(Exclusive);
if (xid)
{
@@ -356,6 +346,17 @@
transactionId = 0;
writePending = false;
state = Available;
+
+ // NOTE: This code is hopefully temporar until we have implemented
+ // support for reusing transaction objects:
+ // Remove this transaction from the active list
+
+ inList = false;
+ transactionManager->activeTransactions.remove(this);
+ ASSERT(useCount >= 2);
+ release();
+ sync.unlock();
+
syncActiveTransactions.unlock();
syncIsActive.unlock();
release();
| Thread |
|---|
| • bzr commit into mysql-6.0-falcon-ann branch (olav:2742) WL#4654 | Olav Sandstaa | 8 Dec |