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

LevelDB: Wrong results with index and range access after INSERT IGNORE or REPLACE

    XMLWordPrintable

Details

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

    Description

      With INSERT IGNORE 3 results are wrong. The first SELECT returns the right number of rows, but it should have been the one with a = 157. The other also two return duplicate rows. With REPLACE, the results are the same, so the first is correct, and the other two are wrong.

      CREATE TABLE t1 (pk INT PRIMARY KEY, a SMALLINT, b INT, KEY (a)) ENGINE=LevelDB;
      INSERT IGNORE INTO t1 VALUES (1, 157, 0), (2, 1898, -504403), (1, -14659,  0);
       
      SELECT * FROM t1;
      pk	a	b
      1	-14659	0
      2	1898	-504403
       
      EXPLAIN EXTENDED
      SELECT pk FROM t1;
      id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
      1	SIMPLE	t1	index	NULL	a	3	NULL	1000	100.00	Using index
      Warnings:
      Note	1003	/* select#1 */ select `test`.`t1`.`pk` AS `pk` from `test`.`t1`
       
      SELECT pk FROM t1;
      pk
      1
      1
      2
       
      EXPLAIN EXTENDED
      SELECT * FROM t1 WHERE a != 97;
      id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
      1	SIMPLE	t1	range	a	a	3	NULL	20	100.00	Using where
      Warnings:
      Note	1003	/* select#1 */ select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (`test`.`t1`.`a` <> 97)
       
      SELECT * FROM t1 WHERE a != 97;
      pk	a	b
      1	-14659	0
      1	-14659	0
      1	-14659	0
      2	1898	-504403

      Test case:

       
      CREATE TABLE t1 (pk INT PRIMARY KEY, a SMALLINT, b INT, KEY (a)) ENGINE=LevelDB;
      INSERT IGNORE INTO t1 VALUES (1, 157, 0), (2, 1898, -504403), (1, -14659,  0);
      SELECT * FROM t1;
      SELECT pk FROM t1;
      SELECT * FROM t1 WHERE a != 97;

      bzr version-info

      revision-id: psergey@askmonty.org-20130125200959-a7gq7phbaiajqs12
      revno: 4519
      branch-nick: mysql-5.6-leveldb

      Attachments

        Activity

          People

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