Assertion failed - exec_method != MATERIALIZATION || (exec_method == MATERIALIZATION && engine->engine_type() == subselect_engine::HASH_SJ_ENGINE)", file=<value optimized out>, line=318, function=0x84fae0 "virtual bool drizzled::Item_in_subselect::exec()

Bug #595305 reported by Patrick Crews
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Drizzle
Fix Released
Medium
PrafullaT
Dexter
Fix Released
Medium
PrafullaT

Bug Description

This is the same failing assertion from https://bugs.launchpad.net/drizzle/+bug/588408
However, the test case for that bug no longer hits the assertion. Creating a new bug with new test case.

Test case to be posted shortly.

Backtrace:

#0 0x00007f28ff4f8a75 in *__GI_raise (sig=<value optimized out>) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#1 0x00007f28ff4fc5c0 in *__GI_abort () at abort.c:92
#2 0x00007f28ff4f1941 in *__GI___assert_fail (
    assertion=0x84d500 "exec_method != MATERIALIZATION || (exec_method == MATERIALIZATION && engine->engine_type() == subselect_engine::HASH_SJ_ENGINE)",
    file=<value optimized out>, line=318, function=0x84fae0 "virtual bool drizzled::Item_in_subselect::exec()") at assert.c:81
#3 0x0000000000575b9e in drizzled::Item_in_subselect::exec (this=0x28c5128) at drizzled/item/subselect.cc:318
#4 0x0000000000572f77 in drizzled::Item_in_subselect::val_bool (this=0x28c5128) at drizzled/item/subselect.cc:907
#5 0x0000000000550c2c in drizzled::Item_in_optimizer::val_int (this=0x7f28e002d680) at drizzled/item/cmpfunc.cc:1597
#6 0x00000000005bbafc in get_mm_tree (param=0x7f28e8dd55a0, cond=0x7f28e002d680) at drizzled/optimizer/range.cc:2654
#7 0x00000000005bbc58 in get_mm_tree (param=0x7f28e8dd55a0, cond=<value optimized out>) at drizzled/optimizer/range.cc:2614
#8 0x00000000005bc667 in drizzled::optimizer::SqlSelect::test_quick_select (this=0x7f28e002de90, session=0x7f28e43f9a30, keys_to_use=...,
    prev_tables=<value optimized out>, limit=<value optimized out>, force_quick_range=false, ordered_output=false) at drizzled/optimizer/range.cc:751
#9 0x0000000000611108 in drizzled::get_quick_record_count (session=0x7f28e43f9a30, select=0x7f28e002de90, table=0x7f28e43f22b0, keys=0x7f28e0025850,
    limit=18446744073709551615) at drizzled/sql_select.cc:476
#10 0x00000000005902fa in make_join_statistics (join=0x7f28dc000db8, tables=<value optimized out>, conds=<value optimized out>,
    keyuse_array=<value optimized out>) at drizzled/join.cc:5826
#11 0x0000000000591c39 in drizzled::Join::optimize (this=0x7f28dc000db8) at drizzled/join.cc:559
#12 0x00000000006111e5 in drizzled::mysql_select (session=0x7f28e43f9a30, rref_pointer_array=<value optimized out>, tables=0x28c3868, wild_num=0,
    fields=..., conds=0x7f28ff60c3d1, og_num=2, order=0x7f28dc000b70, group=0x0, having=0x0, select_options=2147500033, result=0x7f28dc000d98,
    unit=0x7f28e43fa4a0, select_lex=0x7f28e43fa6b0) at drizzled/sql_select.cc:412
#13 0x0000000000611b60 in drizzled::handle_select (session=0x7f28e43f9a30, lex=0x7f28e43fa480, result=0x7f28dc000d98, setup_tables_done_option=0)
    at drizzled/sql_select.cc:146
#14 0x000000000060b895 in drizzled::execute_sqlcom_select (session=0x7f28e43f9a30, all_tables=0x28c3868) at drizzled/sql_parse.cc:543
#15 0x000000000060b4fe in mysql_execute_command (session=0x7f28e43f9a30, inBuf=<value optimized out>, length=<value optimized out>)
    at drizzled/sql_parse.cc:478
#16 drizzled::mysql_parse (session=0x7f28e43f9a30, inBuf=<value optimized out>, length=<value optimized out>) at drizzled/sql_parse.cc:734
#17 0x000000000060d6d2 in drizzled::dispatch_command (command=drizzled::COM_QUERY, session=0x7f28e43f9a30,
    packet=0x7f28e43ea221 "SELECT DISTINCT OUTR . `col_text` AS X FROM BB AS OUTR2 LEFT JOIN BB AS OUTR ON ( OUTR2 . `col_char` <> OUTR . `col_text` ) WHERE OUTR . `col_bigint_key` IN ( SELECT INNR . `pk` AS Y FROM BB AS INNR "..., packet_length=<value optimized out>) at drizzled/sql_parse.cc:223
#18 0x00000000005dd92f in drizzled::Session::executeStatement (this=0x7f28e43f9a30) at drizzled/session.cc:646
#19 0x00000000005dfcd2 in drizzled::Session::run (this=0x7f28e43f9a30) at drizzled/session.cc:505
#20 0x00007f28fba8d083 in MultiThreadScheduler::runSession (arg=<value optimized out>) at ./plugin/multi_thread/multi_thread.h:67
#21 session_thread (arg=<value optimized out>) at plugin/multi_thread/multi_thread.cc:43
#22 0x00007f28ff84d9ca in start_thread (arg=<value optimized out>) at pthread_create.c:300
#23 0x00007f28ff5ab6cd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#24 0x0000000000000000 in ?? ()

Related branches

Changed in drizzle:
status: New → Confirmed
importance: Undecided → Medium
Revision history for this message
Patrick Crews (patrick-crews) wrote :

Test case
Attempt to record via ./test-run --record <test_name>

DROP TABLE IF EXISTS `bb`;
CREATE TABLE `bb` (
  `pk` int NOT NULL AUTO_INCREMENT,
  `col_text_not_null` text NOT NULL,
  `col_bigint_key` bigint DEFAULT NULL,
  `col_int` int DEFAULT NULL,
  `col_char` varchar(1) DEFAULT NULL,
  `col_text` text,
  `col_text_not_null_key` text NOT NULL,
  `col_char_not_null` varchar(1) NOT NULL,
  PRIMARY KEY (`pk`),
  KEY `col_bigint_key` (`col_bigint_key`),
  KEY `col_text_not_null_key` (`col_text_not_null_key`(255))
) ENGINE=InnoDB;

ALTER TABLE `bb` DISABLE KEYS;
INSERT INTO `bb` VALUES (1,'',NULL,NULL,'h',NULL,'','f'),(2,'',NULL,1756299264,'p',NULL,'','w'),(3,'',6,-1990000640,'w',NULL,'','w'),(4,'',NULL,NULL,'f',NULL,'','k'),(5,'',NULL,NULL,'k',NULL,'','t'),(6,'',9,NULL,'m',NULL,'','c'),(7,'',6451687941184946176,0,'z',NULL,'','f'),(8,'',8960474408607023104,1805844480,'h',NULL,'','k'),(9,'',8,7,'y',NULL,'','m'),(10,'',NULL,-415629312,'t',NULL,'','h');
ALTER TABLE `bb` ENABLE KEYS;

SELECT DISTINCT OUTR . `col_text` AS X FROM BB AS OUTR2 LEFT JOIN BB AS OUTR ON ( OUTR2 . `col_char` <> OUTR . `col_text` ) WHERE OUTR . `col_bigint_key` IN ( SELECT INNR . `pk` AS Y FROM BB AS INNR WHERE INNR . `col_bigint_key` > INNR . `col_int` AND INNR . `col_text_not_null_key` >= INNR . `col_char_not_null` ) AND OUTR . `col_bigint_key` = 9 ORDER BY OUTR . `col_text_not_null` , OUTR . `pk`;

DROP TABLE BB;

Revision history for this message
Stewart Smith (stewart) wrote :

this doesn't surprise me that much. Quite possible that I missed a code path there as the MySQL patch that fixed the original issue and the Drizzle code do differ a bit.

Revision history for this message
Patrick Crews (patrick-crews) wrote :

Not crashing for this test query in MySQL 5.1

Revision history for this message
PrafullaT (prafulla-t) wrote :

Simpler query to reproduce on above-mentioned tables:

select outr . `col_text`
from bb as outr
where outr . `col_bigint_key` IN (SELECT innr . `pk` AS y
                                   FROM bb AS innr
                                   WHERE
       innr . `col_bigint_key` > innr . `col_int`)
       AND outr . `col_bigint_key` = 9;

Revision history for this message
PrafullaT (prafulla-t) wrote :

This bug is simillar to mysql bug 36133
http://bugs.mysql.com/bug.php?id=36133

I have fixed this bug by taking changes from corresponding mysql bug.
and pushed my changes in following branch.
http://bazaar.launchpad.net/~prafulla-tekawade/drizzle/dr-bug-595305

Changed in drizzle:
assignee: nobody → Prafulla Tekawade (prafulla-tekawade)
status: Confirmed → Fix Committed
status: Fix Committed → In Progress
Revision history for this message
PrafullaT (prafulla-t) wrote :

Hi Patrick,
Can you take a look at the fix ?

Revision history for this message
Patrick Crews (patrick-crews) wrote : Re: [Bug 595305] Re: Assertion failed - exec_method != MATERIALIZATION || (exec_method == MATERIALIZATION && engine->engine_type() == subselect_engine::HASH_SJ_ENGINE)", file=<value optimized out>, line=318, function=0x84fae0 "virtual bool drizzled::Item_in_subselect::exec()
Download full text (5.1 KiB)

Will do. I am in training this week so please expect a two to three
day turnaround. Thanks for the patch!
Sent from my iPod

On Jul 13, 2010, at 11:44 AM, Prafulla Tekawade <<email address hidden>
 > wrote:

> Hi Patrick,
> Can you take a look at the fix ?
>
> --
> Assertion failed - exec_method != MATERIALIZATION || (exec_method ==
> MATERIALIZATION && engine->engine_type() ==
> subselect_engine::HASH_SJ_ENGINE)", file=<value optimized out>,
> line=318, function=0x84fae0 "virtual bool
> drizzled::Item_in_subselect::exec()
> https://bugs.launchpad.net/bugs/595305
> You received this bug notification because you are a direct subscriber
> of the bug.
>
> Status in A Lightweight SQL Database for Cloud and Web: In Progress
>
> Bug description:
> This is the same failing assertion from https://bugs.launchpad.net/drizzle/+bug/588408
> However, the test case for that bug no longer hits the assertion.
> Creating a new bug with new test case.
>
> Test case to be posted shortly.
>
> Backtrace:
>
> #0 0x00007f28ff4f8a75 in *__GI_raise (sig=<value optimized out>)
> at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
> #1 0x00007f28ff4fc5c0 in *__GI_abort () at abort.c:92
> #2 0x00007f28ff4f1941 in *__GI___assert_fail (
> assertion=0x84d500 "exec_method != MATERIALIZATION ||
> (exec_method == MATERIALIZATION && engine->engine_type() ==
> subselect_engine::HASH_SJ_ENGINE)",
> file=<value optimized out>, line=318, function=0x84fae0 "virtual
> bool drizzled::Item_in_subselect::exec()") at assert.c:81
> #3 0x0000000000575b9e in drizzled::Item_in_subselect::exec
> (this=0x28c5128) at drizzled/item/subselect.cc:318
> #4 0x0000000000572f77 in drizzled::Item_in_subselect::val_bool
> (this=0x28c5128) at drizzled/item/subselect.cc:907
> #5 0x0000000000550c2c in drizzled::Item_in_optimizer::val_int
> (this=0x7f28e002d680) at drizzled/item/cmpfunc.cc:1597
> #6 0x00000000005bbafc in get_mm_tree (param=0x7f28e8dd55a0,
> cond=0x7f28e002d680) at drizzled/optimizer/range.cc:2654
> #7 0x00000000005bbc58 in get_mm_tree (param=0x7f28e8dd55a0,
> cond=<value optimized out>) at drizzled/optimizer/range.cc:2614
> #8 0x00000000005bc667 in
> drizzled::optimizer::SqlSelect::test_quick_select
> (this=0x7f28e002de90, session=0x7f28e43f9a30, keys_to_use=...,
> prev_tables=<value optimized out>, limit=<value optimized out>,
> force_quick_range=false, ordered_output=false) at drizzled/optimizer/
> range.cc:751
> #9 0x0000000000611108 in drizzled::get_quick_record_count
> (session=0x7f28e43f9a30, select=0x7f28e002de90,
> table=0x7f28e43f22b0, keys=0x7f28e0025850,
> limit=18446744073709551615) at drizzled/sql_select.cc:476
> #10 0x00000000005902fa in make_join_statistics (join=0x7f28dc000db8,
> tables=<value optimized out>, conds=<value optimized out>,
> keyuse_array=<value optimized out>) at drizzled/join.cc:5826
> #11 0x0000000000591c39 in drizzled::Join::optimize
> (this=0x7f28dc000db8) at drizzled/join.cc:559
> #12 0x00000000006111e5 in drizzled::mysql_select
> (session=0x7f28e43f9a30, rref_pointer_array=<value optimized out>,
> tables=0x28c3868, wild_num=0,
> fields=..., conds=0x7f28ff60c3d1, og_num=2...

Read more...

Revision history for this message
Patrick Crews (patrick-crews) wrote :

I won't be able to take a look at this until Sunday - internet is unreliable outside of training. I'll run this through the usual tests as soon as I'm back home. Sorry for the delay.

Revision history for this message
Patrick Crews (patrick-crews) wrote :

This patch looks good per the usual randgen / test-suite testing.
Additionally, the result sets look correct now for the original test case.

I also checked a combination of the fixes for Bug#592444 and Bug#595305 and things look good.

As always, thanks for the fixes and solid work : )

PrafullaT (prafulla-t)
Changed in drizzle:
status: In Progress → Fix Committed
Revision history for this message
PrafullaT (prafulla-t) wrote :

Fix merged at rev 1664

Changed in drizzle:
status: Fix Committed → Fix Released
Changed in drizzle:
milestone: none → 2010-07-19
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.