Commit 99ba65e2 authored by Barry Perlman's avatar Barry Perlman Committed by Yoni Fogel

Addresses #2042 refs[t:2042] Take correct checkpoint locks in correct...

Addresses #2042 refs[t:2042] Take correct checkpoint locks in correct sequence.  Fixes deadlock in rename.  Fixes race condition in delete.

git-svn-id: file:///svn/mysql/tokudb-engine/src@14754 c7de825b-a66e-492c-adef-691d508d4ae1
parent 84123cd5
...@@ -4973,6 +4973,16 @@ int ha_tokudb::delete_table(const char *name) { ...@@ -4973,6 +4973,16 @@ int ha_tokudb::delete_table(const char *name) {
int error; int error;
char* newname = NULL; char* newname = NULL;
pthread_mutex_lock(&tokudb_meta_mutex); pthread_mutex_lock(&tokudb_meta_mutex);
//
// 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);
error = db_env->checkpointing_postpone(db_env);
assert(!error);
// remove all of the dictionaries in the table directory // remove all of the dictionaries in the table directory
error = drop_table_from_metadata(name); error = drop_table_from_metadata(name);
if (error) { if (error) {
...@@ -4987,6 +4997,13 @@ int ha_tokudb::delete_table(const char *name) { ...@@ -4987,6 +4997,13 @@ int ha_tokudb::delete_table(const char *name) {
error = rmall(newname); error = rmall(newname);
my_errno = error; my_errno = error;
cleanup: cleanup:
{
int r;
r = db_env->checkpointing_resume(db_env);
assert(r==0);
r = db_env->checkpointing_end_atomic_operation(db_env);
assert(r==0);
}
my_free(newname, MYF(MY_ALLOW_ZERO_PTR)); my_free(newname, MYF(MY_ALLOW_ZERO_PTR));
pthread_mutex_unlock(&tokudb_meta_mutex); pthread_mutex_unlock(&tokudb_meta_mutex);
TOKUDB_DBUG_RETURN(error); TOKUDB_DBUG_RETURN(error);
...@@ -5013,6 +5030,8 @@ int ha_tokudb::rename_table(const char *from, const char *to) { ...@@ -5013,6 +5030,8 @@ int ha_tokudb::rename_table(const char *from, const char *to) {
// this can only fail if we have not opened the environment // this can only fail if we have not opened the environment
// yet. I want to assert that rather than check for the error // yet. I want to assert that rather than check for the error
// //
error = db_env->checkpointing_begin_atomic_operation(db_env);
assert(!error);
error = db_env->checkpointing_postpone(db_env); error = db_env->checkpointing_postpone(db_env);
assert(!error); assert(!error);
...@@ -5042,7 +5061,10 @@ int ha_tokudb::rename_table(const char *from, const char *to) { ...@@ -5042,7 +5061,10 @@ int ha_tokudb::rename_table(const char *from, const char *to) {
cleanup: cleanup:
{ {
int r = db_env->checkpointing_resume(db_env); int r;
r = db_env->checkpointing_resume(db_env);
assert(r==0);
r = db_env->checkpointing_end_atomic_operation(db_env);
assert(r==0); assert(r==0);
} }
my_free(newfrom, MYF(MY_ALLOW_ZERO_PTR)); my_free(newfrom, MYF(MY_ALLOW_ZERO_PTR));
......
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