Commit defa34ff authored by Zardosht Kasheff's avatar Zardosht Kasheff Committed by Yoni Fogel

[t:4695], make handler changes to get this working. Tests remain

git-svn-id: file:///svn/mysql/tokudb-engine/tokudb-engine@41776 c7de825b-a66e-492c-adef-691d508d4ae1
parent cf029f16
......@@ -7717,9 +7717,8 @@ int ha_tokudb::add_index(TABLE *table_arg, KEY *key_info, uint num_of_keys, hand
bool incremented_numDBs = false;
bool modified_DBs = false;
DB_TXN* txn = NULL;
error = db_env->txn_begin(db_env, 0, &txn, 0);
if (error) { goto cleanup; }
// transaction is created in prepare_for_alter
DB_TXN* txn = transaction;
error = tokudb_add_index(
table_arg,
......@@ -7735,7 +7734,6 @@ int ha_tokudb::add_index(TABLE *table_arg, KEY *key_info, uint num_of_keys, hand
if (error) {
if (txn) {
restore_add_index(table_arg, num_of_keys, incremented_numDBs, modified_DBs);
abort_txn(txn);
}
} else {
*add = new ha_tokudb_add_index(table_arg, key_info, num_of_keys, txn, incremented_numDBs, modified_DBs);
......@@ -7760,12 +7758,12 @@ int ha_tokudb::final_add_index(handler_add_index *add_arg, bool commit) {
int error = 0;
if (commit) {
commit_txn(txn, 0);
} else {
if (!commit) {
restore_add_index(table, num_of_keys, incremented_numDBs, modified_DBs);
abort_txn(txn);
}
// transaction does not need to be committed,
// we depend on MySQL to rollback the transaction
// by calling tokudb_rollback
TOKUDB_DBUG_RETURN(error);
}
......
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