LevelDB storage engine (MDEV-3841)

[MDEV-4092] LevelDB: Assertion `in_table(pa, a_len)' fails in LDBSE_KEYDEF::cmp_full_keys with a multi-part key and ORDER BY .. DESC Created: 2013-01-25  Updated: 2013-01-25  Resolved: 2013-01-25

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Technical task Priority: Major
Reporter: Elena Stepanova Assignee: Sergei Petrunia
Resolution: Fixed Votes: 0
Labels: leveldb

Issue Links:
Relates

 Description   

mysqld: mysql-5.6-leveldb/storage/leveldb/ldb_datadic.h:47: int LDBSE_KEYDEF::cmp_full_keys(const char*, uint, const char*, uint, uint): Assertion `in_table(pa, a_len)' failed.
18:16:02 UTC - mysqld got signal 6 ;

#6  0x00007ff1e5c27d4d in __GI___assert_fail (assertion=0xff5705 "in_table(pa, a_len)", file=<optimized out>, line=47, function=<optimized out>) at assert.c:81
#7  0x0000000000a62ec2 in LDBSE_KEYDEF::cmp_full_keys (this=0x256cdb0, pa=0x26aa5a8 "test.t1\001", a_len=13, pb=0x256ced1 "test.t1\002", b_len=12, n_parts=1) at mysql-5.6-leveldb/storage/leveldb/ldb_datadic.h:47
#8  0x0000000000a5f9ee in ha_leveldb::index_read_map (this=0x256c400, buf=0x256c6e8 "\374\002", key=0x27b3b60 "", keypart_map=1, find_flag=HA_READ_PREFIX_LAST) at mysql-5.6-leveldb/storage/leveldb/ha_leveldb.cc:1131
#9  0x0000000000a5fcb0 in ha_leveldb::index_read_last_map (this=0x256c400, buf=0x256c6e8 "\374\002", key=0x27b3b60 "", keypart_map=1) at mysql-5.6-leveldb/storage/leveldb/ha_leveldb.cc:1196
#10 0x00000000007737a0 in join_read_last_key (tab=0x27b5c28) at mysql-5.6-leveldb/sql/sql_executor.cc:2228
#11 0x00000000007715b1 in sub_select (join=0x270e890, join_tab=0x27b5c28, end_of_records=false) at mysql-5.6-leveldb/sql/sql_executor.cc:1246
#12 0x000000000077104b in do_select (join=0x270e890) at mysql-5.6-leveldb/sql/sql_executor.cc:933
#13 0x000000000076f102 in JOIN::exec (this=0x270e890) at mysql-5.6-leveldb/sql/sql_executor.cc:191
#14 0x00000000007c94ab in mysql_execute_select (thd=0x7ff1d4074ba0, select_lex=0x7ff1d40772b8, free_join=true) at mysql-5.6-leveldb/sql/sql_select.cc:1085
#15 0x00000000007c9790 in mysql_select (thd=0x7ff1d4074ba0, tables=0x270d310, wild_num=1, fields=..., conds=0x270e538, order=0x7ff1d4077480, group=0x7ff1d40773b8, having=0x0, select_options=2147748608, result=0x270e868, unit=0x7ff1d4076c78, select_lex=0x7ff1d40772b8) at mysql-5.6-leveldb/sql/sql_select.cc:1206
#16 0x00000000007c79ca in handle_select (thd=0x7ff1d4074ba0, result=0x270e868, setup_tables_done_option=0) at mysql-5.6-leveldb/sql/sql_select.cc:110
#17 0x00000000007a47c8 in execute_sqlcom_select (thd=0x7ff1d4074ba0, all_tables=0x270d310) at mysql-5.6-leveldb/sql/sql_parse.cc:4982
#18 0x000000000079d63a in mysql_execute_command (thd=0x7ff1d4074ba0) at mysql-5.6-leveldb/sql/sql_parse.cc:2552
#19 0x00000000007a6bea in mysql_parse (thd=0x7ff1d4074ba0, rawbuf=0x270d0c0 "SELECT * FROM t1, t2 WHERE pk1 = pk2 AND b = 'o' ORDER BY a DESC", length=64, parser_state=0x7ff1e75b2110) at mysql-5.6-leveldb/sql/sql_parse.cc:6097
#20 0x000000000079aa27 in dispatch_command (command=COM_QUERY, thd=0x7ff1d4074ba0, packet=0x7ff1d414bee1 "", packet_length=64) at mysql-5.6-leveldb/sql/sql_parse.cc:1312
#21 0x0000000000799bea in do_command (thd=0x7ff1d4074ba0) at mysql-5.6-leveldb/sql/sql_parse.cc:1036
#22 0x0000000000764fe1 in do_handle_one_connection (thd_arg=0x7ff1d4074ba0) at mysql-5.6-leveldb/sql/sql_connect.cc:969
#23 0x0000000000764a06 in handle_one_connection (arg=0x7ff1d4074ba0) at mysql-5.6-leveldb/sql/sql_connect.cc:885
#24 0x0000000000d0df73 in pfs_spawn_thread (arg=0x7ff1d409cfb0) at mysql-5.6-leveldb/storage/perfschema/pfs.cc:1853
#25 0x00007ff1e6744efc in start_thread (arg=0x7ff1e75b3700) at pthread_create.c:304

Test case:

CREATE TABLE t1 (pk1 INT PRIMARY KEY, a INT, b VARCHAR(1), KEY(b,a)) ENGINE=LevelDB;
INSERT INTO t1 VALUES (1, 7,'x'),(2,8,'y');
 
CREATE TABLE t2 (pk2 INT PRIMARY KEY) ENGINE=LevelDB;
INSERT INTO t2 VALUES (1),(2);
 
SELECT * FROM t1, t2 WHERE pk1 = pk2 AND b = 'o' ORDER BY a DESC;

EXPLAIN:

EXPLAIN EXTENDED
SELECT * FROM t1, t2 WHERE pk1 = pk2 AND b = 'o' ORDER BY a DESC;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
1	SIMPLE	t1	ref	PRIMARY,b	b	4	const	10	100.00	Using where; Using index
1	SIMPLE	t2	eq_ref	PRIMARY	PRIMARY	4	test.t1.pk1	1	100.00	Using index
Warnings:
Note	1003	/* select#1 */ select `test`.`t1`.`pk1` AS `pk1`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t2`.`pk2` AS `pk2` from `test`.`t1` join `test`.`t2` where ((`test`.`t1`.`b` = 'o') and (`test`.`t2`.`pk2` = `test`.`t1`.`pk1`)) order by `test`.`t1`.`a` desc

revision-id: psergey@askmonty.org-20130125181032-kuuhprzmkes6p9u0
revno: 4517
branch-nick: mysql-5.6-leveldb


Generated at Thu Feb 08 06:53:39 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.