Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
MDEV-15243 Crash with virtual fields and row based binary logging
The cause of this was several different bugs: - When using binary logging with binlog_row_image=FULL the all bits in read_set was set, which caused a different (wrong) pattern for marking vcol_set. - TABLE::mark_virtual_columns_for_write() didn't in all cases mark vcol_set with the vcol_field. - TABLE::update_virtual_fields() has to update all vcol fields on REPLACE if binary logging with FULL is used. - VCOL_UPDATE_INDEXED should update all vcol fields part of an index that was not updated by VCOL_UPDATE_FOR_READ - max_row_length() calculated length of NULL and not used fields. This didn't cause any crash, but used more memory than needed.
- Loading branch information
Showing
8 changed files
with
569 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| include/master-slave.inc | ||
| [connection master] | ||
| CREATE TABLE t1 ( | ||
| pk SERIAL, | ||
| vcol_date DATE AS (col_date) PERSISTENT, | ||
| vcol_int INT AS (col_int) VIRTUAL, | ||
| vcol_year YEAR AS (col_year) PERSISTENT, | ||
| vcol_blob BLOB AS (col_blob) VIRTUAL, | ||
| col_date DATE, | ||
| col_int INT NULL, | ||
| col_blob BLOB NULL, | ||
| col_year YEAR, | ||
| PRIMARY KEY(pk) | ||
| ) ENGINE=InnoDB; | ||
| INSERT INTO t1 (col_date,col_int,col_blob,col_year) VALUES ('2010-04-24',5,'foo',1981); | ||
| SET SQL_MODE=''; | ||
| set binlog_row_image="FULL"; | ||
| CREATE VIEW v1 AS SELECT * FROM t1; | ||
| REPLACE INTO v1 SELECT pk, vcol_date, vcol_int, vcol_year, vcol_blob, col_date, col_int, col_blob, 1982 FROM t1; | ||
| Warnings: | ||
| Warning 1906 The value specified for generated column 'vcol_date' in table 't1' ignored | ||
| Warning 1906 The value specified for generated column 'vcol_int' in table 't1' ignored | ||
| Warning 1906 The value specified for generated column 'vcol_year' in table 't1' ignored | ||
| Warning 1906 The value specified for generated column 'vcol_blob' in table 't1' ignored | ||
| select col_date,col_int,col_blob,col_year from v1; | ||
| col_date col_int col_blob col_year | ||
| 2010-04-24 5 foo 1982 | ||
| connection slave; | ||
| select col_date,col_int,col_blob,col_year from v1; | ||
| col_date col_int col_blob col_year | ||
| 2010-04-24 5 foo 1982 | ||
| connection master; | ||
| DROP VIEW v1; | ||
| set binlog_row_image="MINIMAL"; | ||
| CREATE VIEW v1 AS SELECT * FROM t1; | ||
| REPLACE INTO v1 SELECT pk, vcol_date, vcol_int, vcol_year, vcol_blob, col_date, col_int, col_blob, 1983 FROM t1; | ||
| Warnings: | ||
| Warning 1906 The value specified for generated column 'vcol_date' in table 't1' ignored | ||
| Warning 1906 The value specified for generated column 'vcol_int' in table 't1' ignored | ||
| Warning 1906 The value specified for generated column 'vcol_year' in table 't1' ignored | ||
| Warning 1906 The value specified for generated column 'vcol_blob' in table 't1' ignored | ||
| select col_date,col_int,col_blob,col_year from v1; | ||
| col_date col_int col_blob col_year | ||
| 2010-04-24 5 foo 1983 | ||
| connection slave; | ||
| select col_date,col_int,col_blob,col_year from v1; | ||
| col_date col_int col_blob col_year | ||
| 2010-04-24 5 foo 1983 | ||
| connection master; | ||
| DROP VIEW v1; | ||
| set @@binlog_row_image="NOBLOB"; | ||
| CREATE VIEW v1 AS SELECT * FROM t1; | ||
| REPLACE INTO v1 SELECT pk, vcol_date, vcol_int, vcol_year, vcol_blob, col_date, col_int, col_blob, 1984 FROM t1; | ||
| Warnings: | ||
| Warning 1906 The value specified for generated column 'vcol_date' in table 't1' ignored | ||
| Warning 1906 The value specified for generated column 'vcol_int' in table 't1' ignored | ||
| Warning 1906 The value specified for generated column 'vcol_year' in table 't1' ignored | ||
| Warning 1906 The value specified for generated column 'vcol_blob' in table 't1' ignored | ||
| select col_date,col_int,col_blob,col_year from v1; | ||
| col_date col_int col_blob col_year | ||
| 2010-04-24 5 foo 1984 | ||
| connection slave; | ||
| select col_date,col_int,col_blob,col_year from v1; | ||
| col_date col_int col_blob col_year | ||
| 2010-04-24 5 foo 1984 | ||
| connection master; | ||
| DROP VIEW v1; | ||
| set @@binlog_row_image=default; | ||
| DROP TABLE t1; | ||
| include/rpl_end.inc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.