2012-06-26 22:57:01 +02:00
|
|
|
#if TOKU_INCLUDE_ALTER_55
|
2012-05-21 20:56:56 +02:00
|
|
|
|
2013-03-28 13:04:41 +01:00
|
|
|
#include "ha_tokudb_alter_common.cc"
|
|
|
|
|
2013-02-28 02:02:37 +01:00
|
|
|
bool ha_tokudb::try_hot_alter_table() {
|
|
|
|
TOKUDB_DBUG_ENTER("try_hot_alter_table");
|
2012-05-21 20:56:56 +02:00
|
|
|
THD *thd = ha_thd();
|
2013-02-28 02:02:37 +01:00
|
|
|
bool disable_hot_alter = get_disable_hot_alter(thd);
|
|
|
|
DBUG_RETURN(!disable_hot_alter);
|
2012-05-21 20:56:56 +02:00
|
|
|
}
|
|
|
|
|
2012-12-03 21:51:55 +01:00
|
|
|
void ha_tokudb::prepare_for_alter() {
|
2012-05-21 20:56:56 +02:00
|
|
|
TOKUDB_DBUG_ENTER("prepare_for_alter");
|
|
|
|
|
|
|
|
// this is here because mysql commits the transaction before prepare_for_alter is called.
|
|
|
|
// we need a transaction to add indexes, drop indexes, and write the new frm data, so we
|
|
|
|
// create one. this transaction will be retired by mysql alter table when it commits
|
|
|
|
//
|
|
|
|
// if we remove the commit before prepare_for_alter, then this is not needed.
|
|
|
|
transaction = NULL;
|
|
|
|
THD *thd = ha_thd();
|
|
|
|
tokudb_trx_data *trx = (tokudb_trx_data *) thd_data_get(thd, tokudb_hton->slot);
|
|
|
|
assert(trx);
|
|
|
|
// for partitioned tables, a transaction may already exist,
|
|
|
|
// as we call prepare_for_alter on all partitions
|
|
|
|
if (!trx->sub_sp_level) {
|
|
|
|
int error = create_txn(thd, trx);
|
|
|
|
assert(error == 0);
|
|
|
|
assert(thd->in_sub_stmt == 0);
|
|
|
|
}
|
|
|
|
transaction = trx->sub_sp_level;
|
|
|
|
DBUG_VOID_RETURN;
|
|
|
|
}
|
|
|
|
|
2013-02-28 02:02:37 +01:00
|
|
|
int ha_tokudb::new_alter_table_frm_data(const uchar *frm_data, size_t frm_len) {
|
|
|
|
return write_frm_data(frm_data, frm_len);
|
2012-06-29 15:30:13 +02:00
|
|
|
}
|
|
|
|
|
2012-05-21 20:56:56 +02:00
|
|
|
#endif
|