Uploaded image for project: 'Apache Trafodion (Retired)'
  1. Apache Trafodion (Retired)
  2. TRAFODION-2767

Select count(*) from a renamed table should return error 4082 instead of error 8448

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Cannot Reproduce
    • 2.2.0
    • 2.2.0
    • sql-cmp
    • None

    Description

      Select count from a table that has been renamed now returns a 8448 error with a hbase stack. This used to return a proper 4082 error:

      SQL>select count from mytable1;

          • ERROR[4082] Object TRAFODION.MYTEST.MYTABLE1 does not exist or is inaccessible. [2017-08-30 15:47:07]

      This is a regression introduced sometime between the 20170824 daily build and the 20170901 daily build. The 4082 error was still seen in the 20170824 daily build. The same regression is also seen in R2.2.4 20170830 daily build. It also only occurs with the select count statement, as select and showddl both still return the 4082 error, as shown here:

      >>drop schema if exists mytest cascade;

      — SQL operation complete.
      >>create schema mytest;

      — SQL operation complete.
      >>set schema mytest;

      — SQL operation complete.
      >>
      >>create table mytable1 (a int);

      — SQL operation complete.
      >>insert into mytable1 values (1),(2),(3);

      — 3 row(s) inserted.
      >>
      >>select count from mytable1;

      (EXPR)
      --------------------

      3

      — 1 row(s) selected.
      >>
      >>alter table mytable1 rename to mytable2;

      — SQL operation complete.
      >>
      >>showddl mytable1;

          • ERROR[4082] Object TRAFODION.MYTEST.MYTABLE1 does not exist or is inaccessible.

      — SQL operation failed with errors.
      >>select * from mytable1;

          • ERROR[4082] Object TRAFODION.MYTEST.MYTABLE1 does not exist or is inaccessible.
          • ERROR[8822] The statement was not prepared.

      >>select count from mytable1;

          • ERROR[8448] Unable to access Hbase interface. Call to ExpHbaseInterface::coProcAggr returned error HBASE_ACCESS_ERROR(-706). Cause: org.apache.hadoop.hbase.TableNotFoundException: TRAFODION.MYTEST.MYTABLE1
            org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.locateRegionInMeta(ConnectionManager.java:1264)
            org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.locateRegion(ConnectionManager.java:1162)
            org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.locateRegion(ConnectionManager.java:1146)
            org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.locateRegion(ConnectionManager.java:1103)
            org.apache.hadoop.hbase.client.ConnectionManager$HConnectionImplementation.getRegionLocation(ConnectionManager.java:938)
            org.apache.hadoop.hbase.client.HRegionLocator.getRegionLocation(HRegionLocator.java:83)
            org.apache.hadoop.hbase.client.HTable.getRegionLocation(HTable.java:504)
            org.apache.hadoop.hbase.client.HTable.getKeysAndRegionsInRange(HTable.java:747)
            org.apache.hadoop.hbase.client.HTable.getKeysAndRegionsInRange(HTable.java:717)
            org.apache.hadoop.hbase.client.HTable.getStartKeysInRange(HTable.java:1784)
            org.apache.hadoop.hbase.client.HTable.coprocessorService(HTable.java:1739)
            org.apache.hadoop.hbase.client.coprocessor.AggregationClient.rowCount(AggregationClient.java:319)
            org.apache.hadoop.hbase.client.coprocessor.AggregationClient.rowCount(AggregationClient.java:285)
            org.trafodion.sql.HTableClient.coProcAggr(HTableClient.java:2064).

      — 0 row(s) selected.
      >>
      >>drop schema mytest cascade;

      — SQL operation complete.

      ----- To reproduce

      drop schema if exists mytest cascade;
      create schema mytest;
      set schema mytest;

      create table mytable1 (a int);
      insert into mytable1 values (1),(2),(3);

      select count from mytable1;

      alter table mytable1 rename to mytable2;

      showddl mytable1;
      select * from mytable1;
      select count from mytable1;

      drop schema mytest cascade;

      ---- Analysis
      As Anoop said, when CoProc plan is chosen objectuid was not being added to root tdb. Adding the object uid is necessary as this is used to invalidate query cache upon a DDL change and to invalidate prepared plans held by executor as well. After adding objectuid of table to root tdb we get the expected error messages.

      >>select count from mytable1;

          • ERROR[4082] Object TRAFODION.MYTEST.MYTABLE1 does not exist or is inaccessible.
          • ERROR[8822] The statement was not prepared.

      – s1 was prepared before the alter statement as select count from mytable1
      >>execute s1 ;

          • ERROR[4082] Object TRAFODION.MYTEST.MYTABLE1 does not exist or is inaccessible.
          • ERROR[8822] The statement was not prepared.

      — 0 row(s) selected.

      A simpler way to detect this problem is took for ObjectUIDs in explain output. If they are missing for a Trafodion table, the we will see this problem. Current output of explain is below. Note the line under ROOT with ObjectUIDs.

      ------------------------------------------------------------------ PLAN SUMMARY
      MODULE_NAME .............. DYNAMICALLY COMPILED
      STATEMENT_NAME ........... S1
      PLAN_ID .................. 212373989857170229
      ROWS_OUT ................. 1
      EST_TOTAL_COST ........... 0.01
      STATEMENT ................ select count from mytable1;

      ------------------------------------------------------------------ NODE LISTING
      ROOT ====================================== SEQ_NO 2 ONLY CHILD 1
      REQUESTS_IN .............. 1
      ROWS_OUT ................. 1
      EST_OPER_COST ............ 0
      EST_TOTAL_COST ........... 0.01
      DESCRIPTION
      est_memory_per_node .... 10240.00(Limit), 0.00(BMOs), 0.00(nBMOs) MB
      max_card_est ........... 1
      fragment_id ............ 0
      parent_frag ............ (none)
      fragment_type .......... master
      record_length .......... 8
      statement_index ........ 0
      affinity_value ......... 0
      max_max_cardinality 100
      total_overflow_size .... 0.00 KB
      xn_access_mode ......... read_only
      xn_autoabort_interval 0
      auto_query_retry ....... enabled
      plan_version ....... 2,600
      embedded_arkcmp ........ used
      ObjectUIDs ............. 7043208724545270591
      select_list ............ count(1 )

      HBASE_AGGR ================================ SEQ_NO 1 NO CHILDREN
      REQUESTS_IN .............. (not found)
      ROWS_OUT ................. 1
      EST_OPER_COST ............ 0
      EST_TOTAL_COST ........... 0
      DESCRIPTION
      max_card_est ........... 1
      fragment_id ............ 0
      parent_frag ............ (none)
      fragment_type .......... master
      record_length .......... 8
      aggregates ............. count(1 )

      Attachments

        Activity

          People

            suresh_subbiah Suresh Subbiah
            suresh_subbiah Suresh Subbiah
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: