Fix to ensure updates in gtid_slave_state table do not get binlogged.
Also, renamed wsrep_skip_append_keys to wsrep_ignore_table. Test case : galera.galera_as_slave_gtid.test
This commit is contained in:
parent
b05158cc10
commit
0251232f8c
@ -104,7 +104,7 @@ extern struct wsrep_service_st {
|
|||||||
const char * (*wsrep_thd_query_state_str_func)(THD *thd);
|
const char * (*wsrep_thd_query_state_str_func)(THD *thd);
|
||||||
int (*wsrep_thd_retry_counter_func)(THD *thd);
|
int (*wsrep_thd_retry_counter_func)(THD *thd);
|
||||||
void (*wsrep_thd_set_conflict_state_func)(THD *thd, enum wsrep_conflict_state state);
|
void (*wsrep_thd_set_conflict_state_func)(THD *thd, enum wsrep_conflict_state state);
|
||||||
bool (*wsrep_thd_skip_append_keys_func)(THD *thd);
|
bool (*wsrep_thd_ignore_table_func)(THD *thd);
|
||||||
long long (*wsrep_thd_trx_seqno_func)(THD *thd);
|
long long (*wsrep_thd_trx_seqno_func)(THD *thd);
|
||||||
struct wsrep_ws_handle * (*wsrep_thd_ws_handle_func)(THD *thd);
|
struct wsrep_ws_handle * (*wsrep_thd_ws_handle_func)(THD *thd);
|
||||||
int (*wsrep_trx_is_aborting_func)(MYSQL_THD thd);
|
int (*wsrep_trx_is_aborting_func)(MYSQL_THD thd);
|
||||||
@ -145,7 +145,7 @@ extern struct wsrep_service_st {
|
|||||||
#define wsrep_thd_query_state_str(T) wsrep_service->wsrep_thd_query_state_str_func(T)
|
#define wsrep_thd_query_state_str(T) wsrep_service->wsrep_thd_query_state_str_func(T)
|
||||||
#define wsrep_thd_retry_counter(T) wsrep_service->wsrep_thd_retry_counter_func(T)
|
#define wsrep_thd_retry_counter(T) wsrep_service->wsrep_thd_retry_counter_func(T)
|
||||||
#define wsrep_thd_set_conflict_state(T,S) wsrep_service->wsrep_thd_set_conflict_state_func(T,S)
|
#define wsrep_thd_set_conflict_state(T,S) wsrep_service->wsrep_thd_set_conflict_state_func(T,S)
|
||||||
#define wsrep_thd_skip_append_keys(T) wsrep_service->wsrep_thd_skip_append_keys_func(T)
|
#define wsrep_thd_ignore_table(T) wsrep_service->wsrep_thd_ignore_table_func(T)
|
||||||
#define wsrep_thd_trx_seqno(T) wsrep_service->wsrep_thd_trx_seqno_func(T)
|
#define wsrep_thd_trx_seqno(T) wsrep_service->wsrep_thd_trx_seqno_func(T)
|
||||||
#define wsrep_thd_ws_handle(T) wsrep_service->wsrep_thd_ws_handle_func(T)
|
#define wsrep_thd_ws_handle(T) wsrep_service->wsrep_thd_ws_handle_func(T)
|
||||||
#define wsrep_trx_is_aborting(T) wsrep_service->wsrep_trx_is_aborting_func(T)
|
#define wsrep_trx_is_aborting(T) wsrep_service->wsrep_trx_is_aborting_func(T)
|
||||||
@ -206,7 +206,7 @@ void wsrep_thd_LOCK(THD *thd);
|
|||||||
void wsrep_thd_UNLOCK(THD *thd);
|
void wsrep_thd_UNLOCK(THD *thd);
|
||||||
void wsrep_thd_awake(THD *thd, my_bool signal);
|
void wsrep_thd_awake(THD *thd, my_bool signal);
|
||||||
void wsrep_thd_set_conflict_state(THD *thd, enum wsrep_conflict_state state);
|
void wsrep_thd_set_conflict_state(THD *thd, enum wsrep_conflict_state state);
|
||||||
bool wsrep_thd_skip_append_keys(THD *thd);
|
bool wsrep_thd_ignore_table(THD *thd);
|
||||||
void wsrep_unlock_rollback();
|
void wsrep_unlock_rollback();
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -5723,10 +5723,16 @@ static int binlog_log_row(TABLE* table,
|
|||||||
bool error= 0;
|
bool error= 0;
|
||||||
THD *const thd= table->in_use;
|
THD *const thd= table->in_use;
|
||||||
|
|
||||||
/* only InnoDB tables will be replicated through binlog emulation */
|
#ifdef WITH_WSREP
|
||||||
if (WSREP_EMULATE_BINLOG(thd) &&
|
/*
|
||||||
table->file->partition_ht()->db_type != DB_TYPE_INNODB)
|
Only InnoDB tables will be replicated through binlog emulation. Also
|
||||||
|
updates in mysql.gtid_slave_state table should not be binlogged.
|
||||||
|
*/
|
||||||
|
if ((WSREP_EMULATE_BINLOG(thd) &&
|
||||||
|
table->file->partition_ht()->db_type != DB_TYPE_INNODB) ||
|
||||||
|
(thd->wsrep_ignore_table == true))
|
||||||
return 0;
|
return 0;
|
||||||
|
#endif /* WITH_WSREP */
|
||||||
|
|
||||||
if (check_table_binlog_row_based(thd, table))
|
if (check_table_binlog_row_based(thd, table))
|
||||||
{
|
{
|
||||||
|
@ -567,7 +567,7 @@ rpl_slave_state::record_gtid(THD *thd, const rpl_gtid *gtid, uint64 sub_id,
|
|||||||
Updates in slave state table should not be appended to galera transaction
|
Updates in slave state table should not be appended to galera transaction
|
||||||
writeset.
|
writeset.
|
||||||
*/
|
*/
|
||||||
thd->wsrep_skip_append_keys= true;
|
thd->wsrep_ignore_table= true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!in_transaction)
|
if (!in_transaction)
|
||||||
@ -685,7 +685,7 @@ IF_DBUG(dbug_break:, )
|
|||||||
end:
|
end:
|
||||||
|
|
||||||
#ifdef WITH_WSREP
|
#ifdef WITH_WSREP
|
||||||
thd->wsrep_skip_append_keys= false;
|
thd->wsrep_ignore_table= false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (table_opened)
|
if (table_opened)
|
||||||
|
@ -902,7 +902,7 @@ THD::THD(bool is_wsrep_applier)
|
|||||||
wsrep_po_handle(WSREP_PO_INITIALIZER),
|
wsrep_po_handle(WSREP_PO_INITIALIZER),
|
||||||
wsrep_po_cnt(0),
|
wsrep_po_cnt(0),
|
||||||
wsrep_apply_format(0),
|
wsrep_apply_format(0),
|
||||||
wsrep_skip_append_keys(false)
|
wsrep_ignore_table(false)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
ulong tmp;
|
ulong tmp;
|
||||||
|
@ -3990,7 +3990,12 @@ public:
|
|||||||
#endif /* GTID_SUPPORT */
|
#endif /* GTID_SUPPORT */
|
||||||
void *wsrep_apply_format;
|
void *wsrep_apply_format;
|
||||||
char wsrep_info[128]; /* string for dynamic proc info */
|
char wsrep_info[128]; /* string for dynamic proc info */
|
||||||
bool wsrep_skip_append_keys;
|
/*
|
||||||
|
When enabled, do not replicate/binlog updates from the current table that's
|
||||||
|
being processed. At the moment, it is used to keep mysql.gtid_slave_pos
|
||||||
|
table updates from being replicated to other nodes via galera replication.
|
||||||
|
*/
|
||||||
|
bool wsrep_ignore_table;
|
||||||
wsrep_gtid_t wsrep_sync_wait_gtid;
|
wsrep_gtid_t wsrep_sync_wait_gtid;
|
||||||
#endif /* WITH_WSREP */
|
#endif /* WITH_WSREP */
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ static struct wsrep_service_st wsrep_handler = {
|
|||||||
wsrep_thd_query_state_str,
|
wsrep_thd_query_state_str,
|
||||||
wsrep_thd_retry_counter,
|
wsrep_thd_retry_counter,
|
||||||
wsrep_thd_set_conflict_state,
|
wsrep_thd_set_conflict_state,
|
||||||
wsrep_thd_skip_append_keys,
|
wsrep_thd_ignore_table,
|
||||||
wsrep_thd_trx_seqno,
|
wsrep_thd_trx_seqno,
|
||||||
wsrep_thd_ws_handle,
|
wsrep_thd_ws_handle,
|
||||||
wsrep_trx_is_aborting,
|
wsrep_trx_is_aborting,
|
||||||
|
@ -116,7 +116,7 @@ int wsrep_thd_retry_counter(THD *)
|
|||||||
void wsrep_thd_set_conflict_state(THD *, enum wsrep_conflict_state)
|
void wsrep_thd_set_conflict_state(THD *, enum wsrep_conflict_state)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
bool wsrep_thd_skip_append_keys(THD *)
|
bool wsrep_thd_ignore_table(THD *)
|
||||||
{ return 0; }
|
{ return 0; }
|
||||||
|
|
||||||
longlong wsrep_thd_trx_seqno(THD *)
|
longlong wsrep_thd_trx_seqno(THD *)
|
||||||
|
@ -2377,9 +2377,9 @@ int wsrep_thd_retry_counter(THD *thd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
extern "C" bool wsrep_thd_skip_append_keys(THD *thd)
|
extern "C" bool wsrep_thd_ignore_table(THD *thd)
|
||||||
{
|
{
|
||||||
return thd->wsrep_skip_append_keys;
|
return thd->wsrep_ignore_table;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -8303,7 +8303,7 @@ report_error:
|
|||||||
wsrep_thd_exec_mode(user_thd) == LOCAL_STATE &&
|
wsrep_thd_exec_mode(user_thd) == LOCAL_STATE &&
|
||||||
wsrep_on(user_thd) &&
|
wsrep_on(user_thd) &&
|
||||||
!wsrep_consistency_check(user_thd) &&
|
!wsrep_consistency_check(user_thd) &&
|
||||||
!wsrep_thd_skip_append_keys(user_thd))
|
!wsrep_thd_ignore_table(user_thd))
|
||||||
{
|
{
|
||||||
if (wsrep_append_keys(user_thd, false, record, NULL))
|
if (wsrep_append_keys(user_thd, false, record, NULL))
|
||||||
{
|
{
|
||||||
@ -8825,7 +8825,7 @@ func_exit:
|
|||||||
if (error == DB_SUCCESS &&
|
if (error == DB_SUCCESS &&
|
||||||
wsrep_thd_exec_mode(user_thd) == LOCAL_STATE &&
|
wsrep_thd_exec_mode(user_thd) == LOCAL_STATE &&
|
||||||
wsrep_on(user_thd) &&
|
wsrep_on(user_thd) &&
|
||||||
!wsrep_thd_skip_append_keys(user_thd))
|
!wsrep_thd_ignore_table(user_thd))
|
||||||
{
|
{
|
||||||
DBUG_PRINT("wsrep", ("update row key"));
|
DBUG_PRINT("wsrep", ("update row key"));
|
||||||
|
|
||||||
@ -8891,7 +8891,7 @@ ha_innobase::delete_row(
|
|||||||
if (error == DB_SUCCESS &&
|
if (error == DB_SUCCESS &&
|
||||||
wsrep_thd_exec_mode(user_thd) == LOCAL_STATE &&
|
wsrep_thd_exec_mode(user_thd) == LOCAL_STATE &&
|
||||||
wsrep_on(user_thd) &&
|
wsrep_on(user_thd) &&
|
||||||
!wsrep_thd_skip_append_keys(user_thd))
|
!wsrep_thd_ignore_table(user_thd))
|
||||||
{
|
{
|
||||||
if (wsrep_append_keys(user_thd, false, record, NULL)) {
|
if (wsrep_append_keys(user_thd, false, record, NULL)) {
|
||||||
DBUG_PRINT("wsrep", ("delete fail"));
|
DBUG_PRINT("wsrep", ("delete fail"));
|
||||||
|
@ -8649,7 +8649,7 @@ report_error:
|
|||||||
wsrep_thd_exec_mode(user_thd) == LOCAL_STATE &&
|
wsrep_thd_exec_mode(user_thd) == LOCAL_STATE &&
|
||||||
wsrep_on(user_thd) &&
|
wsrep_on(user_thd) &&
|
||||||
!wsrep_consistency_check(user_thd) &&
|
!wsrep_consistency_check(user_thd) &&
|
||||||
!wsrep_thd_skip_append_keys(user_thd))
|
!wsrep_thd_ignore_table(user_thd))
|
||||||
{
|
{
|
||||||
if (wsrep_append_keys(user_thd, false, record, NULL))
|
if (wsrep_append_keys(user_thd, false, record, NULL))
|
||||||
{
|
{
|
||||||
@ -9195,7 +9195,7 @@ func_exit:
|
|||||||
if (error == DB_SUCCESS &&
|
if (error == DB_SUCCESS &&
|
||||||
wsrep_thd_exec_mode(user_thd) == LOCAL_STATE &&
|
wsrep_thd_exec_mode(user_thd) == LOCAL_STATE &&
|
||||||
wsrep_on(user_thd) &&
|
wsrep_on(user_thd) &&
|
||||||
!wsrep_thd_skip_append_keys(user_thd))
|
!wsrep_thd_ignore_table(user_thd))
|
||||||
{
|
{
|
||||||
DBUG_PRINT("wsrep", ("update row key"));
|
DBUG_PRINT("wsrep", ("update row key"));
|
||||||
|
|
||||||
@ -9281,7 +9281,7 @@ ha_innobase::delete_row(
|
|||||||
if (error == DB_SUCCESS &&
|
if (error == DB_SUCCESS &&
|
||||||
wsrep_thd_exec_mode(user_thd) == LOCAL_STATE &&
|
wsrep_thd_exec_mode(user_thd) == LOCAL_STATE &&
|
||||||
wsrep_on(user_thd) &&
|
wsrep_on(user_thd) &&
|
||||||
!wsrep_thd_skip_append_keys(user_thd))
|
!wsrep_thd_ignore_table(user_thd))
|
||||||
{
|
{
|
||||||
if (wsrep_append_keys(user_thd, false, record, NULL)) {
|
if (wsrep_append_keys(user_thd, false, record, NULL)) {
|
||||||
DBUG_PRINT("wsrep", ("delete fail"));
|
DBUG_PRINT("wsrep", ("delete fail"));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user