diff --git a/sql/table.cc b/sql/table.cc index 51987f3..cfab562 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -3290,33 +3290,40 @@ int TABLE_SHARE::init_from_sql_statement_string(THD *thd, bool write, conditional comments. Anyway, let's copy the caller's string... */ + sql_print_information("xe %d", thd->is_error()); if (!(sql_copy= thd->strmake(sql, sql_length))) DBUG_RETURN(HA_ERR_OUT_OF_MEM); + sql_print_information("xd %d", thd->is_error()); if (parser_state.init(thd, sql_copy, sql_length)) DBUG_RETURN(HA_ERR_OUT_OF_MEM); + sql_print_information("xc %d", thd->is_error()); Sql_mode_instant_set sms(thd, MODE_NO_ENGINE_SUBSTITUTION | MODE_NO_DIR_IN_CREATE); thd->variables.character_set_client= system_charset_info; tmp_disable_binlog(thd); old_lex= thd->lex; thd->lex= &tmp_lex; + sql_print_information("xb %d", thd->is_error()); arena= thd->stmt_arena; if (arena->is_conventional()) arena= 0; else thd->set_n_backup_active_arena(arena, &backup); + sql_print_information("xa %d", thd->is_error()); thd->reset_db(&db); lex_start(thd); thd->push_internal_handler(&silencer); + sql_print_information("x1 %d", thd->is_error()); if (unlikely((error= parse_sql(thd, & parser_state, NULL) || sql_unusable_for_discovery(thd, hton, sql_copy)))) goto ret; + sql_print_information("x2 %d", thd->is_error()); thd->lex->create_info.db_type= hton; #ifdef WITH_PARTITION_STORAGE_ENGINE thd->work_part_info= 0; // For partitioning @@ -3325,12 +3332,14 @@ int TABLE_SHARE::init_from_sql_statement_string(THD *thd, bool write, if (tabledef_version.str) thd->lex->create_info.tabledef_version= tabledef_version; + sql_print_information("x3 %d", thd->is_error()); promote_first_timestamp_column(&thd->lex->alter_info.create_list); file= mysql_create_frm_image(thd, db, table_name, &thd->lex->create_info, &thd->lex->alter_info, C_ORDINARY_CREATE, &unused1, &unused2, &frm); error|= file == 0; delete file; + sql_print_information("x4 %d", thd->is_error()); if (frm.str) { @@ -3338,6 +3347,7 @@ int TABLE_SHARE::init_from_sql_statement_string(THD *thd, bool write, option_struct= 0; // ... if it's an assisted discovery error= init_from_binary_frm_image(thd, write, frm.str, frm.length); } + sql_print_information("x5 %d", thd->is_error()); ret: thd->pop_internal_handler(); @@ -3351,6 +3361,7 @@ int TABLE_SHARE::init_from_sql_statement_string(THD *thd, bool write, thd->variables.character_set_client= old_cs; if (unlikely(silencer.errors || error)) { + sql_print_information("eating error %d", error); my_error(ER_SQL_DISCOVER_ERROR, MYF(0), plugin_name(db_plugin)->str, db.str, table_name.str, sql_copy); diff --git a/storage/xpand/ha_xpand.cc b/storage/xpand/ha_xpand.cc index 1db01d5..9276598 100644 --- a/storage/xpand/ha_xpand.cc +++ b/storage/xpand/ha_xpand.cc @@ -356,9 +356,23 @@ xpand_connection *get_trx(THD *thd, int *error_code) return trx; } -/**************************************************************************** -** Class ha_xpand -****************************************************************************/ + +static void +xpand_mark_table_for_discovery(TABLE *table) +{ + table->m_needs_reopen = true; + Xpand_share *xs; + if ((xs= static_cast(table->s->ha_share))) + xs->rediscover_table = true; +} + +void +xpand_mark_tables_for_discovery(LEX *lex) +{ + for (TABLE_LIST *tbl= lex->query_tables; tbl; tbl= tbl->next_global) + if (tbl->table && tbl->table->file->ht == xpand_hton) + xpand_mark_table_for_discovery(tbl->table); +} ha_xpand::ha_xpand(handlerton *hton, TABLE_SHARE *table_arg) : handler(hton, table_arg) @@ -377,7 +391,6 @@ xpand_connection *get_trx(THD *thd, int *error_code) remove_current_table_from_rpl_table_list(rgi); } - int ha_xpand::create(const char *name, TABLE *form, HA_CREATE_INFO *info) { int error_code; @@ -457,7 +470,7 @@ int ha_xpand::delete_table(const char *path) return trx->run_system_query(delete_cmd); } -int ha_xpand::rename_table(const char* from, const char* to) +int ha_xpand::rename_table(const char *from, const char *to) { int error_code; THD *thd = ha_thd(); @@ -477,6 +490,10 @@ int ha_xpand::rename_table(const char* from, const char* to) &decoded_to_tbname))) return error_code; + sql_print_information("renaming %d", thd->is_error()); + sql_print_information("from fn %s -- %s - %s", from, decoded_from_dbname.c_str(), decoded_from_tbname.c_str()); + sql_print_information("to fn %s -- %s - %s", to, decoded_to_dbname.c_str(), decoded_to_tbname.c_str()); + Sql_mode_instant_set smis(thd, MODE_STRICT_TRANS_TABLES); String rename_cmd; rename_cmd.set_charset(system_charset_info); @@ -496,23 +513,6 @@ int ha_xpand::rename_table(const char* from, const char* to) return trx->run_system_query(rename_cmd); } -static void -xpand_mark_table_for_discovery(TABLE *table) -{ - table->m_needs_reopen = true; - Xpand_share *xs; - if ((xs= static_cast(table->s->ha_share))) - xs->rediscover_table = true; -} - -void -xpand_mark_tables_for_discovery(LEX *lex) -{ - for (TABLE_LIST *tbl= lex->query_tables; tbl; tbl= tbl->next_global) - if (tbl->table && tbl->table->file->ht == xpand_hton) - xpand_mark_table_for_discovery(tbl->table); -} - ulonglong * xpand_extract_table_oids(THD *thd, LEX *lex) { @@ -1480,6 +1480,7 @@ static int xpand_discover_table_names(handlerton *hton, LEX_CSTRING *db, handlerton::discovered_list *result) { DBUG_ENTER("xpand_discover_table_names"); + sql_print_information("xpand_discover_table_names"); xpand_connection *xpand_net = new xpand_connection(); int error_code = xpand_net->connect(); if (error_code) { @@ -1498,6 +1499,7 @@ static int xpand_discover_table_names(handlerton *hton, LEX_CSTRING *db, int xpand_discover_table(handlerton *hton, THD *thd, TABLE_SHARE *share) { DBUG_ENTER("xpand_discover_table"); + sql_print_information("xpand_discover_table %s - %s", share->db.str, share->table_name.str); xpand_connection *xpand_net = new xpand_connection(); int error_code = xpand_net->connect(); if (error_code) { diff --git a/storage/xpand/xpand_connection.cc b/storage/xpand/xpand_connection.cc index 1a469e0..2c624b7 100644 --- a/storage/xpand/xpand_connection.cc +++ b/storage/xpand/xpand_connection.cc @@ -1180,11 +1180,13 @@ int xpand_connection::discover_table_details(LEX_CSTRING *db, LEX_CSTRING *name, ulonglong oid = 0; Xpand_share *cs; + sql_print_information("1"); if ((error_code = xpand_connection::get_table_oid(db->str, db->length, name->str, name->length, &oid, share))) goto error; + sql_print_information("2"); if (!share->ha_share) share->ha_share= new Xpand_share; cs= static_cast(share->ha_share); @@ -1203,6 +1205,7 @@ int xpand_connection::discover_table_details(LEX_CSTRING *db, LEX_CSTRING *name, error_code = HA_ERR_NO_SUCH_TABLE; goto error; } + sql_print_information("3"); results_create = mysql_store_result(&xpand_net); DBUG_PRINT("info", @@ -1215,21 +1218,27 @@ int xpand_connection::discover_table_details(LEX_CSTRING *db, LEX_CSTRING *name, goto error; } + sql_print_information("4"); if (mysql_num_fields(results_create) != 2) { error_code = HA_ERR_CORRUPT_EVENT; goto error; } + sql_print_information("5"); while((row = mysql_fetch_row(results_create))) { DBUG_PRINT("info", ("row: %s - %s", row[0], row[1])); + sql_print_information("row %s - %s", row[0], row[1]); error_code = share->init_from_sql_statement_string(thd, false, row[1], strlen(row[1])); + sql_print_information("aaa %d", error_code); } + sql_print_information("6"); cs->rediscover_table = false; error: if (results_create) mysql_free_result(results_create); + sql_print_information("returning %d", error_code); DBUG_RETURN(error_code); }