List:Commits« Previous MessageNext Message »
From:klewis Date:February 1 2008 6:30am
Subject:bk commit into 6.0 tree (klewis:1.2787)
View as plain text  
Below is the list of changes that have just been committed into a local
6.0 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, 2008-02-01 00:30:23-06:00, klewis@klewis-mysql. +7 -0
  Changes for 34164 and 34086.

  storage/falcon/Dbb.cpp@stripped, 2008-02-01 00:29:58-06:00, klewis@klewis-mysql. +15 -5
    Changes for 34086.

  storage/falcon/IO.cpp@stripped, 2008-02-01 00:30:01-06:00, klewis@klewis-mysql. +5 -4
    Changes for 34086.

  storage/falcon/SQLException.h@stripped, 2008-02-01 00:30:04-06:00, klewis@klewis-mysql. +2 -1
    Changes for 34086.

  storage/falcon/StorageHandler.cpp@stripped, 2008-02-01 00:30:07-06:00, klewis@klewis-mysql. +16 -3
    Changes for 34086.

  storage/falcon/StorageHandler.h@stripped, 2008-02-01 00:30:09-06:00, klewis@klewis-mysql. +1 -0
    Changes for 34086.

  storage/falcon/StorageTableShare.cpp@stripped, 2008-02-01 00:30:11-06:00, klewis@klewis-mysql. +2 -0
    Changes for 34086.

  storage/falcon/ha_falcon.cpp@stripped, 2008-02-01 00:30:13-06:00, klewis@klewis-mysql. +12 -6
    Changes for 34164

diff -Nrup a/storage/falcon/Dbb.cpp b/storage/falcon/Dbb.cpp
--- a/storage/falcon/Dbb.cpp	2008-01-30 01:34:12 -06:00
+++ b/storage/falcon/Dbb.cpp	2008-02-01 00:29:58 -06: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/IO.cpp b/storage/falcon/IO.cpp
--- a/storage/falcon/IO.cpp	2008-01-30 01:34:26 -06:00
+++ b/storage/falcon/IO.cpp	2008-02-01 00:30:01 -06:00
@@ -142,8 +142,10 @@ bool IO::openFile(const char * name, boo
 		}
 
 	if (fileId < 0)
-		throw SQLEXCEPTION (CONNECTION_ERROR, "can't open file \"%s\": %s (%d)", 
-							name, strerror (errno), errno);
+		{
+			int sqlError = (errno == EACCES )? FILE_ACCESS_ERROR :CONNECTION_ERROR;
+			throw SQLEXCEPTION (sqlError, "can't open file \"%s\": %s (%d)", name, strerror (errno), errno);
+		}
 
 	isReadOnly = readOnly;
 	
@@ -184,8 +186,7 @@ bool IO::createFile(const char *name, ui
 		}
 
 	if (fileId < 0)
-		throw SQLEXCEPTION (CONNECTION_ERROR, "can't create file \"%s\", %s (%d)", 
-								name, strerror (errno), errno);
+		throw SQLEXCEPTION (CONNECTION_ERROR,"can't create file \"%s\", %s (%d)", name, strerror (errno), errno);
 
 	isReadOnly = false;
 #ifndef _WIN32
diff -Nrup a/storage/falcon/SQLException.h b/storage/falcon/SQLException.h
--- a/storage/falcon/SQLException.h	2007-11-28 11:20:53 -06:00
+++ b/storage/falcon/SQLException.h	2008-02-01 00:30:04 -06:00
@@ -67,7 +67,8 @@ enum SqlCode {
 	TABLESPACE_EXIST_ERROR		= -33,
 	TABLESPACE_NOT_EMPTY		= -34,
 	TABLESPACE_NOT_EXIST_ERROR	= -35,
-	DEVICE_FULL					= -36
+	DEVICE_FULL					= -36,
+	FILE_ACCESS_ERROR			= -37
 	};
 
 class DllExport SQLException {
diff -Nrup a/storage/falcon/StorageHandler.cpp b/storage/falcon/StorageHandler.cpp
--- a/storage/falcon/StorageHandler.cpp	2008-01-30 01:36:01 -06:00
+++ b/storage/falcon/StorageHandler.cpp	2008-02-01 00:30:07 -06: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();
 
@@ -890,14 +894,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);
 	
@@ -907,8 +913,15 @@ void StorageHandler::initialize(void)
 		dictionaryConnection = defaultDatabase->getOpenConnection();
 		dropTempTables();
 		}
-	catch (...)
+	catch (SQLException &e)
 		{
+		// No point in creating a database if we got memory error.
+		// On FILE_ACCESS_ERROR, an external application can temporarily lock the file.
+		// In this both cases, trying to create database in this case could eventually
+		// lead to "recreate" and data loss.
+		int err = e.getSqlcode();
+		if(err == OUT_OF_MEMORY_ERROR || err == FILE_ACCESS_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 14:17:12 -06:00
+++ b/storage/falcon/StorageHandler.h	2008-02-01 00:30:09 -06: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-30 01:36:04 -06:00
+++ b/storage/falcon/StorageTableShare.cpp	2008-02-01 00:30:11 -06: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=?");
diff -Nrup a/storage/falcon/ha_falcon.cpp b/storage/falcon/ha_falcon.cpp
--- a/storage/falcon/ha_falcon.cpp	2008-01-31 11:23:34 -06:00
+++ b/storage/falcon/ha_falcon.cpp	2008-02-01 00:30:13 -06:00
@@ -189,12 +189,15 @@ int StorageInterface::falcon_init(void *
 	falcon_hton->flags = HTON_NO_FLAGS;
 	storageHandler->addNfsLogger(falcon_debug_mask, StorageInterface::logger, NULL);
 
-	int repeatableRead = (falcon_consistent_read ? 
+	int newRepeatableRead = (falcon_consistent_read ? 
 		TRANSACTION_CONSISTENT_READ : TRANSACTION_WRITE_COMMITTED);
-	if (isolation_levels[2] != repeatableRead)
+	if (isolation_levels[ISO_REPEATABLE_READ] != newRepeatableRead)
+		{
+		int oldRepeatableRead = isolation_levels[ISO_REPEATABLE_READ];
 		for (int i = 0; i < 4; i++)
-			if ((i == 2) || (isolation_levels[i] == isolation_levels[2]))
-				isolation_levels[i] = repeatableRead;
+			if (isolation_levels[i] == oldRepeatableRead)
+				isolation_levels[i] = newRepeatableRead;
+		}
 
 	if (falcon_debug_server)
 		storageHandler->startNfsServer();
@@ -3036,10 +3039,13 @@ void StorageInterface::updateConsistentR
 	int newRepeatableRead = (falcon_consistent_read ? 
 		TRANSACTION_CONSISTENT_READ : TRANSACTION_WRITE_COMMITTED);
 
-	if (isolation_levels[2] != newRepeatableRead)
+	if (isolation_levels[ISO_REPEATABLE_READ] != newRepeatableRead)
+		{
+		int oldRepeatableRead = isolation_levels[ISO_REPEATABLE_READ];
 		for (int i = 0; i < 4; i++)
-			if ((i == 2) || (isolation_levels[i] == isolation_levels[2]))
+			if (isolation_levels[i] == oldRepeatableRead)
 				isolation_levels[i] = newRepeatableRead;
+		}
 }
 
 void StorageInterface::updateRecordMemoryMax(MYSQL_THD thd, struct st_mysql_sys_var* variable, void* var_ptr, void* save)
Thread
bk commit into 6.0 tree (klewis:1.2787)klewis1 Feb