From 01b3cb2f462056c14bac2ba749d8ec16fccaf4c3 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 30 Jun 2022 17:07:56 +0200 Subject: [PATCH] cleanup: whitespace, etc --- .../main/alter_table_online_debug.result | 8 +-- mysql-test/main/alter_table_online_debug.test | 8 +-- sql/log_event.h | 7 +-- sql/log_event_server.cc | 15 ++--- sql/rpl_record.cc | 59 +++++++++---------- sql/wsrep_mysqld.cc | 4 +- 6 files changed, 43 insertions(+), 58 deletions(-) diff --git a/mysql-test/main/alter_table_online_debug.result b/mysql-test/main/alter_table_online_debug.result index 274b16547d3..0ed95ff7570 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 62657cb240a..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 diff --git a/sql/log_event.h b/sql/log_event.h index 132c7469038..dc02f26ad33 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -4811,7 +4811,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] @@ -4821,10 +4821,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 0362d0cbe1f..e34001e3432 100644 --- a/sql/log_event_server.cc +++ b/sql/log_event_server.cc @@ -7270,7 +7270,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; @@ -7327,7 +7328,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]); @@ -7389,10 +7389,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) @@ -7498,9 +7497,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 cb76c66797f..a70ca5c6eec 100644 --- a/sql/rpl_record.cc +++ b/sql/rpl_record.cc @@ -144,7 +144,33 @@ pack_row(TABLE *table, MY_BITMAP const* cols, #endif #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) -static int fill_extra_persistent_columns(TABLE *table, int master_cols); +/** + 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() || + (vfield->flags & (PART_KEY_FLAG | PART_INDIRECT_KEY_FLAG)))) + { + 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]. @@ -190,9 +216,7 @@ static int fill_extra_persistent_columns(TABLE *table, int master_cols); @retval HA_ERR_CORRUPT_EVENT Found error when trying to unpack fields. */ -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) @@ -497,31 +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 - */ -static 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() || - (vfield->flags & (PART_KEY_FLAG | PART_INDIRECT_KEY_FLAG)))) - { - 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/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index 71609e651a7..50bd85e141b 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -3463,8 +3463,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)) {