Uploaded image for project: 'MariaDB ColumnStore'
  1. MariaDB ColumnStore
  2. MCOL-1347

ALTER TABLE ADD COLUMN creates a column with incorrect width for a varchar columns.

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Fixed
    • 1.1.6, 1.2.2
    • 1.1.7
    • PrimProc
    • None
    • 2018-21

    Description

      There is a table used for ETL purposes, that is recreated on regular basis.
      Whilst processing select * from table limit 0,100, there was a failure:

      Apr 12 10:12:12 dbusa ExeMgr[74153]: 12.510096 |1855|0|0| D 16 CAL0041: Start SQL statement: select * from dbusa.table limit 0, 1000; |dbusa|
      Apr 12 10:12:16 dbusa PrimProc[74097]: 16.789519 |0|0|0| I 28 CAL0061: PrimProc error reading file for OID 8242; retry updateptrs for /usr/local/mariadb/columnstore/data1/000.dir/000.dir/032.dir/050.dir/000.dir/FILE000.cdf. rc=0, idx=4, ptr.size=4
      Apr 12 10:12:16 dbusa PrimProc[74097]: 16.793821 |0|0|0| C 28 CAL0000: Invalid Range from HWM for lbid 13379328, range size should be <= blocksReadAhead: HWM 2047, dbroot 1, highfbo 3071, lowfbo 2560, blocksReadAhead 512, range size -512
      Apr 12 10:12:16 dbusa ExeMgr[74153]: 16.802872 |1855|0|0| D 16 CAL0042: End SQL statement

      The problem presumably caused by a block saved by versioning but is absent in dbroot involved.

      Attachments

        Issue Links

          Activity

            drrtuy Roman added a comment - - edited

            To reproduce it first run the DDL statements:

            create table cs1(i bigint) engine=columnstore;
            alter table cs1 add column v1 varchar(1);

            After that one must insert > 8kk rows into the table. I have simple generator for the purpose so feel free to ask for it.
            After the preparations call
            SELECT * FROM cs1 LIMIT 0, 1000;
            and check logs.

            There is a shortcut. Instead of populating the table with values just run:
            select c.object_id,c.column_name,e.width from information_schema.columnstore_extents e, information_schema.columnstore_columns c where e.object_id = c.object_id and c.column_name = 'v1';

            The width returned for the column must be 4 instead of 2 that is the correct value.

            drrtuy Roman added a comment - - edited To reproduce it first run the DDL statements: create table cs1(i bigint) engine=columnstore; alter table cs1 add column v1 varchar(1); After that one must insert > 8kk rows into the table. I have simple generator for the purpose so feel free to ask for it. After the preparations call SELECT * FROM cs1 LIMIT 0, 1000; and check logs. There is a shortcut. Instead of populating the table with values just run: select c.object_id,c.column_name,e.width from information_schema.columnstore_extents e, information_schema.columnstore_columns c where e.object_id = c.object_id and c.column_name = 'v1'; The width returned for the column must be 4 instead of 2 that is the correct value.
            drrtuy Roman added a comment -

            Please review.

            drrtuy Roman added a comment - Please review.

            The fix doesn't appear to work in all cases, more information in the PR

            LinuxJedi Andrew Hutchings (Inactive) added a comment - The fix doesn't appear to work in all cases, more information in the PR

            Also can you please provide a test case in the regression suite?

            LinuxJedi Andrew Hutchings (Inactive) added a comment - Also can you please provide a test case in the regression suite?
            drrtuy Roman added a comment -

            Please review the change.

            drrtuy Roman added a comment - Please review the change.

            Build verified: 1.1.7-1 nightly

            MariaDB [mytest]> alter table cs1 add column v1 varchar(1);
            Query OK, 0 rows affected (0.12 sec)
            Records: 0 Duplicates: 0 Warnings: 0

            MariaDB [mytest]> select c.object_id,c.column_name,e.width from information_schema.columnstore_extents e, information_schema.columnstore_columns c where e.object_id = c.object_id and c.column_name = 'v1';
            ---------------------------

            object_id column_name width

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

            3060 v1 2

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

            dleeyh Daniel Lee (Inactive) added a comment - Build verified: 1.1.7-1 nightly MariaDB [mytest] > alter table cs1 add column v1 varchar(1); Query OK, 0 rows affected (0.12 sec) Records: 0 Duplicates: 0 Warnings: 0 MariaDB [mytest] > select c.object_id,c.column_name,e.width from information_schema.columnstore_extents e, information_schema.columnstore_columns c where e.object_id = c.object_id and c.column_name = 'v1'; ---------- ----------- ------ object_id column_name width ---------- ----------- ------ 3060 v1 2 ---------- ----------- ------ 1 row in set (0.37 sec)

            People

              dleeyh Daniel Lee (Inactive)
              drrtuy Roman
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

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