insert into salt table fails with ERROR[1123]

Bug #1315567 reported by Julie Thai
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Trafodion
Fix Released
High
Hans Zeller

Bug Description

Create salt table with primary key on varchar ucs2 column. Insert into salt table fails with ERROR[1123].

From sqlci:
>>CREATE TABLE f00(
+> colkey int not null,
+> colvchrucs2 varchar(100) character set ucs2 not null,
+> primary key (colvchrucs2))
+> salt using 3 partitions;

--- SQL operation complete.
>>
>>INSERT INTO f00 VALUES (1, 'abcde'), (2, 'fghij'), (3, 'klmnopqrs'), (4, 'tuvwxyz'), (5, 'abc@#$%^&*()efgh');

*** ERROR[1123] Not all of the partition key values () for object TRAFODION.SEABASE.F00 could be processed. Please verify that the correct key value data types were specified.

*** ERROR[8822] The statement was not prepared.

>>
>>CREATE TABLE f01(
+> colkey int not null,
+> colvchrucs2 varchar(100) character set ucs2 not null,
+> primary key (colvchrucs2));

--- SQL operation complete.
>>
>>INSERT INTO f01 VALUES (1, 'abcde'), (2, 'fghij'), (3, 'klmnopqrs'), (4, 'tuvwxyz'), (5, 'abc@#$%^&*()efgh');

--- 5 row(s) inserted.

MY_SQROOT=/opt/home/thaiju/datalake_64_1
who@<email address hidden>
JAVA_HOME=/opt/home/tools/jdk1.7.0_09_64
linux=2.6.32-279.el6.x86_64
redhat=6.3
Release 0.7.0 (Build release [39961], branch 39961-project/datalake_64_1, date 02May14)

To reproduce, in sqlci issue:
DROP TABLE f00;
DROP TABLE f01;
CREATE TABLE f00(
               colkey int not null,
               colvchrucs2 varchar(100) character set ucs2 not null,
               primary key (colvchrucs2))
               salt using 3 partitions;

INSERT INTO f00 VALUES (1, 'abcde'), (2, 'fghij'), (3, 'klmnopqrs'), (4, 'tuvwxyz'), (5, 'abc@#$%^&*()efgh');

CREATE TABLE f01(
               colkey int not null,
               colvchrucs2 varchar(100) character set ucs2 not null,
               primary key (colvchrucs2));

INSERT INTO f01 VALUES (1, 'abcde'), (2, 'fghij'), (3, 'klmnopqrs'), (4, 'tuvwxyz'), (5, 'abc@#$%^&*()efgh');
Also, try showddl and invoke.
Then rerun reproducible script again but this time with primary key DESCENDING.
Again, try showddl and invoke.

Tags: sql-general
Revision history for this message
Julie Thai (julie-y-thai) wrote :

>>CREATE TABLE f00(
               colkey int not null,
               colvchrucs2 varchar(100) character set ucs2 not null,
               primary key (colvchrucs2))
               salt using 3 partitions;+>+>+>+>

--- SQL operation complete.
>>showddl f00;

*** ERROR[1123] Not all of the partition key values () for object TRAFODION.SEABASE.F00 could be processed. Please verify that the correct key value data types were specified.

--- SQL operation failed with errors.
>>invoke f00;

*** ERROR[1123] Not all of the partition key values () for object TRAFODION.SEABASE.F00 could be processed. Please verify that the correct key value data types were specified.

--- SQL operation failed with errors.
>>drop table f00;

*** ERROR[1389] Object TRAFODION.SEABASE.F00 does not exist in Trafodion.

--- SQL operation failed with errors.

Revision history for this message
Julie Thai (julie-y-thai) wrote :
Download full text (7.8 KiB)

On RC2 (0606_0930), if primary key is varchar ucs2 DESCENDNG, sqlci generates core:
>>CREATE TABLE f00(
+> colkey int not null,
+> colvchrucs2 varchar(100) character set ucs2 not null,
+> primary key (colvchrucs2))
+>salt using 3 partitions;

--- SQL operation complete.
>>
>>invoke f00;

-- Definition of Trafodion table TRAFODION.SEABASE.F00
-- Definition current Mon Jun 9 20:27:05 2014

  (
    "_SALT_" INT UNSIGNED NO DEFAULT NOT NULL NOT
      DROPPABLE
  , COLKEY INT NO DEFAULT NOT NULL NOT DROPPABLE
  , COLVCHRUCS2 VARCHAR(100) CHARACTER SET UCS2 COLLATE
      DEFAULT NO DEFAULT NOT NULL NOT DROPPABLE
  )
  PRIMARY KEY ("_SALT_" ASC, COLVCHRUCS2 ASC)

--- SQL operation complete.
>>
>>CREATE TABLE f01(
+> colkey int not null,
+> colvchrucs2 varchar(100) character set ucs2 not null,
+> primary key (colvchrucs2 DESC))
+>salt using 3 partitions;

--- SQL operation complete.
>>
>>invoke f01;
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00007ffff044db64, pid=21479, tid=140737185401568
#
# JRE version: 7.0_09-b05
# Java VM: Java HotSpot(TM) 64-Bit Server VM (23.5-b02 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C [liboptimizer.so+0x729b64] RangePartitionBoundaries::getOptimizedNumberOfPartKeys()+0x34
#
# Core dump written. Default location: /opt/home/thaiju/core or core.21479
#
# An error report file with more information is saved as:
# /opt/home/thaiju/hs_err_pid21479.log
#
# If you would like to submit a bug report, please visit:
# http://bugreport.sun.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
Aborted (core dumped)

Callstack in sqlci core:
#0 0x00000033088328a5 in raise () from /lib64/libc.so.6
#1 0x0000003308834085 in abort () from /lib64/libc.so.6
#2 0x00007ffff6f5a455 in os::abort(bool) ()
   from /opt/home/tools/jdk1.7.0_09_64/jre/lib/amd64/server/libjvm.so
#3 0x00007ffff70ba717 in VMError::report_and_die() ()
   from /opt/home/tools/jdk1.7.0_09_64/jre/lib/amd64/server/libjvm.so
#4 0x00007ffff6f5df60 in JVM_handle_linux_signal ()
   from /opt/home/tools/jdk1.7.0_09_64/jre/lib/amd64/server/libjvm.so
#5 <signal handler called>
#6 0x00007ffff044db64 in RangePartitionBoundaries::getOptimizedNumberOfPartKeys (this=<value optimized out>) at ../optimizer/PartFunc.cpp:3170
#7 0x00007ffff045f60b in RangePartitioningFunction::createPartitioningFunctionForIndexDesc (this=0x7fffd8ebaa48, idesc=0x7fffd8e938b0)
    at ../optimizer/PartFunc.cpp:4166
#8 0x00007ffff01ecf08 in IndexDesc::IndexDesc (this=0x7fffd8e938b0, tdesc=
    0x7fffd8e86f40, fileSet=0x7fffd8ebacc0, cmpContext=0x7fffd8ebacc0)
    at ../optimizer/IndexDesc.cpp:237
#9 0x00007ffff00bb89e in createTableDesc2 (bindWA=<value optimized out>,
    naTable=0x7fffd8eae878, corrName=..., hint=0x0)
    at ../optimizer/BindRelExpr.cpp:1582
#10 0x00007ffff00bd00f in BindWA::createTableDesc (this=0x7ffffffec730,
    naTable=0x7fffd8eae878, corrName=..., catmanCollectUsages=0,
    hint=<value optimized out>) at ../optimizer/BindRelExpr.cp...

Read more...

description: updated
information type: Proprietary → Public
Changed in trafodion:
status: New → In Progress
Revision history for this message
Hans Zeller (hans-zeller) wrote :
Download full text (6.5 KiB)

Looks like the initial problems, reported on 05-02 and 05-14 are fixed in the meantime, probably by fixes for UCS2 columns that Qifan added. The last problem, the core dump reported on 06-09, remains. What happens there is that for the descending UCS2 column, we put a 0xFFFF wide character into one of the split key constants, and that gets interpreted in the Unicode lexer as an EOF. The fix is probably not to use 0xFFFF as a character, but instead to use the hex string form.

We only see this issue on the second statement, because only during the second statement do we parse this string. Here is the stack trace:

 yyULexer::constructStringLiteralWithCharSet (this=0x1be2af0, isHex=0, cs=CharInfo::UNICODE, lvalp=0x7ffffffd93d0, quote=39 L'\047') at ../parser/ulexer.cpp:848
#1 0x00007ffff058dd9a in yyULexer::arkcmplex (this=0x1be2af0, lvalp=0x7ffffffd93d0) at ../parser/ulexer.cpp:1094
#2 0x00007ffff12ad5c3 in Parser::arkcmplex (this=0x7ffffffef160, lvalp=0x7ffffffd93d0) at ../sqlcomp/parser.h:166
#3 0x00007ffff12acf3c in arkcmplex (lvalp=0x7ffffffd93d0) at ../sqlcomp/parser.cpp:1646
#4 0x00007ffff04bbe9a in arkcmpparse () at parser/linux/64bit/debug/sqlparser.cpp:41442
#5 0x00007ffff12a9ad7 in Parser::parseSQL (this=0x7ffffffef160, node=0x7ffffffef010, internalExpr=1, paramItemList=0x0) at ../sqlcomp/parser.cpp:748
#6 0x00007ffff12aa78b in Parser::parseDML (this=0x7ffffffef160, instr=0x7fffd80e5060 "2,_UCS2'\357\277\210", '\357\277\277' <repeats 49 times>, "';", inlen=160, charset=CharInfo::UTF8, node=0x7ffffffef010, internalExpr=1, paramItemList=0x0) at ../sqlcomp/parser.cpp:952
#7 0x00007ffff12ab52c in Parser::getExprTree (this=0x7ffffffef160, str=0x7fffd80e5060 "2,_UCS2'\357\277\210", '\357\277\277' <repeats 49 times>, "';", strlength=160, strCharSet=CharInfo::UTF8, num_params=0, p1=0x0, p2=0x0, p3=0x0, p4=0x0, p5=0x0, p6=0x0, otherParams=0x0, internal_expr=1) at ../sqlcomp/parser.cpp:1174
#8 0x00007ffff12ab92b in Parser::getItemExprTree (this=0x7ffffffef160, str=0x7fffd80e5060 "2,_UCS2'\357\277\210", '\357\277\277' <repeats 49 times>, "';", len=160, strCharSet=CharInfo::UTF8, num_params=0, p1=0x0, p2=0x0, p3=0x0, p4=0x0, p5=0x0, p6=0x0, paramItemList=0x0) at ../sqlcomp/parser.cpp:1260
#9 0x00007fffef9dd298 in getRangePartitionBoundaryValues (keyValueBuffer=0x1bdc2e8 "2,_UCS2'\357\277\210", '\357\277\277' <repeats 49 times>, "'", keyValueBufferSize=159, heap=0x7fffd812a988, strCharSet=CharInfo::UTF8) at ../optimizer/NATable.cpp:1359
#10 0x00007fffefb1d2c1 in RangePartitionBoundaries::setupForStatement (this=0x7fffd8127a50, useStringVersion=1) at ../optimizer/PartFunc.cpp:3601
#11 0x00007fffefb2098c in RangePartitioningFunction::setupForStatement (this=0x7fffd81039a8) at ../optimizer/PartFunc.cpp:4573
#12 0x00007fffef9cee43 in NAFileSet::setupForStatement (this=0x7fffd8103c20) at ../optimizer/NAFileSet.cpp:249
#13 0x00007fffef9ec37c in NATable::setupForStatement (this=0x7fffd8126268) at ../optimizer/NATable.cpp:6146
#14 0x00007fffef9f0773 in NATableDB::get (this=0x7fffe7b09660, corrName=..., bindWA=0x7fffffff1430, inTableDescStruct=0x0) at ../optimizer/NATable.cpp:7229
#15 0x00007fffef75727a in BindWA::getNATable (this=0x7fffffff1430,...

Read more...

Revision history for this message
Hans Zeller (hans-zeller) wrote :

Fix was delivered on July 24: https://review.trafodion.org/116

Changed in trafodion:
status: In Progress → Fix Committed
Changed in trafodion:
milestone: none → r0.8
status: Fix Committed → Fix Released
Changed in trafodion:
milestone: r0.8 → r0.9
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.