Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-26699

Row counter does not work consistently for Columnstore tables

    XMLWordPrintable

Details

    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.

      Attachments

        Issue Links

          Activity

            People

              rucha174 Rucha Deodhar
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.