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

LevelDB: Wrong result of DELETE .. ORDER BY .. LIMIT: rows that should be deleted remain in the table

    Details

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

      Description

      See output of the test case (some extra info and comments included)

      CREATE TABLE t2 (pk INT AUTO_INCREMENT PRIMARY KEY) ENGINE=LevelDB;
      CREATE TABLE t1 (pk INT AUTO_INCREMENT PRIMARY KEY) ENGINE=LevelDB;
      INSERT INTO t1 (pk) VALUES (NULL),(NULL);
      BEGIN;
      INSERT INTO t2 (pk) VALUES (NULL),(NULL);
      INSERT INTO t1 (pk) VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
      # We only have 8 rows in the table ...
      SELECT * FROM t1 ORDER BY pk LIMIT 9;
      pk
      1
      2
      3
      4
      5
      6
      7
      8
      affected rows: 8
      EXPLAIN EXTENDED
      SELECT * FROM t1 ORDER BY pk LIMIT 9;
      id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
      1	SIMPLE	t1	index	NULL	PRIMARY	4	NULL	9	11111.11	Using index
      Warnings:
      Note	1003	/* select#1 */ select `test`.`t1`.`pk` AS `pk` from `test`.`t1` order by `test`.`t1`.`pk` limit 9
      EXPLAIN EXTENDED
      DELETE FROM t1 ORDER BY pk LIMIT 9;
      id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
      1	SIMPLE	t1	index	PRIMARY	PRIMARY	4	NULL	9	100.00	NULL
      # so all of them should be deleted....
      DELETE FROM t1 ORDER BY pk LIMIT 9;
      affected rows: 3
      # but it does not happen:
      SELECT * FROM t1 ORDER BY pk LIMIT 9;
      pk
      4
      5
      6
      7
      8
      affected rows: 5
      

      Test case:

      CREATE TABLE t2 (pk INT AUTO_INCREMENT PRIMARY KEY) ENGINE=LevelDB;
      CREATE TABLE t1 (pk INT AUTO_INCREMENT PRIMARY KEY) ENGINE=LevelDB;
      
      INSERT INTO t1 (pk) VALUES (NULL),(NULL);
      BEGIN;
      INSERT INTO t2 (pk) VALUES (NULL),(NULL);
      INSERT INTO t1 (pk) VALUES (NULL),(NULL),(NULL),(NULL),(NULL),(NULL);
      
      --enable_info
      SELECT * FROM t1 ORDER BY pk LIMIT 9; 
      DELETE FROM t1 ORDER BY pk LIMIT 9;
      SELECT * FROM t1 ORDER BY pk LIMIT 9;
      
      
      revision-id: psergey@askmonty.org-20130406172740-fid7u9tkz5ahlc4c
      revno: 4823
      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 - 4 hours
                  4h