#At file:///G:/bzr/mysql-6.0-falcon-team/ based on revid:vvaintroub@stripped
3011 Vladislav Vaintroub 2009-02-11
Bug#42745 : Exception: can't find table space during recovery
In rare circumstances it can happen that information about newly created tablespace that is stored in falcon system tables is not yet flushed to the disk. Recovery that processes a log record that reference such tablespace, will fail.
Solution:
Skip all updates to such tablespaces. This will make database consistent after recovery even if some tables creating right before crash will be missing.
This patch also includes fix for Bug#42743 Falcon fails to recover;Test tablespace file is not open when doing a fetchPage
modified:
storage/falcon/SerialLog.cpp
storage/falcon/TableSpaceManager.cpp
=== modified file 'storage/falcon/SerialLog.cpp'
--- a/storage/falcon/SerialLog.cpp 2009-02-05 05:34:42 +0000
+++ b/storage/falcon/SerialLog.cpp 2009-02-11 00:54:25 +0000
@@ -365,7 +365,22 @@ void SerialLog::recover()
Log::log("Processed: %8ld\n", recordCount);
if (!isTableSpaceDropped(record->tableSpaceId) || record->type == srlDropTableSpace)
- record->pass2();
+ try
+ {
+ record->pass2();
+ }
+ catch(SQLException &e)
+ {
+ // We can have missing tablespaces at this stage.
+ //(missing in the system table at the time of crash
+ // and not found by bootstrap). Handle them as dropped
+ // until someone comes up with a better idea
+ if (e.getSqlcode() == TABLESPACE_NOT_EXIST_ERROR)
+ {
+ Log::log("Cannot find tablespace %d",record->tableSpaceId);
+ setTableSpaceDropped(record->tableSpaceId);
+ }
+ }
}
Log::log("Processed: %8ld\n", recordCount);
=== modified file 'storage/falcon/TableSpaceManager.cpp'
--- a/storage/falcon/TableSpaceManager.cpp 2009-01-31 23:22:42 +0000
+++ b/storage/falcon/TableSpaceManager.cpp 2009-02-11 00:54:25 +0000
@@ -217,6 +217,17 @@ void TableSpaceManager::bootstrap(int se
TableSpace *tableSpace = new TableSpace(database, name.getString(), id.getInt(), fileName.getString(), type.getInt(), NULL);
Log::debug("New table space %s, id %d, type %d, filename %s\n", (const char*) tableSpace->name, tableSpace->tableSpaceId, tableSpace->type, (const char*) tableSpace->filename);
+ try
+ {
+ tableSpace->open();
+ }
+ catch(SQLException &e)
+ {
+ Log::debug("Can't open tablespace %s, id %d : %s\n",
+ (const char*) tableSpace->name, tableSpace->tableSpaceId,e.getText());
+ delete tableSpace;
+ continue;
+ }
add(tableSpace);
stream.clear();
@@ -237,7 +248,7 @@ TableSpace* TableSpaceManager::getTableS
TableSpace *tableSpace = findTableSpace(id);
if (!tableSpace)
- throw SQLError(COMPILE_ERROR, "can't find table space %d", id);
+ throw SQLError(TABLESPACE_NOT_EXIST_ERROR, "can't find table space %d", id);
if (!tableSpace->active)
tableSpace->open();
| Thread |
|---|
| • bzr commit into mysql-6.0-falcon-team branch (vvaintroub:3011)Bug#42745 | Vladislav Vaintroub | 11 Feb |