List:Commits« Previous MessageNext Message »
From:U-ROWVWADEjas Date:August 24 2007 5:31pm
Subject:bk commit into 6.0-falcon tree (jas:1.2703)
View as plain text  
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-08-24 13:31:07-04:00, jas@rowvwade. +4 -0
  Added function to see if table of same name exists.

  storage/falcon/StorageHandler.cpp@stripped, 2007-08-24 13:30:57-04:00, jas@rowvwade. +8 -68
    Make sure table doesn't exist before re-creating it.  Also
    eliminated some dead code.

  storage/falcon/StorageTableShare.cpp@stripped, 2007-08-24 13:30:58-04:00, jas@rowvwade. +22 -17
    Added function to see if table of same name exists.

  storage/falcon/StorageTableShare.h@stripped, 2007-08-24 13:30:58-04:00, jas@rowvwade. +3 -2
    Added function to see if table of same name exists.

  storage/falcon/ha_falcon.cpp@stripped, 2007-08-24 13:30:58-04:00, jas@rowvwade. +5 -1
    Handle duplicate table error.

# 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.48/storage/falcon/StorageHandler.cpp	2007-08-24 13:31:26 -04:00
+++ 1.49/storage/falcon/StorageHandler.cpp	2007-08-24 13:31:26 -04:00
@@ -499,6 +499,14 @@
 		initialize();
 
 	StorageTableShare *tableShare = new StorageTableShare(this, pathname, tableSpaceName, mySqlLockSize, tempTable);
+	
+	if (tableShare->tableExists())
+		{
+		delete tableShare;
+		
+		return NULL;
+		}
+
 	addTable(tableShare);
 	tableShare->registerTable();
 	
@@ -788,74 +796,6 @@
 	for (StorageDatabase *storageDatabase = databaseList; storageDatabase; storageDatabase = storageDatabase->next)
 		storageDatabase->getTransactionSummaryInfo(infoTable);
 }
-
-/*
-	"upgrade table falcon.tables ("
-	"    given_schema_name varchar(128) not null,"
-	"    effective_schema_name varchar(128) not null,"
-	"    given_table_name varchar(128) not null,"
-	"    effective_table_name varchar(128) not null,"
-	"    tablespace_name varchar(128) not null,"
-	"    pathname varchar(1024) not null primary key)",
-
-	"upgrade table falcon.tablespaces ("
-	"    name varchar(128) not null primary	key,"
-	"    pathname varchar(1024) not null)",
-
-*/
-
-/***
-void StorageHandler::copyOldDictionary(void)
-{
-	try
-		{
-		Configuration configuration(NULL);
-		Connection *connection = new Connection(&configuration);
-		connection->openDatabase(DICTIONARY_NAME, DICTIONARY_PATH, DICTIONARY_ACCOUNT, DICTIONARY_PW, NULL, NULL);
-		PStatement select = connection->prepareStatement(
-			"select given_schema_name,effective_schema_name,given_table_name,effective_table_name,tablespace_name,pathname"
-			" from falcon.tables");
-		RSet resultSet = select->executeQuery();
-		PStatement insert = dictionaryConnection->prepareStatement(
-			"insert into falcon.tables (given_schema_name,effective_schema_name,given_table_name,effective_table_name,tablespace_name,pathname)"
-			"   values(?,?,?,?,?,?)");
-		
-		while (resultSet->next())
-			{
-			for (int n = 1; n <= 6; ++n)
-				insert->setString(n, resultSet->getString(n));
-			
-			insert->executeUpdate();
-			}
-		
-		resultSet.close();
-		select = connection->prepareStatement(
-			"select name, pathname from falcon.tablespaces");
-			
-		resultSet = select->executeQuery();
-		insert = dictionaryConnection->prepareStatement(
-			"insert into falcon.tablespaces (name,pathname) values (?,?)");
-
-		while (resultSet->next())
-			{
-			for (int n = 1; n <= 2; ++n)
-				insert->setString(n, resultSet->getString(n));
-			
-			insert->executeUpdate();
-			}
-		
-		resultSet.close();
-		insert.close();
-		select.close();
-		dictionaryConnection->commit();
-		connection->commit();
-		connection->shutdownDatabase();
-		}
-	catch (SQLException&)
-		{
-		}
-}
-***/
 
 void StorageHandler::initialize(void)
 {

--- 1.32/storage/falcon/StorageTableShare.cpp	2007-08-24 13:31:26 -04:00
+++ 1.33/storage/falcon/StorageTableShare.cpp	2007-08-24 13:31:26 -04:00
@@ -35,7 +35,6 @@
 
 static const char *FALCON_TEMPORARY		= "/falcon_temporary";
 static const char *GLOBAL_TABLESPACE	= "-global-";
-//static const char *TEMP_TABLESPACE		= "-temp-";
 static const char *DB_ROOT				= ".fts";
 
 #if defined(_WIN32) && MYSQL_VERSION_ID < 0x50100
@@ -155,13 +154,6 @@
 	*q = 0;
 }
 
-/***
-const char* StorageTableShare::cleanupName(const char* name, char* buffer, int bufferLength, char *schema, int schemaLength)
-{
-	return cleanupTableName(name, buffer, bufferLength, schema, schemaLength);
-}
-***/
-
 const char* StorageTableShare::cleanupTableName(const char* name, char* buffer, int bufferLength, char *schema, int schemaLength)
 {
 	char *q = buffer;
@@ -411,15 +403,6 @@
 
 void StorageTableShare::getDefaultPath(char *buffer)
 {
-	/***
-	strcpy(buffer, pathName);
-	char *slash = strrchr(buffer, '/');
-	
-	if (slash)
-		strcpy(slash, DB_ROOT);
-	else
-		strcat(buffer, DB_ROOT);
-	***/
 	const char *slash = NULL;
 	const char *p;
 
@@ -487,4 +470,26 @@
 uint64 StorageTableShare::estimateCardinality(void)
 {
 	return table->estimateCardinality();
+}
+
+bool StorageTableShare::tableExists(void)
+{
+	Sync sync(&storageHandler->dictionarySyncObject, "StorageTableShare::save");
+	sync.lock(Exclusive);
+	Connection *connection = storageHandler->getDictionaryConnection();
+	PreparedStatement *statement = connection->prepareStatement(
+		"select pathname from falcon.tables where effective_schema_name=? and effective_table_name=?");
+	int n = 1;
+	statement->setString(n++, schemaName);
+	statement->setString(n++, name);
+	ResultSet *resultSet = statement->executeQuery();
+	bool hit = false;
+	
+	if (resultSet->next())
+		hit = true;
+	
+	statement->close();
+	connection->commit();
+	
+	return hit;
 }

--- 1.32/storage/falcon/StorageTableShare.h	2007-08-24 13:31:26 -04:00
+++ 1.33/storage/falcon/StorageTableShare.h	2007-08-24 13:31:26 -04:00
@@ -112,6 +112,9 @@
 	void				setPath(const char* path);
 	void				getDefaultPath(char *buffer);
 	void				findDatabase(void);
+	void				setDatabase(StorageDatabase* db);
+	uint64				estimateCardinality(void);
+	bool				tableExists(void);
 
 	static const char*	getDefaultRoot(void);
 	static const char*	cleanupTableName(const char* name, char* buffer, int bufferLength, char *schema, int schemaLength);
@@ -133,8 +136,6 @@
 	Sequence			*sequence;
 	int					numberIndexes;
 	bool				tempTable;
-	void setDatabase(StorageDatabase* db);
-	uint64 estimateCardinality(void);
 };
 
 #endif

--- 1.212/storage/falcon/ha_falcon.cpp	2007-08-24 13:31:26 -04:00
+++ 1.213/storage/falcon/ha_falcon.cpp	2007-08-24 13:31:26 -04:00
@@ -632,8 +632,12 @@
 	
 	if (!mySqlThread)
 		mySqlThread = current_thd;
-		
+	
 	storageShare = storageHandler->createTable(mySqlName, info->tablespace, tempTable);
+	
+	if (!storageShare)
+		DBUG_RETURN(HA_ERR_TABLE_EXIST);
+
 	storageConnection = storageHandler->getStorageConnection(storageShare, mySqlThread, mySqlThread->thread_id, openOption, falcon_tablespace_mode);
 	*((StorageConnection**) thd_ha_data(mySqlThread, falcon_hton)) = storageConnection;
 	
Thread
bk commit into 6.0-falcon tree (jas:1.2703)U-ROWVWADEjas24 Aug