[MDEV-29386] Index 'col_text_g' contains 4 entries, should be 2 Created: 2022-08-25  Updated: 2023-08-23

Status: Open
Project: MariaDB Server
Component/s: Storage Engine - InnoDB, Virtual Columns
Affects Version/s: 10.6.10
Fix Version/s: 10.6

Type: Bug Priority: Major
Reporter: Matthias Leich Assignee: Nikita Malyavin
Resolution: Unresolved Votes: 1
Labels: affects-tests, rr-profile

Attachments: File TBR-36.yy    
Issue Links:
Relates

 Description   

origin/10.6 8ff10969996a5349e906fab44b45c6e3ec53eea0 2022-08-24T17:06:57+03:00
 
I have two concurrent sessions.
thread1:
    CREATE TABLE IF NOT EXISTS t3 ( col1 INT, col_text TEXT , col_text_g TEXT GENERATED ALWAYS AS (SUBSTR(col_text,1,499)) ) ENGINE = InnoDB ROW_FORMAT = Compact |
    ALTER TABLE t3 ADD KEY ( col_text_g(9) , col_text(9) ) ;
thread2:
    CHECK TABLE t3 |
    DELETE FROM t3 WHERE col1 = 8 OR col1 IS NULL ; INSERT INTO t3 (col1, col_text) VALUES (8,''), (8,'') ;
 
After some runtime
CHECK TABLE t3 harvests
   Warning InnoDB: Index 'col_text_g' contains 4 entries, should be 2.
and RQG reacts with killing the server.
 
pluto:/data/results/1661424131/TBR-36$ _RR_TRACE_DIR=./1/rr/ rr replay
 
RQG
====
# git clone https://github.com/mleich1/rqg --branch experimental RQG
#
# GIT_SHOW: HEAD -> experimental, origin/experimental 32e1b1a96b072f6a71c564d3e2d50d9cf2fb3561 2022-08-24T17:04:19+02:00
# rqg.pl  : Version 4.0.6 (2022-05)
#
# $RQG_HOME/rqg.pl \
# --duration=300 \
# --queries=10000000 \
# --no_mask \
# --seed=random \
# --rpl_mode=none \
# --gendata_sql=conf/mariadb/table_stress.sql \
# --max_gd_duration=1200 \
# --gendata=conf/mariadb/table_stress.zz \
# --engine=InnoDB \
# --mysqld=--loose-idle_write_transaction_timeout=0 \
# --mysqld=--wait_timeout=28800 \
# --mysqld=--loose-idle_transaction_timeout=0 \
# --mysqld=--log-output=none \
# --mysqld=--interactive_timeout=28800 \
# --mysqld=--sync-binlog=1 \
# --mysqld=--lock-wait-timeout=86400 \
# --mysqld=--loose-innodb_fatal_semaphore_wait_threshold=300 \
# --mysqld=--net_read_timeout=30 \
# --mysqld=--connect_timeout=60 \
# --mysqld=--plugin-load-add=file_key_management.so \
# --mysqld=--loose-table_lock_wait_timeout=50 \
# --mysqld=--innodb-buffer-pool-size=5M \
# --mysqld=--net_write_timeout=60 \
# --mysqld=--innodb-lock-wait-timeout=50 \
# --mysqld=--loose_innodb_lock_schedule_algorithm=fcfs \
# --mysqld=--log_bin_trust_function_creators=1 \
# --mysqld=--loose-max-statement-time=30 \
# --mysqld=--log-bin \
# --mysqld=--loose-plugin-load-add=provider_lz4.so \
# --mysqld=--file-key-management-filename=$RQG_HOME/conf/mariadb/encryption_keys.txt \
# --mysqld=--innodb_page_size=4K \
# --mysqld=--loose-idle_readonly_transaction_timeout=0 \
# --mysqld=--loose-innodb_read_only_compressed=OFF \
# --mysqld=--loose-debug_assert_on_not_freed_memory=0 \
# --mysqld=--slave_net_timeout=60 \
# --reporters=Backtrace,Deadlock1,ErrorLog \
# --validators=None \
# --grammar=TBR-36.yy \
# --threads=2 \
# --batch \
# --script_debug=_nix_ \
# --rr=Extended \
# --rr_options=--chaos --wait  \
# <local settings>
 
The already simplified tests replays also frequent the error patterns
-  [ 'TBR-915-MDEV-25004', 'mysqld: .{1,200}row0upd.cc:.{1,20} dberr_t row_upd_sec_index_entry\(upd_node_t\*, que_thr_t\*\): Assertion .0. failed' ],   
    but in the current case system versioning is not involved.
- [ 'TBR-915A', '\[ERROR\] InnoDB: Record in index .{1,70} of table .{1,150} was not found on update: TUPLE .+mysqld: .{1,200}row0upd.cc:.{1,20} dberr_t row_upd_sec_index_entry\(upd_node_t\*, que_thr_t\*\): Assertion .0. failed' ],
- [ 'TBR-835', '\[ERROR\] InnoDB: Record in index `(?!FTS_DOC_ID_INDEX).{0,200}` of table .{1,100} was not found on update: ' ],
I am aware that the patterns are to some extend redundant.



 Comments   
Comment by Marko Mäkelä [ 2022-08-25 ]

In the trace, the indexes of the table contain the a number of the following type of entries at the time when dict_set_corrupted() was invoked:
GEN_CLUST_INDEX: (RB_ROW_ID,DB_TRX_ID,DB_ROLL_PTR,col1,col_text)=
delete-marked(0x200,0x25,(update),8,''),
delete-marked(0x201,0x25,(update),8,''),
delete-marked(0x202,0x2d,(update),8,''),
…,
(0x207,0x36,(insert),8,'')

col_text_g: (col_text_g(9),col_text(9),DB_ROW_ID)=
(not delete-marked!)('','',0x202),
(not delete-marked!)('','',0x203),

('','',0x207)

If this is repeatable while defining PRIMARY KEY(col1), I would suggest to define that, so that it would be easier to debug this. Even as it is now, it is not impossible to debug this; each index consists of a single page and there are only 8 records in total.

Generated at Thu Feb 08 10:08:09 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.