virtual int Mrr_ordered_index_reader::refill_buffer(): Assertion `!know_key_tuple_params || key_buffer->is_empty()' failed in maria-5.3-mwl128-dsmrr-cpk

Bug #671361 reported by Philip Stoev
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MariaDB
Fix Released
Undecided
Sergey Petrunia

Bug Description

The following query:

SELECT table2.col_varchar_10_latin1_key
FROM t1 AS table1 JOIN t2 AS table2 ON table1.col_varchar_1024_latin1_key = table2.col_varchar_10_latin1
WHERE table2.col_varchar_10_utf8 OR table1.pk ;

asserted as follows in maria-5.3-mwl128-dsmrr-cpk. maria-5.3-dsmrr-cpk is not affected

mysqld: multi_range_read.cc:405: virtual int Mrr_ordered_index_reader::refill_buffer(): Assertion `!know_key_tuple_params || key_buffer->is_empty()' failed.

#8 0x00133d98 in __assert_fail () from /lib/libc.so.6
#9 0x084a2edd in Mrr_ordered_index_reader::refill_buffer (this=0xae6f29ac) at multi_range_read.cc:405
#10 0x084a33f2 in Mrr_ordered_rndpos_reader::refill_buffer (this=0xae6f2984) at multi_range_read.cc:527
#11 0x084a3da4 in DsMrr_impl::dsmrr_init (this=0xae6f2968, h_arg=0xae6f25e8, seq_funcs=0xae743c6c, seq_init_param=0xae743b80, n_ranges=1, mode=129,
    buf=0xae743c84) at multi_range_read.cc:789
#12 0x08566aa3 in ha_maria::multi_range_read_init (this=0xae6f25e8, seq=0xae743c6c, seq_init_param=0xae743b80, n_ranges=1, mode=129, buf=0xae743c84)
    at ha_maria.cc:3615
#13 0x082e1541 in JOIN_TAB_SCAN_MRR::open (this=0xae743c58) at sql_join_cache.cc:3500
#14 0x082df994 in JOIN_CACHE::join_matching_records (this=0xae743b80, skip_last=false) at sql_join_cache.cc:2085
#15 0x082df652 in JOIN_CACHE::join_records (this=0xae743b80, skip_last=false) at sql_join_cache.cc:1927
#16 0x08327178 in sub_select_cache (join=0xae748f58, join_tab=0xae64f404, end_of_records=false) at sql_select.cc:13178
#17 0x08327abb in evaluate_join_record (join=0xae748f58, join_tab=0xae64f230, error=0) at sql_select.cc:13565
#18 0x08327447 in sub_select (join=0xae748f58, join_tab=0xae64f230, end_of_records=false) at sql_select.cc:13370
#19 0x0832686c in do_select (join=0xae748f58, fields=0x9d82678, table=0x0, procedure=0x0) at sql_select.cc:12914
#20 0x0830c405 in JOIN::exec (this=0xae748f58) at sql_select.cc:2382
#21 0x0830cb6b in mysql_select (thd=0x9d80c48, rref_pointer_array=0x9d82700, tables=0xae743e88, wild_num=0, fields=..., conds=0xae744180, og_num=0,
    order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147764736, result=0xae744d88, unit=0x9d82334, select_lex=0x9d825d8)
    at sql_select.cc:2592
#22 0x083051a1 in handle_select (thd=0x9d80c48, lex=0x9d822d4, result=0xae744d88, setup_tables_done_option=0) at sql_select.cc:284
#23 0x082a130f in execute_sqlcom_select (thd=0x9d80c48, all_tables=0xae743e88) at sql_parse.cc:5102
#24 0x08297e0f in mysql_execute_command (thd=0x9d80c48) at sql_parse.cc:2281
#25 0x082a3880 in mysql_parse (thd=0x9d80c48,
    rawbuf=0xae65f2d0 "SELECT table2.col_varchar_10_latin1_key\nFROM t1 AS table1 JOIN t2 AS table2 ON table1.col_varchar_1024_latin1_key = table2.col_varchar_10_latin1\nWHERE table2.col_varchar_10_utf8 OR table1.pk", length=190, found_semicolon=0xae9a0228) at sql_parse.cc:6109
#26 0x0829597c in dispatch_command (command=COM_QUERY, thd=0x9d80c48, packet=0x9d82cb9 "", packet_length=191) at sql_parse.cc:1209
#27 0x08294e2e in do_command (thd=0x9d80c48) at sql_parse.cc:902
#28 0x08291de4 in handle_one_connection (arg=0x9d80c48) at sql_connect.cc:1154
#29 0x00bea919 in start_thread () from /lib/libpthread.so.0
#30 0x001edcbe in clone () from /lib/libc.so.6

Tags: rqg dsmrr-cpk mrr
Revision history for this message
Philip Stoev (pstoev-askmonty) wrote :
Download full text (3.4 KiB)

Test case:

SET SESSION optimizer_use_mrr = 'force';
SET SESSION join_cache_level = 6;
SET SESSION join_buffer_size = 1024;

--disable_warnings
DROP TABLE /*! IF EXISTS */ t1;
DROP TABLE /*! IF EXISTS */ t2;
--enable_warnings

CREATE TABLE t1 (
  col_varchar_10_latin1_key varchar(10) DEFAULT NULL,
  pk int(11) NOT NULL AUTO_INCREMENT,
  col_varchar_10_latin1 varchar(10) DEFAULT NULL,
  col_varchar_1024_latin1_key varchar(1024) DEFAULT NULL,
  col_varchar_10_utf8 varchar(10) CHARACTER SET utf8 DEFAULT NULL,
  PRIMARY KEY (pk),
  KEY col_varchar_10_latin1_key (col_varchar_10_latin1_key),
  KEY col_varchar_1024_latin1_key (col_varchar_1024_latin1_key)
) ENGINE=Aria AUTO_INCREMENT=51 DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1;
INSERT INTO t1 VALUES ('FSLXI',1,'mean','z','CETCI'),('r',2,'abcdefjhjkl','abcdefjhjkl','g'),('been',3,'abcdefjhjkl','in','hey'),('I\'ll',4,'abcdefjhjkl','abcdefjhjkl','CVCZR'),('GSMTS',6,'he\'s','abcdefjhjkl','u'),('GSKUD',7,'h','at','the'),('going',8,'this','RNEVG','JVXGC'),('say',9,'WGBVU','ZNQVR','SOFFU'),('you\'re',10,'z','j','tell'),('abcdefjhjkl',14,'abcdefjhjkl','no','p'),('NOFJH',15,'GLSXZ','k','DWTZJ'),('b',16,'could','JFJAU','LIPLE'),('abcdefjhjkl',17,'z','f','IGFKY'),('abcdefjhjkl',18,'abcdefjhjkl','g','e'),('didn\'t',5,'this','this','would'),('AUWVN',12,'abcdefjhjkl','AOOUK','EHGSK'),('QNHWK',20,'q','on','m'),('x',22,'n','it','abcdefjhjkl'),('mean',23,'KVJEK','have','right'),('h',24,'VJVDS','abcdefjhjkl','XJJVP'),('if',26,'u','abcdefjhjkl','CLULE'),('abcdefjhjkl',28,'you\'re','abcdefjhjkl','think'),('with',30,'z','on','n'),('s',31,'s','MUVHW','a'),('abcdefjhjkl',33,'LCVTC','she','abcdefjhjkl'),('m',19,'for','GNCJI','abcdefjhjkl'),('abcdefjhjkl',11,'up','all','it\'s'),('g',21,'u','abcdefjhjkl','then'),('t',25,'abcdefjhjkl','MQFEC','right'),('out',34,'abcdefjhjkl','g','GRPDG'),('your',35,'can\'t','RXSIK','b'),('b',37,'abcdefjhjkl','FZCZL','d'),('to',42,'m','will','l'),('abcdefjhjkl',43,'abcdefjhjkl','TNOSX','PWQKO');

CREATE TABLE t2 (
  col_varchar_10_utf8 varchar(10) CHARACTER SET utf8 DEFAULT NULL,
  col_varchar_10_latin1 varchar(10) DEFAULT NULL,
  col_varchar_10_latin1_key varchar(10) DEFAULT NULL,
  pk int(11) NOT NULL AUTO_INCREMENT,
  col_varchar_1024_latin1_key varchar(1024) DEFAULT NULL,
  PRIMARY KEY (pk),
  KEY col_varchar_10_latin1_key (col_varchar_10_latin1_key),
  KEY col_varchar_1024_latin1_key (col_varchar_1024_latin1_key)
) ENGINE=Aria AUTO_INCREMENT=51 DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1;
INSERT INTO t2 VALUES ('GINHU','abcdefjhjkl','c',1,'i'),('m','abcdefjhjkl','ILVHS',2,'abcdefjhjkl'),('he\'s','abcdefjhjkl','were',3,'PRNZK'),('d','abcdefjhjkl','here',4,'abcdefjhjkl'),('can','BLJCV','go',5,'that'),('this','SWGQI','BFBWJ',6,'QECYF'),('time','p','m',7,'q'),('abcdefjhjkl','is','XEZRN',9,'abcdefjhjkl'),('yes','g','abcdefjhjkl',10,'been'),('e','u','p',11,'v'),('FFJIH','j','ARQHA',8,'abcdefjhjkl'),('BNEQB','FCIPV','e',13,'XSECZ'),('JMRST','NDHZT','q',15,'oh'),('abcdefjhjkl','then','oh',16,'abcdefjhjkl'),('k','don\'t','abcdefjhjkl',17,'go'),('v','abcdefjhjkl','PMPKB',18,'about'),('abcdefjhjkl','AIKFD','abcdefjhjkl',19,'she'),('abcdefjhjkl','yeah','oh',20,'b'),('z','just','TSDNQ',21,'abcdefjhjkl'),('...

Read more...

Changed in maria:
assignee: nobody → Sergey Petrunia (sergefp)
milestone: none → 5.3
Revision history for this message
Sergey Petrunia (sergefp) wrote :

A mechanically-simplified testcase:

--disable_warnings
drop table if exists t1, t2;
--enable_warnings
SET SESSION optimizer_use_mrr = 'force';
SET SESSION join_cache_level = 6;
SET SESSION join_buffer_size = 1024;
CREATE TABLE t1 (
  pk int(11) NOT NULL AUTO_INCREMENT,
  col_varchar_1024_latin1_key varchar(1024) DEFAULT NULL,
  PRIMARY KEY (pk),
  KEY col_varchar_1024_latin1_key (col_varchar_1024_latin1_key)
) ENGINE=Aria;

INSERT INTO t1 VALUES
(1,'z'),
(2,'abcdefjhjkl'),
(3,'in'),
(4,'abcdefjhjkl'),
(6,'abcdefjhjkl');

CREATE TABLE t2 (
  col_varchar_10_latin1 varchar(10) DEFAULT NULL
) ENGINE=Aria;
INSERT INTO t2 VALUES ('foo'), ('foo');

EXPLAIN SELECT count(*)
FROM t1 AS table1, t2 AS table2
WHERE
  table1.col_varchar_1024_latin1_key = table2.col_varchar_10_latin1 AND table1.pk<>0 ;

SELECT count(*)
FROM t1 AS table1, t2 AS table2
WHERE
  table1.col_varchar_1024_latin1_key = table2.col_varchar_10_latin1 AND table1.pk<>0 ;

Changed in maria:
status: New → Fix Committed
Changed in maria:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.