#At bzr+ssh://bk-internal.mysql.com/bzrroot/server/mysql-6.0-falcon/
2692 Vladislav Vaintroub 2008-06-06
Bug#37080, Bug#35991
- Serialize truncate with any other table operation via MySQL server.
- Remove Falcon own truncate serialization mechanism, that results
into deadlocks
modified:
storage/falcon/Database.cpp
storage/falcon/StorageTable.cpp
storage/falcon/StorageTable.h
storage/falcon/StorageTableShare.cpp
storage/falcon/StorageTableShare.h
storage/falcon/ha_falcon.cpp
per-file messages:
storage/falcon/Database.cpp
Temove lock on Table::syncObject from Database::truncateTable
a) it is not necessary if TRUNCATE is serialized via server
b) potential deadlock Table::validateUpdate coming from gopher,
(outlined in Bug#37080)
storage/falcon/StorageTable.cpp
remove setTruncateLock,clearTruncateLock and haveTruncateLock
storage/falcon/StorageTable.h
remove setTruncateLock,clearTruncateLock and haveTruncateLock
storage/falcon/StorageTableShare.cpp
remove setTruncateLock,clearTruncateLock and haveTruncateLock
storage/falcon/StorageTableShare.h
remove syncTruncate
storage/falcon/ha_falcon.cpp
serialize TRUNCATE with other table operations in store_lock
remove setTruncateLock,clearTruncateLock and haveTruncateLock
=== modified file 'storage/falcon/Database.cpp'
--- a/storage/falcon/Database.cpp 2008-05-09 19:58:50 +0000
+++ b/storage/falcon/Database.cpp 2008-06-06 11:06:11 +0000
@@ -1474,11 +1474,6 @@ void Database::truncateTable(Table *tabl
Sync syncTbl(&syncTables, "Database::truncateTable");
syncTbl.lock(Shared);
- // No table access until truncate completes
-
- Sync syncObj(&table->syncObject, "Database::truncateTable");
- syncObj.lock(Exclusive);
-
table->deleting = true;
// Purge records out of committed transactions
=== modified file 'storage/falcon/StorageTable.cpp'
--- a/storage/falcon/StorageTable.cpp 2008-05-02 22:09:28 +0000
+++ b/storage/falcon/StorageTable.cpp 2008-06-06 11:06:11 +0000
@@ -51,13 +51,10 @@ StorageTable::StorageTable(StorageConnec
upperBound = lowerBound = NULL;
record = NULL;
recordLocked = false;
- haveTruncateLock = false;
}
StorageTable::~StorageTable(void)
{
- clearTruncateLock();
-
if (bitmap)
((Bitmap*) bitmap)->release();
@@ -85,7 +82,6 @@ int StorageTable::open(void)
int StorageTable::deleteTable(void)
{
- clearTruncateLock();
int ret = share->deleteTable(storageConnection);
if (ret == 0)
@@ -96,31 +92,9 @@ int StorageTable::deleteTable(void)
int StorageTable::truncateTable(void)
{
- clearTruncateLock();
- Sync sync(share->syncTruncate, "StorageTable::truncateTable");
- sync.lock(Exclusive);
clearRecord();
int ret = share->truncateTable(storageConnection);
-
return ret;
-}
-
-void StorageTable::clearTruncateLock(void)
-{
- if (haveTruncateLock)
- {
- share->clearTruncateLock();
- haveTruncateLock = false;
- }
-}
-
-void StorageTable::setTruncateLock()
-{
- if (!haveTruncateLock)
- {
- share->setTruncateLock();
- haveTruncateLock = true;
- }
}
int StorageTable::insert(void)
=== modified file 'storage/falcon/StorageTable.h'
--- a/storage/falcon/StorageTable.h 2008-05-02 22:09:28 +0000
+++ b/storage/falcon/StorageTable.h 2008-06-06 11:06:11 +0000
@@ -64,9 +64,6 @@ public:
void clearAlter(void);
bool setAlter(void);
- void clearTruncateLock(void);
- void setTruncateLock();
-
virtual void setConnection(StorageConnection* connection);
virtual void clearIndexBounds(void);
virtual void clearRecord(void);
@@ -128,7 +125,6 @@ public:
Stream insertStream;
int searchFlags;
bool recordLocked;
- bool haveTruncateLock;
};
#endif
=== modified file 'storage/falcon/StorageTableShare.cpp'
--- a/storage/falcon/StorageTableShare.cpp 2008-04-24 14:07:55 +0000
+++ b/storage/falcon/StorageTableShare.cpp 2008-06-06 11:06:11 +0000
@@ -66,9 +66,6 @@ StorageTableShare::StorageTableShare(Sto
sequence = NULL;
tempTable = tempTbl;
setPath(path);
- syncTruncate = new SyncObject;
- syncTruncate->setName("StorageTableShare::syncTruncate");
- truncateLockCount = 0;
if (tempTable)
tableSpace = TEMPORARY_TABLESPACE;
@@ -80,11 +77,8 @@ StorageTableShare::StorageTableShare(Sto
StorageTableShare::~StorageTableShare(void)
{
- while (truncateLockCount > 0)
- clearTruncateLock();
delete syncObject;
- delete syncTruncate;
delete [] impure;
if (storageDatabase)
@@ -565,21 +559,6 @@ JString StorageTableShare::lookupPathNam
return path;
}
-void StorageTableShare::setTruncateLock(void)
-{
- INTERLOCKED_INCREMENT(truncateLockCount);
- syncTruncate->lock(NULL, Shared);
-}
-
-void StorageTableShare::clearTruncateLock(void)
-{
- if (truncateLockCount > 0)
- {
- INTERLOCKED_DECREMENT(truncateLockCount);
- syncTruncate->unlock();
-// syncTruncate->unlock(NULL, Shared);
- }
-}
int StorageTableShare::getFieldId(const char* fieldName)
{
=== modified file 'storage/falcon/StorageTableShare.h'
--- a/storage/falcon/StorageTableShare.h 2008-04-23 14:39:53 +0000
+++ b/storage/falcon/StorageTableShare.h 2008-06-06 11:06:11 +0000
@@ -141,7 +141,6 @@ public:
unsigned char *impure;
int initialized;
SyncObject *syncObject;
- SyncObject *syncTruncate;
StorageDatabase *storageDatabase;
StorageHandler *storageHandler;
Table *table;
=== modified file 'storage/falcon/ha_falcon.cpp'
--- a/storage/falcon/ha_falcon.cpp 2008-06-02 11:19:39 +0000
+++ b/storage/falcon/ha_falcon.cpp 2008-06-06 11:06:11 +0000
@@ -416,8 +416,7 @@ StorageInterface::StorageInterface(handl
StorageInterface::~StorageInterface(void)
{
- if (storageTable)
- storageTable->clearTruncateLock();
+
if (activeBlobs)
freeActiveBlobs();
@@ -530,8 +529,6 @@ int StorageInterface::close(void)
{
DBUG_ENTER("StorageInterface::close");
- if (storageTable)
- storageTable->clearTruncateLock();
unmapFields();
FALCON_CLOSE();
@@ -902,7 +899,7 @@ THR_LOCK_DATA **StorageInterface::store_
if ( (lock_type >= TL_WRITE_CONCURRENT_INSERT && lock_type <= TL_WRITE)
&& !(thd_in_lock_tables(thd) && sql_command == SQLCOM_LOCK_TABLES)
&& !(thd_tablespace_op(thd))
- // && (sql_command != SQLCOM_TRUNCATE)
+ && (sql_command != SQLCOM_TRUNCATE)
&& (sql_command != SQLCOM_OPTIMIZE)
&& (sql_command != SQLCOM_CREATE_TABLE)
)
@@ -1251,8 +1248,6 @@ void StorageInterface::startTransaction(
{
storageConnection->startTransaction(isolation);
- if (storageTable)
- storageTable->setTruncateLock();
trans_register_ha(mySqlThread, true, falcon_hton);
}
@@ -1862,9 +1857,6 @@ int StorageInterface::external_lock(THD
if (!thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))
{
- if (storageTable)
- storageTable->clearTruncateLock();
-
storageConnection->endImplicitTransaction();
}
else
@@ -1879,7 +1871,7 @@ int StorageInterface::external_lock(THD
storageConnection->setCurrentStatement(thd->query);
insertCount = 0;
- bool isTruncate = false;
+
switch (thd_sql_command(thd))
{
@@ -1891,8 +1883,6 @@ int StorageInterface::external_lock(THD
if (ret)
{
- if (storageTable)
- storageTable->clearTruncateLock();
DBUG_RETURN(error(ret));
}
@@ -1900,7 +1890,6 @@ int StorageInterface::external_lock(THD
break;
case SQLCOM_TRUNCATE:
- isTruncate = true;
break;
default:
@@ -1915,9 +1904,6 @@ int StorageInterface::external_lock(THD
if (storageConnection->startTransaction(isolation))
{
- if (!isTruncate && storageTable)
- storageTable->setTruncateLock();
-
trans_register_ha(thd, true, falcon_hton);
}
@@ -1930,9 +1916,6 @@ int StorageInterface::external_lock(THD
if (storageConnection->startImplicitTransaction(isolation))
{
- if (!isTruncate && storageTable)
- storageTable->setTruncateLock();
-
trans_register_ha(thd, false, falcon_hton);
}
}
| Thread |
|---|
| • bzr commit into mysql-6.0-falcon:mysql-6.0-falcon branch (vvaintroub:2692)Bug#35991, Bug#37080 | Vladislav Vaintroub | 6 Jun |