List:Commits« Previous MessageNext Message »
From:U-ROWVWADEjas Date:June 9 2007 7:16pm
Subject:bk commit into 6.0-falcon tree (jas:1.2558)
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-06-09 13:15:59-04:00, jas@rowvwade. +14 -0
  First pass at support of Falcon internal tablespaces.

  storage/falcon/Connection.cpp@stripped, 2007-06-09 13:15:45-04:00, jas@rowvwade. +1 -0
    Unlink database from global database list in Connection.cpp
    when shutting down.

  storage/falcon/Database.cpp@stripped, 2007-06-09 13:15:46-04:00, jas@rowvwade. +2 -0
    Eliminate another wrapping function in Database in favor
    of table space specific function Dbb.

  storage/falcon/Database.h@stripped, 2007-06-09 13:15:46-04:00, jas@rowvwade. +1 -1
    Eliminate another wrapping function in Database in favor
    of table space specific function Dbb.

  storage/falcon/Dbb.cpp@stripped, 2007-06-09 13:15:47-04:00, jas@rowvwade. +3 -1
    Initial Dbb variable "recovering".

  storage/falcon/IO.cpp@stripped, 2007-06-09 13:15:47-04:00, jas@rowvwade. +2 -0
    Stylistic edit for clarify.

  storage/falcon/IOx.h@stripped, 2007-06-09 13:15:47-04:00, jas@rowvwade. +1 -1
    Made IO::createPath a module static.

  storage/falcon/RepositoryVolume.cpp@stripped, 2007-06-09 13:15:48-04:00, jas@rowvwade. +1 -1
    Changed call to IO::createPath to reflect class static
    from.

  storage/falcon/SRLDropTable.cpp@stripped, 2007-06-09 13:15:48-04:00, jas@rowvwade. +1 -1
    Made SRLDropTable table space sensitive.

  storage/falcon/StorageConnection.cpp@stripped, 2007-06-09 13:15:48-04:00, jas@rowvwade. +0
-29
    Dead code elimination.

  storage/falcon/StorageDatabase.cpp@stripped, 2007-06-09 13:15:49-04:00, jas@rowvwade. +16
-10
    Copied metadatabase from "falcon_dictionary" to "falcon_master" 
    during initialization of new falcon_master.

  storage/falcon/StorageHandler.cpp@stripped, 2007-06-09 13:15:49-04:00, jas@rowvwade. +150
-111
    First pass at support of Falcon internal tablespaces.

  storage/falcon/StorageHandler.h@stripped, 2007-06-09 13:15:50-04:00, jas@rowvwade. +12 -6
    First pass at support of Falcon internal tablespaces.

  storage/falcon/Table.cpp@stripped, 2007-06-09 13:15:50-04:00, jas@rowvwade. +7 -2
    Fix table space problem with drop table.

  storage/falcon/ha_falcon.cpp@stripped, 2007-06-09 13:15:50-04:00, jas@rowvwade. +32 -114
    First pass at support of Falcon internal tablespaces.

# 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.30/storage/falcon/StorageHandler.cpp	2007-06-09 13:16:21 -04:00
+++ 1.31/storage/falcon/StorageHandler.cpp	2007-06-09 13:16:21 -04:00
@@ -29,11 +29,10 @@
 #include "Configuration.h"
 #include "Threads.h"
 #include "Connection.h"
-#include "PreparedStatement.h"
-#include "ResultSet.h"
-//#include "Database.h"
+#include "PStatement.h"
+#include "RSet.h"
 #include "InfoTable.h"
-
+#include "CmdGen.h"
 
 #define DICTIONARY_NAME			"falcon_dictionary"
 #define DICTIONARY_PATH			"falcon_dictionary.fdd"
@@ -49,6 +48,8 @@
 	};
 
 static const char *falconSchema [] = {
+	"create tablespace " DEFAULT_TABLESPACE " filename 'falcon_user.fts'",
+	
 	"upgrade table falcon.tablespaces ("
 	"    name varchar(128) not null primary	key,"
 	"    pathname varchar(1024) not null)",
@@ -92,6 +93,7 @@
 	memset(tables, 0, sizeof(tables));
 	dictionaryConnection = NULL;
 	databaseList = NULL;
+	defaultDatabase = NULL;
 	globalTableSpace = false;
 }
 
@@ -122,99 +124,16 @@
 	addLogListener(mask, listener, arg);
 }
 
-/***
-StorageConnection* StorageHandler::getStorageConnection(const char* dbName, THD*
mySqlThread, OpenOption createFlag, const char *path, const char *tableSpace)
-{
-	Sync sync(&syncObject, "StorageConnection::getStorageConnection");
-	StorageDatabase *storageDatabase = NULL;
-	
-	if (tableSpace)
-		{
-		storageDatabase = findTablespace(tableSpace);
-		
-		if (!storageDatabase)
-			return NULL;
-		
-		dbName = storageDatabase->filename;
-		}
-		
-	sync.lock(Shared);
-	int slot = HASH(mySqlThread, connectionHashSize);
-	StorageConnection *storageConnection;
-	
-	for (storageConnection = connections[slot]; storageConnection; storageConnection =
storageConnection->collision)
-		if (storageConnection->mySqlThread == mySqlThread && (!dbName
||storageConnection->path == dbName))
-			{
-			storageConnection->addRef();
-			
-			return storageConnection;
-			}
-
-	sync.unlock();
-	sync.lock(Exclusive);
-	
-	for (storageConnection = connections[slot]; storageConnection; storageConnection =
storageConnection->collision)
-		if (storageConnection->mySqlThread == mySqlThread && (!dbName ||
storageConnection->matches(dbName)))
-			{
-			storageConnection->addRef();
-			
-			return storageConnection;
-			}
-	
-	if (!dbName)
-		return NULL;
-
-	storageConnection = new StorageConnection(this, dbName, mySqlThread);
-	bool success = false;
-	
-	if (createFlag != CreateDatabase && createFlag != OpenTemporaryDatabase)
-		try
-			{
-			storageConnection->connect();
-			success = true;
-			}
-		catch (SQLException& exception)
-			{
-			//fprintf(stderr, "database open failed: %s\n", exception.getText());
-			storageConnection->setErrorText(exception.getText());
-			
-			if (createFlag == OpenDatabase)
-				{
-				delete storageConnection;
-				
-				return NULL;
-				}
-			}
-	
-	if (!success && createFlag != OpenDatabase)
-		try
-			{
-			storageConnection->create();
-			}
-		catch (SQLException& exception)
-			{
-			//fprintf(stderr, "database create failed: %s\n", exception.getText());
-			delete storageConnection;
-			
-			return NULL;
-			}
-	
-	storageConnection->collision = connections[slot];
-	connections[slot] = storageConnection;
-	
-	return storageConnection;
-}
-***/
 
 void StorageHandler::shutdownHandler(void)
 {
 	if (dictionaryConnection)
 		{
 		dictionaryConnection->commit();
-		dictionaryConnection->shutdownDatabase();
+		dictionaryConnection->close();
 		dictionaryConnection = NULL;
 		}
-		
+	
 	for (int n = 0; n < databaseHashSize; ++n)
 		for (StorageDatabase *storageDatabase = storageDatabases[n]; storageDatabase;
storageDatabase = storageDatabase->collision)
 			storageDatabase->close();
@@ -454,20 +373,6 @@
 			}
 }
 
-/***
-const char* StorageHandler::getEngineStatus(THD* mySqlThread)
-{
-	StorageConnection *storageConnection = getStorageConnection(NULL, mySqlThread,
OpenDatabase, NULL, NULL);
-	
-	if (!storageConnection || !storageConnection->connection)
-		return NULL;
-	
-	storageConnection->lastErrorText =
storageConnection->connection->analyze(analyzeTables | analyzeSpace);
-	
-	return storageConnection->lastErrorText;
-}
-***/
-
 void StorageHandler::releaseText(const char* text)
 {
 	delete [] text;
@@ -485,6 +390,7 @@
 
 Connection* StorageHandler::getDictionaryConnection(void)
 {
+	/***
 	if (!dictionaryConnection)
 		{
 		Configuration *configuration = new Configuration(NULL);
@@ -520,19 +426,36 @@
 		statement->close();
 		dictionaryConnection->commit();
 		}
+	***/
 	
 	return dictionaryConnection;
 }
 
-int StorageHandler::createTablespace(const char* tableSpaceName, const char* filename)
+int StorageHandler::createTablespace(const char* tableSpaceName, const char* filename,
int tableSpaceMode)
 {
+	if (!defaultDatabase)
+		initialize();
+
 	StorageDatabase *storageDatabase = NULL;
 	JString tableSpace = JString::upcase(tableSpaceName);
 	
 	try
 		{
-		storageDatabase = getStorageDatabase(tableSpace, filename);
-		storageDatabase->save();
+		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();
+			}
 		}
 	catch (SQLException&)
 		{
@@ -583,6 +506,9 @@
 
 StorageTableShare* StorageHandler::createTable(const char* pathname, const char
*tableSpaceName, bool tempTable)
 {
+	if (!defaultDatabase)
+		initialize();
+
 	StorageTableShare *tableShare = new StorageTableShare(this, pathname, tableSpaceName,
mySqlLockSize, tempTable);
 	addTable(tableShare);
 	tableShare->registerTable();
@@ -613,10 +539,13 @@
 			}
 }
 
-StorageConnection* StorageHandler::getStorageConnection(StorageTableShare* tableShare,
THD* mySqlThread, int mySqlThdId, OpenOption createFlag)
+StorageConnection* StorageHandler::getStorageConnection(StorageTableShare* tableShare,
THD* mySqlThread, int mySqlThdId, OpenOption createFlag, int tableSpaceMode)
 {
 	Sync sync(&syncObject, "StorageConnection::getStorageConnection");
 	
+	if (!defaultDatabase)
+		initialize();
+
 	if (!tableShare->storageDatabase)
 		tableShare->findDatabase();
 
@@ -647,11 +576,18 @@
 			return storageConnection;
 			}
 	
-	const char *dbName = tableShare->tableSpace;
-	char path[FILENAME_MAX];
-	tableShare->getDefaultPath(path);
+	StorageDatabase *storageDatabase;
 	
-	StorageDatabase *storageDatabase = getStorageDatabase(dbName, path);
+	if (tableSpaceMode == TABLESPACE_INTERNAL)
+		storageDatabase = defaultDatabase;
+	else
+		{
+		const char *dbName = tableShare->tableSpace;
+		char path[FILENAME_MAX];
+		tableShare->getDefaultPath(path);
+		storageDatabase = getStorageDatabase(dbName, path);
+		}
+		
 	storageConnection = new StorageConnection(this, storageDatabase, mySqlThread,
mySqlThdId);
 	tableShare->setDatabase(storageDatabase);
 	storageDatabase->release();
@@ -856,3 +792,106 @@
 		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();
+		connection->shutdownDatabase();
+		}
+	catch (SQLException&)
+		{
+		}
+}
+
+void StorageHandler::initialize(void)
+{
+	if (defaultDatabase)
+		return;
+	
+	Sync sync(&syncObject, "StorageConnection::initialize");
+	sync.lock(Exclusive);
+	
+	if (defaultDatabase)
+		return;
+		
+	defaultDatabase = getStorageDatabase(MASTER_NAME, MASTER_PATH);
+	
+	try
+		{
+		defaultDatabase->getOpenConnection();
+		dictionaryConnection = defaultDatabase->getOpenConnection();
+		}
+	catch (...)
+		{
+		try
+			{
+			defaultDatabase->createDatabase();
+			dictionaryConnection = defaultDatabase->getOpenConnection();
+			Statement *statement = dictionaryConnection->createStatement();
+			
+			for (const char **ddl = falconSchema; *ddl; ++ddl)
+				statement->executeUpdate(*ddl);
+			
+			statement->close();
+			copyOldDictionary();
+			dictionaryConnection->commit();
+			}
+		catch(...)
+			{
+			return;
+			}
+		}
+}

--- 1.17/storage/falcon/StorageHandler.h	2007-06-09 13:16:21 -04:00
+++ 1.18/storage/falcon/StorageHandler.h	2007-06-09 13:16:21 -04:00
@@ -18,6 +18,10 @@
 
 #include "SyncObject.h"
 
+#define MASTER_NAME				"falcon_master"
+#define MASTER_PATH				"falcon_master.fts"
+#define DEFAULT_TABLESPACE		"falcon_user"
+
 static const int connectionHashSize = 101;
 
 enum OpenOption {
@@ -27,6 +31,8 @@
 	OpenTemporaryDatabase
 	};
 	
+static const int TABLESPACE_INTERNAL		= 0;
+static const int TABLESPACE_SCHEMA			= 1;
 
 typedef void (Logger) (int, const char*, void *arg);
 
@@ -56,8 +62,6 @@
 	virtual ~StorageHandler(void);
 	virtual void		startNfsServer(void);
 	virtual void		addNfsLogger(int mask, Logger listener, void* arg);
-	//virtual int		isTempTable(const char *path);
-	//virtual StorageConnection* getStorageConnection(const char* dbName, THD* mySqlThread,
OpenOption createFlag, const char *path, const char *tableSpace);
 
 	virtual void		shutdownHandler(void);
 	virtual void		databaseDropped(StorageDatabase *storageDatabase, StorageConnection*
storageConnection);
@@ -68,17 +72,16 @@
 	virtual int			savepointSet(THD* mySqlThread, void* savePoint);
 	virtual int			savepointRelease(THD* mySqlThread, void* savePoint);
 	virtual int			savepointRollback(THD* mySqlThread, void* savePoint);
-	//virtual const char* getEngineStatus(THD* mySqlThread);
 	virtual void		releaseText(const char* text);
 	virtual int			commitByXID(int xidLength, const unsigned char* xid);
 	virtual int			rollbackByXID(int xidLength, const unsigned char* xis);
 	virtual Connection*	getDictionaryConnection(void);
-	virtual int			createTablespace(const char* tableSpaceName, const char* filename);
+	virtual int			createTablespace(const char* tableSpaceName, const char* filename, int
tableSpaceMode);
 	virtual int			deleteTablespace(const char* tableSpaceName);
 
 	virtual StorageTableShare* findTable(const char* pathname);
 	virtual StorageTableShare* createTable(const char* pathname, const char *tableSpaceName,
bool tempTable);
-	virtual StorageConnection* getStorageConnection(StorageTableShare* tableShare, THD*
mySqlThread, int mySqlThdId, OpenOption createFlag);
+	virtual StorageConnection* getStorageConnection(StorageTableShare* tableShare, THD*
mySqlThread, int mySqlThdId, OpenOption createFlag, int tableSpaceMode);
 
 	virtual void		getIOInfo(InfoTable* infoTable);
 	virtual void		getMemoryDetailInfo(InfoTable* infoTable);
@@ -104,15 +107,18 @@
 	int					dropDatabase(const char* path);
 	
 	StorageConnection	*connections[connectionHashSize];
+	StorageDatabase		*defaultDatabase;
 	SyncObject			syncObject;
 	SyncObject			hashSyncObject;
 	SyncObject			dictionarySyncObject;
 	StorageDatabase		*storageDatabases[databaseHashSize];
 	StorageDatabase		*databaseList;
 	StorageTableShare	*tables[tableHashSize];
-	Connection			*dictionaryConnection;
+	Connection		*dictionaryConnection;
 	int					mySqlLockSize;
 	bool				globalTableSpace;
+	void copyOldDictionary(void);
+	void initialize(void);
 };
 
 #endif

--- 1.15/storage/falcon/Connection.cpp	2007-06-09 13:16:21 -04:00
+++ 1.16/storage/falcon/Connection.cpp	2007-06-09 13:16:21 -04:00
@@ -1797,6 +1797,7 @@
 	if (database)
 		{
 		Database *db = database;
+		unlink(db);
 		close();
 		db->shutdown();
 		delete db;

--- 1.70/storage/falcon/Database.cpp	2007-06-09 13:16:21 -04:00
+++ 1.71/storage/falcon/Database.cpp	2007-06-09 13:16:21 -04:00
@@ -1543,6 +1543,7 @@
 		serialLog->close();
 }
 
+/***
 void Database::deleteSection(int32 sectionId, Transaction *transaction)
 {
 	dbb->deleteSection (sectionId, TRANSACTION_ID(transaction));
@@ -1551,6 +1552,7 @@
 		transaction->hasUpdates = true;
 
 }
+***/
 
 void Database::invalidateCompiledStatements(Table * table)
 {

--- 1.34/storage/falcon/Database.h	2007-06-09 13:16:21 -04:00
+++ 1.35/storage/falcon/Database.h	2007-06-09 13:16:21 -04:00
@@ -160,7 +160,6 @@
 #endif
 
 	void			invalidateCompiledStatements (Table *table);
-	void			deleteSection (int32 sectionId, Transaction *transaction);
 	void			shutdown();
 	void			execute (const char *sql);
 	void			addTable (Table *table);
@@ -178,6 +177,7 @@
 	//int32			createIndex(Transaction *transaction);
 	//void			deleteIndex (int32 indexId, int indexVersion, Transaction *transaction);
 	//bool			deleteIndexEntry (int32 indexId, int indexVersion, IndexKey *key, int32
recordNumber, Transaction *transaction);
+	//void			deleteSection (int32 sectionId, Transaction *transaction);
 	void			commitSystemTransaction();
 	void			flush();
 	

--- 1.72/storage/falcon/Dbb.cpp	2007-06-09 13:16:21 -04:00
+++ 1.73/storage/falcon/Dbb.cpp	2007-06-09 13:16:21 -04:00
@@ -84,6 +84,7 @@
 	defaultIndexVersion = INDEX_VERSION_1;
 	tableSpaceSectionId = 0;
 	tableSpaceId = 0;
+	recovering = false;
 }
 
 
@@ -93,7 +94,7 @@
 	tableSpaceId = tblSpaceId;
 	cache = dbb->cache;
 	pageSize = dbb->pageSize;
-	//hashSize = dbb->hashSize;
+	serialLog = dbb->serialLog;
 	sections = NULL;
 	sequenceSection = NULL;
 	nextIndex = 0;
@@ -105,6 +106,7 @@
 	shadows = NULL;
 	highPage = 0;
 	defaultIndexVersion = dbb->defaultIndexVersion;
+	recovering = false;
 }
 
 Dbb::~Dbb()

--- 1.12/storage/falcon/IO.cpp	2007-06-09 13:16:21 -04:00
+++ 1.13/storage/falcon/IO.cpp	2007-06-09 13:16:21 -04:00
@@ -261,9 +261,11 @@
 	for (const char *p = fileName; *p;)
 		{
 		char c = *p++;
+		
 		if (c == '/' || c == '\\')
 			{
 			*q = 0;
+			
 			if (q > directory && q [-1] != ':')
 				if (MKDIR (directory) && errno != EEXIST)
 					throw SQLError (IO_ERROR, "can't create directory \"%s\"\n", directory);

--- 1.8/storage/falcon/IOx.h	2007-06-09 13:16:21 -04:00
+++ 1.9/storage/falcon/IOx.h	2007-06-09 13:16:21 -04:00
@@ -41,7 +41,6 @@
 	int read(int length, UCHAR *buffer);
 	void write(uint32 length, const UCHAR *data);
 	bool doesFileExits (const char *fileName);
-	void createPath (const char *fileName);
 	void declareFatalError();
 	void seek (int pageNumber);
 	void closeFile();
@@ -57,6 +56,7 @@
 	IO();
 	~IO();
 
+	static void createPath (const char *fileName);
 	static void expandFileName (const char *fileName, int length, char *buffer);
 
 	JString		fileName;

--- 1.16/storage/falcon/RepositoryVolume.cpp	2007-06-09 13:16:21 -04:00
+++ 1.17/storage/falcon/RepositoryVolume.cpp	2007-06-09 13:16:21 -04:00
@@ -208,7 +208,7 @@
 
 void RepositoryVolume::create()
 {
-	dbb->createPath (fileName);
+	IO::createPath (fileName);
 	dbb->create(fileName, dbb->pageSize, 0, HdrRepositoryFile, 0, NULL);
 	//int indexId = 
 	dbb->createIndex (0);

--- 1.20/storage/falcon/SRLDropTable.cpp	2007-06-09 13:16:21 -04:00
+++ 1.21/storage/falcon/SRLDropTable.cpp	2007-06-09 13:16:21 -04:00
@@ -83,7 +83,7 @@
 	if (!log->bumpSectionIncarnation(sectionId, tableSpaceId, objDeleted))
 		return;
 
-	log->database->deleteSection(sectionId, NULL);
+	log->getDbb(tableSpaceId)->deleteSection(sectionId, NULL);
 }
 
 void SRLDropTable::print()

--- 1.27/storage/falcon/StorageConnection.cpp	2007-06-09 13:16:21 -04:00
+++ 1.28/storage/falcon/StorageConnection.cpp	2007-06-09 13:16:21 -04:00
@@ -56,35 +56,6 @@
 // Construction/Destruction
 //////////////////////////////////////////////////////////////////////
 
-/***
-StorageConnection::StorageConnection(StorageHandler *handler, const char *pathname, THD
*mySqlThd)
-{
-	storageHandler = handler;
-	mySqlThread = mySqlThd;
-	connection = NULL;
-	path = pathname;
-	transactionActive = false;
-	useCount = 1;
-	implicitTransactionCount = 0;
-	verbMark = 0;
-	prepared = false;
-	int pathLength = strlen(pathname);
-	const char *p = pathname + pathLength;
-	
-	while (p > pathname && p[-1] != '/')
-		--p;
-		
-	name = p;
-	char *q = filename.getBuffer(pathLength + sizeof(DB_ROOT));
-	
-	for (p = pathname; *p;)
-		*q++ = *p++;
-	
-	strcpy(q, DB_ROOT);
-	filename.releaseBuffer();
-	storageDatabase = storageHandler->getStorageDatabase(name, filename);
-}
-***/
 
 StorageConnection::StorageConnection(StorageHandler* handler, StorageDatabase* db, THD*
mySqlThd, int mySqlThdId)
 {

--- 1.72/storage/falcon/StorageDatabase.cpp	2007-06-09 13:16:21 -04:00
+++ 1.73/storage/falcon/StorageDatabase.cpp	2007-06-09 13:16:21 -04:00
@@ -46,6 +46,7 @@
 #include "StorageConnection.h"
 #include "MySqlEnums.h"
 #include "ScaledBinary.h"
+#include "Dbb.h"
 
 #define ACCOUNT				"mysql"
 #define PASSWORD			"mysql"
@@ -179,6 +180,7 @@
 	try
 		{
 		masterConnection = getConnection();
+		IO::createPath(filename);
 		masterConnection->createDatabase(name, filename, ACCOUNT, PASSWORD, threads);
 		Statement *statement = masterConnection->createStatement();
 		
@@ -1040,17 +1042,21 @@
 	Sync sync(&storageHandler->dictionarySyncObject, "StorageDatabase::load");
 	sync.lock(Exclusive);
 	Connection *connection = storageHandler->getDictionaryConnection();
-	PreparedStatement *statement = connection->prepareStatement(
-		"select pathname from falcon.tablespaces where name=?");
-	statement->setString(1, name);
-	ResultSet *resultSet = statement->executeQuery();
-	
-	if (resultSet->next())
-		filename = resultSet->getString(1);
 	
-	resultSet->close();
-	statement->close();
-	connection->commit();
+	if (connection)
+		{
+		PreparedStatement *statement = connection->prepareStatement(
+			"select pathname from falcon.tablespaces where name=?");
+		statement->setString(1, name);
+		ResultSet *resultSet = statement->executeQuery();
+		
+		if (resultSet->next())
+			filename = resultSet->getString(1);
+		
+		resultSet->close();
+		statement->close();
+		connection->commit();
+		}
 }
 
 void StorageDatabase::clearTransactions(void)

--- 1.118/storage/falcon/Table.cpp	2007-06-09 13:16:21 -04:00
+++ 1.119/storage/falcon/Table.cpp	2007-06-09 13:16:21 -04:00
@@ -2756,12 +2756,17 @@
 
 void Table::expunge(Transaction *transaction)
 {
+	if (transaction)
+		transaction->hasUpdates = true;
+
 	if (dataSectionId)
 		{
-		database->deleteSection(dataSectionId, transaction);
+		dbb->deleteSection(dataSectionId, TRANSACTION_ID(transaction));
 		dataSectionId = 0;
-		database->deleteSection(blobSectionId, transaction);
+		dataSection = NULL;
+		dbb->deleteSection(blobSectionId, TRANSACTION_ID(transaction));
 		blobSectionId = 0;
+		blobSection = NULL;
 		}
 }
 

--- 1.181/storage/falcon/ha_falcon.cpp	2007-06-09 13:16:21 -04:00
+++ 1.182/storage/falcon/ha_falcon.cpp	2007-06-09 13:16:21 -04:00
@@ -65,14 +65,15 @@
 unsigned long long		falcon_min_record_memory;
 unsigned long long		falcon_max_record_memory; // = 20 * 1024 * 1024;
 unsigned long long		falcon_page_cache_size; // = 2097152;
-uint			falcon_page_size; // = 4096;
-uint			falcon_log_windows;
-int				falcon_log_mask;
-my_bool			falcon_debug_server;
-char*			falcon_log_dir;
-FILE			*falcon_log_file;
-uint			falcon_index_chill_threshold;
-uint			falcon_record_chill_threshold;
+uint					falcon_page_size; // = 4096;
+uint					falcon_log_windows;
+int						falcon_log_mask;
+my_bool					falcon_debug_server;
+char*					falcon_log_dir;
+FILE					*falcon_log_file;
+uint					falcon_index_chill_threshold;
+uint					falcon_record_chill_threshold;
+uint					falcon_tablespace_mode;
 
 static struct st_mysql_show_var falconStatus[]=
 {
@@ -381,16 +382,6 @@
 	//delete [] dbName;
 }
 
-/***
-bool StorageInterface::show_status(handlerton* hton, THD* thd, stat_print_fn* print, enum
ha_stat_type stat)
-{
-	const char *status = storageHandler->getEngineStatus(thd);
-	(print)(thd, "", 0, "", 0, status, 40);
-
-	return false;
-}
-***/
-
 int StorageInterface::rnd_init(bool scan)
 {
 	DBUG_ENTER("StorageInterface::rnd_init");
@@ -411,7 +402,7 @@
 	if (!storageTable)
 		{
 		storageShare = storageHandler->findTable(name);
-		storageConnection = storageHandler->getStorageConnection(storageShare, mySqlThread,
mySqlThread->thread_id, OpenDatabase);
+		storageConnection = storageHandler->getStorageConnection(storageShare, mySqlThread,
mySqlThread->thread_id, OpenDatabase, falcon_tablespace_mode);
 		
 		if (!storageConnection)
 			DBUG_RETURN(HA_ERR_NO_CONNECTION);
@@ -650,7 +641,7 @@
 		mySqlThread = current_thd;
 		
 	storageShare = storageHandler->createTable(mySqlName, info->tablespace,
tempTable);
-	storageConnection = storageHandler->getStorageConnection(storageShare, mySqlThread,
mySqlThread->thread_id, openOption);
+	storageConnection = storageHandler->getStorageConnection(storageShare, mySqlThread,
mySqlThread->thread_id, openOption, falcon_tablespace_mode);
 	
 	if (!storageConnection)
 		DBUG_RETURN(HA_ERR_NO_CONNECTION);
@@ -706,6 +697,18 @@
 		}
 
 	gen.gen (")");
+	const char *tableSpace = NULL;
+	
+	if (falcon_tablespace_mode == TABLESPACE_INTERNAL)
+		{
+		if (info->tablespace)
+			tableSpace = info->tablespace;
+		else
+			tableSpace = DEFAULT_TABLESPACE;
+		}
+	
+	if (tableSpace)
+		gen.gen(" tablespace %s", tableSpace);
 
 	DBUG_PRINT("info",("incrementValue = %ld", incrementValue));
 
@@ -814,26 +817,12 @@
 		storageShare = storageHandler->findTable(tableName);
 	
 	if (!storageConnection)
-		if ( !(storageConnection = storageHandler->getStorageConnection(storageShare,
mySqlThread, mySqlThread->thread_id, OpenDatabase)) )
+		if ( !(storageConnection = storageHandler->getStorageConnection(storageShare,
mySqlThread, mySqlThread->thread_id, OpenDatabase, falcon_tablespace_mode)) )
 			DBUG_RETURN(0);
 
 	if (!storageTable)
 		storageTable = storageConnection->getStorageTable(storageShare);
 	
-	/***
-	if (!storageConnection &&
-		!(storageConnection = storageHandler->getStorageConnection(getDbName(tableName),
NULL, OpenDatabase, tableName, NULL)))
-			//DBUG_RETURN(HA_ERR_NO_CONNECTION);
-			DBUG_RETURN(0);
-
-	if (!storageTable)
-		if (!(storageTable = storageConnection->getStorageTable(tableName, sizeof(THR_LOCK),
tempTable)))
-			DBUG_RETURN(0);
-
-	if (!storageShare && storageTable)
-		storageShare = storageTable->share;
-	***/
-	
 	if (storageShare)
 		{
 		storageShare->lock(true);
@@ -1449,7 +1438,7 @@
 		storageConnection->release();
 		}	
 
-	storageConnection = storageHandler->getStorageConnection(storageShare, newThread,
newThread->thread_id, OpenDatabase);
+	storageConnection = storageHandler->getStorageConnection(storageShare, newThread,
newThread->thread_id, OpenDatabase, falcon_tablespace_mode);
 
 	if (storageTable)
 		storageTable->setConnection(storageConnection);
@@ -1664,30 +1653,6 @@
 {
 	DBUG_ENTER("StorageInterface::dropDatabase");
 	storageHandler->dropDatabase(path);
-	/***
-	char pathname[FN_REFLEN];
-	char *q = pathname;
-
-	for (const char *p = path; *p;)
-		{
-		char c = *p++;
-		*q++ = (IS_SLASH(c)) ? '/' : c;
-		}
-
-	if (q[-1] == '/')
-		--q;
-
-	*q = 0;
-
-	StorageConnection *storageConn = storageHandler->getStorageConnection(pathname, NULL,
OpenDatabase, path, NULL);
-	
-	if (storageConn)
-		{
-		storageConn->dropDatabase();
-		storageHandler->databaseDropped(NULL, storageConn);
-		storageConn->release();
-		}
-	***/
 
 	DBUG_VOID_RETURN;
 }
@@ -1718,63 +1683,10 @@
 	return 0;
 }
 
-/***
-const char *StorageInterface::getDbName(const char *tableName)
-{
-	if (dbName)
-		return dbName;
-
-	const char *slash = NULL;
-	const char *p;
-
-	for (p = tableName; *p; p++)
-		if (IS_SLASH(*p))
-			slash = p;
-
-	if (!slash)
-		slash = p;
-
-	int len = slash - tableName + 1;
-	
-	if (tempTable)
-		len += sizeof(FALCON_TEMPORARY);
-		
-	char *q = new char[len];
-	dbName = q;
-
-	for (p = tableName; p < slash; )
-		{
-		char c = *p++;
-		*q++ = (IS_SLASH(c)) ? '/' : c;
-		}
-
-	if (tempTable)
-		for (p = FALCON_TEMPORARY; *p;)
-			*q++ = *p++;
-			
-	*q = 0;
-
-	return dbName;
-}
-***/
 
 int StorageInterface::closeConnection(handlerton *hton, THD *thd)
 {
 	DBUG_ENTER("NfsStorageEngine::closeConnection");
-	/***
-	StorageConnection *storageConn = storageHandler->getStorageConnection(NULL, thd,
OpenDatabase, NULL, NULL);
-
-	if (storageConn)
-		{
-		storageConn->close();
-		
-		if (storageConn->mySqlThread)
-			storageConn->release();	// This is for thd->ha_data[falcon_hton->slot]
-			
-		storageConn->release();	// This is for storageConn
-		}
-	***/
-	
 	storageHandler->closeConnections(thd);
 	*thd_ha_data(thd, hton) = NULL;
 
@@ -1799,7 +1711,7 @@
 	switch (ts_info->ts_cmd_type)
 		{
 		case CREATE_TABLESPACE:
-			ret = storageHandler->createTablespace(ts_info->tablespace_name,
ts_info->data_file_name);
+			ret = storageHandler->createTablespace(ts_info->tablespace_name,
ts_info->data_file_name, falcon_tablespace_mode);
 			break;
 		
 		case DROP_TABLESPACE:
@@ -2789,6 +2701,11 @@
   "Mbytes of pending index data that is 'frozen' to the Falcon serial log.",
   NULL, &updateIndexChillThreshold, 4, 1, 1024, 1);
 
+static MYSQL_SYSVAR_UINT(tablespace_mode, falcon_tablespace_mode,
+  PLUGIN_VAR_RQCMDARG,
+  "tablespace mapping mode.",
+  NULL, NULL, 0, 0, 3, 1);
+
 static MYSQL_SYSVAR_UINT(record_chill_threshold, falcon_record_chill_threshold,
   PLUGIN_VAR_RQCMDARG,
   "Mbytes of pending record data that is 'frozen' to the Falcon serial log.",
@@ -2805,6 +2722,7 @@
 	MYSQL_SYSVAR(log_windows),
 	MYSQL_SYSVAR(index_chill_threshold),
 	MYSQL_SYSVAR(record_chill_threshold),
+	MYSQL_SYSVAR(tablespace_mode),
 	NULL
 };
 
Thread
bk commit into 6.0-falcon tree (jas:1.2558)U-ROWVWADEjas9 Jun