Skip to content

Commit

Permalink
cleanup: whitespace, etc
Browse files Browse the repository at this point in the history
  • Loading branch information
vuvova committed Aug 15, 2023
1 parent 93049e3 commit 01b3cb2
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 58 deletions.
8 changes: 2 additions & 6 deletions mysql-test/main/alter_table_online_debug.result
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -51,16 +50,14 @@ 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);
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);
Expand All @@ -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;
Expand Down
8 changes: 2 additions & 6 deletions mysql-test/main/alter_table_online_debug.test
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
Expand All @@ -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
Expand All @@ -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
Expand Down
7 changes: 3 additions & 4 deletions sql/log_event.h
Original file line number Diff line number Diff line change
Expand Up @@ -4811,7 +4811,7 @@ class Rows_log_event : public Log_event

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]
Expand All @@ -4821,10 +4821,9 @@ class Rows_log_event : public Log_event

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);

/**
Expand Down
15 changes: 6 additions & 9 deletions sql/log_event_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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]);
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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) {

Expand Down
59 changes: 28 additions & 31 deletions sql/rpl_record.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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].
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
4 changes: 2 additions & 2 deletions sql/wsrep_mysqld.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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))
{
Expand Down

0 comments on commit 01b3cb2

Please sign in to comment.