Bug #108940 Duplicate update column assertion error
Submitted: 31 Oct 2022 16:03 Modified: 4 Nov 2022 10:08
Reporter: Pedro Ferreira Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: DML Severity:S6 (Debug Builds)
Version:8.0.31 OS:Ubuntu (22.04)
Assigned to: CPU Architecture:x86 (x86_x64)
Tags: UPDATE

[31 Oct 2022 16:03] Pedro Ferreira
Description:
On a clean database run the following statements:

CREATE TABLE t0 (c1 INT, c0 INT);
SET SESSION BINLOG_FORMAT = MIXED;
CREATE TABLE t2 (c2 INT, c0 INT);
INSERT INTO t2 (c0) (SELECT 5);
DELETE FROM t0;
INSERT INTO t0 (c2) (SELECT 5);
UPDATE t2 SET c0 = 1, c2 = 2;
UPDATE t2 SET c0 = DEFAULT, c0 = 1 ORDER BY c2;

Most of the time triggers an assertion error in field.cc:3761

SSERT_COLUMN_MARKED_FOR_READ;

The second update sets the column "c0" twice, which I expect to be wrong?

My current MySQL compilation parameters are the same as issue 108148:

-DWITH_DEBUG=1 -DWITH_ASAN=ON -DWITH_UBSAN=ON and boost library version 1.77

This is the database creation command:
mysqld --log-error-verbosity=3 --initialize-insecure --user=mysql --basedir=<path to basedir> --datadir=<path to datadir> --default-authentication-plugin=mysql_native_password

This is the command to run the database:
mysqld --no-defaults --port=3306 --mysqlx-port=3307 --slave-parallel-type=LOGICAL_CLOCK --slave-parallel-workers=4 --slave-preserve-commit-order=ON --enforce-gtid-consistency --gtid-mode=ON --binlog-format=ROW --server-id=1 --log-error=logerror.err --log-error-verbosity=2 --basedir=<path to basedir> --datadir=<path to datadir> --plugin-dir=<path to plugindir> --pid-file=mysqld.pid --core-file --default-authentication-plugin=mysql_native_password

How to repeat:
Run the statements above.
[1 Nov 2022 11:00] Pedro Ferreira
The assertion is:

ASSERT_COLUMN_MARKED_FOR_READ;

Sorry for the typo.
[2 Nov 2022 12:33] MySQL Verification Team
Hello Pedro Ferreira,

Thank you for the report and feedback. 
I quickly tried to reproduce the issue at my end but not seeing any issues. Am I missing anything here? Please let me know.

-
-- build 8.0.31 build

scl enable devtoolset-10 bash
MYSQL_VERSION="8031_ASAN"
TARGET=/export/home/tmp/ushastry/src/$MYSQL_VERSION
rm -rf /export/home/tmp/ushastry/src/$MYSQL_VERSION
rm -rf bld/
mkdir bld && cd bld
rm -rf CMakeCache.txt
/home/umshastr/work/binaries/utils/cmake-3.19/bin/cmake ..                    \
-DBUILD_CONFIG=mysql_release             \
-DCMAKE_INSTALL_PREFIX=$TARGET           \
-DWITH_BOOST=../boost                    \
-DCOMPILATION_COMMENT=`date +"%m-%d-%Y"` \
-DWITH_DEBUG=1                           \
-DWITH_ASAN=ON -DWITH_ASAN_SCOPE=ON      \
-DWITH_UBSAN=ON -DWITH_MYSQLX=OFF                        \
-DWITH_ROUTER=OFF -DCMAKE_C_COMPILER=/opt/rh/devtoolset-10/root/usr/bin/gcc -DCMAKE_CXX_COMPILER=/opt/rh/devtoolset-10/root/usr/bin/g++                       
make -j 16
make install

-
 ./mtr bug108940
Logging: ./mtr  bug108940
MySQL Version 8.0.31
Checking supported features
 - Binaries are debug compiled
Using 'all' suites
Collecting tests
Checking leftover processes
Removing old var directory
Creating var directory '/export/home/tmp/ushastry/src/8031_ASAN/mysql-test/var'
Installing system database
Using parallel: 1

==============================================================================
                  TEST NAME                       RESULT  TIME (ms) COMMENT
------------------------------------------------------------------------------
[ 50%] main.bug108940                            [ fail ]
        Test ended at 2022-11-02 13:18:14

CURRENT_TEST: main.bug108940
mysqltest: At line 6: Query 'INSERT INTO t0 (c2) (SELECT 5)' failed.
ERROR 1054 (42S22): Unknown column 'c2' in 'field list'
safe_process[26696]: Child process: 26697, exit: 1

Mysqltest client output from logfile
----------- MYSQLTEST OUTPUT START -----------

CREATE TABLE t0 (c1 INT, c0 INT);
SET SESSION BINLOG_FORMAT = MIXED;
CREATE TABLE t2 (c2 INT, c0 INT);
INSERT INTO t2 (c0) (SELECT 5);
DELETE FROM t0;
INSERT INTO t0 (c2) (SELECT 5);

------------ MYSQLTEST OUTPUT END -----------

 - the logfile can be found in '/export/home/tmp/ushastry/src/8031_ASAN/mysql-test/var/log/main.bug108940/bug108940.log'

[100%] shutdown_report                           [ pass ]
------------------------------------------------------------------------------

regards,
Umesh
[3 Nov 2022 9:35] Pedro Ferreira
I trigger this assertion on my machine very often. Make sure the debug build is on. Maybe a faster machine will trigger it with ease?
[3 Nov 2022 10:11] MySQL Verification Team
Thank you for the details.
Let me try on some other boxes and get back to you.

Sincerely,
Umesh
[4 Nov 2022 10:08] MySQL Verification Team
Hello Pedro Ferreira,

Thank you for the report and feedback.
Observed that 8.0.31 debug build is affected.

regards,
Umesh