MDEV-38899 Fix Assertion !((f->flags & 4096U) && f->vcol_info) upon RBR with NOBLOB and unique blob#4763
MDEV-38899 Fix Assertion !((f->flags & 4096U) && f->vcol_info) upon RBR with NOBLOB and unique blob#4763itzanway wants to merge 1 commit intoMariaDB:12.3from
!((f->flags & 4096U) && f->vcol_info) upon RBR with NOBLOB and unique blob#4763Conversation
!((f->flags & 4096U) && f->vcol_info) upon RBR with NOBLOB and unique blob!((f->flags & 4096U) && f->vcol_info) upon RBR with NOBLOB and unique blob
d2d6371 to
c3f5419
Compare
gkodinov
left a comment
There was a problem hiding this comment.
Thank you for your contribution! Before I do an actual review please:
- fix the buildbot failures
- squash into a single commit
- add a good commit message to it compliant with CODING_STANDARDS.md
- Make sure there's no extra changes into the PR (there's now removal of the BUILD dir for some reason)
- rebase to 12.3 (as the first affected version): this is a bugfix.
45ada02 to
45b0f05
Compare
45b0f05 to
8e5fbb3
Compare
8e5fbb3 to
620733d
Compare
|
Hi @gkodinov, I have addressed all the review comments:
My replication tests are now passing! The only remaining failure on the buildbot is main.opt_hints, which appears to be an unrelated flaky test. Could you please re-trigger the buildbot or take another look? Thank you! |
grooverdan
left a comment
There was a problem hiding this comment.
There's no code change here. Make 100% sure there is no space only changed lines.
There's no .test file here.
When you rebase, there shouldn't be a need for a merge commit.
You have a decent commit message. Could additionally include (from MDEV) the commit/MDEV when this error was introduced in this commit message.
| @@ -0,0 +1,20 @@ | |||
| include/master-slave.inc | |||
There was a problem hiding this comment.
should be part of another RBR replication test.
There was a problem hiding this comment.
Rebased & Squashed: Squashed into a single clean commit on the 12.3 branch (no merge commits).
Code & Test Verified: Verified the fix in sql/rpl_record.cc and appended the MTR test/result cases to the existing rpl_row_img_eng_noblob files.
Commit Message: Updated to include the regression source (MDEV-36290) and a detailed description.
Ready for final review!
6740685 to
720255c
Compare
gkodinov
left a comment
There was a problem hiding this comment.
Thank you for your work so far.
One thing to note: when updating or rebasing a branch from the github UI, please always use "rebase" instead of "merge". Merge creates an extra commit. And you now again have 2 commits.
Also be careful about editors and how they change files on save.
Also, there are some tests failing because of these space only changes.
FWIW, I will not insist on fixing the assert() as suggested. Feel free to explore this or leave it for the final review.
| DROP TABLE t1; | ||
|
|
||
| --source include/rpl_end.inc | ||
| --source include/rpl_end.inc No newline at end of file |
There was a problem hiding this comment.
This is why your test fails in buildbot: mtr has a long standing bug that if you have a mtr command (as you do here) on the last line without a line terminator to follow it, mtr will consider it "trash", won't execute it and will instead fail the test with an error.
| --let $rpl_topology= 1->2->3 | ||
| --source include/rpl_init.inc | ||
| -- source include/have_binlog_format_row.inc | ||
| --source include/have_binlog_format_row.inc |
There was a problem hiding this comment.
don't do space only changes of existing code please.
| DBUG_RETURN(0); | ||
| } | ||
| #endif // HAVE_REPLICATION | ||
| #endif // HAVE_REPLICATION No newline at end of file |
There was a problem hiding this comment.
Please set your editor not to strip the tailing new line in files! And also please revert this space only change.
| continue; | ||
|
|
||
| Field *const f= *field_ptr; | ||
| DBUG_ASSERT(!((f->flags & NO_DEFAULT_VALUE_FLAG) && f->vcol_info)); // QQ |
There was a problem hiding this comment.
I'm guessing this is a left-over from times when there was no has_no_default_value() helper function.
I would model this check to be as close as possible to the check in check_that_all_fields_are_given_values(). I'd even consider addopting check_that_all_fields_are_given_values() itself.
There was a problem hiding this comment.
has_no_default_value() has the expression including system version interval rows:
if ((field->flags & (NO_DEFAULT_VALUE_FLAG | VERS_ROW_START | VERS_ROW_END))
== NO_DEFAULT_VALUE_FLAG && field->real_type() != MYSQL_TYPE_ENUM)
And no !(*field)->vcol_info (added with be237b3), however given the other use of has_no_default_value it could be moved there.
Yes looks scarily close.
17f3df6 to
d412b16
Compare
|
Hi @gkodinov, Thanks for the review! I’ve updated the PR to address your feedback: Fixed editor settings to include trailing newlines and avoid space-only changes. Reverted accidental changes to the .result and .test files. I've kept the DBUG_ASSERT as-is for now per your note. Ready for another look!" |
like the test file. look at the failures on https://buildbot.mariadb.org/#/grid?branch=refs%2Fpull%2F4763%2Fhead
But the first 1/2 of mysql-test/suite/rpl/t/rpl_row_img_eng_noblob.test is whitespace changes.
Except for mysql-test/suite/rpl/r/rpl_noblob_unique_blob.result which is still here.
That's not what the comment said. |
gkodinov
left a comment
There was a problem hiding this comment.
Please squash your commits into a single one.
And fix the test failure as I've requested in my previous comment: mtr has an issue that if an "--command" is on the list line of a test it's considered junk and not executed.
Please have an empty line after it.
548760f to
7c54d89
Compare
149bb16 to
d3cc590
Compare
610be89 to
4a46cdc
Compare
…que BLOB column Problem: When using Row-Based Replication (RBR) with binlog_row_image=NOBLOB, operations on a table with a UNIQUE constraint on a BLOB NOT NULL column cause a debug assertion failure in prepare_record() on the replica. A UNIQUE index on a BLOB creates a hidden virtual column (storing the blob's hash). This hidden virtual column inherits NOT NULL and receives NO_DEFAULT_VALUE_FLAG (4096U). During replication, if the blob is absent from the row image, prepare_record() evaluates missing columns and hits the overly strict assertion. Fix: Virtual columns evaluate their own expressions and do not use the default value mechanism. It is valid for them (especially auto-generated hidden ones) to have NO_DEFAULT_VALUE_FLAG set. Remove the invalid assertion and add an MTR test case appended to the existing rpl_row_img_eng_noblob test to prevent future regressions. Regression introduced by: MDEV-36290 Fix formatting and newlines Restore original result file Pull in rpl_row_img_eng_noblob.test from upstream/12.3 Add test case and results for MDEV-38899
4a46cdc to
53996c1
Compare
grooverdan
left a comment
There was a problem hiding this comment.
Test case needs work. removal of assertion was ok.
|
|
||
|
|
||
| --source include/rpl_end.inc | ||
| --echo # |
There was a problem hiding this comment.
I'm confused why the original part of this test is removed.
I didn't follow "Pull in rpl_row_img_eng_noblob.test from upstream/12.3" from commit message, because as this is based on 12.3, the should only be the addition of the test for this MDEV.
Per the GH status failure, they pertain to this test. Replication test aren't supported in embedded mode requring --source include/not_embedded.inc in the prefix. Its assumed that part of the original test had this already.
|
|
||
| INSERT INTO t1 VALUES (1, 'hello'); | ||
| INSERT INTO t1 VALUES (2, 'world'); | ||
| --source include/rpl_sync.inc |
There was a problem hiding this comment.
per the comments in in the top of this file, this requires rpl_int.inc`.
| --echo # MDEV-38899: Assert !((f->flags & NO_DEFAULT_VALUE_FLAG) && f->vcol_info) | ||
| --echo # in prepare_record() with binlog_row_image=NOBLOB and UNIQUE BLOB column | ||
| --echo # | ||
| --connection server_1 |
There was a problem hiding this comment.
binlog_row_image=NOBLOB isn't set by this test.
| --source include/rpl_sync.inc | ||
|
|
||
| --connection server_1 | ||
| SELECT id, CONVERT(b USING utf8) AS b FROM t1 ORDER BY id; |
There was a problem hiding this comment.
Its not clear why you think the result is changing. If you really want to check, perhaps testing on the replica connection.
| SELECT id, CONVERT(b USING utf8) AS b FROM t1 ORDER BY id; | ||
|
|
||
| --connection server_1 | ||
| UPDATE t1 SET id = 10 WHERE id = 1; |
There was a problem hiding this comment.
as this isn't changing the unique blobs, what is the exercising?
| SELECT id, CONVERT(b USING utf8) AS b FROM t1 ORDER BY id; | ||
|
|
||
| --connection server_1 | ||
| DROP TABLE t1; |
There was a problem hiding this comment.
The original test included include/rpl_row_img.test. This might be a good place to add a BLOB with index. Per the MDEV the only real test required is to insert and ensure it replicates.
| continue; | ||
|
|
||
| Field *const f= *field_ptr; | ||
| DBUG_ASSERT(!((f->flags & NO_DEFAULT_VALUE_FLAG) && f->vcol_info)); // QQ |
There was a problem hiding this comment.
has_no_default_value() has the expression including system version interval rows:
if ((field->flags & (NO_DEFAULT_VALUE_FLAG | VERS_ROW_START | VERS_ROW_END))
== NO_DEFAULT_VALUE_FLAG && field->real_type() != MYSQL_TYPE_ENUM)
And no !(*field)->vcol_info (added with be237b3), however given the other use of has_no_default_value it could be moved there.
Yes looks scarily close.
Fixes: Regression introduced by MDEV-36290.
Problem
When using Row-Based Replication (RBR) with
binlog_row_image = NOBLOB, operations on a table with aUNIQUEconstraint on aBLOB NOT NULLcolumn cause a debug assertion failure inprepare_record()on the replica.A
UNIQUEindex on aBLOBcreates a hidden virtual column (to store the blob's hash). This hidden virtual column inherits theNOT NULLproperty and receives theNO_DEFAULT_VALUE_FLAG(4096U). During replication, if the blob isn't included in the row image,prepare_record()evaluates missing columns and hits the overly strict assertion.Solution
Virtual columns evaluate their own expressions and do not use the default value mechanism. It is completely valid for them (especially automatically generated hidden ones) to have
NO_DEFAULT_VALUE_FLAGset.This PR removes the invalid assertion:
DBUG_ASSERT(!((f->flags & NO_DEFAULT_VALUE_FLAG) && f->vcol_info));and includes an MTR test case to prevent future regressions.