3061 lars-erik.bjork@stripped 2009-03-16 [merge]
merging
added:
mysql-test/include/UnicodeData.txt
storage/falcon/ErrorInjector.cpp
storage/falcon/ErrorInjector.h
modified:
mysql-test/suite/falcon/r/falcon_options.result
mysql-test/suite/falcon/r/falcon_options2.result
mysql-test/suite/falcon/r/falcon_unicode-big.result
mysql-test/suite/falcon/t/disabled.def
mysql-test/suite/falcon/t/falcon_unicode-big.test
mysql-test/suite/falcon_team/r/falcon_deadlock.result
mysql-test/suite/falcon_team/t/falcon_deadlock.test
storage/falcon/CMakeLists.txt
storage/falcon/IndexPage.cpp
storage/falcon/Makefile.am
storage/falcon/SerialLog.cpp
storage/falcon/SerialLogRecord.h
storage/falcon/ha_falcon.cpp
=== modified file 'storage/falcon/IndexWalker.cpp'
--- a/storage/falcon/IndexWalker.cpp 2009-03-07 07:51:29 +0000
+++ b/storage/falcon/IndexWalker.cpp 2009-03-16 09:06:42 +0000
@@ -142,31 +142,51 @@ Record* IndexWalker::getValidatedRecord(
// Fetch record. If it doesn't exist, that's ok.
- Record *candidate = table->fetch(recordId);
- if (!candidate)
- return NULL;
- RECORD_HISTORY(candidate);
+ Record *candidate = NULL;
+ Record *record = NULL;
+
+ try
+ {
+ candidate = table->fetch(recordId);
- // Get the correct version. If this is select for update, get a lock record
+ if (!candidate)
+ return NULL;
- Record *record = (lockForUpdate)
- ? table->fetchForUpdate(transaction, candidate, true)
- : candidate->fetchVersion(transaction);
+ RECORD_HISTORY(candidate);
+
+ // Get the correct version. If this is select for update, get a lock record
+ record = (lockForUpdate)
+ ? table->fetchForUpdate(transaction, candidate, true)
+ : candidate->fetchVersion(transaction);
- if (!record)
- {
- if (!lockForUpdate)
- candidate->release(REC_HISTORY);
+ if (!record)
+ {
+ if (!lockForUpdate)
+ candidate->release(REC_HISTORY);
- return NULL;
- }
+ return NULL;
+ }
- // If we have a different record version, release the original
+ // If we have a different record version, release the original
- if (!lockForUpdate && candidate != record)
+ if (!lockForUpdate && candidate != record)
+ {
+ record->addRef(REC_HISTORY);
+ candidate->release(REC_HISTORY);
+ }
+ }
+ catch (SQLException& exception)
{
- record->addRef(REC_HISTORY);
- candidate->release(REC_HISTORY);
+
+ // 'record' must be NULL if an exception has been thrown.
+ // fetchForUpdate releases the 'candidate' on error
+
+ if (candidate && !lockForUpdate)
+ candidate->release(REC_HISTORY);
+
+ // Re-throw the exception, catch it further up to return the correct
+ // error
+ throw;
}
// Compute record key and compare against index key. If there' different, punt
=== modified file 'storage/falcon/StorageDatabase.cpp'
--- a/storage/falcon/StorageDatabase.cpp 2009-02-26 20:04:31 +0000
+++ b/storage/falcon/StorageDatabase.cpp 2009-03-10 08:33:34 +0000
@@ -484,14 +484,45 @@ int StorageDatabase::nextIndexed(Storage
int StorageDatabase::nextIndexed(StorageTable* storageTable, IndexWalker* indexWalker,
bool lockForUpdate)
{
- Record *record = indexWalker->getNext(lockForUpdate);
- if (!record)
- return StorageErrorRecordNotFound;
+ try
+ {
+ Record *record = indexWalker->getNext(lockForUpdate);
+
+ if (!record)
+ return StorageErrorRecordNotFound;
+
+ storageTable->setRecord(record, lockForUpdate);
+ return record->recordNumber;
+ }
+ catch (SQLException& exception)
+ {
+ StorageConnection *storageConnection = storageTable->storageConnection;
+ storageConnection->setErrorText(&exception);
+ int errorCode = exception.getSqlcode();
- storageTable->setRecord(record, lockForUpdate);
-
- return record->recordNumber;
+ switch (errorCode)
+ {
+ case UPDATE_CONFLICT:
+ return StorageErrorUpdateConflict;
+
+ case OUT_OF_MEMORY_ERROR:
+ return StorageErrorOutOfMemory;
+
+ case OUT_OF_RECORD_MEMORY_ERROR:
+ return StorageErrorOutOfRecordMemory;
+
+ case DEADLOCK:
+ return StorageErrorDeadlock;
+
+ case LOCK_TIMEOUT:
+ return StorageErrorLockTimeout;
+
+ default:
+ ASSERT(false);
+ }
+
+ }
}
int StorageDatabase::savepointSet(Connection* connection)
| Thread |
|---|
| • bzr push into mysql-6.0-falcon-team branch (lars-erik.bjork:3061) | lars-erik.bjork | 16 Mar 2009 |