Commit bb91facb authored by Sachin's avatar Sachin

::WAITING removed everything works

parent 6aedaa06
......@@ -1675,12 +1675,9 @@ static int process_commit_alter(THD *thd, uint64 thread_id)
return 1;
}
/*
start_alter_state can be either ::REGISTERED or ::WAITING
start_alter_state must be ::REGISTERED
*/
mysql_mutex_lock(&mi->start_alter_lock);
while(info->state == start_alter_state::REGISTERED )
mysql_cond_wait(&info->start_alter_cond, &mi->start_alter_lock);
mysql_mutex_unlock(&mi->start_alter_lock);
DBUG_ASSERT(info->state == start_alter_state::REGISTERED);
mysql_mutex_lock(&mi->start_alter_lock);
info->state= start_alter_state::COMMIT_ALTER;
mysql_mutex_unlock(&mi->start_alter_lock);
......@@ -1690,8 +1687,8 @@ static int process_commit_alter(THD *thd, uint64 thread_id)
while(info->state != start_alter_state::COMMITTED )
mysql_cond_wait(&info->start_alter_cond, &mi->start_alter_lock);
mysql_mutex_unlock(&mi->start_alter_lock);
my_free(info);
mysql_cond_destroy(&info->start_alter_cond);
my_free(info);
if (write_bin_log(thd, true, thd->query(), thd->query_length()))
return 2;
return 0;
......@@ -1722,12 +1719,9 @@ static int process_rollback_alter(THD *thd, uint64 thread_id)
return 0;
}
/*
start_alter_state can be either ::REGISTERED or ::WAITING
start_alter_state must be ::REGISTERED
*/
mysql_mutex_lock(&mi->start_alter_lock);
while(info->state == start_alter_state::REGISTERED )
mysql_cond_wait(&info->start_alter_cond, &mi->start_alter_lock);
mysql_mutex_unlock(&mi->start_alter_lock);
DBUG_ASSERT(info->state == start_alter_state::REGISTERED);
mysql_mutex_lock(&mi->start_alter_lock);
info->state= start_alter_state::ROLLBACK_ALTER;
mysql_mutex_unlock(&mi->start_alter_lock);
......@@ -1737,8 +1731,8 @@ static int process_rollback_alter(THD *thd, uint64 thread_id)
while(info->state != start_alter_state::COMMITTED )
mysql_cond_wait(&info->start_alter_cond, &mi->start_alter_lock);
mysql_mutex_unlock(&mi->start_alter_lock);
my_free(info);
mysql_cond_destroy(&info->start_alter_cond);
my_free(info);
if (write_bin_log(thd, true, thd->query(), thd->query_length()))
return 2;
return 0;
......
......@@ -148,8 +148,7 @@ typedef struct st_rows_event_tracker
enum start_alter_state
{
REGISTERED, // Start Alter exist
WAITING, // WAITING for commit/rollback
REGISTERED= 0, // Start Alter exist, Default state
COMMIT_ALTER, // COMMIT the alter
ROLLBACK_ALTER, // Rollback the alter
COMMITTED, // COMMIT/ROLLBACK Alter written in binlog
......
......@@ -9366,12 +9366,12 @@ static void wait_for_master(THD *thd, start_alter_info* info)
{
Master_info *mi= thd->rgi_slave->rli->mi;
mysql_mutex_lock(&mi->start_alter_lock);
if (info->state != start_alter_state::SHUTDOWN_RECIEVED)
info->state= start_alter_state::WAITING;
// if (info->state != start_alter_state::SHUTDOWN_RECIEVED)
// info->state= start_alter_state::WAITING;
mysql_mutex_unlock(&mi->start_alter_lock);
mysql_cond_broadcast(&info->start_alter_cond);
mysql_mutex_lock(&mi->start_alter_lock);
while (info->state == start_alter_state::WAITING)
while (info->state == start_alter_state::REGISTERED)
{
mysql_cond_wait(&info->start_alter_cond, &mi->start_alter_lock);
}
......@@ -9391,7 +9391,7 @@ static int master_result(THD *thd, Master_info *mi, start_alter_info *info,
{
if (info->state == start_alter_state::REGISTERED)
wait_for_master(thd, info);
DBUG_ASSERT(info->state > start_alter_state::WAITING);
DBUG_ASSERT(info->state > start_alter_state::REGISTERED);
if (info->state == start_alter_state::ROLLBACK_ALTER)
{
mysql_mutex_lock(&mi->start_alter_lock);
......@@ -9480,6 +9480,7 @@ start_alter_info *get_new_start_alter_info(THD *thd)
return 0;
}
mysql_cond_init(0, &info->start_alter_cond, NULL);
// info->start_alter_cond.m_psi= NULL;
return 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