[MCOL-1188] assertion 'fColumn.get() && fSub && fFunc' failed , caused lost connection to MySQL server during query and crash of mysql Created: 2018-02-01  Updated: 2018-12-19  Resolved: 2018-12-19

Status: Closed
Project: MariaDB ColumnStore
Component/s: MDB Plugin
Affects Version/s: 1.1.2
Fix Version/s: 1.1.7

Type: Bug Priority: Major
Reporter: Zdravelina Sokolovska (Inactive) Assignee: Daniel Lee (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Environment:

MCS run on VMs, Multi Server ColumnStore System UM1-PM1 ;guest OS RHEL 7.4


Attachments: Text File item_table.txt     Text File modified_query.txt     Text File query41_original.txt     File um1.xentio.lan.err    
Issue Links:
Problem/Incident
causes MCOL-1722 Regression in semi_join Closed
Sprint: 2018-17, 2018-18, 2018-19, 2018-20, 2018-21

 Description   

assertion 'fColumn.get() && fSub && fFunc' failed , caused lost connection to MySQL server during query and crash of mysql

crash occurred during the execution of query41 done with small modification –
attached original query and modified query
attached also the stack trace in the um1.xentio.lan.err file

how to repeat :
loaded tpc-ds shema and 1TB tpc-ds data

MariaDB [tpcds_1000]> select  distinct(i_product_name)
    ->  from item
    ->  where i_manufact_id between 742 and 742+40
    ->    and
    -> (select count(*) as item_cnt
    ->         from item
    ->         where (i_manufact = i_manufact and
    ->         ((i_category = 'Women' and
    ->         (i_color = 'orchid' or i_color = 'papaya') and
    ->         (i_units = 'Pound' or i_units = 'Lb') and
    ->         (i_size = 'petite' or i_size = 'medium')
    ->         ) or
    ->         (i_category = 'Women' and
    ->         (i_color = 'burlywood' or i_color = 'navy') and
    ->         (i_units = 'Bundle' or i_units = 'Each') and
    ->         (i_size = 'N/A' or i_size = 'extra large')
    ->         ) or
    ->         (i_category = 'Men' and
    ->         (i_color = 'bisque' or i_color = 'azure') and
    ->         (i_units = 'N/A' or i_units = 'Tsp') and
    ->         (i_size = 'small' or i_size = 'large')
    ->         ) or
    ->         (i_category = 'Men' and
    ->         (i_color = 'chocolate' or i_color = 'cornflower') and
    ->         (i_units = 'Bunch' or i_units = 'Gross') and
    ->         (i_size = 'petite' or i_size = 'medium')
    ->         ))) or
    ->        (i_manufact = i_manufact and
    ->         ((i_category = 'Women' and
    ->         (i_color = 'salmon' or i_color = 'midnight') and
    ->         (i_units = 'Oz' or i_units = 'Box') and
    ->         (i_size = 'petite' or i_size = 'medium')
    ->         ) or
    ->         (i_category = 'Women' and
    ->         (i_color = 'snow' or i_color = 'steel') and
    ->         (i_units = 'Carton' or i_units = 'Tbl') and
    ->         (i_size = 'N/A' or i_size = 'extra large')
    ->         ) or
    ->         (i_category = 'Men' and
    ->         (i_color = 'purple' or i_color = 'gainsboro') and
    ->         (i_units = 'Dram' or i_units = 'Unknown') and
    ->         (i_size = 'small' or i_size = 'large')
    ->         ) or
    ->         (i_category = 'Men' and
    ->         (i_color = 'metallic' or i_color = 'forest') and
    ->         (i_units = 'Gram' or i_units = 'Ounce') and
    ->         (i_size = 'petite' or i_size = 'medium')
    ->         )))) > 0
    ->  order by i_product_name
    ->  limit 100;
ERROR 2013 (HY000): Lost connection to MySQL server during query

mariadb columnstore err.log :

Feb  1 13:21:33 um1 Calpont[1289]: 33.974480 |0|0|0| E 00 CAL0000: /home/builder/mariadb-columnstore-server/mariadb-columnstore-engine/dbcon/mysql/ha_scalar_sub.cpp@203: assertion 'fColumn.get() && fSub && fFunc' failed



 Comments   
Comment by Andrew Hutchings (Inactive) [ 2018-02-01 ]

Hi,

Can you please send us the schema for the item table?

Comment by Andrew Hutchings (Inactive) [ 2018-02-02 ]

Issue confirmed. Many thanks.

Comment by Ravi Prakash (Inactive) [ 2018-06-26 ]

The following simple query will also crash the columnstore server:
select i_product_name
from item
where i_manufact_id > 742 and
(select count as item_cnt from item where ((i_category = 'Women' ))) > 0
;

Comment by Ravi Prakash (Inactive) [ 2018-09-04 ]

Comment for QA:
This problem is caused by handling a sub-query marked as an CACHED_ITEM by MariaDB server. The columnstore cannot assume that this is cached and it needed to parse the subquery any way. Note that a single subquery in the WHERE clause is not marked as a cached item. The code change also touched handling of constant expressions "(TRUE or FALSE)", "1=0" or "1=1". I tested the fix using the original supplied query as well as the following:
CREATE TABLE cs_item (
`i_product_name` char(50) DEFAULT NULL,
`i_category` char(50) DEFAULT NULL,
`i_manufact_id` int(11) DEFAULT NULL
) ENGINE=Columnstore DEFAULT CHARSET=latin1 ;

select i_product_name from cs_item
where i_manufact_id > 742 and (select count as item_cnt from cs_item where ((i_category = 'Women' ))) > 0 ;

select i_product_name from cs_item
where i_manufact_id > 742 and (select count as item_cnt from cs_item where ((i_category = 'Women' ))) > 0 and (1=0);

select i_product_name from cs_item
where i_manufact_id > 742 and (select count as item_cnt from cs_item where ((i_category = 'Women' ))) > 0 and (1=1);

select i_product_name from cs_item where i_manufact_id > 742 and i_category = 'Women' ;
select i_product_name from cs_item where i_manufact_id > 742 and i_category = 'Women' AND (TRUE OR FALSE);
select i_product_name from cs_item where i_manufact_id > 742 and i_category = 'Women' AND ( 1 = 0);
select i_product_name from cs_item where i_manufact_id > 742 and i_category = 'Women' AND ( 1 = 1);
select i_product_name from cs_item where i_manufact_id > 742 and i_category = 'Women' AND ( 1 > 5/7);
select i_product_name from cs_item where i_manufact_id > 742 and i_category = 'Women' AND ( 1 > 7/5);
select i_product_name from cs_item where i_manufact_id > 742 and i_category = 'Women' AND ( i_manufact_id > 300 OR i_manufact_id <= 300);
select i_product_name from cs_item where i_manufact_id > 742 and i_category = 'Women' AND (TRUE);
select i_product_name from cs_item where i_manufact_id > 742 and i_category = 'Women' AND (FALSE);

Comment by Ravi Prakash (Inactive) [ 2018-09-04 ]

The fix is to to not skip the walking of an item marked as CACHED_ITEM. A subquery is not really cached and needed to be traversed before it can be converted into column store tree.

Comment by Daniel Lee (Inactive) [ 2018-12-19 ]

Build verified: 1.1.7-1

Verified test cases in the ticket.

Generated at Thu Feb 08 02:26:52 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.