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

    XMLWordPrintable

Details

    • Technical task
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • None
    • None
    • None

    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

      Attachments

        Activity

          People

            psergei Sergei Petrunia
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            1 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.