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

[t:2582], use separate transactions in show engine user_data

git-svn-id: file:///svn/mysql/tokudb-engine/tokudb-engine@20028 c7de825b-a66e-492c-adef-691d508d4ae1
parent 3b117933
...@@ -668,6 +668,7 @@ static bool tokudb_show_data_size(THD * thd, stat_print_fn * stat_print, bool ex ...@@ -668,6 +668,7 @@ static bool tokudb_show_data_size(THD * thd, stat_print_fn * stat_print, bool ex
goto cleanup; goto cleanup;
} }
while (error == 0) { while (error == 0) {
DB_TXN* tmp_txn = NULL;
// //
// here, and in other places, check if process has been killed // here, and in other places, check if process has been killed
// if so, get out of function so user is not stalled // if so, get out of function so user is not stalled
...@@ -675,7 +676,11 @@ static bool tokudb_show_data_size(THD * thd, stat_print_fn * stat_print, bool ex ...@@ -675,7 +676,11 @@ static bool tokudb_show_data_size(THD * thd, stat_print_fn * stat_print, bool ex
if (thd->killed) { if (thd->killed) {
break; break;
} }
error = db_env->txn_begin(db_env, 0, &tmp_txn, DB_READ_UNCOMMITTED);
if (error) {
goto cleanup;
}
// //
// do not need this to be super fast, so use old simple API // do not need this to be super fast, so use old simple API
// //
...@@ -705,7 +710,7 @@ static bool tokudb_show_data_size(THD * thd, stat_print_fn * stat_print, bool ex ...@@ -705,7 +710,7 @@ static bool tokudb_show_data_size(THD * thd, stat_print_fn * stat_print, bool ex
error = db_create(&curr_db, db_env, 0); error = db_create(&curr_db, db_env, 0);
if (error) { goto cleanup; } if (error) { goto cleanup; }
error = curr_db->open(curr_db, txn, newname, NULL, DB_BTREE, DB_THREAD, 0); error = curr_db->open(curr_db, tmp_txn, newname, NULL, DB_BTREE, DB_THREAD, 0);
if (error == ENOENT) { error = 0; continue; } if (error == ENOENT) { error = 0; continue; }
if (error) { goto cleanup; } if (error) { goto cleanup; }
...@@ -714,7 +719,7 @@ static bool tokudb_show_data_size(THD * thd, stat_print_fn * stat_print, bool ex ...@@ -714,7 +719,7 @@ static bool tokudb_show_data_size(THD * thd, stat_print_fn * stat_print, bool ex
// flatten if exact is required // flatten if exact is required
// //
uint curr_num_items = 0; uint curr_num_items = 0;
error = curr_db->cursor(curr_db, txn, &tmp_table_cursor, 0); error = curr_db->cursor(curr_db, tmp_txn, &tmp_table_cursor, 0);
if (error) { if (error) {
tmp_table_cursor = NULL; tmp_table_cursor = NULL;
goto cleanup; goto cleanup;
...@@ -739,7 +744,7 @@ static bool tokudb_show_data_size(THD * thd, stat_print_fn * stat_print, bool ex ...@@ -739,7 +744,7 @@ static bool tokudb_show_data_size(THD * thd, stat_print_fn * stat_print, bool ex
error = curr_db->stat64( error = curr_db->stat64(
curr_db, curr_db,
txn, tmp_txn,
&dict_stats &dict_stats
); );
if (error) { goto cleanup; } if (error) { goto cleanup; }
...@@ -770,6 +775,11 @@ static bool tokudb_show_data_size(THD * thd, stat_print_fn * stat_print, bool ex ...@@ -770,6 +775,11 @@ static bool tokudb_show_data_size(THD * thd, stat_print_fn * stat_print, bool ex
} }
my_free(newname,MYF(MY_ALLOW_ZERO_PTR)); my_free(newname,MYF(MY_ALLOW_ZERO_PTR));
} }
if (tmp_txn) {
commit_txn(tmp_txn, 0);
tmp_txn = NULL;
}
} }
sprintf(data_amount_msg, "Number of bytes in database: %" PRIu64, num_bytes_in_db); sprintf(data_amount_msg, "Number of bytes in database: %" PRIu64, num_bytes_in_db);
......
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