Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-4201 LevelDB Storage Engine MS2
  3. MDEV-4304

LevelDB: Index-only scan by a field with utf8_bin collation returns garbage symbols

    Details

    • Type: Technical task
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:

      Description

      MySQL [test]> CREATE TABLE t1 (pk INT PRIMARY KEY, c1 CHAR(1), c2 CHAR(1), KEY(c1)) ENGINE=LevelDB CHARSET utf8 COLLATE utf8_bin;
      Query OK, 0 rows affected (0.21 sec)
      
      MySQL [test]> INSERT INTO t1 VALUES (1,'h','h');
      Query OK, 1 row affected (0.00 sec)
      
      MySQL [test]> SELECT * FROM t1;
      +----+------+------+
      | pk | c1   | c2   |
      +----+------+------+
      |  1 | h    | h    |
      +----+------+------+
      1 row in set (0.00 sec)
      
      MySQL [test]> SELECT c1 FROM t1;
      +------+
      | c1   |
      +------+
      | h€?   |
      +------+
      1 row in set (0.00 sec)
      
      MySQL [test]> EXPLAIN EXTENDED SELECT c1 FROM t1;
      +----+-------------+-------+-------+---------------+------+---------+------+------+----------+-------------+
      | id | select_type | table | type  | possible_keys | key  | key_len | ref  | rows | filtered | Extra       |
      +----+-------------+-------+-------+---------------+------+---------+------+------+----------+-------------+
      |  1 | SIMPLE      | t1    | index | NULL          | c1   | 4       | NULL | 1000 |   100.00 | Using index |
      +----+-------------+-------+-------+---------------+------+---------+------+------+----------+-------------+
      1 row in set, 1 warning (0.00 sec)
      

      I'm not quite sure if index-only scans for utf8_bin are currently supported (the wiki page is unclear about it, it says " possibly support utf8_bin"), but I suppose in either case it should not return wrong results.

      Test case (same as above, for copy-paste):

      CREATE TABLE t1 (pk INT PRIMARY KEY, c1 CHAR(1), c2 CHAR(1), KEY(c1)) ENGINE=LevelDB CHARSET utf8 COLLATE utf8_bin;
      INSERT INTO t1 VALUES (1,'h','h');
      SELECT c1 FROM t1;
      
      revision-id: psergey@askmonty.org-20130319094846-yze9xy3qeb5g6hrc
      revno: 4610
      branch-nick: mysql-5.6-leveldb
      

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            psergey Sergei Petrunia added a comment -

            Yes, index_only scans are intended to be supported for utf8_bin collation. It seems, the code that unpacks the data back doesn't work correctly.

            Show
            psergey Sergei Petrunia added a comment - Yes, index_only scans are intended to be supported for utf8_bin collation. It seems, the code that unpacks the data back doesn't work correctly.

              People

              • Assignee:
                psergey Sergei Petrunia
                Reporter:
                elenst Elena Stepanova
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 4 hours, 30 minutes
                  4h 30m