Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-3841 LevelDB storage engine
  3. MDEV-4090

LevelDB: Wrong result (duplicate rows) on range access with secondary key and ORDER BY DESC

    Details

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

      Description

      CREATE TABLE t1 (pk INT PRIMARY KEY, i INT, KEY(i)) ENGINE=LevelDB;
      INSERT INTO t1 VALUES (1,10), (2,20);
      SELECT i FROM t1 WHERE i NOT IN (8) ORDER BY i DESC;
      i
      20
      20
      10
      10
      EXPLAIN EXTENDED
      SELECT i FROM t1 WHERE i NOT IN (8) ORDER BY i DESC;
      id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
      1	SIMPLE	t1	range	i	i	5	NULL	20	100.00	Using where; Using index
      Warnings:
      Note	1003	/* select#1 */ select `test`.`t1`.`i` AS `i` from `test`.`t1` where (`test`.`t1`.`i` <> 8) order by `test`.`t1`.`i` desc
      

      Please note that the result is non-deterministic, here is the variation that I'm getting on the exact same test (now it's 3 rows, not 4):

      CREATE TABLE t1 (pk INT PRIMARY KEY, i INT, KEY(i)) ENGINE=LevelDB;
      INSERT INTO t1 VALUES (1,10), (2,20);
      SELECT i FROM t1 WHERE i NOT IN (8) ORDER BY i DESC;
      i
      20
      10
      10
      EXPLAIN EXTENDED
      SELECT i FROM t1 WHERE i NOT IN (8) ORDER BY i DESC;
      id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
      1	SIMPLE	t1	range	i	i	5	NULL	20	100.00	Using where; Using index
      Warnings:
      Note	1003	/* select#1 */ select `test`.`t1`.`i` AS `i` from `test`.`t1` where (`test`.`t1`.`i` <> 8) order by `test`.`t1`.`i` desc
      

      Test case:

      CREATE TABLE t1 (pk INT PRIMARY KEY, i INT, KEY(i)) ENGINE=LevelDB;
      INSERT INTO t1 VALUES (1,10), (2,20);
      SELECT i FROM t1 WHERE i NOT IN (8) ORDER BY i DESC;
      
      revision-id: psergey@askmonty.org-20130125135708-w6flw90gj2voizou
      revno: 4516
      branch-nick: mysql-5.6-leveldb
      

        Gliffy Diagrams

          Attachments

            Activity

            There are no comments yet on this issue.

              People

              • Assignee:
                psergey Sergei Petrunia
                Reporter:
                elenst Elena Stepanova
              • Votes:
                0 Vote for this issue
                Watchers:
                1 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 - 45 minutes
                  45m