[MCOL-4264] [Cross-Engine] UPDATE to INNODB table with WHERE clause using Columnstore as sub query failing Created: 2020-08-21  Updated: 2022-01-06  Resolved: 2020-09-09

Status: Closed
Project: MariaDB ColumnStore
Component/s: N/A
Affects Version/s: 1.5.3
Fix Version/s: 5.4.1

Type: Bug Priority: Major
Reporter: suresh ramagiri Assignee: Daniel Lee (Inactive)
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MCOL-4955 [cross-engine] insert into innodbtabl... Open
Sprint: 2020-8

 Description   

UPDATE query to an innodb table with WHERE clause using the columnstore table as a sub query (Cross-engine query). Found that it errors as innodb table doesn't exist in Columnstore.

Test Results:

MariaDB [suresh]> create table cstab1 (a int, b varchar(10)) engine=columnstore;
Query OK, 0 rows affected (0.471 sec)
 
MariaDB [suresh]> create table innotab1 (a int, b varchar(10));
Query OK, 0 rows affected (0.011 sec)
 
MariaDB [suresh]> update innotab1 set a=100 where a not in (select a from cstab1 where a=1);
ERROR 1815 (HY000): Internal error: IDB-2006: 'suresh.innotab1' does not exist in Columnstore.
MariaDB [suresh]>
MariaDB [suresh]> select @@version;
+----------------+
| @@version      |
+----------------+
| 10.5.5-MariaDB |
+----------------+
1 row in set (0.001 sec)

But the same query, if we try to update an Columnstore table with WHERE clause using the innodb table as a sub query, is working.

MariaDB [suresh]> update cstab1 set a=100 where a not in (select a from innotab1 where a=11);
Query OK, 2 rows affected (0.366 sec)
Rows matched: 2 Changed: 2 Warnings: 0



 Comments   
Comment by Todd Stoffel (Inactive) [ 2020-08-25 ]

This does not reproduce:

[root@mcs1 /]# mariadb
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 12
Server version: 10.5.6-MariaDB MariaDB Server
 
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
 
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
 
MariaDB [(none)]> drop database test;
Query OK, 2 rows affected (0.179 sec)
 
MariaDB [(none)]> create database suresh;
Query OK, 1 row affected (0.001 sec)
 
MariaDB [(none)]> use suresh;
Database changed
MariaDB [suresh]> create table cstab1 (a int, b varchar(10)) engine=columnstore;
Query OK, 0 rows affected (2.748 sec)
 
MariaDB [suresh]> create table innotab1 (a int, b varchar(10));
Query OK, 0 rows affected (0.006 sec)
 
MariaDB [suresh]> update innotab1 set a=100 where a not in (select a from cstab1 where a=1);
Query OK, 0 rows affected (0.001 sec)
Rows matched: 0  Changed: 0  Warnings: 0
 
MariaDB [suresh]> update cstab1 set a=100 where a not in (select a from innotab1 where a=11);
Query OK, 0 rows affected (0.415 sec)
Rows matched: 0  Changed: 0  Warnings: 0
 
MariaDB [suresh]> select @@version;
+----------------+
| @@version      |
+----------------+
| 10.5.6-MariaDB |
+----------------+
1 row in set (0.000 sec)
 
MariaDB [suresh]>

Comment by suresh ramagiri [ 2020-08-26 ]

Looking some more, it sounds like on the empty tables, UPDATE to the INNODB table with WHERE clause using the CS Table as a subquery, getting executed.

My bad, in my repro steps, I should have mentioned to insert some data in those two tables and shown, then you would have reproduced the issue.

Repro results:

MariaDB [(none)]> create database suresh;
Query OK, 1 row affected (0.000 sec)

MariaDB [suresh]> create table cstab1 (a int, b varchar(10)) engine=columnstore;
Query OK, 0 rows affected (0.155 sec)

MariaDB [suresh]> create table innotab1 (a int, b varchar(10));
Query OK, 0 rows affected (0.004 sec)

      1. Empty tables, UPDATE works fine.
        MariaDB [suresh]> update innotab1 set a=100 where a not in (select a from cstab1 where a=1);
        Query OK, 0 rows affected (0.001 sec)
        Rows matched: 0 Changed: 0 Warnings: 0

MariaDB [suresh]> insert into cstab1 values (1,'aaa'),(2,'sas');
Query OK, 2 rows affected (0.117 sec)
Records: 2 Duplicates: 0 Warnings: 0

MariaDB [suresh]> insert into innotab1 values (11,'aaa'),(22,'sas');
Query OK, 2 rows affected (0.001 sec)
Records: 2 Duplicates: 0 Warnings: 0

MariaDB [suresh]> update innotab1 set a=100 where a not in (select a from cstab1 where a=1);
ERROR 1815 (HY000): Internal error: IDB-2006: 'suresh.innotab1' does not exist in Columnstore.
MariaDB [suresh]> select @@version;
----------------

@@version

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

10.5.5-MariaDB

----------------
1 row in set (0.000 sec)

Comment by Todd Stoffel (Inactive) [ 2020-08-26 ]

Ok bug confirmed.

This is the error:

Aug 26 00:55:30 mcs1 ExeMgr[2974]: 30.856268 |2147483659|0|0| D 16 CAL0041: Start SQL statement: select objectid from systable where schema='suresh' and tablename='innotab1' --tableRID/; ||

Comment by David Hall (Inactive) [ 2020-09-01 ]

Does not work in columnstore 1.2.6 – same result

Comment by Alexander Barkov [ 2020-09-03 ]

The same problem is repeatable with multi-table DELETE:

delete from innotab1  where a not in (select a from cstab1 where a=1);

ERROR 1815 (HY000): Internal error: IDB-2006: 'test.innotab1' does not exist in Columnstore.

Comment by Daniel Lee (Inactive) [ 2020-09-09 ]

Build verified: 1.5.4-1 (Drone #595)

Reproduced the issues in Drone build #587 and verified the fix in #595.

Generated at Thu Feb 08 02:49:02 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.