[MDEV-32685] Decoding ttl error, assertion failure in myrocks::ha_rocksdb::should_hide_ttl_rec Created: 2023-11-05  Updated: 2023-11-26

Status: Open
Project: MariaDB Server
Component/s: Storage Engine - RocksDB
Affects Version/s: 10.4, 10.5, 10.6, 10.10, 10.11, 11.0, 11.1, 11.2
Fix Version/s: 10.4, 10.5, 10.6, 10.11, 11.0, 11.1, 11.2

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Sergei Petrunia
Resolution: Unresolved Votes: 0
Labels: None


 Description   

INSTALL SONAME 'ha_rocksdb';
 
CREATE TABLE t (id INT, a INT, b INT, PRIMARY KEY(id), KEY(a), KEY(b)) ENGINE=RocksDB COMMENT='ttl_duration=300';
START TRANSACTION;
INSERT INTO t VALUES (1,1,1),(2,2,2);
DELETE FROM t ORDER BY a LIMIT 10;

10.4 64f44b22d9a3dab3d4c0b77addbcbdafde57b466

2023-11-26 17:39:42 4 [ERROR] Decoding ttl from PK value failed, for index (0,257), val: 
mysqld: /data/bld/10.4-asan/storage/rocksdb/ha_rocksdb.cc:6433: bool myrocks::ha_rocksdb::should_hide_ttl_rec(const myrocks::Rdb_key_def&, const rocksdb::Slice&, int64_t): Assertion `0' failed.
 
#9  0x00007f7ba5e53e32 in __GI___assert_fail (assertion=0x7f7b9bb3a040 "0", file=0x7f7b9bb2bca0 "/data/bld/10.4-asan/storage/rocksdb/ha_rocksdb.cc", line=6433, function=0x7f7b9bb39ea0 "bool myrocks::ha_rocksdb::should_hide_ttl_rec(const myrocks::Rdb_key_def&, const rocksdb::Slice&, int64_t)") at ./assert/assert.c:101
#10 0x00007f7b9ae8062e in myrocks::ha_rocksdb::should_hide_ttl_rec (this=0x61d0002468a8, kd=..., ttl_rec_val=..., curr_ts=1701013182) at /data/bld/10.4-asan/storage/rocksdb/ha_rocksdb.cc:6433
#11 0x00007f7b9ae80c1b in myrocks::ha_rocksdb::rocksdb_skip_expired_records (this=0x61d0002468a8, kd=..., iter=0x6080000103a0, seek_backward=false) at /data/bld/10.4-asan/storage/rocksdb/ha_rocksdb.cc:6461
#12 0x00007f7b9ae980b6 in myrocks::ha_rocksdb::index_next_with_direction (this=0x61d0002468a8, buf=0x61900009f1b8 "\371\002", move_forward=true) at /data/bld/10.4-asan/storage/rocksdb/ha_rocksdb.cc:9145
#13 0x00007f7b9ae977f7 in myrocks::ha_rocksdb::index_next (this=0x61d0002468a8, buf=0x61900009f1b8 "\371\002") at /data/bld/10.4-asan/storage/rocksdb/ha_rocksdb.cc:9096
#14 0x000056488d21f98a in handler::ha_index_next (this=0x61d0002468a8, buf=0x61900009f1b8 "\371\002") at /data/bld/10.4-asan/sql/handler.cc:3011
#15 0x000056488d644091 in rr_index (info=0x7f7b9ce51710) at /data/bld/10.4-asan/sql/records.cc:450
#16 0x000056488c8aea84 in READ_RECORD::read_record (this=0x7f7b9ce51710) at /data/bld/10.4-asan/sql/records.h:70
#17 0x000056488d692083 in mysql_delete (thd=0x62b00005b208, table_list=0x62b000062340, conds=0x0, order_list=0x62b00005fc20, limit=8, options=0, result=0x0) at /data/bld/10.4-asan/sql/sql_delete.cc:794
#18 0x000056488ca6777c in mysql_execute_command (thd=0x62b00005b208) at /data/bld/10.4-asan/sql/sql_parse.cc:4817
#19 0x000056488ca7da6b in mysql_parse (thd=0x62b00005b208, rawbuf=0x62b000062228 "DELETE FROM t ORDER BY a LIMIT 10", length=33, parser_state=0x7f7b9ce53c60, is_com_multi=false, is_next_command=false) at /data/bld/10.4-asan/sql/sql_parse.cc:8060
#20 0x000056488ca53ae2 in dispatch_command (command=COM_QUERY, thd=0x62b00005b208, packet=0x62900021c209 "DELETE FROM t ORDER BY a LIMIT 10", packet_length=33, is_com_multi=false, is_next_command=false) at /data/bld/10.4-asan/sql/sql_parse.cc:1857
#21 0x000056488ca50651 in do_command (thd=0x62b00005b208) at /data/bld/10.4-asan/sql/sql_parse.cc:1378
#22 0x000056488ce56d15 in do_handle_one_connection (connect=0x6080000009a8) at /data/bld/10.4-asan/sql/sql_connect.cc:1419
#23 0x000056488ce5662c in handle_one_connection (arg=0x6080000009a8) at /data/bld/10.4-asan/sql/sql_connect.cc:1323
#24 0x000056488dabb26c in pfs_spawn_thread (arg=0x615000003508) at /data/bld/10.4-asan/storage/perfschema/pfs.cc:1869
#25 0x00007f7ba5ea8044 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
#26 0x00007f7ba5f2861c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81

Non-debug build produces the same error without server abort:

2023-11-26 17:39:42 4 [ERROR] Decoding ttl from PK value failed, for index (0,257), val: 

(it does indeed end with val:, nothing after that).

Reproducible on all existing versions.


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