Commit 01868fd2 authored by Zardosht Kasheff's avatar Zardosht Kasheff Committed by Yoni Fogel

addresses #1396

write stuff to error log if fail to open file due to dirty bit

git-svn-id: file:///svn/mysql/tokudb-engine/src@9156 c7de825b-a66e-492c-adef-691d508d4ae1
parent 92850380
...@@ -683,6 +683,7 @@ int ha_tokudb::open_secondary_table(DB** ptr, KEY* key_info, const char* name, i ...@@ -683,6 +683,7 @@ int ha_tokudb::open_secondary_table(DB** ptr, KEY* key_info, const char* name, i
int error = ENOSYS; int error = ENOSYS;
char part[MAX_ALIAS_NAME + 10]; char part[MAX_ALIAS_NAME + 10];
char name_buff[FN_REFLEN]; char name_buff[FN_REFLEN];
char error_msg[MAX_ALIAS_NAME + 50]; //50 is arbitrary upper bound of extra txt
uint open_flags = (mode == O_RDONLY ? DB_RDONLY : 0) | DB_THREAD; uint open_flags = (mode == O_RDONLY ? DB_RDONLY : 0) | DB_THREAD;
DBT cmp_byte_stream; DBT cmp_byte_stream;
char* newname = NULL; char* newname = NULL;
...@@ -728,6 +729,10 @@ int ha_tokudb::open_secondary_table(DB** ptr, KEY* key_info, const char* name, i ...@@ -728,6 +729,10 @@ int ha_tokudb::open_secondary_table(DB** ptr, KEY* key_info, const char* name, i
(*ptr)->api_internal = share->file->app_private; (*ptr)->api_internal = share->file->app_private;
if ((error = (*ptr)->open(*ptr, 0, name_buff, NULL, DB_BTREE, open_flags, 0))) { if ((error = (*ptr)->open(*ptr, 0, name_buff, NULL, DB_BTREE, open_flags, 0))) {
if (error == TOKUDB_DIRTY_DICTIONARY) {
sprintf(error_msg, "File %s is dirty, not opening DB", name_buff);
sql_print_error(error_msg);
}
my_errno = error; my_errno = error;
goto cleanup; goto cleanup;
} }
...@@ -757,6 +762,7 @@ int ha_tokudb::open(const char *name, int mode, uint test_if_locked) { ...@@ -757,6 +762,7 @@ int ha_tokudb::open(const char *name, int mode, uint test_if_locked) {
TOKUDB_OPEN(); TOKUDB_OPEN();
char name_buff[FN_REFLEN]; char name_buff[FN_REFLEN];
char error_msg[MAX_ALIAS_NAME + 50]; //50 is arbitrary upper bound of extra txt
uint open_flags = (mode == O_RDONLY ? DB_RDONLY : 0) | DB_THREAD; uint open_flags = (mode == O_RDONLY ? DB_RDONLY : 0) | DB_THREAD;
uint max_key_length; uint max_key_length;
int error; int error;
...@@ -901,6 +907,10 @@ int ha_tokudb::open(const char *name, int mode, uint test_if_locked) { ...@@ -901,6 +907,10 @@ int ha_tokudb::open(const char *name, int mode, uint test_if_locked) {
make_name(newname, name, "main"); make_name(newname, name, "main");
fn_format(name_buff, newname, "", 0, MY_UNPACK_FILENAME); fn_format(name_buff, newname, "", 0, MY_UNPACK_FILENAME);
if ((error = share->file->open(share->file, 0, name_buff, NULL, DB_BTREE, open_flags, 0))) { if ((error = share->file->open(share->file, 0, name_buff, NULL, DB_BTREE, open_flags, 0))) {
if (error == TOKUDB_DIRTY_DICTIONARY) {
sprintf(error_msg, "File %s is dirty, not opening DB", name_buff);
sql_print_error(error_msg);
}
free_share(share, table, hidden_primary_key, 1); free_share(share, table, hidden_primary_key, 1);
my_free((char *) rec_buff, MYF(0)); my_free((char *) rec_buff, MYF(0));
rec_buff = NULL; rec_buff = NULL;
...@@ -1724,6 +1734,7 @@ int ha_tokudb::get_status() { ...@@ -1724,6 +1734,7 @@ int ha_tokudb::get_status() {
DBT key, value; DBT key, value;
HA_METADATA_KEY curr_key; HA_METADATA_KEY curr_key;
int error; int error;
char error_msg[MAX_ALIAS_NAME + 50]; //50 is arbitrary upper bound of extra txt
char* newname = NULL; char* newname = NULL;
// //
// open status.tokudb // open status.tokudb
...@@ -1746,7 +1757,13 @@ int ha_tokudb::get_status() { ...@@ -1746,7 +1757,13 @@ int ha_tokudb::get_status() {
if (error) { goto cleanup; } if (error) { goto cleanup; }
error = share->status_block->open(share->status_block, NULL, name_buff, NULL, DB_BTREE, open_mode, 0); error = share->status_block->open(share->status_block, NULL, name_buff, NULL, DB_BTREE, open_mode, 0);
if (error) { goto cleanup; } if (error) {
if (error == TOKUDB_DIRTY_DICTIONARY) {
sprintf(error_msg, "File %s is dirty, not opening DB", name_buff);
sql_print_error(error_msg);
}
goto cleanup;
}
} }
// //
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment