List:Commits« Previous MessageNext Message »
From:U-ROWVWADEjas Date:July 5 2007 9:45pm
Subject:bk commit into 6.0-falcon tree (jas:1.2591)
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-07-05 17:45:13-04:00, jas@rowvwade. +4 -0
  Simplify table space file creation, avoid database creation
  errors, and do a better job of handling error conditions.

  storage/falcon/IO.cpp@stripped, 2007-07-05 17:44:58-04:00, jas@rowvwade. +7 -2
    Add static method IO::deleteFile(const char*).

  storage/falcon/IOx.h@stripped, 2007-07-05 17:44:58-04:00, jas@rowvwade. +22 -20
    Add static method IO::deleteFile(const char*).

  storage/falcon/StorageHandler.cpp@stripped, 2007-07-05 17:44:59-04:00, jas@rowvwade. +16 -63
    Clean out any existing Falcon-defined tablespace files
    during database creation to avoid database creation
    failures.

  storage/falcon/TableSpaceManager.cpp@stripped, 2007-07-05 17:44:59-04:00, jas@rowvwade. +2 -11
    Simplify problem of table space file creation.

# 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.37/storage/falcon/StorageHandler.cpp	2007-07-05 17:45:35 -04:00
+++ 1.38/storage/falcon/StorageHandler.cpp	2007-07-05 17:45:35 -04:00
@@ -33,11 +33,12 @@
 #include "RSet.h"
 #include "InfoTable.h"
 #include "CmdGen.h"
+#include "Dbb.h"
 
-#define DICTIONARY_NAME			"falcon_dictionary"
-#define DICTIONARY_PATH			"falcon_dictionary.fdd"
 #define DICTIONARY_ACCOUNT		"mysql"
 #define DICTIONARY_PW			"mysql"
+#define FALCON_USER				"falcon_user.fts"
+#define FALCON_TEMPORARY		"falcon_temporary.fts"
 
 #define HASH(address,size)				(int)(((UIPTR) address >> 2) % size)
 
@@ -47,11 +48,11 @@
 	int					savepoint;
 	};
 
-static const char *createTempSpace = "upgrade tablespace " TEMPORARY_TABLESPACE " filename 'falcon_temporary.fts'";
+static const char *createTempSpace = "upgrade tablespace " TEMPORARY_TABLESPACE " filename '" FALCON_TEMPORARY "'";
 static const char *dropTempSpace = "drop tablespace " TEMPORARY_TABLESPACE;
 
 static const char *falconSchema [] = {
-	"create tablespace " DEFAULT_TABLESPACE " filename 'falcon_user.fts'",
+	"create tablespace " DEFAULT_TABLESPACE " filename '" FALCON_USER "'",
 	createTempSpace,
 	
 	"upgrade table falcon.tablespaces ("
@@ -401,44 +402,6 @@
 
 Connection* StorageHandler::getDictionaryConnection(void)
 {
-	/***
-	if (!dictionaryConnection)
-		{
-		Configuration *configuration = new Configuration(NULL);
-		configuration->recordMemoryUpper = 100000;
-		configuration->pageCacheSize = 1001024;
-		configuration->serialLogWindows = 10;
-		dictionaryConnection = new Connection(configuration);
-		Threads *threads = new Threads(NULL);
-		
-		try
-			{
-			dictionaryConnection->openDatabase(DICTIONARY_NAME, DICTIONARY_PATH, DICTIONARY_ACCOUNT, DICTIONARY_PW, NULL, threads);
-			}
-		catch (SQLException&)
-			{
-			try
-				{
-				dictionaryConnection->createDatabase(DICTIONARY_NAME, DICTIONARY_PATH, DICTIONARY_ACCOUNT, DICTIONARY_PW, threads);
-				}
-			catch (SQLException&)
-				{
-				dictionaryConnection->close();
-				dictionaryConnection = NULL;
-				throw;
-				}
-			}
-		
-		Statement *statement = dictionaryConnection->createStatement();
-		
-		for (const char **ddl = falconSchema; *ddl; ++ddl)
-			statement->executeUpdate(*ddl);
-		
-		statement->close();
-		dictionaryConnection->commit();
-		}
-	***/
-	
 	return dictionaryConnection;
 }
 
@@ -452,29 +415,17 @@
 	
 	try
 		{
-		if (tableSpaceMode == TABLESPACE_INTERNAL)
-			{
-			CmdGen gen;
-			gen.gen("create tablespace %s filename '%s'", tableSpaceName, filename);
-			Sync sync(&dictionarySyncObject, "StorageHandler::createTablespace");
-			sync.lock(Exclusive);
-			Statement *statement = dictionaryConnection->createStatement();
-			statement->executeUpdate(gen.getString());
-			statement->close();
-			}
-		else
-			{
-			storageDatabase = getStorageDatabase(tableSpace, filename);
-			storageDatabase->save();
-			}
+		CmdGen gen;
+		gen.gen("create tablespace %s filename '%s'", tableSpaceName, filename);
+		Sync sync(&dictionarySyncObject, "StorageHandler::createTablespace");
+		sync.lock(Exclusive);
+		Statement *statement = dictionaryConnection->createStatement();
+		statement->executeUpdate(gen.getString());
+		statement->close();
 		}
 	catch (SQLException&)
 		{
-		if (storageDatabase)
-			{
-			databaseDropped(storageDatabase, NULL);
-			storageDatabase->dropDatabase();
-			}
+		return StorageErrorTablesSpaceOperationFailed;
 		}
 	
 	return 0;
@@ -919,6 +870,8 @@
 		try
 			{
 			defaultDatabase->createDatabase();
+			IO::deleteFile(FALCON_USER);
+			IO::deleteFile(FALCON_TEMPORARY);
 			dictionaryConnection = defaultDatabase->getOpenConnection();
 			Statement *statement = dictionaryConnection->createStatement();
 			
@@ -926,7 +879,6 @@
 				statement->executeUpdate(*ddl);
 			
 			statement->close();
-			//copyOldDictionary();
 			dictionaryConnection->commit();
 			}
 		catch(...)
@@ -964,6 +916,7 @@
 	
 	try
 		{
+		IO::deleteFile(FALCON_TEMPORARY);
 		statement->executeUpdate(createTempSpace);
 		}
 	catch(SQLException& exception)

--- 1.13/storage/falcon/TableSpaceManager.cpp	2007-07-05 17:45:35 -04:00
+++ 1.14/storage/falcon/TableSpaceManager.cpp	2007-07-05 17:45:35 -04:00
@@ -146,21 +146,12 @@
 	Sequence *sequence = database->sequenceManager->getSequence(database->getSymbol("SYSTEM"), database->getSymbol("TABLESPACE_IDS"));
 	int id = (int) sequence->update(1, database->getSystemTransaction());
 	TableSpace *tableSpace = new TableSpace(database, name, id, fileName);
-	bool opened = false;
 	
-	try
+	if (tableSpace->dbb->doesFileExits(fileName))
 		{
-		tableSpace->dbb->openFile(fileName, false);
-		tableSpace->dbb->closeFile();
-		opened = true;
 		delete tableSpace;
-		}
-	catch (SQLException&)
-		{
-		}
-	
-	if (opened)
 		throw SQLError(DDL_ERROR, "table space file name \"%s\" already exists\n", fileName);
+		}
 		
 	try
 		{

--- 1.13/storage/falcon/IO.cpp	2007-07-05 17:45:35 -04:00
+++ 1.14/storage/falcon/IO.cpp	2007-07-05 17:45:35 -04:00
@@ -301,7 +301,7 @@
 {
 	struct stat stats;
 
-	return stat (fileName, &stats) == 0;
+	return stat(fileName, &stats) == 0;
 }
 
 void IO::write(uint32 length, const UCHAR *data)
@@ -328,7 +328,7 @@
 
 void IO::deleteFile()
 {
-	unlink(fileName);
+	deleteFile(fileName);
 }
 
 void IO::read(int64 offset, int length, UCHAR* buffer)
@@ -366,4 +366,9 @@
 #else
 	fsync(fileId);
 #endif
+}
+
+void IO::deleteFile(const char* fileName)
+{
+	unlink(fileName);
 }

--- 1.9/storage/falcon/IOx.h	2007-07-05 17:45:36 -04:00
+++ 1.10/storage/falcon/IOx.h	2007-07-05 17:45:36 -04:00
@@ -35,29 +35,31 @@
 class IO  
 {
 public:
-	bool trialRead (Bdb *bdb);
-	void deleteFile();
-	void writeHeader (Hdr *header);
-	int read(int length, UCHAR *buffer);
-	void write(uint32 length, const UCHAR *data);
-	bool doesFileExits (const char *fileName);
-	void declareFatalError();
-	void seek (int pageNumber);
-	void closeFile();
-	void readHeader (Hdr *header);
-	void writePage (Bdb *buffer);
-	void readPage (Bdb *page);
-	bool createFile (const char *name);
-	bool openFile (const char *name, bool readOnly);
-	void longSeek(int64 offset);
-	void read(int64 offset, int length, UCHAR* buffer);
-	void write(int64 offset, int length, const UCHAR* buffer);
-	void sync(void);
 	IO();
 	~IO();
 
-	static void createPath (const char *fileName);
-	static void expandFileName (const char *fileName, int length, char *buffer);
+	bool	trialRead (Bdb *bdb);
+	void	deleteFile();
+	void	writeHeader (Hdr *header);
+	int		read(int length, UCHAR *buffer);
+	void	write(uint32 length, const UCHAR *data);
+	bool	doesFileExits (const char *fileName);
+	void	declareFatalError();
+	void	seek (int pageNumber);
+	void	closeFile();
+	void	readHeader (Hdr *header);
+	void	writePage (Bdb *buffer);
+	void	readPage (Bdb *page);
+	bool	createFile (const char *name);
+	bool	openFile (const char *name, bool readOnly);
+	void	longSeek(int64 offset);
+	void	read(int64 offset, int length, UCHAR* buffer);
+	void	write(int64 offset, int length, const UCHAR* buffer);
+	void	sync(void);
+	
+	static void		createPath (const char *fileName);
+	static void		expandFileName (const char *fileName, int length, char *buffer);
+	static void		deleteFile(const char* fileName);
 
 	JString		fileName;
 	SyncObject	syncObject;
Thread
bk commit into 6.0-falcon tree (jas:1.2591)U-ROWVWADEjas5 Jul