SB_HISTOGRAMS table not found is incorrectly reported

Bug #1405235 reported by Roberta Marton
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Trafodion
Invalid
High
Barry Fritchman

Bug Description

There is a set of histogram tables created per schema. When update statistics is executed and the tables do not exist, update statistics creates them before continuing.

There is a regression where an error is returned indicating that the histogram tables do not exist when in fact they have been created.

To re-created:

*In one session, perform:

Create shared schema t132sch;

set schema t132sch;
get tables;

create table t132t1 (c1 int, c2 int);
create table t132t2 (c1 int, c2 int) attribute by sql_user1;
insert into t132t1 values (1,1), (2,2), (3,3),(4,4), (5,5),(6,6), (7,7),(8,8);
insert into t132t2 values (1,1), (2,2), (3,3),(4,4), (5,5),(6,6), (7,7),(8,8);

get tables;
select count(*) from t132t1;
select count(*) from t132t2;

*Log off and create a new sqlci session and do:

set schema t132sch;
update statistics for table t132t1 on every column;

*** ERROR[9200] UPDATE STATISTICS for table TRAFODION.T132SCH.T132T1 encountered an error (4082) from statement .

*** ERROR[4082] Object TRAFODION.T132SCH.SB_HISTOGRAMS does not exist or is inaccessible.

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

--- SQL operation failed with errors.

When putting the arkcmp that performs the update statistics into debug:

The code to create the histogram tables is being executed and tables are created. I can go to a different sqlci session and see the tables.

During stats collection, I am getting an internal error from the cli (8898) in Descriptor::setDescItem
The assertion in Descriptor::setDescItem is failing because the rowsetSize is 0.

#0 ComDiagsArea::insertNewError (this=0x7fffe9821830) at ../export/ComDiags.cpp:2807
#1 0x00007ffff6387d89 in ComDiagsArea::acceptNewCondition (this=0x7fffe9821830)
    at ../export/ComDiags.cpp:2824
#2 0x00007ffff6ed41c9 in operator<< (d=..., dgObj=...) at ../common/DgBaseType.cpp:139
#3 0x00007ffff762df34 in Descriptor::setDescItem (this=0x7fffe8dec2f0, entry=0,
    what_to_set=36, numeric_value=140737488313360, string_value=0x0, info_desc=0x0,
    info_desc_index=0) at ../cli/Descriptor.cpp:2702
#4 0x00007ffff75e5724 in SQLCLI_SetRowsetDescPointers(CliGlobals *, SQLDESC_ID *, Lng32, Lng32 *, Lng32, Lng32, typedef __va_list_tag __va_list_tag *, SQLCLI_QUAD_FIELDS *) (
   cliGlobals=0xb9ed80, desc_id=0x7fffdbf6b9d0, rowset_size=0,
    rowset_status_ptr=0x7fffffff5c10, starting_entry=1, num_quadruple_fields=3, ap=0x0,
    quad_fields=0x7fffdcbab1b0) at ../cli/Cli.cpp:1857
#5 0x00007ffff767cbf3 in SQL_EXEC_SETROWSETDESCPOINTERS (sql_descriptor=0x7fffdbf6b9d0,
    rowset_size=0, rowset_status_ptr=0x7fffffff5c10, starting_entry=1,
    num_quadruple_fields=3, quad_fields=0x7fffdcbab1b0) at ../cli/CliExtern.cpp:5602
#6 0x00007ffff5c42d19 in HSCursor::setRowsetPointers (this=0x7fffffff5df0, group=0x0,
    maxRows=0) at ../ustat/hs_cli.cpp:2880
#7 0x00007ffff5c7e1d1 in HSGlobalsClass::readColumnsIntoMem (this=0x7fffffff6750,
    cursor=0x7fffffff5df0, rows=8) at ../ustat/hs_globals.cpp:10626
#8 0x00007ffff5c6bb15 in HSGlobalsClass::CollectStatistics (this=0x7fffffff6750)
    at ../ustat/hs_globals.cpp:5404
#9 0x00007ffff5cdc53d in UpdateStats (
    input=0x7fffdcbe1808 "update statistics for table t132t1 on every column;",
    requestedByCompiler=0) at ../ustat/hs_update.cpp:421

The code continues processing and error 8898 comes again during HSCursor destruction:

ComDiagsArea::insertNewError (this=0x7fffe9821830) at ../export/ComDiags.cpp:2804
#1 0x00007ffff6387d89 in ComDiagsArea::acceptNewCondition (this=0x7fffe9821830)
    at ../export/ComDiags.cpp:2824
#2 0x00007ffff6388a98 in ComDiagsArea::mergeAfter (this=0x7fffe9821830, source=...)
    at ../export/ComDiags.cpp:3186
#3 0x00007ffff3478f7b in ex_root_tcb::cancel (this=0x7fffe8da91a0, glob=0x7fffe8dcc610,
    diagsArea=@0x7fffffff5a90, getQueueDiags=0) at ../executor/ex_root.cpp:2381
#4 0x00007ffff76576f6 in CliStatement::close (this=0x7fffe8da61e8, diagsArea=...,
    inRollback=0) at ../cli/Statement.cpp:1146
#5 0x00007ffff75e9abf in SQLCLI_PerformTasks(CliGlobals *, ULng32, SQLSTMT_ID *, SQLDESC_ID *, SQLDESC_ID *, Lng32, Lng32, typedef __va_list_tag __va_list_tag *, SQLCLI_PTR_PAIRS *, SQLCLI_PTR_PAIRS *) (cliGlobals=0xb9ed80, tasks=776, statement_id=0x7fffdcb93728,
    input_descriptor=0x0, output_descriptor=0x0, num_input_ptr_pairs=0,
    num_output_ptr_pairs=0, ap=0x0, input_ptr_pairs=0x0, output_ptr_pairs=0x0)
    at ../cli/Cli.cpp:3451
#6 0x00007ffff75e9d03 in SQLCLI_CloseStmt (cliGlobals=0xb9ed80,
    statement_id=0x7fffdcb93728) at ../cli/Cli.cpp:3504
#7 0x00007ffff76767e2 in SQL_EXEC_CloseStmt (statement_id=0x7fffdcb93728)
    at ../cli/CliExtern.cpp:1404
#8 0x00007ffff5c4114d in HSCursor::~HSCursor (this=0x7fffffff5df0,
    __in_chrg=<value optimized out>) at ../ustat/hs_cli.cpp:2573
#9 0x00007ffff5c6bfbc in HSGlobalsClass::CollectStatistics (this=0x7fffffff6750)
    at ../ustat/hs_globals.cpp:5397
#10 0x00007ffff5cdc53d in UpdateStats (
    input=0x7fffdcbe1808 "update statistics for table t132t1 on every column;",
    requestedByCompiler=0) at ../ustat/hs_update.cpp:421

Then flushStatistics is called and error 4082 is returned when trying to read histograms table. The error is coming back from the second arkcmp. I didn’t put the second arkcmp into debug so don’t know why it is failing to find the table. As I mentioned earlier, I can bring up a sqlci session at the same time and see these tables.

0x00007ffff767bce4 in SQL_EXEC_Prepare2 (statement_id=0x7fffdbf71460,
    sql_source=0x7fffdbf71498, gencode_ptr=0x0, gencode_len=0, ret_gencode_len=0x0,
    query_cost_info=0x7fffffff60b0, comp_stats_info=0x7fffffff4fb0, uniqueStmtId=0x0,
    uniqueStmtIdLen=0x0, flags=0) at ../cli/CliExtern.cpp:4958
#23 0x00007ffff5c4fa0d in HSCursor::prepareQuery (this=0x7fffffff6260,
    cliStr=0x17be068 "SELECT HISTOGRAM_ID, COL_POSITION, COLUMN_NUMBER, COLCOUNT, cast(READ_TIME as char(19)), REASON FROM TRAFODION.T132SCH.SB_HISTOGRAMS WHERE TABLE_UID = 36082714901494630 ORDER BY TABLE_UID, HISTOGRAM_I"..., numParams=0, numResults=6)
    at ../ustat/hs_cli.cpp:6052
#24 0x00007ffff5c74945 in HSGlobalsClass::groupListFromTable (this=0x7fffffff6750,
    groupList=@0x7fffffff6518, skipEmpty=0, exclusive=1) at ../ustat/hs_globals.cpp:7673
#25 0x00007ffff5c66e8e in HSGlobalsClass::MakeAllHistid (this=0x7fffffff6750)
    at ../ustat/hs_globals.cpp:4023
#26 0x00007ffff5c726e0 in HSGlobalsClass::FlushStatistics (this=0x7fffffff6750,
    statsWritten=@0x7fffffff6adc) at ../ustat/hs_globals.cpp:7179
#27 0x00007ffff5cdc774 in UpdateStats (
    input=0x7fffdcbe1808 "update statistics for table t132t1 on every column;",
    requestedByCompiler=0) at ../ustat/hs_update.cpp:444

Eventually 4082 is returned along with 9200 and 8822.

If I rerun the update statistics a second time in the same session, I get:

>>update statistics for table t132t1 on every column;

*** ERROR[1389] Object T132T1 does not exist in Trafodion.

*** ERROR[4082] Object TRAFODION.T132SCH.T132T1 does not exist or is inaccessible.

--- SQL operation failed with errors.

And if I rerun it a third time, it succeeds.

Tags: sql-security
Changed in trafodion:
assignee: nobody → Barry Fritchman (barry-fritchman)
importance: Undecided → High
Paul Low (paul-low-x)
Changed in trafodion:
milestone: none → r1.0
tags: added: sql-security
Changed in trafodion:
status: New → In Progress
Revision history for this message
Roberta Marton (roberta-marton) wrote :

This proved to be not a problem but an interim issue.

Changed in trafodion:
status: In Progress → Invalid
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.