Commit a47d4eb8 authored by Rich Prohaska's avatar Rich Prohaska

#141 fix another open close race

parent 7241741f
...@@ -308,6 +308,8 @@ static int free_share(TOKUDB_SHARE * share) { ...@@ -308,6 +308,8 @@ static int free_share(TOKUDB_SHARE * share) {
if (error) { if (error) {
result = error; result = error;
} }
if (share->key_file[i] == share->file)
share->file = NULL;
share->key_file[i] = NULL; share->key_file[i] = NULL;
} }
} }
...@@ -321,7 +323,6 @@ static int free_share(TOKUDB_SHARE * share) { ...@@ -321,7 +323,6 @@ static int free_share(TOKUDB_SHARE * share) {
tokudb_pthread_mutex_lock(&share->mutex); tokudb_pthread_mutex_lock(&share->mutex);
share->m_state = TOKUDB_SHARE::CLOSED; share->m_state = TOKUDB_SHARE::CLOSED;
if (share->use_count > 0) { if (share->use_count > 0) {
fprintf(stderr, "%ld %s:%u free_share %p %d\n", syscall(186), __FILE__, __LINE__, share, share->use_count);
tokudb_pthread_cond_broadcast(&share->m_openclose_cond); tokudb_pthread_cond_broadcast(&share->m_openclose_cond);
tokudb_pthread_mutex_unlock(&share->mutex); tokudb_pthread_mutex_unlock(&share->mutex);
tokudb_pthread_mutex_unlock(&tokudb_mutex); tokudb_pthread_mutex_unlock(&tokudb_mutex);
...@@ -1600,6 +1601,7 @@ int ha_tokudb::initialize_share( ...@@ -1600,6 +1601,7 @@ int ha_tokudb::initialize_share(
} }
DBUG_PRINT("info", ("share->use_count %u", share->use_count)); DBUG_PRINT("info", ("share->use_count %u", share->use_count));
share->m_initialize_count++;
error = get_status(txn); error = get_status(txn);
if (error) { if (error) {
......
...@@ -192,6 +192,7 @@ public: ...@@ -192,6 +192,7 @@ public:
pthread_cond_t m_openclose_cond; pthread_cond_t m_openclose_cond;
enum { CLOSED, OPENING, OPENED, CLOSING, ERROR } m_state; enum { CLOSED, OPENING, OPENED, CLOSING, ERROR } m_state;
int m_error; int m_error;
int m_initialize_count;
}; };
typedef struct st_filter_key_part_info { typedef struct st_filter_key_part_info {
......
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