[MDEV-26699] Row counter does not work consistently for Columnstore tables Created: 2021-09-27  Updated: 2021-10-13

Status: Open
Project: MariaDB Server
Component/s: Documentation, Server, Storage Engine - ColumnStore
Affects Version/s: 10.5, 10.6, 10.7
Fix Version/s: N/A

Type: Bug Priority: Minor
Reporter: Elena Stepanova Assignee: Rucha Deodhar
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Problem/Incident
is caused by MDEV-10075 Provide index of error causing error ... Closed
Relates
relates to MCOL-4877 Too long values are silently truncate... Open
relates to MCOL-4879 Error code miscommunication between C... Open

 Description   

Below are some examples how the row counter can be right or wrong for Columnstore tables, and some loosely related MCOL bugs are linked. I don't expect it to be fixable on the server side or to be fixed on the Columnstore side, and I doubt we can spell any meaningful rules for the end users for when ERROR_INDEX works for Columnstore and when doesn't, so I lean towards passing it over straight to documentation to issue a blank statement that it cannot be relied upon when Columnstore is involved.

This works

10.7 8dd4794c4e1

MariaDB [db]> create table t (a tinyint) engine=Columnstore;
Query OK, 0 rows affected (0.661 sec)
 
MariaDB [db]> insert into t values (1),(200);
ERROR 1264 (22003): Out of range value for column 'a' at row 2
 
MariaDB [db]> set @n = null; get diagnostics condition 1 @n = error_index; select @n;
Query OK, 0 rows affected (0.001 sec)
 
Query OK, 0 rows affected (0.000 sec)
 
+------+
| @n   |
+------+
|    2 |
+------+
1 row in set (0.000 sec)

This doesn't:

MariaDB [db]> create table t (a tinyint) engine=Columnstore;
Query OK, 0 rows affected (0.701 sec)
 
MariaDB [db]> insert into t values (1),(100);
Query OK, 2 rows affected (0.530 sec)
Records: 2  Duplicates: 0  Warnings: 0
 
MariaDB [db]> update t set a = a*2;
ERROR 1264 (22003): CAL0002: IDB-2025: Data truncated for column 'a' 
MariaDB [db]> show warnings;
+-------+------+---------------------------------------------------------------------+
| Level | Code | Message                                                             |
+-------+------+---------------------------------------------------------------------+
| Error | 1264 | CAL0002: IDB-2025: Data truncated for column 'a'                    |
| Error | 1030 | Got error 1815 "Unknown error 1815" from storage engine ColumnStore |
+-------+------+---------------------------------------------------------------------+
2 rows in set (0.000 sec)
 
MariaDB [db]> set @n1 = null, @n2 = null; get diagnostics condition 1 @n1 = error_index; get diagnostics condition 2 @n2 = error_index; select @n1, @n2;
 
+------+------+
| @n1  | @n2  |
+------+------+
|    1 |    1 |
+------+------+
1 row in set (0.000 sec)

This also doesn't:

MariaDB [db]> insert into t select a * 2 from t;
ERROR 1264 (22003): Out of range value for column 'a' at row 1
MariaDB [db]> show warnings;
+-------+------+--------------------------------------------+
| Level | Code | Message                                    |
+-------+------+--------------------------------------------+
| Error | 1264 | Out of range value for column 'a' at row 1 |
+-------+------+--------------------------------------------+
1 row in set (0.001 sec)
 
MariaDB [db]> set @n = null; get diagnostics condition 1 @n = error_index; select @n;
Query OK, 0 rows affected (0.000 sec)
 
Query OK, 0 rows affected (0.000 sec)
 
+------+
| @n   |
+------+
|    1 |
+------+
1 row in set (0.000 sec)

It can also fail in a different way (MCOL-4879), which doesn't do any good to the counter either:

MariaDB [db]> insert into t select a * 2 from t;
ERROR 1815 (HY000): Internal error: Unknown error
MariaDB [db]> set @n = null; get diagnostics condition 1 @n = error_index; select @n;
Query OK, 0 rows affected (0.000 sec)
 
Query OK, 0 rows affected (0.000 sec)
 
+------+
| @n   |
+------+
|    1 |
+------+
1 row in set (0.000 sec)

I've set affected version to 10.5+ as I don't suppose the counter works any better than in 10.7, but I only tried 10.7. I don't think there is any place to document it for 10.5-10.6, but for the new diagnostics addition in 10.7 the mention of it may be suitable.


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