Commit 1c326deb authored by Zardosht Kasheff's avatar Zardosht Kasheff Committed by Yoni Fogel

addresses #1593

after every 1000 inserts, check thd->killed to see if user has killed 
the add index. If so, gracefully exit

git-svn-id: file:///svn/mysql/tokudb-engine/src@10551 c7de825b-a66e-492c-adef-691d508d4ae1
parent 9b6676e7
...@@ -4679,6 +4679,11 @@ int ha_tokudb::add_index(TABLE *table_arg, KEY *key_info, uint num_of_keys) { ...@@ -4679,6 +4679,11 @@ int ha_tokudb::add_index(TABLE *table_arg, KEY *key_info, uint num_of_keys) {
if ((num_processed % 1000) == 0) { if ((num_processed % 1000) == 0) {
sprintf(status_msg, "Adding indexes: Processed %llu of about %llu rows.", num_processed, share->rows); sprintf(status_msg, "Adding indexes: Processed %llu of about %llu rows.", num_processed, share->rows);
thd_proc_info(thd, status_msg); thd_proc_info(thd, status_msg);
if (thd->killed) {
error = ER_ABORTING_CONNECTION;
txn->commit(txn, 0);
goto cleanup;
}
} }
cursor_ret_val = tmp_cursor->c_getf_next(tmp_cursor, DB_PRELOCKED, smart_dbt_ai_callback, &info); cursor_ret_val = tmp_cursor->c_getf_next(tmp_cursor, DB_PRELOCKED, smart_dbt_ai_callback, &info);
} }
...@@ -4707,6 +4712,7 @@ int ha_tokudb::add_index(TABLE *table_arg, KEY *key_info, uint num_of_keys) { ...@@ -4707,6 +4712,7 @@ int ha_tokudb::add_index(TABLE *table_arg, KEY *key_info, uint num_of_keys) {
error = tmp_cursor->c_getf_next(tmp_cursor, DB_PRELOCKED, smart_dbt_opt_callback, NULL); error = tmp_cursor->c_getf_next(tmp_cursor, DB_PRELOCKED, smart_dbt_opt_callback, NULL);
if (error && error != DB_NOTFOUND) { if (error && error != DB_NOTFOUND) {
tmp_cursor->c_close(tmp_cursor); tmp_cursor->c_close(tmp_cursor);
tmp_cursor = NULL;
txn->commit(txn, 0); txn->commit(txn, 0);
goto cleanup; goto cleanup;
} }
...@@ -4714,6 +4720,11 @@ int ha_tokudb::add_index(TABLE *table_arg, KEY *key_info, uint num_of_keys) { ...@@ -4714,6 +4720,11 @@ int ha_tokudb::add_index(TABLE *table_arg, KEY *key_info, uint num_of_keys) {
if ((num_processed % 1000) == 0) { if ((num_processed % 1000) == 0) {
sprintf(status_msg, "Adding indexes: Applied %llu of %llu rows in key-%s.", num_processed, share->rows, key_info[i].name); sprintf(status_msg, "Adding indexes: Applied %llu of %llu rows in key-%s.", num_processed, share->rows, key_info[i].name);
thd_proc_info(thd, status_msg); thd_proc_info(thd, status_msg);
if (thd->killed) {
error = ER_ABORTING_CONNECTION;
txn->commit(txn, 0);
goto cleanup;
}
} }
} }
...@@ -4727,6 +4738,10 @@ int ha_tokudb::add_index(TABLE *table_arg, KEY *key_info, uint num_of_keys) { ...@@ -4727,6 +4738,10 @@ int ha_tokudb::add_index(TABLE *table_arg, KEY *key_info, uint num_of_keys) {
error = 0; error = 0;
cleanup: cleanup:
if (error) { if (error) {
if (tmp_cursor) {
tmp_cursor->c_close(tmp_cursor);
tmp_cursor = NULL;
}
// //
// We need to delete all the files that may have been created // We need to delete all the files that may have been created
// The DB's must be closed and removed // The DB's must be closed and removed
......
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