Skip to content

Commit 1125f59

Browse files
committed
Removed Rows_log_event::m_master_reclength as it is not used
The usage of the variable was removed in 2007 Other things (minor cleanups): - Replaced variable 'f' with 'field' to get code more readable - Removed not needed variable unpack_result - Removed DBUG_OFF in middle of the code and replaced with attribute() - Replaced 'auto' variable with real type (readability)
1 parent a32d5c3 commit 1125f59

File tree

4 files changed

+13
-32
lines changed

4 files changed

+13
-32
lines changed

sql/log_event.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4840,8 +4840,6 @@ class Rows_log_event : public Log_event
48404840
*/
48414841
MY_BITMAP m_cols_ai;
48424842

4843-
ulong m_master_reclength; /* Length of record on master side */
4844-
48454843
/* Bit buffers in the same memory as the class */
48464844
my_bitmap_map m_bitbuf[128/(sizeof(my_bitmap_map)*8)];
48474845
my_bitmap_map m_bitbuf_ai[128/(sizeof(my_bitmap_map)*8)];
@@ -4935,7 +4933,7 @@ class Rows_log_event : public Log_event
49354933

49364934
ASSERT_OR_RETURN_ERROR(m_curr_row <= m_rows_end, HA_ERR_CORRUPT_EVENT);
49374935
return ::unpack_row(rgi, m_table, m_width, m_curr_row, cols,
4938-
&m_curr_row_end, &m_master_reclength, m_rows_end);
4936+
&m_curr_row_end, m_rows_end);
49394937
}
49404938

49414939
// Unpack the current row into m_table->record[0]
@@ -4945,7 +4943,7 @@ class Rows_log_event : public Log_event
49454943

49464944
ASSERT_OR_RETURN_ERROR(m_curr_row <= m_rows_end, HA_ERR_CORRUPT_EVENT);
49474945
return ::unpack_row(rgi, m_table, m_width, m_curr_row, &m_cols,
4948-
&m_curr_row_end, &m_master_reclength, m_rows_end);
4946+
&m_curr_row_end, m_rows_end);
49494947
}
49504948
bool process_triggers(trg_event_type event, trg_action_time_type time_type,
49514949
bool old_row_is_record1, bool *skip_row_indicator);

sql/log_event_server.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7450,7 +7450,7 @@ int Rows_log_event::find_key(const rpl_group_info *rgi)
74507450
const uchar *curr_row_end= m_curr_row_end;
74517451
Check_level_instant_set clis(m_table->in_use, CHECK_FIELD_IGNORE);
74527452
if (int err= unpack_row(rgi, m_table, m_width, m_curr_row, &m_cols,
7453-
&curr_row_end, &m_master_reclength, m_rows_end))
7453+
&curr_row_end, m_rows_end))
74547454
DBUG_RETURN(err);
74557455
}
74567456

sql/rpl_record.cc

Lines changed: 9 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -322,9 +322,6 @@ static void convert_field(Field *f, Field *result_field, Field *conv_field)
322322
@param curr_row_end
323323
Pointer to variable that will hold the value of the
324324
one-after-end position for the current row
325-
@param master_reclength
326-
Pointer to variable that will be set to the length of the
327-
record on the master side
328325
@param row_end
329326
Pointer to variable that will hold the value of the
330327
end position for the data in the row event
@@ -340,7 +337,7 @@ static void convert_field(Field *f, Field *result_field, Field *conv_field)
340337
int unpack_row(const rpl_group_info *rgi, TABLE *table, uint const colcnt,
341338
uchar const *const row_data, MY_BITMAP const *cols,
342339
uchar const **const current_row_end,
343-
ulong *const master_reclength, uchar const *const row_end)
340+
uchar const *const row_end)
344341
{
345342
int error;
346343
DBUG_ENTER("unpack_row");
@@ -357,7 +354,6 @@ int unpack_row(const rpl_group_info *rgi, TABLE *table, uint const colcnt,
357354
nothing to unpack.
358355
*/
359356
*current_row_end= st.pack_ptr;
360-
*master_reclength= 0;
361357
DBUG_RETURN(0);
362358
}
363359

@@ -380,12 +376,12 @@ int unpack_row(const rpl_group_info *rgi, TABLE *table, uint const colcnt,
380376
pointer is NULL, no conversions are necessary.
381377
*/
382378
Field *conv_field= conv_table ? conv_table->field[i] : NULL;
383-
Field *const f= conv_field ? conv_field : result_field;
379+
Field *const field= conv_field ? conv_field : result_field;
380+
DBUG_ASSERT(field != NULL);
384381

385382
DBUG_PRINT("debug", ("Conversion %srequired for field '%s' (#%u)",
386383
conv_field ? "" : "not ",
387384
result_field->field_name.str, i));
388-
DBUG_ASSERT(f != NULL);
389385

390386
/*
391387
No need to bother about columns that does not exist: they have
@@ -396,13 +392,12 @@ int unpack_row(const rpl_group_info *rgi, TABLE *table, uint const colcnt,
396392

397393
result_field->set_has_explicit_value();
398394

399-
bool unpack_result= unpack_field(tabledef, f, &st, i);
400-
if (!unpack_result)
395+
if (!unpack_field(tabledef, field, &st, i))
401396
{
402397
rgi->rli->report(ERROR_LEVEL, ER_SLAVE_CORRUPT_EVENT,
403398
rgi->gtid_info(),
404399
"Could not read field '%s' of table '%s.%s'",
405-
f->field_name.str, table->s->db.str,
400+
field->field_name.str, table->s->db.str,
406401
table->s->table_name.str);
407402
DBUG_RETURN(HA_ERR_CORRUPT_EVENT);
408403
}
@@ -417,7 +412,7 @@ int unpack_row(const rpl_group_info *rgi, TABLE *table, uint const colcnt,
417412
and will use copy_fields set up in copy_data_between_tables
418413
*/
419414
if (conv_field)
420-
convert_field(f, result_field, conv_field);
415+
convert_field(field, result_field, conv_field);
421416
}
422417

423418
/*
@@ -440,14 +435,6 @@ int unpack_row(const rpl_group_info *rgi, TABLE *table, uint const colcnt,
440435
st.null_mask <<= 1;
441436
}
442437
}
443-
444-
if (master_reclength)
445-
{
446-
if (result_field)
447-
*master_reclength = (ulong)(result_field->ptr - table->record[0]);
448-
else
449-
*master_reclength = table->s->reclength;
450-
}
451438
}
452439
else
453440
{
@@ -461,21 +448,17 @@ int unpack_row(const rpl_group_info *rgi, TABLE *table, uint const colcnt,
461448
{
462449
DBUG_ASSERT(bitmap_is_set(cols, i));
463450
Field *f= conv_table->field[i];
464-
#ifndef DBUG_OFF
465-
bool result=
466-
#endif
467-
unpack_field(tabledef, f, &st, i);
451+
bool result __attribute__((unused));
452+
result= unpack_field(tabledef, f, &st, i);
468453
DBUG_ASSERT(result);
469454
}
470455

471-
for (const auto *copy=rpl_data.copy_fields;
456+
for (const Copy_field *copy= rpl_data.copy_fields;
472457
copy != rpl_data.copy_fields_end; copy++)
473458
{
474459
copy->to_field->set_has_explicit_value();
475460
copy->do_copy(copy);
476461
}
477-
if (master_reclength)
478-
*master_reclength = conv_table->s->reclength;
479462
} // if (rpl_data.is_online_alter())
480463

481464
/*

sql/rpl_record.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ size_t pack_row(TABLE* table, MY_BITMAP const* cols,
3232
int unpack_row(const rpl_group_info *rgi,
3333
TABLE *table, uint const colcnt,
3434
uchar const *const row_data, MY_BITMAP const *cols,
35-
uchar const **const curr_row_end, ulong *const master_reclength,
35+
uchar const **const curr_row_end,
3636
uchar const *const row_end);
3737

3838
// Fill table's record[0] with default values.

0 commit comments

Comments
 (0)