Skip to content
/ server Public

MDEV-38899 Fix Assertion !((f->flags & 4096U) && f->vcol_info) upon RBR with NOBLOB and unique blob#4763

Open
itzanway wants to merge 1 commit intoMariaDB:12.3from
itzanway:fix-mdev-36290-assert
Open

MDEV-38899 Fix Assertion !((f->flags & 4096U) && f->vcol_info) upon RBR with NOBLOB and unique blob#4763
itzanway wants to merge 1 commit intoMariaDB:12.3from
itzanway:fix-mdev-36290-assert

Conversation

@itzanway
Copy link

@itzanway itzanway commented Mar 9, 2026

Fixes: Regression introduced by MDEV-36290.

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 (to store the blob's hash). This hidden virtual column inherits the NOT NULL property and receives the NO_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_FLAG set.

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.

@itzanway itzanway changed the title Fix Assertion !((f->flags & 4096U) && f->vcol_info) upon RBR with NOBLOB and unique blob MDEV-38899 Fix Assertion !((f->flags & 4096U) && f->vcol_info) upon RBR with NOBLOB and unique blob Mar 9, 2026
@itzanway itzanway force-pushed the fix-mdev-36290-assert branch from d2d6371 to c3f5419 Compare March 9, 2026 17:06
@gkodinov gkodinov added the External Contribution All PRs from entities outside of MariaDB Foundation, Corporation, Codership agreements. label Mar 10, 2026
Copy link
Member

@gkodinov gkodinov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@itzanway itzanway changed the base branch from main to 12.3 March 10, 2026 11:43
@itzanway itzanway force-pushed the fix-mdev-36290-assert branch from 45ada02 to 45b0f05 Compare March 10, 2026 11:49
@bnestere bnestere added the Replication Patches involved in replication label Mar 10, 2026
@itzanway itzanway force-pushed the fix-mdev-36290-assert branch from 45b0f05 to 8e5fbb3 Compare March 10, 2026 16:30
@itzanway itzanway closed this Mar 10, 2026
@itzanway itzanway force-pushed the fix-mdev-36290-assert branch from 8e5fbb3 to 620733d Compare March 10, 2026 17:09
… RBR with NOBLOB

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 (to store the
blob's hash). This hidden virtual column inherits the NOT NULL property
and receives the NO_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_FLAG set.

Removed the invalid assertion:
DBUG_ASSERT(!((f->flags & NO_DEFAULT_VALUE_FLAG) && f->vcol_info));
Added an MTR test case to prevent future regressions.
@itzanway itzanway reopened this Mar 10, 2026
@itzanway
Copy link
Author

Hi @gkodinov,

I have addressed all the review comments:

  • Restored the accidentally deleted BUILD/ directory.

  • Squashed everything into a single commit with a CODING_STANDARDS compliant message.

  • Rebased to 12.3.

  • Fixed the line endings (CRLF -> LF) and result mismatch in the new MTR test.

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

External Contribution All PRs from entities outside of MariaDB Foundation, Corporation, Codership agreements. Replication Patches involved in replication

Development

Successfully merging this pull request may close these issues.

3 participants