You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-30 19:23:07 +03:00
Make drop table work
This commit is contained in:
@ -159,28 +159,26 @@ static uchar* calpont_get_key(INFINIDB_SHARE *share, size_t *length,
|
|||||||
int calpont_discover(handlerton *hton, THD* thd, TABLE_SHARE *share)
|
int calpont_discover(handlerton *hton, THD* thd, TABLE_SHARE *share)
|
||||||
{
|
{
|
||||||
DBUG_ENTER("calpont_discover");
|
DBUG_ENTER("calpont_discover");
|
||||||
DBUG_PRINT("calpont_discover", ("db: '%s' name: '%s'", share->db.str,
|
DBUG_PRINT("calpont_discover", ("db: '%s' name: '%s'", share->db.str, share->table_name.str));
|
||||||
share->table_name.str));
|
|
||||||
#ifdef INFINIDB_DEBUG
|
#ifdef INFINIDB_DEBUG
|
||||||
fprintf(stderr, "calpont_discover()\n");
|
fprintf(stderr, "calpont_discover()\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uchar* frm_data = NULL;
|
uchar* frm_data = NULL;
|
||||||
size_t frm_len = 0;
|
size_t frm_len = 0;
|
||||||
int error = 0;
|
int error = 0;
|
||||||
|
|
||||||
|
if (!ha_calpont_impl_discover_existence(share->db.str, share->table_name.str))
|
||||||
|
DBUG_RETURN(HA_ERR_NO_SUCH_TABLE);
|
||||||
|
|
||||||
if (!ha_calpont_impl_discover_existence(share->db.str, share->table_name.str))
|
error = share->read_frm_image((const uchar**)&frm_data, &frm_len);
|
||||||
DBUG_RETURN(HA_ERR_NO_SUCH_TABLE);
|
|
||||||
|
|
||||||
error = share->read_frm_image((const uchar**)&frm_data, &frm_len);
|
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
DBUG_RETURN(HA_ERR_NO_SUCH_TABLE);
|
DBUG_RETURN(HA_ERR_NO_SUCH_TABLE);
|
||||||
|
|
||||||
my_errno= share->init_from_binary_frm_image(thd, 1, frm_data, frm_len);
|
my_errno= share->init_from_binary_frm_image(thd, 1, frm_data, frm_len);
|
||||||
|
|
||||||
my_free(frm_data);
|
my_free(frm_data);
|
||||||
DBUG_RETURN(my_errno);
|
DBUG_RETURN(my_errno);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -215,7 +213,7 @@ static int calpont_init_func(void *p)
|
|||||||
calpont_hton->state= SHOW_OPTION_YES;
|
calpont_hton->state= SHOW_OPTION_YES;
|
||||||
calpont_hton->create= calpont_create_handler;
|
calpont_hton->create= calpont_create_handler;
|
||||||
calpont_hton->flags= HTON_CAN_RECREATE;
|
calpont_hton->flags= HTON_CAN_RECREATE;
|
||||||
// calpont_hton->discover_table= calpont_discover;
|
calpont_hton->discover_table= calpont_discover;
|
||||||
calpont_hton->discover_table_existence= calpont_discover_existence;
|
calpont_hton->discover_table_existence= calpont_discover_existence;
|
||||||
calpont_hton->commit= calpont_commit;
|
calpont_hton->commit= calpont_commit;
|
||||||
calpont_hton->rollback= calpont_rollback;
|
calpont_hton->rollback= calpont_rollback;
|
||||||
@ -1030,7 +1028,7 @@ int ha_calpont::create(const char *name, TABLE *table_arg,
|
|||||||
DBUG_ENTER("ha_calpont::create");
|
DBUG_ENTER("ha_calpont::create");
|
||||||
|
|
||||||
int rc = ha_calpont_impl_create(name, table_arg, create_info);
|
int rc = ha_calpont_impl_create(name, table_arg, create_info);
|
||||||
|
table_arg->s->write_frm_image();
|
||||||
DBUG_RETURN(rc);
|
DBUG_RETURN(rc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2094,13 +2094,14 @@ int ha_calpont_impl_create_(const char *name, TABLE *table_arg, HA_CREATE_INFO *
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ha_calpont_impl_delete_table_(const char *name, cal_connection_info& ci)
|
int ha_calpont_impl_delete_table_(const char *db, const char *name, cal_connection_info& ci)
|
||||||
{
|
{
|
||||||
#ifdef INFINIDB_DEBUG
|
#ifdef INFINIDB_DEBUG
|
||||||
cout << "ha_calpont_impl_delete_table: " << name << endl;
|
cout << "ha_calpont_impl_delete_table: " << db << name << endl;
|
||||||
#endif
|
#endif
|
||||||
THD *thd = current_thd;
|
THD *thd = current_thd;
|
||||||
std::string tbl(name);
|
std::string tbl(name);
|
||||||
|
std::string schema(db);
|
||||||
std::string stmt(idb_mysql_query_str(thd));
|
std::string stmt(idb_mysql_query_str(thd));
|
||||||
algorithm::to_upper(stmt);
|
algorithm::to_upper(stmt);
|
||||||
// @bug 4158 allow table name with 'restrict' in it (but not by itself)
|
// @bug 4158 allow table name with 'restrict' in it (but not by itself)
|
||||||
@ -2124,12 +2125,10 @@ int ha_calpont_impl_delete_table_(const char *name, cal_connection_info& ci)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
TABLE_LIST *first_table= (TABLE_LIST*) thd->lex->select_lex.table_list.first;
|
|
||||||
string db = first_table->table->s->db.str;
|
|
||||||
string emsg;
|
string emsg;
|
||||||
stmt = idb_mysql_query_str(thd);
|
stmt = idb_mysql_query_str(thd);
|
||||||
stmt += ";";
|
stmt += ";";
|
||||||
int rc = ProcessDDLStatement(stmt, db, tbl, tid2sid(thd->thread_id), emsg);
|
int rc = ProcessDDLStatement(stmt, schema, tbl, tid2sid(thd->thread_id), emsg);
|
||||||
if (rc != 0)
|
if (rc != 0)
|
||||||
push_warning(thd, Sql_condition::WARN_LEVEL_NOTE, 9999, emsg.c_str());
|
push_warning(thd, Sql_condition::WARN_LEVEL_NOTE, 9999, emsg.c_str());
|
||||||
return rc;
|
return rc;
|
||||||
|
@ -3180,10 +3180,6 @@ int ha_calpont_impl_delete_table(const char *name)
|
|||||||
setError(thd, ER_INTERNAL_ERROR, "Null table pointer detected when dropping table");
|
setError(thd, ER_INTERNAL_ERROR, "Null table pointer detected when dropping table");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (!(first_table->table && first_table->table->s && first_table->table->s->db.str))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
string db = first_table->table->s->db.str;
|
|
||||||
|
|
||||||
if (!ci) return 0;
|
if (!ci) return 0;
|
||||||
|
|
||||||
@ -3193,7 +3189,7 @@ int ha_calpont_impl_delete_table(const char *name)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
// @bug 1793. make vtable droppable in calpontsys. "$vtable" ==> "@0024vtable" passed in as name.
|
// @bug 1793. make vtable droppable in calpontsys. "$vtable" ==> "@0024vtable" passed in as name.
|
||||||
if (db == "calpontsys" && string(name).find("@0024vtable") == string::npos)
|
if (strcmp(first_table->db, "calpontsys") == 0 && string(name).find("@0024vtable") == string::npos)
|
||||||
{
|
{
|
||||||
std::string stmt(idb_mysql_query_str(thd));
|
std::string stmt(idb_mysql_query_str(thd));
|
||||||
algorithm::to_upper(stmt);
|
algorithm::to_upper(stmt);
|
||||||
@ -3206,7 +3202,7 @@ int ha_calpont_impl_delete_table(const char *name)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int rc = ha_calpont_impl_delete_table_(name, *ci);
|
int rc = ha_calpont_impl_delete_table_(first_table->db, name, *ci);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
int ha_calpont_impl_write_row(uchar *buf, TABLE* table)
|
int ha_calpont_impl_write_row(uchar *buf, TABLE* table)
|
||||||
|
@ -60,7 +60,7 @@ extern int ha_calpont_impl_write_last_batch(TABLE* table, cal_impl_if::cal_conne
|
|||||||
extern int ha_calpont_impl_commit_ (handlerton *hton, THD *thd, bool all, cal_impl_if::cal_connection_info& ci);
|
extern int ha_calpont_impl_commit_ (handlerton *hton, THD *thd, bool all, cal_impl_if::cal_connection_info& ci);
|
||||||
extern int ha_calpont_impl_rollback_ (handlerton *hton, THD *thd, bool all, cal_impl_if::cal_connection_info& ci);
|
extern int ha_calpont_impl_rollback_ (handlerton *hton, THD *thd, bool all, cal_impl_if::cal_connection_info& ci);
|
||||||
extern int ha_calpont_impl_close_connection_ (handlerton *hton, THD *thd, cal_impl_if::cal_connection_info& ci);
|
extern int ha_calpont_impl_close_connection_ (handlerton *hton, THD *thd, cal_impl_if::cal_connection_info& ci);
|
||||||
extern int ha_calpont_impl_delete_table_(const char *name, cal_impl_if::cal_connection_info& ci);
|
extern int ha_calpont_impl_delete_table_(const char *db, const char *name, cal_impl_if::cal_connection_info& ci);
|
||||||
extern int ha_calpont_impl_create_(const char *name, TABLE *table_arg, HA_CREATE_INFO *create_info,
|
extern int ha_calpont_impl_create_(const char *name, TABLE *table_arg, HA_CREATE_INFO *create_info,
|
||||||
cal_impl_if::cal_connection_info& ci);
|
cal_impl_if::cal_connection_info& ci);
|
||||||
extern std::string ha_calpont_impl_markpartition_ (execplan::CalpontSystemCatalog::TableName tableName, uint32_t partition);
|
extern std::string ha_calpont_impl_markpartition_ (execplan::CalpontSystemCatalog::TableName tableName, uint32_t partition);
|
||||||
|
Reference in New Issue
Block a user