mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
MDEV-11636 Extra persistent columns on slave always gets NULL in RBR
Problem:- In replication if slave has extra persistent column then these column are not computed while applying write-set from master. Solution:- While applying row events from server, we will generate values for extra persistent columns.
This commit is contained in:
@ -416,6 +416,13 @@ unpack_row(rpl_group_info *rgi,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Add Extra slave persistent columns
|
||||
*/
|
||||
int error= 0;
|
||||
if ((error= fill_extra_persistent_columns(table, cols->n_bits)))
|
||||
DBUG_RETURN(error);
|
||||
|
||||
/*
|
||||
We should now have read all the null bytes, otherwise something is
|
||||
really wrong.
|
||||
@ -489,5 +496,30 @@ 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())
|
||||
{
|
||||
/*Set bitmap for writing*/
|
||||
bitmap_set_bit(table->vcol_set, vfield->field_index);
|
||||
error= vfield->vcol_info->expr->save_in_field(vfield,0);
|
||||
bitmap_clear_bit(table->vcol_set, vfield->field_index);
|
||||
}
|
||||
}
|
||||
return error;
|
||||
}
|
||||
#endif // HAVE_REPLICATION
|
||||
|
Reference in New Issue
Block a user