Below is the list of changes that have just been committed into a local
6.0 repository of cpowers. When cpowers does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2007-12-04 20:46:39-06:00, chris@stripped +2 -0
Bug#32963, falcon_bug_22173a fails
- Eliminated potential deadlock between scavenger and truncate operation
storage/falcon/Database.cpp@stripped, 2007-12-04 20:46:37-06:00, chris@stripped +18
-12
Database::truncateTable()
- Reordered locking order and lock types:
Table::syncScavenge (exclusive)
Database::syncTables (shared)
Table::syncObject (exclusive)
Database::syncSysConnection (shared)
Database::updateCardinalities()
- Reveresd lock order of syncTables and sysConnection
storage/falcon/Table.cpp@stripped, 2007-12-04 20:46:37-06:00, chris@stripped +12 -15
Table::truncate()
- Removed redundant exclusive lock
- Moved system transaction acquisition back to Database
- Update cardinality along with section ids in system.tables
diff -Nrup a/storage/falcon/Database.cpp b/storage/falcon/Database.cpp
--- a/storage/falcon/Database.cpp 2007-12-03 09:22:00 -06:00
+++ b/storage/falcon/Database.cpp 2007-12-04 20:46:37 -06:00
@@ -1417,29 +1417,35 @@ void Database::truncateTable(Table *tabl
throw SQLError(UNCOMMITTED_UPDATES, "table %s.%s has uncommitted updates and cannot be
truncated",
table->schemaName, table->name);
+ // Keep scavenger out of the way
+
+ Sync scavenge(&table->syncScavenge, "Database::truncateTable");
+ scavenge.lock(Shared);
+
+ // Block drop/add, table list scans ok
+
Sync sync(&syncTables, "Database::truncateTable");
- sync.lock(Exclusive);
+ sync.lock(Shared);
- // No access until truncate complete
+ // No access until truncate completes
Sync syncObj(&table->syncObject, "Database::truncateTable");
syncObj.lock(Exclusive);
- // Keep scavenger out of the way
-
- Sync scavenge(&table->syncScavenge, "Database::truncateTable");
- scavenge.lock(Exclusive);
-
// Purge records out of committed transactions
transactionManager->truncateTable(table, transaction);
+ Sync syncConnection(&syncSysConnection, "Table::truncate");
+ syncConnection.lock(Shared);
+
+ Transaction *sysTransaction = getSystemTransaction();
+
// Recreate data/blob sections and indexes
- Sync syncConnection(&syncSysConnection, "Table::truncate");
- syncConnection.lock(Exclusive);
+ table->truncate(sysTransaction);
- table->truncate(transaction);
+ syncConnection.unlock();
commitSystemTransaction();
}
@@ -2250,10 +2256,10 @@ void Database::getTransactionSummaryInfo
void Database::updateCardinalities(void)
{
- Sync syncSystemTransaction(&syncSysConnection, "Database::updateCardinalities");
- syncSystemTransaction.lock(Shared);
Sync sync (&syncTables, "Database::updateCardinalities");
sync.lock (Shared);
+ Sync syncSystemTransaction(&syncSysConnection, "Database::updateCardinalities");
+ syncSystemTransaction.lock(Shared);
bool hit = false;
try
diff -Nrup a/storage/falcon/Table.cpp b/storage/falcon/Table.cpp
--- a/storage/falcon/Table.cpp 2007-12-03 07:02:19 -06:00
+++ b/storage/falcon/Table.cpp 2007-12-04 20:46:37 -06:00
@@ -1462,18 +1462,14 @@ void Table::drop(Transaction *transactio
void Table::truncate(Transaction *transaction)
{
- Sync sync(&syncObject, "Table::truncate");
- sync.lock(Exclusive);
- Transaction *sysTransaction = database->getSystemTransaction();
-
// Delete data and blob sections
- expunge(sysTransaction);
+ expunge(transaction);
// Recreate data and blob sections
- dataSectionId = dbb->createSection(TRANSACTION_ID(sysTransaction));
- blobSectionId = dbb->createSection(TRANSACTION_ID(sysTransaction));
+ dataSectionId = dbb->createSection(TRANSACTION_ID(transaction));
+ blobSectionId = dbb->createSection(TRANSACTION_ID(transaction));
dataSection = dbb->findSection(dataSectionId);
blobSection = dbb->findSection(dataSectionId);
@@ -1481,12 +1477,16 @@ void Table::truncate(Transaction *transa
emptySections->clear();
recordBitmap->clear();
- // Update system.tables with new section ids
+ cardinality = 0;
+ priorCardinality = cardinality;
+
+ // Update system.tables with new section ids and cardinality
- PreparedStatement *statement = database->prepareStatement("update system.tables set
dataSection=?, blobSection=? where tableId=?");
+ PreparedStatement *statement = database->prepareStatement("update system.tables set
dataSection=?, blobSection=?, cardinality=? where tableId=?");
statement->setInt(1, dataSectionId);
statement->setInt(2, blobSectionId);
- statement->setInt(3, tableId);
+ statement->setLong(3, cardinality);
+ statement->setInt(4, tableId);
statement->executeUpdate();
statement->close();
@@ -1496,17 +1496,14 @@ void Table::truncate(Transaction *transa
records = NULL;
}
- rebuildIndexes(sysTransaction, true);
+ rebuildIndexes(transaction, true);
- // Reset select Table attributes
+ // Reset remaining Table attributes
- priorCardinality = cardinality; // forces update to system tables during scavenge
- cardinality = 0;
ageGroup = database->currentGeneration;
debugThawedRecords = 0;
debugThawedBytes = 0;
alterIsActive = false;
- //database->commitSystemTransaction();
}
void Table::checkNullable(Record * record)
| Thread |
|---|
| • bk commit into 6.0 tree (chris:1.2733) BUG#32963 | cpowers | 5 Dec |