[MCOL-698] Joining two text/longtext/blob/longblob columns returns an internal error. Created: 2017-05-03  Updated: 2017-05-05  Resolved: 2017-05-05

Status: Closed
Project: MariaDB ColumnStore
Component/s: ExeMgr
Affects Version/s: 1.1.0
Fix Version/s: 1.1.0

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

Issue Links:
Relates
relates to MCOL-267 TEXT and BLOB data types are not supp... Closed
Sprint: 2017-9

 Description   

Build tested:

[root@localhost mariadb-columnstore-server]# git show
commit 5a090c64bced6532578dd8910f15530fd37fce2c
Merge: 9efb0a7 b062156
Author: david hill <david.hill@mariadb.com>
Date: Thu Apr 27 16:13:15 2017 -0500

Merge pull request #45 from mariadb-corporation/FixPackageName

Change the package name to match engines format

[root@localhost mariadb-columnstore-server]# cd mariadb-columnstore-engine/
[root@localhost mariadb-columnstore-engine]# git show
commit cb788c0be215ad30e77e35298142fef43c61e70e
Merge: 775c605 de06c48
Author: dhall-InfiniDB <david.hall@mariadb.com>
Date: Wed May 3 09:43:29 2017 -0500

Merge pull request #163 from mariadb-corporation/MCOL-697

MCOL-697 Remove 64KB VARCHAR response limit

MariaDB [mytest]> truncate text1;
Query OK, 0 rows affected (0.10 sec)

MariaDB [mytest]> truncate text2;
Query OK, 0 rows affected (0.08 sec)

MariaDB [mytest]> insert into text1 values (1, "this is a test");
Query OK, 1 row affected (0.09 sec)

MariaDB [mytest]> insert into text2 values (1, "this is a test");
Query OK, 1 row affected (0.09 sec)

MariaDB [mytest]> select 'text1' as tableName, length(t1.c2) from text1 t1, text2 t2 where t1.c2 = t2.c2;
ERROR 1815 (HY000): Internal error: IDB-2035: An internal error occurred. Check the error log file & contact support.
MariaDB [mytest]> desc text1;
---------------------------------+

Field Type Null Key Default Extra

---------------------------------+

c1 int(11) YES   NULL  
c2 text YES   NULL  

---------------------------------+



 Comments   
Comment by Daniel Lee (Inactive) [ 2017-05-03 ]

Build tested:

[root@localhost mariadb-columnstore-server]# git show
commit 5a090c64bced6532578dd8910f15530fd37fce2c
Merge: 9efb0a7 b062156
Author: david hill <david.hill@mariadb.com>
Date: Thu Apr 27 16:13:15 2017 -0500

Merge pull request #45 from mariadb-corporation/FixPackageName

Change the package name to match engines format

[root@localhost mariadb-columnstore-server]# cd mariadb-columnstore-engine/
[root@localhost mariadb-columnstore-engine]# git show
commit 6915629c7308613cfa515b8592f09611288c767b
Merge: a79b674 132ef03
Author: benthompson15 <ben.thompson@mariadb.com>
Date: Wed May 3 16:45:25 2017 -0500

Merge pull request #166 from mariadb-corporation/fix-snappy-cpack

Fix cpack snappy dependency

I got the following error:

ERROR 1815 (HY000) at line 2: Internal error: std::bad_alloc

Comment by Daniel Lee (Inactive) [ 2017-05-03 ]

Reopen per my last comment.

Comment by Andrew Hutchings (Inactive) [ 2017-05-04 ]

This usually means you are out of memory. Please try on a machine with more RAM.

Comment by Andrew Hutchings (Inactive) [ 2017-05-04 ]

New review to deal with LONGTEXT eating all the RAM in the datacenter.

Comment by Daniel Lee (Inactive) [ 2017-05-04 ]

Build tested: Github source

[root@localhost mariadb-columnstore-server]# git show
commit 5a090c64bced6532578dd8910f15530fd37fce2c
Merge: 9efb0a7 b062156
Author: david hill <david.hill@mariadb.com>
Date: Thu Apr 27 16:13:15 2017 -0500

Merge pull request #45 from mariadb-corporation/FixPackageName

Change the package name to match engines format

[root@localhost mariadb-columnstore-server]# cd mariadb-columnstore-engine/
[root@localhost mariadb-columnstore-engine]# git show
commit 1c2a8fccf3f7d9a0b6dbd9279d7877e4f3adc16a
Merge: 6915629 e03267a
Author: dhall-InfiniDB <david.hall@mariadb.com>
Date: Wed May 3 17:18:49 2017 -0500

Merge pull request #164 from mariadb-corporation/MCOL-697

MCOL-697 Limit the return length for LONGBLOB

I was already using 18gb of memory.

I did another run and here is what I found:

There are the two queries I tested:

select 'longblob1' as tableName, length(c2) from longblob1 where c2 > ' ';
select 'longblob1' as tableName, length(t1.c2) from longblob1 t1, longblob2 t2 where t1.c2 = t2.c2;

where is c2 is one of the text/longtext/blob/longblob.

TEXT: worked
LONGTEXT: query #2 returned:" ERROR 1815 (HY000) at line 2: Internal error: std::bad_alloc". I have only 5 rows in each table. The expected result is 25 rows.

BLOB/LONGBLOB: Returned

> ERROR 1815 (HY000) at line 1: Internal error: VARBINARY/BLOB in filter or function is not supported.
> ERROR 1815 (HY000) at line 2: Internal error: IDB-2035: An internal error occurred. Check the error log file & contact support.

the err.log showed:
May 4 14:11:36 localhost Calpont[11341]: 36.201523 |0|0|0| E 00 CAL0000: /root/columnstore/mariadb-columnstore-server/mariadb-columnstore-engine/utils/rowgroup/rowgroup.h@532: assertion '0' failed
May 4 14:11:36 localhost joblist[11341]: 36.201667 |283|0|0| C 05 CAL0000: IDB-2035: An internal error occurred. Check the error log fi

The first error is expected since VARBINARY/BLOB are not supported in filter. The 2nd error is still an issue.

Comment by Daniel Lee (Inactive) [ 2017-05-04 ]

Build tested: Github source

[root@localhost mariadb-columnstore-server]# git show
commit bd13090ea83f35f125c1d103204c0070ae0f721b
Merge: abc4c52 f63ee30
Author: dhall-InfiniDB <david.hall@mariadb.com>
Date: Thu May 4 11:01:51 2017 -0500
Merge pull request #46 from mariadb-corporation/MCOL-693
MCOL-693 Fix non-string SP parameters
[root@localhost mariadb-columnstore-server]# cd mariadb-columnstore-engine/
[root@localhost mariadb-columnstore-engine]# git show
commit a6dfc3c366c861d5777a9931e18f594405e4aab6
Merge: 1c2a8fc 00cd7f4
Author: dhall-InfiniDB <david.hall@mariadb.com>
Date: Thu May 4 10:33:30 2017 -0500
Merge pull request #168 from mariadb-corporation/MCOL-698
MCOL-698 Fix joiner for LONGTEXT

Repeat the same tests

TEXT: Worked
LONGTEXT: No longer reported the bad_alloc error, but returned an empty set. 25 rows are expected
BLOB/LONGBLOB: As error were reported.

Comment by Daniel Lee (Inactive) [ 2017-05-04 ]

I used the following tables for me tests:

drop table if exists text1;
drop table if exists blob1;
drop table if exists longtext1;
drop table if exists longblob1;
create table text1 (c1 int, c2 text) engine=columnstore;
create table blob1 (c1 int, c2 blob) engine=columnstore;
create table longtext1 (c1 int, c2 longtext) engine=columnstore;
create table longblob1 (c1 int, c2 longblob) engine=columnstore;
#
drop table if exists text2;
drop table if exists blob2;
drop table if exists longtext2;
drop table if exists longblob2;
create table text2 (c1 int, c2 text) engine=columnstore;
create table blob2 (c1 int, c2 blob) engine=columnstore;
create table longtext2 (c1 int, c2 longtext) engine=columnstore;
create table longblob2 (c1 int, c2 longblob) engine=columnstore;

having one row should work the same, expect two rows back from the join

select 'longtext1' as tableName, length(t1.c2) from longtext1 t1, longtext2 t2 where t1.c2 = t2.c2

For BLOB/LONGBLOB, we should handle the condition better, instead of just return an internal error. If such joins joins are not reasonable and it is not supported, then we need failed the query and indicate as such.

Comment by Daniel Lee (Inactive) [ 2017-05-04 ]

Created MCOL-701 for the better error msg request for BLOB/LONGBLOB.

Comment by Andrew Hutchings (Inactive) [ 2017-05-05 ]

Can't reproduce your longtext problem:

MariaDB [test]> create table longtext1 (c1 int, c2 longtext) engine=columnstore;
Query OK, 0 rows affected (0.28 sec)
 
MariaDB [test]> create table longtext2 (c1 int, c2 longtext) engine=columnstore; 
Query OK, 0 rows affected (0.44 sec)
 
MariaDB [test]> insert into longtext1 values (1, 'hello world');
Query OK, 1 row affected (0.17 sec)
 
MariaDB [test]> insert into longtext2 values (1, 'hello world');
Query OK, 1 row affected (0.25 sec)
 
MariaDB [test]> select * from longtext1 t1, longtext2 t2 where t1.c2 = t2.c2;
+------+-------------+------+-------------+
| c1   | c2          | c1   | c2          |
+------+-------------+------+-------------+
|    1 | hello world |    1 | hello world |
+------+-------------+------+-------------+
1 row in set (1.56 sec)
 
MariaDB [test]> select 'longtext1' as tableName, length(t1.c2) from longtext1 t1, longtext2 t2 where t1.c2 = t2.c2;
+-----------+---------------+
| tableName | length(t1.c2) |
+-----------+---------------+
| longtext1 |            11 |
+-----------+---------------+
1 row in set (0.83 sec)

Comment by Daniel Lee (Inactive) [ 2017-05-05 ]

[root@localhost ~]# cd tests
[root@localhost tests]# mcsmysql mytest < longtext.n.insert.sql
tableName length(c2)
longtext1 120000
longtext1 120000
longtext1 120000
longtext1 120000
longtext1 120000
tableName length(c2)
longtext2 120000
longtext2 120000
longtext2 120000
longtext2 120000
longtext2 120000
[root@localhost tests]# mcsmysql mytest
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 293
Server version: 10.2.5-MariaDB-log Columnstore 1.1.0-1

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [mytest]> select count from longtext2;
----------

count

----------

5

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

MariaDB [mytest]> select count from longtext1;
----------

count

----------

5

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

MariaDB [mytest]> select 'longtext1' as tableName, length(t1.c2) from longtext1 t1, longtext2 t2 where t1.c2 = t2.c2;
Empty set (1.17 sec)

MariaDB [mytest]>

Comment by Daniel Lee (Inactive) [ 2017-05-05 ]

It worked with shorter strings.

If we cannot handle the query for whatever reason, we need to error it out with appropriate error messages, instead of silently returning an empty set.

MariaDB [mytest]> update longtext1 set c2 = 'Hello world';
Query OK, 5 rows affected (0.07 sec)
Rows matched: 0 Changed: 0 Warnings: 0

MariaDB [mytest]> update longtext2 set c2 = 'Hello world';
Query OK, 5 rows affected (0.15 sec)
Rows matched: 0 Changed: 0 Warnings: 0

MariaDB [mytest]> select 'longtext1' as tableName, length(t1.c2) from longtext1 t1, longtext2 t2 where t1.c2 = t2.c2;
------------------------+

tableName length(t1.c2)

------------------------+

longtext1 11
longtext1 11
longtext1 11
longtext1 11
longtext1 11
longtext1 11
longtext1 11
longtext1 11
longtext1 11
longtext1 11
longtext1 11
longtext1 11
longtext1 11
longtext1 11
longtext1 11
longtext1 11
longtext1 11
longtext1 11
longtext1 11
longtext1 11
longtext1 11
longtext1 11
longtext1 11
longtext1 11
longtext1 11

------------------------+
25 rows in set (1.25 sec)

Comment by Daniel Lee (Inactive) [ 2017-05-05 ]

Per my last comment

Comment by Andrew Hutchings (Inactive) [ 2017-05-05 ]

New review to error on joins with > 64KB of key data. New behaviour when this is attempted:

MariaDB [test]> select length(c2) from longtext2;
+------------+
| length(c2) |
+------------+
|         11 |
|      80000 |
+------------+
2 rows in set (0.44 sec)
 
MariaDB [test]> select 'longtext1' as tableName, length(t1.c2) from longtext1 t1, longtext2 t2 where t1.c2 = t2.c2;
ERROR 1815 (HY000): Internal error: Cannot join strings greater than 64KB

Comment by Daniel Lee (Inactive) [ 2017-05-05 ]

Build verified: Github source

[root@localhost mariadb-columnstore-server]# git show
commit 349cae544b6bc71910267a3b3b0fa3fb57b0a587
Merge: bd13090 2ecb85c
Author: benthompson15 <ben.thompson@mariadb.com>
Date: Thu May 4 16:06:16 2017 -0500

Merge pull request #50 from mariadb-corporation/10.2-fixes

10.2 fixes

[root@localhost mariadb-columnstore-server]# cd mariadb-columnstore-engine/
[root@localhost mariadb-columnstore-engine]# git show
commit 19342efe5796be22764cde32d9d07de2fb4cee36
Merge: a6dfc3c 33ed669
Author: dhall-InfiniDB <david.hall@mariadb.com>
Date: Fri May 5 09:42:07 2017 -0500

Merge pull request #170 from mariadb-corporation/MCOL-698

MCOL-698 Stop joins bigger than 64KB

> ERROR 1815 (HY000) at line 2: Internal error: Cannot join strings greater than 64KB

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