You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafodion.apache.org by "Alice Chen (JIRA)" <ji...@apache.org> on 2015/07/22 20:17:58 UTC

[jira] [Created] (TRAFODION-732) LP Bug: 1388277 - Optmizer cores at NestedJoin::checkCompleteSortOrder()

Alice Chen created TRAFODION-732:
------------------------------------

             Summary: LP Bug: 1388277 - Optmizer cores at NestedJoin::checkCompleteSortOrder()
                 Key: TRAFODION-732
                 URL: https://issues.apache.org/jira/browse/TRAFODION-732
             Project: Apache Trafodion
          Issue Type: Bug
          Components: sql-cmp
            Reporter: Weishiun Tsai
            Assignee: Qifan Chen
            Priority: Blocker


This problem causes optimizer to crash sqlci when running from sqlci, and mxosrvr when running through trafci.  The stack trace shows that NestedJoin::checkCompleteSortOrder() casues NAList<ValueId>::operator[] to abend because of "List index exceeds # of entries".

The problem is first seen on the 1029 daily build.  It has left several cores, as well as test failures, during the SQL regression run.  It is also fairly reproducible using the 1031 daily build installed on a workstation.

----------------------------------------------

Here is the entire script to reproduce this problem:

create table tmp1
(a int      NOT NULL,
b char(11) NOT NULL,
c float    NOT NULL,
d timestamp,
primary key (a,b,c)) no partition;

create view vtmp1 as select b,c,d,a from tmp1;

create table tmp2 (a int       NOT NULL,
b char(11)  NOT NULL,
c float     NOT NULL,
d timestamp,
primary key (a,b,c)) no partition;

create view vtmp2 as select b,c,d,a from tmp2;

create view vunion as
select * from tmp1
union all
select a+1,b,c,d from vtmp1;

insert into vtmp1 values ('xxx', 3.5, current, 1);

insert into vtmp2 (select * from vtmp1
union all select b,c,d,a+1 from tmp1);

insert into vtmp2 (select
b,c,d,a+2 from vunion);

insert into vtmp2 (select distinct b,c,d,a+4
from vunion);

insert into vtmp2 (select b,c,d,a+10
from vunion)
order by 1,2,3,4;

insert into vtmp2
(select b,c,d,a+12 from
 vtmp1)
order by 2,3,4,1;

----------------------------------------------

Here is the execution output:

>>create table tmp1
+>(a int      NOT NULL,
+>b char(11) NOT NULL,
+>c float    NOT NULL,
+>d timestamp,
+>primary key (a,b,c)) no partition;

--- SQL operation complete.
>>
>>create view vtmp1 as select b,c,d,a from tmp1;

--- SQL operation complete.
>>
>>create table tmp2 (a int       NOT NULL,
+>b char(11)  NOT NULL,
+>c float     NOT NULL,
+>d timestamp,
+>primary key (a,b,c)) no partition;

--- SQL operation complete.
>>
>>create view vtmp2 as select b,c,d,a from tmp2;

--- SQL operation complete.
>>
>>create view vunion as
+>select * from tmp1
+>union all
+>select a+1,b,c,d from vtmp1;

--- SQL operation complete.
>>
>>insert into vtmp1 values ('xxx', 3.5, current, 1);

--- 1 row(s) inserted.
>>
>>insert into vtmp2 (select * from vtmp1
+>union all select b,c,d,a+1 from tmp1);

--- 2 row(s) inserted.
>>
>>insert into vtmp2 (select
+>b,c,d,a+2 from vunion);

--- 2 row(s) inserted.
>>
>>insert into vtmp2 (select distinct b,c,d,a+4
+>from vunion);

--- 2 row(s) inserted.
>>
>>insert into vtmp2 (select b,c,d,a+10
+>from vunion)
+>order by 1,2,3,4;

--- 2 row(s) inserted.
>>
>>insert into vtmp2
+>(select b,c,d,a+12 from
+> vtmp1)
+>order by 2,3,4,1;
Aborted (core dumped)

----------------------------------------------

Here is the stack trace of the sqlci core file:

(gdb) bt
#0  0x00000039e28328a5 in raise () from /lib64/libc.so.6
#1  0x00000039e283400d in abort () from /lib64/libc.so.6
#2  0x00007ffff5d53810 in assert_botch_abend (
    f=0x7ffff16153c0 "../common/Collections.cpp", l=871,
    m=0x7ffff1615a90 "List index exceeds # of entries",
    c=<value optimized out>) at ../export/NAAbort.cpp:282
#3  0x00007ffff152d750 in NAList<ValueId>::operator[] (this=0x7ffffffebd10,
    i=3) at ../common/Collections.cpp:871
#4  0x00007fffeffec5a8 in NestedJoin::checkCompleteSortOrder (
    this=0x7fffd5607260, sppForChild0=0x7fffd561a7d8)
    at ../optimizer/OptPhysRelExpr.cpp:4101
#5  0x00007ffff000a890 in NestedJoin::createContextForAChild (
    this=0x7fffd5607260, myContext=0x7fffd5601c38, pws=0x7fffd5607a00,
    childIndex=@0x7ffffffec6dc) at ../optimizer/OptPhysRelExpr.cpp:4780
#6  0x00007fffeffeec31 in RelExpr::createPlan (this=<value optimized out>,
    myContext=0x7fffd5601c38, pws=0x7fffd5607a00, rule=0x7fffe8e25440,
    guidance=0x0, guidanceForChild=@0x7ffffffec748)
    at ../optimizer/OptPhysRelExpr.cpp:440
#7  0x00007ffff01c0d3f in CreatePlanTask::perform (this=0x7fffd5606e40,
    taskId=56) at ../optimizer/tasks.cpp:1495
#8  0x00007fffeff991d5 in QueryOptimizerDriver::optimizeAPassHelper (
    this=0x7ffffffecc50, context=0x7fffd5600b20) at ../optimizer/opt.cpp:7009
#9  0x00007fffeff995c5 in QueryOptimizerDriver::optimizeAPass (
    this=0x7ffffffecc50, context=0x7fffd5600b20) at ../optimizer/opt.cpp:6942
#10 0x00007fffeff99b47 in QueryOptimizerDriver::doPass2PerhapsPass1 (
    this=0x7ffffffecc50, relExpr=0x7fffd7c1d8f0, context=0x7fffd5600b20,
    original=0x7fffd55f4bd8) at ../optimizer/opt.cpp:6869
#11 0x00007fffeff99d23 in RelExpr::optimize2 (this=0x7fffd7c1d8f0)
    at ../optimizer/opt.cpp:6565
#12 0x00007fffeffcafd8 in RelExpr::optimizeNode (this=0x7fffd7c1d8f0)
    at ../optimizer/OptLogRelExpr.cpp:73
#13 0x00007ffff1535e00 in CmpMain::compile (this=0x7ffffffefd30,
    input_str=0x7fffd7c35df0 "insert into vtmp2 (select b,c,d,a+12 from  vtmp1) order by 2,3,4,1;", charset=15, queryExpr=@0x7ffffffefc68,
    gen_code=0x7fffd7c51398, gen_code_len=0x7fffd7c51390, heap=0x7fffe997ebf8,
    phase=CmpMain::END, fragmentDir=0x7ffffffefe88, op=3014,
    useQueryCache=<value optimized out>, cacheable=0x7ffffffefc78,
    begTime=0x7ffffffefc50, shouldLog=0) at ../sqlcomp/CmpMain.cpp:2190
#14 0x00007ffff15376cc in CmpMain::sqlcomp (this=0x7ffffffefd30,
    input_str=0x7fffd7c35df0 "insert into vtmp2 (select b,c,d,a+12 from  vtmp1) order by 2,3,4,1;", charset=15, queryExpr=@0x7ffffffefc68,
    gen_code=0x7fffd7c51398, gen_code_len=0x7fffd7c51390, heap=0x7fffe997ebf8,
    phase=CmpMain::END, fragmentDir=0x7ffffffefe88, op=3014, useQueryCache=1,
    cacheable=0x7ffffffefc78, begTime=0x7ffffffefc50, shouldLog=0)
    at ../sqlcomp/CmpMain.cpp:1660
#15 0x00007ffff15388bc in CmpMain::sqlcomp (this=0x7ffffffefd30, input=...,
    gen_code=0x7fffd7c51398, gen_code_len=0x7fffd7c51390, heap=0x7fffe997ebf8,
    phase=CmpMain::END, fragmentDir=0x7ffffffefe88, op=3014)
    at ../sqlcomp/CmpMain.cpp:809
#16 0x00007ffff56238d8 in CmpStatement::process (this=0x7fffd7bfbfd8,
    sqltext=<value optimized out>) at ../arkcmp/CmpStatement.cpp:488
#17 0x00007ffff56182de in CmpContext::compileDirect (this=0x7fffe8de7090,
    data=0x7fffe998e428 "\200", data_len=208, outHeap=0x7fffea3ee0f0,
    charset=15, op=CmpMessageObj::SQLTEXT_RECOMPILE, gen_code=@0x7fffffff0410,
    gen_code_len=@0x7fffffff0418, parserFlags=0, diagsArea=0x7fffe998e500)
    at ../arkcmp/CmpContext.cpp:688
#18 0x00007ffff5fd3a67 in CliStatement::prepare2 (this=0x7fffe998c6c0,
    source=0x7fffe998cf98 "insert into vtmp2 (select b,c,d,a+12 from  vtmp1) order by 2,3,4,1;", diagsArea=..., passed_gen_code=<value optimized out>,
    passed_gen_code_len=3929989360, charset=15, unpackTdbs=1, cliFlags=155)
    at ../cli/Statement.cpp:1797
#19 0x00007ffff5fd3eb6 in CliStatement::prepare (this=0x7fffe998c6c0,
    source=0x7fffe998cf98 "insert into vtmp2 (select b,c,d,a+12 from  vtmp1) order by 2,3,4,1;", diagsArea=..., passed_gen_code=<value optimized out>,
    passed_gen_code_len=<value optimized out>, charset=<value optimized out>,
    unpackTdbs=1, cliFlags=155) at ../cli/Statement.cpp:1388
#20 0x00007ffff5f9e8cc in SQLCLI_Prepare2 (cliGlobals=0xb95660,
    statement_id=0x7fffffff19c0, sql_source=0x7fffffff1990, gencode_ptr=0x0,
    gencode_len=0, ret_gencode_len=0x0, query_cost_info=0x7fffffff1800,
    query_comp_stats_info=0x7fffffff0700, uniqueStmtId=<value optimized out>,
    uniqueStmtIdLen=0x7fffffff1b74, flags=139) at ../cli/Cli.cpp:5910
#21 0x00007ffff5f9f61c in SQLCLI_RetryQuery (cliGlobals=0xb95660,
    statement_id=0x19750e0, sqlcode=-2235, afterPrepare=1, afterExec=0,
    afterFetch=0, afterCEFC=0) at ../cli/Cli.cpp:2256
#22 SQLCLI_ProcessRetryQuery (cliGlobals=0xb95660, statement_id=0x19750e0,
    sqlcode=-2235, afterPrepare=1, afterExec=0, afterFetch=0, afterCEFC=0)
    at ../cli/Cli.cpp:2747
#23 0x00007ffff5fded68 in SQL_EXEC_Prepare2 (statement_id=0x19750e0,
    sql_source=0x1c36200, gencode_ptr=0x0, gencode_len=0, ret_gencode_len=0x0,
    query_cost_info=<value optimized out>, comp_stats_info=0x7fffffff1ce0,
    uniqueStmtId=0x7fffffff2de0 "MXID11000027392212281554293506154000000000206U3333300_585___SQLCI_DML_LAST__\377\177", uniqueStmtIdLen=0x7fffffff3028,
    flags=129) at ../cli/CliExtern.cpp:4963
#24 0x00007ffff79d5def in SqlCmd::do_prepare (sqlci_env=0xb93e60,
    prep_stmt=0x233cd90,
    sqlStmt=0x2174c70 "insert into vtmp2 (select b,c,d,a+12 from  vtmp1) order by 2,3,4,1;", resetLastExecStmt=1, rsIndex=-53792, prepcode=0x7fffffff30fc,
    statisticsType=0x7fffffff30f8) at ../sqlci/SqlCmd.cpp:893
#25 0x00007ffff79d51f0 in DML::process (this=0x2170360, sqlci_env=0xb93e60)
    at ../sqlci/SqlCmd.cpp:2803
#26 0x00007ffff79bbad4 in Obey::process (this=0x2381890,
    sqlci_env=<value optimized out>) at ../sqlci/Obey.cpp:264
#27 0x00007ffff79c1fe6 in SqlciEnv::executeCommands (this=0xb93e60,
    input_stmt=@0x7fffffff32e8) at ../sqlci/SqlciEnv.cpp:847
#28 0x00007ffff79c408b in SqlciEnv::run (this=0xb93e60)
    at ../sqlci/SqlciEnv.cpp:656
#29 0x0000000000401ab1 in main (argc=1, argv=0x7fffffff34b8)
    at ../bin/SqlciMain.cpp:319



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)