List:Commits« Previous MessageNext Message »
From:vvaintroub Date:January 30 2008 9:47am
Subject: bk commit into 6.0 tree (vvaintroub:1.2785) BUG#34806
View as plain text  
Below is the list of changes that have just been committed into a local
6.0 repository of vvaintroub. When vvaintroub 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, 2008-01-30 09:37:40+01:00, vvaintroub@wva. +4 -0
  Bug#34806 : If falcon_page_cache_size is too big, this can lead to 
  crashes. In worst case, if master database is created as a result of 
  the first CREATE TABLE ...ENGINE=FALCON, invalid master.fts with 0 bytes 
  size is still left. This prevents subsequent CREATE TABLE ... 
  ENGINE=FALCON, even after page cache size is reset to a sane value.
  Also, do not try to initialize Falcon after failed initialization.   

  storage/falcon/Dbb.cpp@stripped, 2008-01-30 09:37:37+01:00, vvaintroub@wva. +15 -5
    Cleanup empty file master.fts, if database creation is not successfull,
    e.g after memory allocation error.

  storage/falcon/StorageHandler.cpp@stripped, 2008-01-30 09:37:37+01:00, vvaintroub@wva. +12
-3
    -Avoid dereferencing null-pointer if page cache could not be allocated
    -Avoid calling StorageHandler::initialize() again after failure,  
    errors are irrepairable.
    -Do not attempt to create MASTER, unless exception code indicates 
    it is not there.

  storage/falcon/StorageHandler.h@stripped, 2008-01-30 09:37:38+01:00, vvaintroub@wva. +1 -0
    Track whether initialize() has already been called, don't call it many 
    times after failure.

  storage/falcon/StorageTableShare.cpp@stripped, 2008-01-30 09:37:38+01:00, vvaintroub@wva.
+2 -0
    Avoid dereferencing null-pointer if page cache could not be allocated.

diff -Nrup a/storage/falcon/Dbb.cpp b/storage/falcon/Dbb.cpp
--- a/storage/falcon/Dbb.cpp	2008-01-19 18:59:10 +01:00
+++ b/storage/falcon/Dbb.cpp	2008-01-30 09:37:37 +01:00
@@ -153,12 +153,22 @@ Cache* Dbb::create(const char * fileName
 	odsVersion = ODS_VERSION;
 	odsMinorVersion = ODS_MINOR_VERSION;
 	sequence = 1;
-	createFile(fileName, initialAllocation);
+
 	init (pageSz, (int) ((cacheSize + pageSz - 1) / pageSz));
-	Hdr::create (this, fileType, transId, logRoot);
-	PageInventoryPage::create (this, transId);
-	SectionRootPage::create (this, transId);
-	IndexRootPage::create (this, transId);
+	createFile(fileName, initialAllocation);
+	try
+		{
+		Hdr::create (this, fileType, transId, logRoot);
+		PageInventoryPage::create (this, transId);
+		SectionRootPage::create (this, transId);
+		IndexRootPage::create (this, transId);
+		}
+	catch(...)
+		{
+		closeFile();
+		deleteFile();
+		throw;
+		}
 
 	return cache;
 }
diff -Nrup a/storage/falcon/StorageHandler.cpp b/storage/falcon/StorageHandler.cpp
--- a/storage/falcon/StorageHandler.cpp	2008-01-26 23:52:21 +01:00
+++ b/storage/falcon/StorageHandler.cpp	2008-01-30 09:37:37 +01:00
@@ -102,6 +102,7 @@ StorageHandler::StorageHandler(int lockS
 	dictionaryConnection = NULL;
 	databaseList = NULL;
 	defaultDatabase = NULL;
+	initialized = false;
 }
 
 StorageHandler::~StorageHandler(void)
@@ -642,6 +643,9 @@ StorageConnection* StorageHandler::getSt
 	if (!defaultDatabase)
 		initialize();
 
+	if (!dictionaryConnection)
+		return NULL;
+
 	if (!tableShare->storageDatabase)
 		tableShare->findDatabase();
 
@@ -887,14 +891,16 @@ void StorageHandler::getTransactionSumma
 
 void StorageHandler::initialize(void)
 {
-	if (defaultDatabase)
+
+	if (initialized)
 		return;
 	
 	Sync sync(&syncObject, "StorageConnection::initialize");
 	sync.lock(Exclusive);
 	
-	if (defaultDatabase)
+	if (initialized)
 		return;
+	initialized = true;
 		
 	defaultDatabase = getStorageDatabase(MASTER_NAME, MASTER_PATH);
 	
@@ -904,8 +910,11 @@ void StorageHandler::initialize(void)
 		dictionaryConnection = defaultDatabase->getOpenConnection();
 		dropTempTables();
 		}
-	catch (...)
+	catch (SQLException &e)
 		{
+		// If database is not there, create it
+		if(e.getSqlcode() != CONNECTION_ERROR)
+			return;
 		try
 			{
 			defaultDatabase->createDatabase();
diff -Nrup a/storage/falcon/StorageHandler.h b/storage/falcon/StorageHandler.h
--- a/storage/falcon/StorageHandler.h	2007-12-02 21:17:12 +01:00
+++ b/storage/falcon/StorageHandler.h	2008-01-30 09:37:38 +01:00
@@ -134,6 +134,7 @@ public:
 	StorageTableShare	*tables[tableHashSize];
 	Connection			*dictionaryConnection;
 	int					mySqlLockSize;
+	bool				initialized;
 	virtual void getFalconVersionInfo(InfoTable* infoTable);
 };
 
diff -Nrup a/storage/falcon/StorageTableShare.cpp b/storage/falcon/StorageTableShare.cpp
--- a/storage/falcon/StorageTableShare.cpp	2008-01-04 00:35:04 +01:00
+++ b/storage/falcon/StorageTableShare.cpp	2008-01-30 09:37:38 +01:00
@@ -358,6 +358,8 @@ void StorageTableShare::load(void)
 	Sync sync(&storageHandler->dictionarySyncObject, "StorageTableShare::load");
 	sync.lock(Exclusive);
 	Connection *connection = storageHandler->getDictionaryConnection();
+	if (!connection)
+		return;
 	PreparedStatement *statement = connection->prepareStatement(
 		"select
given_schema_name,given_table_name,effective_schema_name,effective_table_name,tablespace_name
"
 		"from falcon.tables where pathname=?");


Thread
bk commit into 6.0 tree (vvaintroub:1.2785) BUG#34806vvaintroub30 Jan