Below is the list of changes that have just been committed into a local
6.0-falcon repository of . When 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-07-09 17:18:05-04:00, jas@rowvwade. +7 -0
Do a more civilized, race condition-free version of drop tablespace.
storage/falcon/SRLDropTableSpace.cpp@stripped, 2007-07-09 17:17:55-04:00, jas@rowvwade. +14
-4
Do a more civilized, race condition-free version of drop tablespace.
storage/falcon/SRLDropTableSpace.h@stripped, 2007-07-09 17:17:55-04:00, jas@rowvwade. +2 -1
Do a more civilized, race condition-free version of drop tablespace.
storage/falcon/SRLVersion.h@stripped, 2007-07-09 17:17:56-04:00, jas@rowvwade. +3 -2
Do a more civilized, race condition-free version of drop tablespace.
storage/falcon/TableSpace.cpp@stripped, 2007-07-09 17:17:56-04:00, jas@rowvwade. +3 -8
Do a more civilized, race condition-free version of drop tablespace.
storage/falcon/TableSpace.h@stripped, 2007-07-09 17:17:56-04:00, jas@rowvwade. +1 -0
Do a more civilized, race condition-free version of drop tablespace.
storage/falcon/TableSpaceManager.cpp@stripped, 2007-07-09 17:17:57-04:00, jas@rowvwade. +49
-28
Do a more civilized, race condition-free version of drop tablespace.
storage/falcon/TableSpaceManager.h@stripped, 2007-07-09 17:17:57-04:00, jas@rowvwade. +2 -0
Do a more civilized, race condition-free version of drop tablespace.
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: jas
# Host: rowvwade.
# Root: D:/MySQL/mysql-5.1-falcon
--- 1.1/storage/falcon/SRLDropTableSpace.cpp 2007-07-09 17:18:31 -04:00
+++ 1.2/storage/falcon/SRLDropTableSpace.cpp 2007-07-09 17:18:31 -04:00
@@ -20,6 +20,10 @@
#include "Engine.h"
#include "SRLDropTableSpace.h"
#include "TableSpace.h"
+#include "TableSpaceManager.h"
+#include "SRLVersion.h"
+#include "SerialLogControl.h"
+#include "Transaction.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
@@ -35,15 +39,21 @@
}
-void SRLDropTableSpace::append(TableSpace *tableSpace)
+void SRLDropTableSpace::append(TableSpace *tableSpace, Transaction *transaction)
{
- START_RECORD(srlDropTableSpace, "SRLData::append");
+ START_RECORD(srlDropTableSpace, "SRLDropTableSpace::append");
putInt(tableSpace->tableSpaceId);
+ putInt(transaction->transactionId);
}
void SRLDropTableSpace::read()
{
tableSpaceId = getInt();
+
+ if (control->version >= srlVersion10)
+ transactionId = getInt();
+ else
+ transactionId = 0;
}
void SRLDropTableSpace::pass1()
@@ -58,10 +68,10 @@
void SRLDropTableSpace::commit()
{
-
+ log->tableSpaceManager->expungeTableSpace(tableSpaceId);
}
void SRLDropTableSpace::redo()
{
-
+ log->tableSpaceManager->expungeTableSpace(tableSpaceId);
}
--- 1.1/storage/falcon/SRLDropTableSpace.h 2007-07-09 17:18:31 -04:00
+++ 1.2/storage/falcon/SRLDropTableSpace.h 2007-07-09 17:18:31 -04:00
@@ -27,6 +27,7 @@
#include "SerialLogRecord.h"
class TableSpace;
+class Transaction;
class SRLDropTableSpace : public SerialLogRecord
{
@@ -39,7 +40,7 @@
virtual void pass2();
virtual void pass1();
virtual void read();
- void append (TableSpace *tableSpace);
+ void append (TableSpace *tableSpace, Transaction *transaction);
int tableSpaceId;
};
--- 1.13/storage/falcon/SRLVersion.h 2007-07-09 17:18:31 -04:00
+++ 1.14/storage/falcon/SRLVersion.h 2007-07-09 17:18:31 -04:00
@@ -35,8 +35,9 @@
static const int srlVersion6 = 6; // Added index version number of SRLIndexUpdate,
SRLUpdateIndex, and SRLDeleteIndex
static const int srlVersion7 = 7; // Added xid to SRLPrepare 1/20/07
static const int srlVersion8 = 8; // Adding tableSpaceId to many classes June 5, 2007
(Ann's birthday!)
-static const int srlVersion9 = 9; // Added block number for checkpoint operation
-static const int srlCurrentVersion = srlVersion9;
+static const int srlVersion9 = 9; // Added block number for checkpoint operation July 9,
2007
+static const int srlVersion10 = 10; // Added transaction id for drop table space July 9,
2007
+static const int srlCurrentVersion = srlVersion10;
class SRLVersion : public SerialLogRecord
{
--- 1.5/storage/falcon/TableSpace.cpp 2007-07-09 17:18:31 -04:00
+++ 1.6/storage/falcon/TableSpace.cpp 2007-07-09 17:18:31 -04:00
@@ -40,6 +40,7 @@
tableSpaceId = spaceId;
filename = spaceFilename;
dbb = new Dbb(database->dbb, tableSpaceId);
+ active = false;
}
TableSpace::~TableSpace()
@@ -53,6 +54,7 @@
try
{
dbb->openFile(filename, false);
+ active = true;
}
catch (SQLException&)
{
@@ -97,14 +99,7 @@
{
dbb->createPath(filename);
dbb->create(filename, dbb->pageSize, 0, HdrTableSpace, 0, NULL);
- /***
- Bdb *bdb = dbb->fetchPage(HEADER_PAGE, PAGE_header, Exclusive);
- bdb->mark(0);
- Hdr *header = (Hdr*) bdb->buffer;
- header->volumeNumber = volumeNumber;
- header->putHeaderVariable (dbb, hdrRepositoryName, (int) strlen
(repository->name), repository->name);
- bdb->release();
- ***/
+ active = true;
dbb->flush();
}
--- 1.6/storage/falcon/TableSpace.h 2007-07-09 17:18:31 -04:00
+++ 1.7/storage/falcon/TableSpace.h 2007-07-09 17:18:31 -04:00
@@ -47,6 +47,7 @@
Dbb *dbb;
Database *database;
int tableSpaceId;
+ bool active;
};
#endif // !defined(AFX_TABLESPACE_H__FAD68264_27D0_4E8B_B19C_911F9DC25A89__INCLUDED_)
--- 1.16/storage/falcon/TableSpaceManager.cpp 2007-07-09 17:18:31 -04:00
+++ 1.17/storage/falcon/TableSpaceManager.cpp 2007-07-09 17:18:31 -04:00
@@ -135,6 +135,9 @@
if (!tableSpace)
throw SQLError(DDL_ERROR, "can't find table space \"%s\"", name);
+ if (!tableSpace->active)
+ throw SQLError(RUNTIME_ERROR, "table space \"%s\" is not active", (const char*)
tableSpace->name);
+
return tableSpace;
}
@@ -230,6 +233,9 @@
if (!tableSpace)
throw SQLError(COMPILE_ERROR, "can't find table space %d", id);
+ if (!tableSpace->active)
+ throw SQLError(RUNTIME_ERROR, "table space \"%s\" is not active", (const char*)
tableSpace->name);
+
return tableSpace;
}
@@ -256,9 +262,51 @@
"delete from system.tablespaces where tablespace=?");
statement->setString(1, tableSpace->name);
statement->executeUpdate();
+ Transaction *transaction = database->getSystemTransaction();
+ transaction->hasUpdates = true;
+ database->serialLog->logControl->dropTableSpace.append(tableSpace,
transaction);
syncSystem.unlock();
- database->serialLog->logControl->dropTableSpace.append(tableSpace);
database->commitSystemTransaction();
+ sync.unlock();
+ tableSpace->active = false;
+}
+
+void TableSpaceManager::reportStatistics(void)
+{
+ Sync sync(&syncObject, "TableSpaceManager::reportStatistics");
+ sync.lock(Shared);
+
+ for (TableSpace *tableSpace = tableSpaces; tableSpace; tableSpace = tableSpace->next)
+ tableSpace->dbb->reportStatistics();
+}
+
+void TableSpaceManager::validate(int optionMask)
+{
+ Sync sync(&syncObject, "TableSpaceManager::validate");
+ sync.lock(Shared);
+
+ for (TableSpace *tableSpace = tableSpaces; tableSpace; tableSpace = tableSpace->next)
+ tableSpace->dbb->validate(optionMask);
+}
+
+void TableSpaceManager::sync(void)
+{
+ Sync sync(&syncObject, "TableSpaceManager::sync");
+ sync.lock(Shared);
+
+ for (TableSpace *tableSpace = tableSpaces; tableSpace; tableSpace = tableSpace->next)
+ tableSpace->dbb->sync();
+}
+
+void TableSpaceManager::expungeTableSpace(int tableSpaceId)
+{
+ Sync sync(&syncObject, "TableSpaceManager::expungeTableSpace");
+ sync.lock(Exclusive);
+ TableSpace *tableSpace = findTableSpace(tableSpaceId);
+
+ if (!tableSpace)
+ return;
+
TableSpace **ptr;
int slot = tableSpace->name.hash(TS_HASH_SIZE);
@@ -288,31 +336,4 @@
sync.unlock();
tableSpace->dropTableSpace();
delete tableSpace;
-}
-
-void TableSpaceManager::reportStatistics(void)
-{
- Sync sync(&syncObject, "TableSpaceManager::reportStatistics");
- sync.lock(Shared);
-
- for (TableSpace *tableSpace = tableSpaces; tableSpace; tableSpace = tableSpace->next)
- tableSpace->dbb->reportStatistics();
-}
-
-void TableSpaceManager::validate(int optionMask)
-{
- Sync sync(&syncObject, "TableSpaceManager::validate");
- sync.lock(Shared);
-
- for (TableSpace *tableSpace = tableSpaces; tableSpace; tableSpace = tableSpace->next)
- tableSpace->dbb->validate(optionMask);
-}
-
-void TableSpaceManager::sync(void)
-{
- Sync sync(&syncObject, "TableSpaceManager::sync");
- sync.lock(Shared);
-
- for (TableSpace *tableSpace = tableSpaces; tableSpace; tableSpace = tableSpace->next)
- tableSpace->dbb->sync();
}
--- 1.8/storage/falcon/TableSpaceManager.h 2007-07-09 17:18:31 -04:00
+++ 1.9/storage/falcon/TableSpaceManager.h 2007-07-09 17:18:31 -04:00
@@ -31,6 +31,7 @@
class TableSpace;
class Database;
+class Transaction;
class TableSpaceManager
{
@@ -57,6 +58,7 @@
SyncObject syncObject;
void validate(int optionMask);
void sync(void);
+ void expungeTableSpace(int tableSpaceId);
};
#endif //
!defined(AFX_TABLESPACEMANAGER_H__BD1D39F6_2201_4136_899C_7CB106E99B8C__INCLUDED_)
| Thread |
|---|
| • bk commit into 6.0-falcon tree (jas:1.2615) | U-ROWVWADEjas | 9 Jul |