Code looks good. OK to push.
Vladislav Vaintroub wrote:
> #At file:///G:/bzr/mysql-6.0-falcon-team/ based on
> revid:kevin.lewis@stripped
>
> 3129 Vladislav Vaintroub 2009-04-19
> Bug #36993 Falcon reports Index SCHEDULE..PRIMARY_KEY in SYSTEM.SCHEDULE
> damaged
>
> The problem here is that mysqld was killed before database was completely
> created
> (i.e before all data dictionary was completely written to the disk). Falcon
> cannot
> handle such sutuations gracefully yet, recovery after such point is not
> guaranteed
> to succeed.
>
> The patch improves the sutation a little bit, disabling user queiries until
> database is
> fully created and written to the disk.
>
> Also, this patch introduces a clean Falcon shutdown : waiting for background
> theads
> to complete their work , followed by flushing the page cache. This will
> eliminate the
> need for recovery after a clean shutdown.
>
> modified:
> storage/falcon/Database.cpp
> storage/falcon/StorageHandler.cpp
> storage/falcon/TransactionManager.cpp
> === modified file 'storage/falcon/Database.cpp'
> --- a/storage/falcon/Database.cpp 2009-04-09 15:40:11 +0000
> +++ b/storage/falcon/Database.cpp 2009-04-19 20:21:00 +0000
> @@ -1640,6 +1640,9 @@ void Database::shutdown()
> if (shuttingDown)
> return;
>
> + // Wait for all gophers to finish.
> + waitForWriteComplete(NULL);
> +
> if (updateCardinality)
> {
> updateCardinality->close();
>
> === modified file 'storage/falcon/StorageHandler.cpp'
> --- a/storage/falcon/StorageHandler.cpp 2009-03-31 18:19:17 +0000
> +++ b/storage/falcon/StorageHandler.cpp 2009-04-19 20:21:00 +0000
> @@ -1035,6 +1035,11 @@ void StorageHandler::createDatabase(void
> statement->executeUpdate(*ddl);
> statement->close();
> dictionaryConnection->commit();
> +
> + Database *database = dictionaryConnection->database;
> + database->waitForWriteComplete(NULL);
> + database->flush((int64)0);
> +
> inCreateDatabase = false;
> }
>
>
> === modified file 'storage/falcon/TransactionManager.cpp'
> --- a/storage/falcon/TransactionManager.cpp 2009-04-06 12:33:12 +0000
> +++ b/storage/falcon/TransactionManager.cpp 2009-04-19 20:21:00 +0000
> @@ -177,6 +177,8 @@ bool TransactionManager::hasUncommittedR
>
> // Wait until all committed records for a table are purged by gophers
> // (their transaction become write complete)
> +// If table is NULL pointer, the functions wait for all transactions to
> +// become write complete
> void TransactionManager::waitForWriteComplete(Table* table)
> {
> for(;;)
> @@ -189,11 +191,18 @@ void TransactionManager::waitForWriteCom
> for (Transaction *trans = committedTransactions.first; trans;
> trans = trans->next)
> {
> - if (trans->hasRecords(table)&& trans->writePending)
> - {
> - again = true;
> - break;
> - }
> + if (table)
> + {
> + if (trans->hasRecords(table)&& trans->writePending)
> + again = true;
> + }
> + else
> + {
> + if(trans->writePending)
> + again = true;
> + }
> + if (again)
> + break;
> }
>
> if(!again)
>
>
>
> ------------------------------------------------------------------------
>
>