Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-35933

repair removes wrong line for sequence with engine InnoDB

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 11.7(EOL), 11.8
    • 11.8
    • None

    Description

      After task MDEV-33449 repair for incorrect sequence (two rows in table with type sequence) fails with segv. Commit 25b4000290d43faa03a56a39ce918a1bd789f9fc fixed problem with segv, but after fix it becomes obvious that the repair is not working properly: the first row is deleted from the table instead of the second

      Testcase:

      --source include/have_innodb.inc
      CREATE TABLE `s2` (
      `next_not_cached_value` bigint(21) NOT NULL,
      `minimum_value` bigint(21) NOT NULL,
      `maximum_value` bigint(21) NOT NULL,
      `start_value` bigint(21) NOT NULL COMMENT 'start value when sequences is created or value if RESTART is used',
      `increment` bigint(21) NOT NULL COMMENT 'increment value',
      `cache_size` bigint(21) unsigned NOT NULL,
      `cycle_option` tinyint(1) unsigned NOT NULL COMMENT '0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed',
      `cycle_count` bigint(21) NOT NULL COMMENT 'How many cycles have been done'
      ) ENGINE=InnoDB;
       
      insert into s2 values (1,1,9223372036854775806,1,1,1000,0,0);
      insert into s2 values (2,1,9223372036854775806,1,1,1000,0,0);
       
      alter table s2 sequence=1;
       
      select nextval(s2);
       
      select * from s2;
       
      repair table s2;
       
      alter table s2 sequence=0;
       
      select * from s2;
       
      drop table s2;
      

      Actual result:

      alter table s2 sequence=1;
      select nextval(s2);
      nextval(s2)
      1
      select * from s2;
      next_not_cached_value	minimum_value	maximum_value	start_value	increment	cache_size	cycle_option	cycle_count
      1001	1	9223372036854775806	1	1	1000	0	0
      repair table s2;
      Table	Op	Msg_type	Msg_text
      test.s2	repair	status	OK
      alter table s2 sequence=0;
      select * from s2;
      next_not_cached_value	minimum_value	maximum_value	start_value	increment	cache_size	cycle_option	cycle_count
      2	1	9223372036854775806	1	1	1000	0	0
      

      Result before MDEV-33449:

      select nextval(s2);
      nextval(s2)
      1
      select * from s2;
      next_not_cached_value	minimum_value	maximum_value	start_value	increment	cache_size	cycle_option	cycle_count
      1001	1	9223372036854775806	1	1	1000	0	0
      repair table s2;
      Table	Op	Msg_type	Msg_text
      test.s2	repair	status	OK
      alter table s2 sequence=0;
      select * from s2;
      next_not_cached_value	minimum_value	maximum_value	start_value	increment	cache_size	cycle_option	cycle_count
      1001	1	9223372036854775806	1	1	1000	0	0
      2	1	9223372036854775806	1	1	1000	0	0
      

      Attachments

        Issue Links

          Activity

            There are no comments yet on this issue.

            People

              monty Michael Widenius
              lstartseva Lena Startseva
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.