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

Sequences discard all cache values when altered

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 11.0(EOL)
    • 11.0(EOL)
    • Sequences
    • None

    Description

      https://lists.launchpad.net/maria-developers/msg13299.html

      Sequences will skip all cached value at alter.

      d77aaa6994b 11.0

      create sequence s;
      select next value for s; # 1
      alter sequence s cycle;
      select next value for s; # 1001, because the default cache size is 1000 and reserved_until is 1001
      drop sequence s;
      

      It becomes worse when we throw in as <int_type> (Item 1 or MDEV-28152):

      create sequence s as tinyint;
      select next value for s;
      alter sequence s maxvalue 63;
      select next value for s; # error: ER_SEQUENCE_RUN_OUT, because default cache size 1000 is out of range for tiny int, and no maxvalue will work.
      drop sequence s;
      

      This may be related to the documented behaviour[1] of discarding cached values when flushing tables. Presumably this makes server restart also do the same.

      create sequence s;
      select next value for s; # 1
      flush tables;
      select next value for s; # 1001
      drop sequence s;
       
      create sequence s;
      select next value for s; # 1
      --source include/restart_mysqld.inc
      select next value for s; # 1001
      drop sequence s;
      

      [1] https://mariadb.com/kb/en/sequence-overview/#notes

      Shall we
      1. treat the alter-discard behaviour as a bug and fix it, OR
      2. treat the alter-discard behaviour as intended, just like flush tables, OR
      3. treat all cache discard behaviours as a bug and fix them?

      CC monty serg

      Attachments

        Issue Links

          Activity

            People

              ycp Yuchen Pei
              ycp Yuchen Pei
              Votes:
              0 Vote for this issue
              Watchers:
              4 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.