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

Assertion `(ulonglong) next_free_value % real_increment == (ulonglong) offset' failed in void sequence_definition::adjust_values(longlong)

    XMLWordPrintable

Details

    Description

      Seems similar to MDEV-22705 but following test case crashes only 11.5 debug build.

      CREATE SEQUENCE s AS BIGINT UNSIGNED START WITH 9223372036854775800 INCREMENT 0;
      SET GLOBAL AUTO_INCREMENT_INCREMENT=10;
      SELECT NEXTVAL (s);
      FLUSH TABLES WITH READ LOCK;
      UPDATE s SET a=1;
      

      Leads to:

      11.5.0 8f0c9340537b84fcd7012d4a31e6f858e7eb919c (Debug)

      mariadbd: /test/server_dbg/sql/sql_sequence.cc:766: void sequence_definition::adjust_values(longlong): Assertion `(ulonglong) next_free_value % real_increment == (ulonglong) offset' failed.
      

      11.5.0 8f0c9340537b84fcd7012d4a31e6f858e7eb919c (Debug)

      Core was generated by `/test/MD200324-mariadb-11.5.0-linux-x86_64-dbg/bin/mariadbd --no-defaults --max'.
      Program terminated with signal SIGABRT, Aborted.
      #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
      [Current thread is 1 (Thread 0x14af7815f700 (LWP 535573))]
      (gdb) bt
      #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
      #1  0x000014af8f4f1859 in __GI_abort () at abort.c:79
      #2  0x000014af8f4f1729 in __assert_fail_base (fmt=0x14af8f687588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x5574bc2068b0 "(ulonglong) next_free_value % real_increment == (ulonglong) offset", file=0x5574bc206860 "/test/server_dbg/sql/sql_sequence.cc", line=766, function=<optimized out>) at assert.c:92
      #3  0x000014af8f502fd6 in __GI___assert_fail (assertion=assertion@entry=0x5574bc2068b0 "(ulonglong) next_free_value % real_increment == (ulonglong) offset", file=file@entry=0x5574bc206860 "/test/server_dbg/sql/sql_sequence.cc", line=line@entry=766, function=function@entry=0x5574bc2068f8 "void sequence_definition::adjust_values(longlong)") at assert.c:101
      #4  0x00005574bb747673 in sequence_definition::adjust_values (this=this@entry=0x14af3c059680, next_value=<optimized out>) at /test/server_dbg/sql/sql_sequence.cc:766
      #5  0x00005574bb747b0c in SEQUENCE::read_stored_values (this=this@entry=0x14af3c059680, table=0x5574bed78ad8) at /test/server_dbg/sql/sql_sequence.cc:713
      #6  0x00005574bb747c6f in SEQUENCE::read_initial_values (this=0x14af3c059680, table=<optimized out>) at /test/server_dbg/sql/sql_sequence.cc:666
      #7  0x00005574bbb2fb13 in ha_sequence::open (this=0x14af3c05a070, name=<optimized out>, mode=<optimized out>, flags=18) at /test/server_dbg/sql/ha_sequence.cc:122
      #8  0x00005574bb802111 in handler::ha_open (this=0x14af3c05a070, table_arg=table_arg@entry=0x5574bed78ad8, name=0x14af3c059498 "./test/s", mode=mode@entry=2, test_if_locked=test_if_locked@entry=18, mem_root=mem_root@entry=0x0, partitions_to_open=0x0) at /test/server_dbg/sql/handler.cc:3517
      #9  0x00005574bb604284 in open_table_from_share (thd=thd@entry=0x14af3c000d48, share=share@entry=0x14af3c058e10, alias=alias@entry=0x14af3c01af60, db_stat=db_stat@entry=33, prgflag=prgflag@entry=8, ha_open_flags=18, outparam=0x5574bed78ad8, is_create_table=false, partitions_to_open=0x0) at /test/server_dbg/sql/table.cc:4597
      #10 0x00005574bb42c907 in open_table (thd=thd@entry=0x14af3c000d48, table_list=table_list@entry=0x14af3c01af18, ot_ctx=ot_ctx@entry=0x14af7815da70) at /test/server_dbg/sql/sql_base.cc:2233
      #11 0x00005574bb430854 in open_and_process_table (ot_ctx=0x14af7815da70, has_prelocking_list=false, prelocking_strategy=0x14af3c01b848, flags=0, counter=0x14af3c01b828, tables=0x14af3c01af18, thd=0x14af3c000d48) at /test/server_dbg/sql/sql_base.cc:4166
      #12 open_tables (thd=thd@entry=0x14af3c000d48, options=@0x14af3c0067b0: {m_options = DDL_options_st::OPT_NONE}, start=start@entry=0x14af7815daf8, counter=counter@entry=0x14af3c01b828, flags=0, prelocking_strategy=prelocking_strategy@entry=0x14af3c01b848) at /test/server_dbg/sql/sql_base.cc:4652
      #13 0x00005574bb431bd9 in open_tables (prelocking_strategy=0x14af3c01b848, flags=<optimized out>, counter=0x14af3c01b828, tables=0x14af7815daf8, thd=0x14af3c000d48) at /test/server_dbg/sql/sql_base.h:271
      #14 open_tables_for_query (thd=thd@entry=0x14af3c000d48, tables=<optimized out>, table_count=table_count@entry=0x14af3c01b828, flags=flags@entry=0, prelocking_strategy=0x14af3c01b848) at /test/server_dbg/sql/sql_base.cc:5766
      #15 0x00005574bb502272 in Sql_cmd_dml::prepare (this=0x14af3c01b810, thd=0x14af3c000d48) at /test/server_dbg/sql/sql_select.cc:33490
      #16 0x00005574bb5046cf in Sql_cmd_dml::execute (this=0x14af3c01b810, thd=0x14af3c000d48) at /test/server_dbg/sql/sql_select.cc:33552
      #17 0x00005574bb4bde6f in mysql_execute_command (thd=thd@entry=0x14af3c000d48, is_called_from_prepared_stmt=is_called_from_prepared_stmt@entry=false) at /test/server_dbg/sql/sql_parse.cc:4396
      #18 0x00005574bb4ad8a6 in mysql_parse (thd=thd@entry=0x14af3c000d48, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14af7815e270) at /test/server_dbg/sql/sql_parse.cc:7821
      #19 0x00005574bb4c4b61 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14af3c000d48, packet=packet@entry=0x14af3c00b229 "UPDATE s SET a=1", packet_length=packet_length@entry=16, blocking=blocking@entry=true) at /test/server_dbg/sql/sql_class.h:1636
      #20 0x00005574bb4c75d9 in do_command (thd=0x14af3c000d48, blocking=blocking@entry=true) at /test/server_dbg/sql/sql_parse.cc:1405
      #21 0x00005574bb64c545 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x5574bedbbb68, put_in_cache=put_in_cache@entry=true) at /test/server_dbg/sql/sql_connect.cc:1447
      #22 0x00005574bb64cafa in handle_one_connection (arg=arg@entry=0x5574bedbbb68) at /test/server_dbg/sql/sql_connect.cc:1349
      #23 0x00005574bbacdc58 in pfs_spawn_thread (arg=0x5574bed2c868) at /test/server_dbg/storage/perfschema/pfs.cc:2201
      #24 0x000014af8fa02609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #25 0x000014af8f5ee133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Bug confirmed present in:
      MariaDB: 11.5.0 (dbg)

      Bug (or feature/syntax) confirmed not present in:
      MariaDB: 10.4.33 (opt), 10.4.34 (opt), 10.5.25 (dbg), 10.5.25 (opt), 10.6.18 (dbg), 10.6.18 (opt), 10.11.8 (dbg), 10.11.8 (opt), 11.0.6 (dbg), 11.0.6 (opt), 11.1.4 (dbg), 11.1.4 (opt), 11.2.4 (dbg), 11.2.4 (opt), 11.3.2 (dbg), 11.3.2 (opt), 11.4.2 (dbg), 11.4.2 (opt), 11.5.0 (opt)

      Attachments

        Issue Links

          Activity

            People

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