Commit d1507050 authored by Sachin's avatar Sachin

Solve compile error

parent 6729b0b2
......@@ -146,36 +146,6 @@ typedef struct st_rows_event_tracker
bool check_and_report(const char* file_name, my_off_t pos);
} Rows_event_tracker;
enum start_alter_state
{
REGISTERED= 0, // Start Alter exist, Default state
COMMIT_ALTER, // COMMIT the alter
ROLLBACK_ALTER, // Rollback the alter
COMMITTED // COMMIT/ROLLBACK Alter written in binlog
};
struct start_alter_info
{
/*
Unique among replication channel at one point of time
*/
uint thread_id; //key for searching
/*
0 prepared and not error from commit and rollback
>0 error expected in commit/rollback
TODO maybe used later ?
*/
uint error;
enum start_alter_state state;
/* We are not using mysql_cond_t because we do not need PSI */
mysql_cond_t start_alter_cond;
};
struct start_alter_struct
{
List <start_alter_info> start_alter_list;
mysql_mutex_t start_alter_list_lock, start_alter_lock;
mysql_cond_t start_alter_list_cond;
};
/*****************************************************************************
Replication IO Thread
......@@ -381,16 +351,6 @@ class Master_info : public Slave_reporting_capability
start_alter_struct start_alter_struct_master;
};
struct start_alter_thd_args
{
rpl_group_info *rgi;
LEX_CSTRING query;
LEX_CSTRING *db;
char *catalog;
bool shutdown;
CHARSET_INFO *cs;
};
int init_master_info(Master_info* mi, const char* master_info_fname,
const char* slave_info_fname,
bool abort_if_no_master_info_file,
......
......@@ -20,6 +20,7 @@
// mysql_exchange_partition
#include "sql_alter.h"
#include "rpl_mi.h"
#include "rpl_rli.h"
#include "slave.h"
#include "wsrep_mysqld.h"
......@@ -381,6 +382,8 @@ static int process_start_alter(THD *thd, uint64 thread_id,
mysql_mutex_t *start_alter_lock,
mysql_cond_t *start_alter_list_cond)
{
#ifdef HAVE_REPLICATION
/*
start_alter_thread will be true for spawned thread
*/
......@@ -445,6 +448,9 @@ static int process_start_alter(THD *thd, uint64 thread_id,
DBUG_ASSERT(info->state == start_alter_state::REGISTERED);
if (write_bin_log(thd, false, thd->query(), thd->query_length(), true) && ha_commit_trans(thd, true))
return 2;
#else
return START_ALTER_PARSE;
#endif
return 0;
}
/* 0= Nothing to do skip query_log_event parsing , 1= query_log_event_parsing
......@@ -703,11 +709,13 @@ bool Sql_cmd_alter_table::execute(THD *thd)
mysql_cond_t *start_alter_list_cond;
if (thd->rgi_slave)
{
#ifdef HAVE_REPLICATION
start_alter_struct *data= &thd->rgi_slave->rli->mi->start_alter_struct_master;
start_alter_list= &data->start_alter_list;
start_alter_list_lock= &data->start_alter_list_lock;
start_alter_lock= &data->start_alter_lock;
start_alter_list_cond= &data->start_alter_list_cond;
#endif
}
else
{
......
......@@ -56,6 +56,8 @@
#include "tztime.h"
#include <algorithm>
#include "rpl_mi.h"
#include "rpl_rli.h"
#include "slave.h"
#ifdef __WIN__
......@@ -9377,6 +9379,7 @@ static int master_result(THD *thd, start_alter_info *info,
}
else if (info->state == start_alter_state::COMMIT_ALTER && alter_result)
{
/*
//TODO
thd->rgi_slave->rli->report(ERROR_LEVEL, 0, thd->rgi_slave->gtid_info(),
"Query caused different errors on master and slave. "
......@@ -9387,6 +9390,7 @@ static int master_result(THD *thd, start_alter_info *info,
0, thd->get_stmt_da()->message() ,
1045,
"test", thd->query());
*/
thd->is_slave_error= 1;
return MASTER_RESULT_COMMIT_ERROR;
}
......@@ -9500,12 +9504,16 @@ bool mysql_alter_table(THD *thd, const LEX_CSTRING *new_db,
bool partial_alter= false;
start_alter_info *info= get_new_start_alter_info(thd);
start_alter_struct *alter_struct;
DBUG_ENTER("mysql_alter_table");
if (thd->slave_thread)
#ifdef HAVE_REPLICATION
alter_struct= &thd->rgi_slave->rli->mi->start_alter_struct_master;
#else
DBUG_RETURN(true);
#endif
else
alter_struct= NULL;
ulong start_alter_id= thd->lex->alter_info.alter_identifier;
DBUG_ENTER("mysql_alter_table");
/*
Check if we attempt to alter mysql.slow_log or
......
......@@ -324,6 +324,49 @@ typedef struct st_grant_info
GRANT_INTERNAL_INFO m_internal;
} GRANT_INFO;
enum start_alter_state
{
REGISTERED= 0, // Start Alter exist, Default state
COMMIT_ALTER, // COMMIT the alter
ROLLBACK_ALTER, // Rollback the alter
COMMITTED // COMMIT/ROLLBACK Alter written in binlog
};
struct start_alter_info
{
/*
Unique among replication channel at one point of time
*/
uint thread_id; //key for searching
/*
0 prepared and not error from commit and rollback
>0 error expected in commit/rollback
TODO maybe used later ?
*/
uint error;
enum start_alter_state state;
/* We are not using mysql_cond_t because we do not need PSI */
mysql_cond_t start_alter_cond;
};
struct start_alter_struct
{
List <start_alter_info> start_alter_list;
mysql_mutex_t start_alter_list_lock, start_alter_lock;
mysql_cond_t start_alter_list_cond;
};
struct rpl_group_info;
struct start_alter_thd_args
{
rpl_group_info *rgi;
LEX_CSTRING query;
LEX_CSTRING *db;
char *catalog;
bool shutdown;
CHARSET_INFO *cs;
};
enum tmp_table_type
{
NO_TMP_TABLE, NON_TRANSACTIONAL_TMP_TABLE, TRANSACTIONAL_TMP_TABLE,
......
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