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

INSERT is not updating extent ranges

    XMLWordPrintable

Details

    Description

      Extent min/max range gets unset (current values lost) after a fresh INSERT. Only later after a fresh SELECT COUNT it updates the range with the new values. For TEXT column it requires a WHERE clause on it to update the ranges.

      Repro
      ------
      1. Create table, collect extent OIDs, check extent ranges
      Schema: CREATE TABLE t3 (i INT, t TEXT) engine=columnstore;
      MariaDB [test]> CREATE TABLE t1 (i INT, t TEXT) engine=columnstore;
      Query OK, 0 rows affected (0.444 sec)

      MariaDB [test]> SELECT object_id, dictionary_object_id FROM information_schema.columnstore_columns WHERE table_schema = 'test' and table_name = 't1';
      -------------------------------+

      object_id dictionary_object_id

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

      3099 NULL
      3100 3101

      -------------------------------+
      2 rows in set (0.044 sec)

      MariaDB [test]> system editem -o 3099; system editem -o 3100; system editem -o 3101;
      Col OID = 3099, NumExtents = 1, width = 4
      417792 - 421887 (4096) min: notset, max: notset, seqNum: 0, state: invalid, fbo: 0, DBRoot: 1, part#: 0, seg#: 0, HWM: 0; status: avail

      Col OID = 3100, NumExtents = 1, width = 8
      421888 - 430079 (8192) min: -1, max: 0, seqNum: 0, state: invalid, fbo: 0, DBRoot: 1, part#: 0, seg#: 0, HWM: 0; status: avail

      Dct OID = 3101
      430080 - 438271 (8192) min: -1, max: 0, seqNum: 0, state: invalid, fbo: 0, DBRoot: 1, part#: 0, seg#: 0, HWM: 0; status: avail

      MariaDB [test]>

      2. INSERT data, check extent ranges
      Extent ranges are not updated.

      MariaDB [test]> SELECT NOW(); INSERT INTO t1 VALUES (1, 'a');
      ---------------------

      NOW()

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

      2024-05-24 18:58:03

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

      MariaDB [test]> SELECT NOW(); system editem -o 3099; system editem -o 3100; system editem -o 3101;
      ---------------------

      NOW()

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

      2024-05-24 19:05:33

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

      Col OID = 3099, NumExtents = 1, width = 4
      417792 - 421887 (4096) min: notset, max: notset, seqNum: 2, state: invalid, fbo: 0, DBRoot: 1, part#: 0, seg#: 0, HWM: 0; status: avail

      Col OID = 3100, NumExtents = 1, width = 8
      421888 - 430079 (8192) min: -1, max: 0, seqNum: 2, state: invalid, fbo: 0, DBRoot: 1, part#: 0, seg#: 0, HWM: 0; status: avail

      Dct OID = 3101
      430080 - 438271 (8192) min: -1, max: 0, seqNum: 1, state: invalid, fbo: 0, DBRoot: 1, part#: 0, seg#: 0, HWM: 0; status: avail

      MariaDB [test]>

      3. SELECT COUNT updates the extent range of the INTEGER column only, not of the TEXT column
      MariaDB [test]> SELECT COUNT FROM t1;
      ----------

      COUNT

      ----------

      1

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

      MariaDB [test]> system editem -o 3099; system editem -o 3100; system editem -o 3101;
      Col OID = 3099, NumExtents = 1, width = 4
      417792 - 421887 (4096) min: 1, max: 1, seqNum: 3, state: valid, fbo: 0, DBRoot: 1, part#: 0, seg#: 0, HWM: 0; status: avail

      Col OID = 3100, NumExtents = 1, width = 8
      421888 - 430079 (8192) min: -1, max: 0, seqNum: 2, state: invalid, fbo: 0, DBRoot: 1, part#: 0, seg#: 0, HWM: 0; status: avail

      Dct OID = 3101
      430080 - 438271 (8192) min: -1, max: 0, seqNum: 1, state: invalid, fbo: 0, DBRoot: 1, part#: 0, seg#: 0, HWM: 0; status: avail

      4. SELECT COUNT...WHERE clause on TEXT column updates its extent range
      MariaDB [test]> SELECT COUNT FROM t1 WHERE t = 'a';
      ----------

      COUNT

      ----------

      1

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

      MariaDB [test]> system editem -o 3099; system editem -o 3100; system editem -o 3101;
      Col OID = 3099, NumExtents = 1, width = 4
      417792 - 421887 (4096) min: 1, max: 1, seqNum: 3, state: valid, fbo: 0, DBRoot: 1, part#: 0, seg#: 0, HWM: 0; status: avail

      Col OID = 3100, NumExtents = 1, width = 8
      421888 - 430079 (8192) min: 18295873486192640, max: 18295873486192640, seqNum: 3, state: valid, fbo: 0, DBRoot: 1, part#: 0, seg#: 0, HWM: 0; status: avail

      Dct OID = 3101
      430080 - 438271 (8192) min: -1, max: 0, seqNum: 1, state: invalid, fbo: 0, DBRoot: 1, part#: 0, seg#: 0, HWM: 0; status: avail

      MariaDB [test]>

      Expected behavior
      -------------------
      Ideally every INSERT should automatically update the extent ranges for all (types of) columns.

      Attachments

        Issue Links

          Activity

            People

              leonid.fedorov Leonid Fedorov
              susil.behera Susil Behera
              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.