Some ODBC api tests fail with sql error Unknown PCode instruction

Bug #1323865 reported by Aruna Sadashiva
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Trafodion
Fix Released
High
James Capps

Bug Description

Some ODBC API tests fail with this error:

[Trafodion ODBC Driver][Trafodion Database] SQL ERROR:*** ERROR[2006] Internal error: assertion failure (Unknown PCode Instruction) in file ../exp/ExpPCode.cpp at line 1199.

It worked when pcode was turned off with "cqd pcode_opt_level 'OFF'".

Relevant SQL stmts used by this test are below, it fails during prepare of insert stmt.

drop table UJZ6R0EHYY;
create table UJZ6R0EHYY(RLUJZ6R0EH CHAR(10) CHARACTER SET ISO88591,WP4VDZAWNV VARCHAR(10) CHARACTER SET ISO88591,VT2DEURLUJ DECIMAL(10,5),Z6R0EHYYFC NUMERIC(10,5),TCBMMOHJ7F SMALLINT,LPIOBAI9_S INTEGER,NQ3KXGK5QS REAL,X1GWP4VDZA FLOAT,WNVT2DEURL DOUBLE PRECISION,YYFCTCBMMO DATE,HJ7FLPIOBA TIME,I9_S8NQ3KX TIMESTAMP,GK5QSX1GWP bigint,VDZAWNVT2D LONG VARCHAR CHARACTER SET ISO88591,EURLUJZ6R0 CHAR(10) CHARACTER SET UCS2,EHYYFCTCBM VARCHAR(10) CHARACTER SET UCS2,MOHJ7FLPIO LONG VARCHAR CHARACTER SET UCS2,BAI9_S8NQ3 NUMERIC(19,0),KXGK5QSX1G NUMERIC(19,6),T2DEURLUJZ NUMERIC(128,0),R0EHYYFCTC NUMERIC(128,128),BMMOHJ7FLP NUMERIC(128,64),IOBAI9_S8N NUMERIC(10,5) UNSIGNED,Q3KXGK5QSX NUMERIC(18,5) UNSIGNED,GWP4VDZAWN NUMERIC(30,10) UNSIGNED) NO PARTITION;
insert into UJZ6R0EHYY (RLUJZ6R0EH,WP4VDZAWNV,VT2DEURLUJ,Z6R0EHYYFC,TCBMMOHJ7F,LPIOBAI9_S,NQ3KXGK5QS,X1GWP4VDZA,WNVT2DEURL,YYFCTCBMMO,HJ7FLPIOBA,I9_S8NQ3KX,GK5QSX1GWP,VDZAWNVT2D,EURLUJZ6R0,EHYYFCTCBM,MOHJ7FLPIO,BAI9_S8NQ3,KXGK5QSX1G,T2DEURLUJZ,R0EHYYFCTC,BMMOHJ7FLP,IOBAI9_S8N,Q3KXGK5QSX,GWP4VDZAWN) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);

Tags: sql-exe
Changed in trafodion:
assignee: nobody → Jim Capp (jcapp)
Changed in trafodion:
assignee: Jim Capp (jcapp) → nobody
assignee: nobody → James Capps (james-capps)
information type: Proprietary → Public
Revision history for this message
Sandhya Sundaresan (sandhya-sundaresan) wrote :

Jim is waiting for a reproducible test case for this . Marking it Incomplete so reporter can provide that.

Changed in trafodion:
status: New → Incomplete
Changed in trafodion:
importance: High → Medium
Changed in trafodion:
importance: Medium → High
Changed in trafodion:
status: Incomplete → In Progress
Revision history for this message
James Capps (james-capps) wrote :

I had QA run a UTT with some debug code to force a core dump at the time that PCode::getInstruction(...) detects that the current PCode instruction is not valid. When a looked at the core dump, I found that we were doing the pcode generation for an hbase expr. So, this appears to be a problem introduced with the PCode changes for hbase and not a problem that existed in the past.

I also found that the current PCode instruction was a EQ comparison instruction with only 1 operand. All comparison-type pcode instructions should have at least 3 operands ... two to actually compare and one for where to store the result of the comparison.
I believe this is why the PCode::getInstruction(...) method decided that the instruction was invalid.

So, the next step is to figure out how we managed to generate an EQ comparison instruction with only 1 operand. This may involve building a new UTT which more debug code to catch the problem sooner, but that remains to be seen.

Changed in trafodion:
milestone: none → r1.1
Revision history for this message
James Capps (james-capps) wrote :

During PCODE generation, we were attempting to generate a PCODE instruction to compare two operands for equality. The two operands had a data type of REC_BYTE_V_ASCII_LONG which is used only by ODBC. PCIT::getMemoryAddressingMode() does not currently know how to handle that datatype so it returned AM_NONE for the operand type. That resulted in a failure later.

Fix was to detect the operand(s) of that datatype and call
ex_clause::pCodeGenerate(...) rather than doing PCODE generation of the current expression.

Note: Also found a line saying
      return ex_clause::pCodeGenerate(space, f);
      which has been missing for a long time. We got away with it
      because the preceding 'if' was always false for Trafodion.

Files changed:
.../exp/ExpPCodeClauseGen.cpp

Changed in trafodion:
status: In Progress → Fix Committed
Revision history for this message
Aruna Sadashiva (aruna-sadashiva) wrote :

Jieping tseted this and it works ok now.

Changed in trafodion:
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.