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

addresses #1661, #1718

fix both issues

git-svn-id: file:///svn/mysql/tokudb-engine/src@11469 c7de825b-a66e-492c-adef-691d508d4ae1
parent 80f9eac6
...@@ -2251,6 +2251,13 @@ int ha_tokudb::write_row(uchar * record) { ...@@ -2251,6 +2251,13 @@ int ha_tokudb::write_row(uchar * record) {
tokudb_trx_data *trx = NULL; tokudb_trx_data *trx = NULL;
declare_lockretry; declare_lockretry;
//
// this can only fail if we have not opened the environment
// yet. I want to assert that rather than check for the error
//
error = db_env->checkpointing_begin_atomic_operation(db_env);
assert(!error);
// //
// some crap that needs to be done because MySQL does not properly abstract // some crap that needs to be done because MySQL does not properly abstract
// this work away from us, namely filling in auto increment and setting auto timestamp // this work away from us, namely filling in auto increment and setting auto timestamp
...@@ -2414,6 +2421,7 @@ int ha_tokudb::write_row(uchar * record) { ...@@ -2414,6 +2421,7 @@ int ha_tokudb::write_row(uchar * record) {
error = sub_trans->commit(sub_trans, DB_TXN_NOSYNC); error = sub_trans->commit(sub_trans, DB_TXN_NOSYNC);
} }
} }
db_env->checkpointing_end_atomic_operation(db_env);
TOKUDB_DBUG_RETURN(error); TOKUDB_DBUG_RETURN(error);
} }
...@@ -2489,6 +2497,13 @@ int ha_tokudb::update_row(const uchar * old_row, uchar * new_row) { ...@@ -2489,6 +2497,13 @@ int ha_tokudb::update_row(const uchar * old_row, uchar * new_row) {
DB_TXN* sub_trans = NULL; DB_TXN* sub_trans = NULL;
DB_TXN* txn = NULL; DB_TXN* txn = NULL;
//
// this can only fail if we have not opened the environment
// yet. I want to assert that rather than check for the error
//
error = db_env->checkpointing_begin_atomic_operation(db_env);
assert(!error);
LINT_INIT(error); LINT_INIT(error);
statistic_increment(table->in_use->status_var.ha_update_count, &LOCK_status); statistic_increment(table->in_use->status_var.ha_update_count, &LOCK_status);
if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE) { if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE) {
...@@ -2625,6 +2640,7 @@ int ha_tokudb::update_row(const uchar * old_row, uchar * new_row) { ...@@ -2625,6 +2640,7 @@ int ha_tokudb::update_row(const uchar * old_row, uchar * new_row) {
error = sub_trans->commit(sub_trans, DB_TXN_NOSYNC); error = sub_trans->commit(sub_trans, DB_TXN_NOSYNC);
} }
} }
db_env->checkpointing_end_atomic_operation(db_env);
TOKUDB_DBUG_RETURN(error); TOKUDB_DBUG_RETURN(error);
} }
...@@ -2717,6 +2733,14 @@ int ha_tokudb::delete_row(const uchar * record) { ...@@ -2717,6 +2733,14 @@ int ha_tokudb::delete_row(const uchar * record) {
key_map keys = table_share->keys_in_use; key_map keys = table_share->keys_in_use;
bool has_null; bool has_null;
THD* thd = ha_thd(); THD* thd = ha_thd();
//
// this can only fail if we have not opened the environment
// yet. I want to assert that rather than check for the error
//
error = db_env->checkpointing_begin_atomic_operation(db_env);
assert(!error);
statistic_increment(table->in_use->status_var.ha_delete_count, &LOCK_status); statistic_increment(table->in_use->status_var.ha_delete_count, &LOCK_status);
create_dbt_key_from_table(&prim_key, primary_key, key_buff, record, &has_null); create_dbt_key_from_table(&prim_key, primary_key, key_buff, record, &has_null);
...@@ -2738,6 +2762,7 @@ int ha_tokudb::delete_row(const uchar * record) { ...@@ -2738,6 +2762,7 @@ int ha_tokudb::delete_row(const uchar * record) {
thd_proc_info(thd, write_status_msg); thd_proc_info(thd, write_status_msg);
} }
} }
db_env->checkpointing_end_atomic_operation(db_env);
TOKUDB_DBUG_RETURN(error); TOKUDB_DBUG_RETURN(error);
} }
...@@ -4543,6 +4568,13 @@ int ha_tokudb::rename_table(const char *from, const char *to) { ...@@ -4543,6 +4568,13 @@ int ha_tokudb::rename_table(const char *from, const char *to) {
char* newfrom = NULL; char* newfrom = NULL;
char* newto = NULL; char* newto = NULL;
//
// this can only fail if we have not opened the environment
// yet. I want to assert that rather than check for the error
//
error = db_env->checkpointing_postpone(db_env);
assert(!error);
int n = get_name_length(from) + NAME_CHAR_LEN; int n = get_name_length(from) + NAME_CHAR_LEN;
newfrom = (char *)my_malloc(n,MYF(MY_WME)); newfrom = (char *)my_malloc(n,MYF(MY_WME));
if (newfrom == NULL){ if (newfrom == NULL){
...@@ -4565,6 +4597,7 @@ int ha_tokudb::rename_table(const char *from, const char *to) { ...@@ -4565,6 +4597,7 @@ int ha_tokudb::rename_table(const char *from, const char *to) {
} }
cleanup: cleanup:
db_env->checkpointing_resume(db_env);
my_free(newfrom, MYF(MY_ALLOW_ZERO_PTR)); my_free(newfrom, MYF(MY_ALLOW_ZERO_PTR));
my_free(newto, MYF(MY_ALLOW_ZERO_PTR)); my_free(newto, MYF(MY_ALLOW_ZERO_PTR));
TOKUDB_DBUG_RETURN(error); 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