diff options
-rw-r--r-- | mysql-test/main/alter_table_online_debug.result | 8 | ||||
-rw-r--r-- | mysql-test/main/alter_table_online_debug.test | 12 | ||||
-rw-r--r-- | sql/log_event.h | 7 | ||||
-rw-r--r-- | sql/log_event_server.cc | 15 | ||||
-rw-r--r-- | sql/rpl_record.cc | 59 | ||||
-rw-r--r-- | sql/rpl_record.h | 1 | ||||
-rw-r--r-- | sql/wsrep_mysqld.cc | 4 |
7 files changed, 46 insertions, 60 deletions
diff --git a/mysql-test/main/alter_table_online_debug.result b/mysql-test/main/alter_table_online_debug.result index d341d3bab7e..e9b6199ba5f 100644 --- a/mysql-test/main/alter_table_online_debug.result +++ b/mysql-test/main/alter_table_online_debug.result @@ -28,9 +28,8 @@ insert t1 values (5), (5); connection con2; set debug_sync= 'now WAIT_FOR ended'; connection default; -set session lock_wait_timeout=1; set debug_sync= 'alter_table_copy_end SIGNAL ended WAIT_FOR end'; -alter table t1 add unique (a), algorithm= copy, lock= none; +alter table t1 nowait add unique (a), algorithm= copy, lock= none; connection con2; start transaction; insert into t1 values (123), (456), (789); @@ -51,7 +50,6 @@ a select variable_value-@otd from information_schema.session_status where variable_name='Opened_table_definitions'; variable_value-@otd 1 -set session lock_wait_timeout=default; # long transaction and add column create or replace table t1 (a int); insert t1 values (5); @@ -59,8 +57,7 @@ connection con2; set debug_sync= 'now WAIT_FOR ended'; connection default; set debug_sync= 'alter_table_copy_end SIGNAL ended WAIT_FOR end'; -set session lock_wait_timeout=1; -alter table t1 add b int NULL, algorithm= copy, lock= none; +alter table t1 nowait add b int NULL, algorithm= copy, lock= none; connection con2; start transaction; insert into t1 values (123), (456), (789); @@ -70,7 +67,6 @@ ERROR HY000: Lock wait timeout exceeded; try restarting transaction select * from t1; a 5 -set session lock_wait_timeout=default; connection con2; rollback; connection default; diff --git a/mysql-test/main/alter_table_online_debug.test b/mysql-test/main/alter_table_online_debug.test index 5b4fe1f3724..7ab4031f77c 100644 --- a/mysql-test/main/alter_table_online_debug.test +++ b/mysql-test/main/alter_table_online_debug.test @@ -43,11 +43,10 @@ insert t1 values (5), (5); set debug_sync= 'now WAIT_FOR ended'; --connection default -set session lock_wait_timeout=1; set debug_sync= 'alter_table_copy_end SIGNAL ended WAIT_FOR end'; --send -alter table t1 add unique (a), algorithm= copy, lock= none; +alter table t1 nowait add unique (a), algorithm= copy, lock= none; --connection con2 --reap @@ -64,7 +63,6 @@ commit; select variable_value into @otd from information_schema.session_status where variable_name='Opened_table_definitions'; select * from t1; select variable_value-@otd from information_schema.session_status where variable_name='Opened_table_definitions'; -set session lock_wait_timeout=default; --echo # long transaction and add column create or replace table t1 (a int); @@ -76,9 +74,8 @@ set debug_sync= 'now WAIT_FOR ended'; --connection default set debug_sync= 'alter_table_copy_end SIGNAL ended WAIT_FOR end'; -set session lock_wait_timeout=1; --send -alter table t1 add b int NULL, algorithm= copy, lock= none; +alter table t1 nowait add b int NULL, algorithm= copy, lock= none; --connection con2 --reap @@ -90,7 +87,6 @@ set debug_sync= 'now SIGNAL end'; --error ER_LOCK_WAIT_TIMEOUT --reap select * from t1; -set session lock_wait_timeout=default; --connection con2 rollback; --connection default @@ -732,12 +728,12 @@ insert into t1 values (1),(2),(3); set sql_mode='STRICT_TRANS_TABLES,STRICT_ALL_TABLES'; set debug_sync= 'alter_table_online_downgraded signal downgraded wait_for goforit'; --send alter table t1 modify a int not null, algorithm=copy, lock=none - + --connection default --reap insert into t1 values (null),(null); set debug_sync= 'now signal goforit'; - + --connection con2 --error WARN_DATA_TRUNCATED --reap diff --git a/sql/log_event.h b/sql/log_event.h index f4b75748bf0..a65a040a829 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -5274,7 +5274,7 @@ protected: ASSERT_OR_RETURN_ERROR(m_curr_row <= m_rows_end, HA_ERR_CORRUPT_EVENT); return ::unpack_row(rgi, m_table, m_width, m_curr_row, cols, - &m_curr_row_end, &m_master_reclength, m_rows_end); + &m_curr_row_end, &m_master_reclength, m_rows_end); } // Unpack the current row into m_table->record[0] @@ -5284,10 +5284,9 @@ protected: ASSERT_OR_RETURN_ERROR(m_curr_row <= m_rows_end, HA_ERR_CORRUPT_EVENT); return ::unpack_row(rgi, m_table, m_width, m_curr_row, &m_cols, - &m_curr_row_end, &m_master_reclength, m_rows_end); + &m_curr_row_end, &m_master_reclength, m_rows_end); } - bool process_triggers(trg_event_type event, - trg_action_time_type time_type, + bool process_triggers(trg_event_type event, trg_action_time_type time_type, bool old_row_is_record1); /** diff --git a/sql/log_event_server.cc b/sql/log_event_server.cc index fec84193510..cd915667b0d 100644 --- a/sql/log_event_server.cc +++ b/sql/log_event_server.cc @@ -8188,7 +8188,8 @@ int Rows_log_event::find_row(rpl_group_info *rgi) { DBUG_ENTER("Rows_log_event::find_row"); - DBUG_ASSERT(m_table && m_table->in_use != NULL); + DBUG_ASSERT(m_table); + DBUG_ASSERT(m_table->in_use != NULL); TABLE *table= m_table; int error= 0; @@ -8248,7 +8249,6 @@ int Rows_log_event::find_row(rpl_group_info *rgi) table->s->reclength) == 0); */ - int error; DBUG_PRINT("info",("locating record using primary key (position)")); error= table->file->ha_rnd_pos_by_record(table->record[0]); @@ -8316,10 +8316,9 @@ int Rows_log_event::find_row(rpl_group_info *rgi) table->record[0][table->s->null_bytes - 1]|= 256U - (1U << table->s->last_null_bit_pos); - if (unlikely((error= table->file->ha_index_read_map(table->record[0], - m_key, - HA_WHOLE_KEY, - HA_READ_KEY_EXACT)))) + error= table->file->ha_index_read_map(table->record[0], m_key, HA_WHOLE_KEY, + HA_READ_KEY_EXACT); + if (unlikely(error)) { DBUG_PRINT("info",("no record matching the key found in the table")); if (error == HA_ERR_KEY_NOT_FOUND) @@ -8425,9 +8424,7 @@ int Rows_log_event::find_row(rpl_group_info *rgi) /* Continue until we find the right record or have made a full loop */ do { - error= table->file->ha_rnd_next(table->record[0]); - - if (unlikely(error)) + if (unlikely((error= table->file->ha_rnd_next(table->record[0])))) DBUG_PRINT("info", ("error: %s", HA_ERR(error))); switch (error) { diff --git a/sql/rpl_record.cc b/sql/rpl_record.cc index 8f8fb7c5bb9..3ed93b07529 100644 --- a/sql/rpl_record.cc +++ b/sql/rpl_record.cc @@ -144,6 +144,34 @@ pack_row(TABLE *table, MY_BITMAP const* cols, #endif +#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) +/** + Fills @c table->record[0] with computed values of extra persistent column + which are present on slave but not on master. + + @param table Table whose record[0] buffer is prepared. + @param master_cols No of columns on master + @returns 0 on success + */ +static int fill_extra_persistent_columns(TABLE *table, int master_cols) +{ + int error= 0; + + if (!table->vfield) + return 0; + for (Field **vfield_ptr= table->vfield; *vfield_ptr; ++vfield_ptr) + { + Field *vfield= *vfield_ptr; + if (vfield->field_index >= master_cols && vfield->stored_in_db()) + { + bitmap_set_bit(table->write_set, vfield->field_index); + error= vfield->vcol_info->expr->save_in_field(vfield,0); + } + } + return error; +} + + /** Unpack a row into @c table->record[0]. @@ -188,10 +216,7 @@ pack_row(TABLE *table, MY_BITMAP const* cols, @retval HA_ERR_CORRUPT_EVENT Found error when trying to unpack fields. */ -#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) -int -unpack_row(rpl_group_info *rgi, - TABLE *table, uint const colcnt, +int unpack_row(rpl_group_info *rgi, TABLE *table, uint const colcnt, uchar const *const row_data, MY_BITMAP const *cols, uchar const **const current_row_end, ulong *const master_reclength, uchar const *const row_end) @@ -496,30 +521,4 @@ int prepare_record(TABLE *const table, const uint skip, const bool check) DBUG_RETURN(0); } -/** - Fills @c table->record[0] with computed values of extra persistent column - which are present on slave but not on master. - - @param table Table whose record[0] buffer is prepared. - @param master_cols No of columns on master - @returns 0 on success - */ -int fill_extra_persistent_columns(TABLE *table, int master_cols) -{ - int error= 0; - Field **vfield_ptr, *vfield; - - if (!table->vfield) - return 0; - for (vfield_ptr= table->vfield; *vfield_ptr; ++vfield_ptr) - { - vfield= *vfield_ptr; - if (vfield->field_index >= master_cols && vfield->stored_in_db()) - { - bitmap_set_bit(table->write_set, vfield->field_index); - error= vfield->vcol_info->expr->save_in_field(vfield,0); - } - } - return error; -} #endif // HAVE_REPLICATION diff --git a/sql/rpl_record.h b/sql/rpl_record.h index 357dc7619f9..e93cfb63193 100644 --- a/sql/rpl_record.h +++ b/sql/rpl_record.h @@ -37,7 +37,6 @@ int unpack_row(rpl_group_info *rgi, // Fill table's record[0] with default values. int prepare_record(TABLE *const table, const uint skip, const bool check); -int fill_extra_persistent_columns(TABLE *table, int master_cols); #endif #endif diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index d9670dccfab..2569c8971dc 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -3416,8 +3416,8 @@ int wsrep_ignored_error_code(Log_event* ev, int error) const THD* thd= ev->thd; DBUG_ASSERT(error); - DBUG_ASSERT(wsrep_thd_is_applying(thd) && - !wsrep_thd_is_local_toi(thd)); + DBUG_ASSERT(wsrep_thd_is_applying(thd)); + DBUG_ASSERT(!wsrep_thd_is_local_toi(thd)); if ((wsrep_ignore_apply_errors & WSREP_IGNORE_ERRORS_ON_RECONCILING_DML)) { |