redo create_sub_table so that it can be more easily modified
all cosmetic

git-svn-id: file:///svn/mysql/tokudb-engine/src@10923 c7de825b-a66e-492c-adef-691d508d4ae1
This commit is contained in:
Zardosht Kasheff 2013-04-17 00:01:48 -04:00 committed by Yoni Fogel
parent 71f6bc07cb
commit 1582aa54d9

View file

@ -3559,22 +3559,31 @@ THR_LOCK_DATA **ha_tokudb::store_lock(THD * thd, THR_LOCK_DATA ** to, enum thr_l
static int create_sub_table(const char *table_name, int flags) {
TOKUDB_DBUG_ENTER("create_sub_table");
int error;
DB *file;
DB *file = NULL;
DBUG_PRINT("enter", ("flags: %d", flags));
if (!(error = db_create(&file, db_env, 0))) {
file->set_flags(file, flags);
error = (file->open(file, NULL, table_name, NULL, DB_BTREE, DB_THREAD | DB_CREATE, my_umask));
if (error) {
DBUG_PRINT("error", ("Got error: %d when opening table '%s'", error, table_name));
(void) file->remove(file, table_name, NULL, 0);
} else
(void) file->close(file, 0);
} else {
error = db_create(&file, db_env, 0);
if (error) {
DBUG_PRINT("error", ("Got error: %d when creating table", error));
}
if (error)
my_errno = error;
goto exit;
}
file->set_flags(file, flags);
error = file->open(file, NULL, table_name, NULL, DB_BTREE, DB_THREAD | DB_CREATE, my_umask);
if (error) {
DBUG_PRINT("error", ("Got error: %d when opening table '%s'", error, table_name));
goto exit;
}
(void) file->close(file, 0);
error = 0;
exit:
if (error) {
if (file != NULL) {
(void) file->remove(file, table_name, NULL, 0);
}
}
TOKUDB_DBUG_RETURN(error);
}