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

Server crash in Rows_log_event::update_sequence upon replaying binary log

Details

    Description

      --source include/have_log_bin.inc
       
      --let $datadir=`select @@datadir`
       
      reset master;
      create sequence s;
      select nextval(s);
      flush binary logs;
      drop sequence s;
       
      --exec $MYSQL_BINLOG $datadir/master-bin.000001 | $MYSQL test
      show create sequence s;
       
      # Cleanup
      drop sequence s;
      

      10.4 30f3db3c

      #3  <signal handler called>
      #4  0x00005585ac506e1e in Rows_log_event::update_sequence (this=0x61300006e0c8) at /data/src/10.4/sql/log_event.cc:13776
      #5  0x00005585ac5055c9 in Rows_log_event::write_row (this=0x61300006e0c8, rgi=0x61d000244a80, overwrite=false) at /data/src/10.4/sql/log_event.cc:13591
      #6  0x00005585ac50787e in Write_rows_log_event::do_exec_row (this=0x61300006e0c8, rgi=0x61d000244a80) at /data/src/10.4/sql/log_event.cc:13834
      #7  0x00005585ac4f8cb9 in Rows_log_event::do_apply_event (this=0x61300006e0c8, rgi=0x61d000244a80) at /data/src/10.4/sql/log_event.cc:11678
      #8  0x00005585ab78e808 in Log_event::apply_event (this=0x61300006e0c8, rgi=0x61d000244a80) at /data/src/10.4/sql/log_event.h:1492
      #9  0x00005585abd6533e in mysql_client_binlog_statement (thd=0x62b00009a208) at /data/src/10.4/sql/sql_binlog.cc:355
      #10 0x00005585ab9fa369 in mysql_execute_command (thd=0x62b00009a208) at /data/src/10.4/sql/sql_parse.cc:6135
      #11 0x00005585aba065b1 in mysql_parse (thd=0x62b00009a208, rawbuf=0x62b0000a1228 "BINLOG '\nbz/BZBMBAAAAMwAAAEwCAAAAACAAAAAAAAEABHRlc3QAAXMACAgICAgICAEIAAAi1wZ2\nbz/BZBcBAAAAWwAAAKcCAAAAACAAAAAAAAEACP8A6QMAAAAAAAABAAAAAAAAAP7///////9/AQAA\nAAAAAAABAAAAAAAAAOgD", 'A' <repeats 20 times>, "eUzZs"..., length=205, parser_state=0x7f89a28db860, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:8010
      #12 0x00005585ab9dc87c in dispatch_command (command=COM_QUERY, thd=0x62b00009a208, packet=0x62900024e209 "BINLOG '\nbz/BZBMBAAAAMwAAAEwCAAAAACAAAAAAAAEABHRlc3QAAXMACAgICAgICAEIAAAi1wZ2\nbz/BZBcBAAAAWwAAAKcCAAAAACAAAAAAAAEACP8A6QMAAAAAAAABAAAAAAAAAP7///////9/AQAA\nAAAAAAABAAAAAAAAAOgD", 'A' <repeats 20 times>, "eUzZs"..., packet_length=205, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1857
      #13 0x00005585ab9d93eb in do_command (thd=0x62b00009a208) at /data/src/10.4/sql/sql_parse.cc:1378
      #14 0x00005585abdd807a in do_handle_one_connection (connect=0x608000000aa8) at /data/src/10.4/sql/sql_connect.cc:1420
      #15 0x00005585abdd7991 in handle_one_connection (arg=0x608000000aa8) at /data/src/10.4/sql/sql_connect.cc:1324
      #16 0x00005585aca46d5a in pfs_spawn_thread (arg=0x615000003f08) at /data/src/10.4/storage/perfschema/pfs.cc:1869
      #17 0x00007f89aa8a7fd4 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
      #18 0x00007f89aa9285bc in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
      

      The failure started happening on 10.4 after this merge in 10.4.29:

      commit edd0b03e60f4cc666fbdf16e7b01b97188f2f887
      Merge: ddcc9d2281d 55a53949bea
      Author: Oleksandr Byelkin
      Date:   Tue May 2 10:09:27 2023 +0200
       
          Merge branch '10.3' into 10.4
      

      It doesn't fail on 10.3, but there were only a couple of commits in that merge, so it's easy to guess that the guilty one is

      commit 55a53949beac6e212b1232d3628d96b9b8121a49
      Author: Andrei
      Date:   Sat Mar 18 21:11:07 2023 +0200
       
          MDEV-29621: Replica stopped by locks on sequence
      

      Attachments

        Issue Links

          Activity

            elenst Elena Stepanova created issue -
            elenst Elena Stepanova made changes -
            Field Original Value New Value
            elenst Elena Stepanova made changes -
            Component/s Sequences [ 14009 ]
            elenst Elena Stepanova made changes -
            julien.fritsch Julien Fritsch made changes -
            Fix Version/s 10.9 [ 26905 ]
            julien.fritsch Julien Fritsch made changes -
            Fix Version/s 10.10 [ 27530 ]
            niljoshi Nilnandan Joshi made changes -
            Labels CS0689897
            Elkin Andrei Elkin made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            alice Alice Sherepa made changes -
            Fix Version/s 11.2 [ 28603 ]
            Fix Version/s 11.3 [ 28565 ]
            Fix Version/s 11.4 [ 29301 ]
            alice Alice Sherepa made changes -
            Affects Version/s 11.2 [ 28603 ]
            Affects Version/s 11.3 [ 28565 ]
            Affects Version/s 11.4 [ 29301 ]
            JIraAutomate JiraAutomate made changes -
            Status In Progress [ 3 ] Stalled [ 10000 ]
            Elkin Andrei Elkin made changes -
            Status Stalled [ 10000 ] In Progress [ 3 ]
            valerii Valerii Kravchuk made changes -
            Labels CS0689897 CS0689897 CS0742702
            Elkin Andrei Elkin made changes -
            Priority Major [ 3 ] Critical [ 2 ]
            Elkin Andrei Elkin made changes -
            Fix Version/s 10.5.25 [ 29626 ]
            Fix Version/s 10.6.18 [ 29627 ]
            Fix Version/s 10.11.8 [ 29630 ]
            Fix Version/s 11.0.6 [ 29628 ]
            Fix Version/s 11.2.4 [ 29631 ]
            Fix Version/s 11.4.2 [ 29633 ]
            Fix Version/s 11.3.2 [ 29522 ]
            Fix Version/s 10.4 [ 22408 ]
            Fix Version/s 10.5 [ 23123 ]
            Fix Version/s 10.6 [ 24028 ]
            Fix Version/s 10.11 [ 27614 ]
            Fix Version/s 11.0 [ 28320 ]
            Fix Version/s 11.1 [ 28549 ]
            Fix Version/s 11.3 [ 28565 ]
            Fix Version/s 11.2 [ 28603 ]
            Fix Version/s 11.4 [ 29301 ]
            Resolution Fixed [ 1 ]
            Status In Progress [ 3 ] Closed [ 6 ]
            JIraAutomate JiraAutomate made changes -
            Fix Version/s 11.1.5 [ 29629 ]
            alice Alice Sherepa made changes -
            julien.fritsch Julien Fritsch made changes -
            Labels CS0689897 CS0742702
            mariadb-jira-automation Jira Automation (IT) made changes -
            Zendesk Related Tickets 104981 193225
            naresh.chandra@copart.com Naresh Chandra added a comment - - edited

            Hi Andrei,

            Due to the below proc, we got the same issue like below.

            ERROR 2013 (HY000) at line 562853: Lost connection to MySQL server during query

            Create Procedure: CREATE DEFINER=`definer_db_usr`@`localhost` PROCEDURE `get_object_number`(
            IN in_obj_type VARCHAR (20),
            IN in_num_of_objs BIGINT (20),
            OUT out_obj_num VARCHAR (5000)
            )
            MODIFIES SQL DATA
            DETERMINISTIC
            COMMENT 'Sproc to return Range'
            BEGIN
            DECLARE i INT;
            DECLARE out_obj_num VARCHAR (5000);

            SET i = 0;

            DROP TEMPORARY TABLE IF EXISTS tmp_seq_range;

            CREATE TEMPORARY TABLE tmp_seq_range
            (
            tmp_obj_type VARCHAR (20),
            tmp_obj_nums VARCHAR (5000)
            );

            WHILE
            i < in_num_of_objs
            DO
            SET
            out_obj_num = CASE WHEN in_obj_type = 'BILL' THEN CONCAT('VB-',nextval(vb_bng.bill_num_seq))
            WHEN in_obj_type = 'PAYMENT' THEN CONCAT('VP-',nextval(vb_bng.pymt_num_seq))
            ELSE NULL END ;

            SET i = i + 1;

            INSERT INTO tmp_seq_range (tmp_obj_type, tmp_obj_nums) VALUES(in_obj_type, out_obj_num);

            END WHILE;

            SELECT
            GROUP_CONCAT(tmp_obj_nums) INTO out_obj_num
            FROM tmp_seq_range
            GROUP BY tmp_obj_type;

            SELECT out_obj_num;

            DROP TEMPORARY TABLE IF EXISTS tmp_seq_range;

            END
            character_set_client: utf8mb4
            collation_connection: utf8mb4_general_ci
            Database Collation: utf8_general_ci
            1 row in set (0.004 sec)

            MariaDB [vb_bng]>

            naresh.chandra@copart.com Naresh Chandra added a comment - - edited Hi Andrei, Due to the below proc, we got the same issue like below. ERROR 2013 (HY000) at line 562853: Lost connection to MySQL server during query Create Procedure: CREATE DEFINER=`definer_db_usr`@`localhost` PROCEDURE `get_object_number`( IN in_obj_type VARCHAR (20), IN in_num_of_objs BIGINT (20), OUT out_obj_num VARCHAR (5000) ) MODIFIES SQL DATA DETERMINISTIC COMMENT 'Sproc to return Range' BEGIN DECLARE i INT; DECLARE out_obj_num VARCHAR (5000); SET i = 0; DROP TEMPORARY TABLE IF EXISTS tmp_seq_range; CREATE TEMPORARY TABLE tmp_seq_range ( tmp_obj_type VARCHAR (20), tmp_obj_nums VARCHAR (5000) ); WHILE i < in_num_of_objs DO SET out_obj_num = CASE WHEN in_obj_type = 'BILL' THEN CONCAT('VB-',nextval(vb_bng.bill_num_seq)) WHEN in_obj_type = 'PAYMENT' THEN CONCAT('VP-',nextval(vb_bng.pymt_num_seq)) ELSE NULL END ; SET i = i + 1; INSERT INTO tmp_seq_range (tmp_obj_type, tmp_obj_nums) VALUES(in_obj_type, out_obj_num); END WHILE; SELECT GROUP_CONCAT(tmp_obj_nums) INTO out_obj_num FROM tmp_seq_range GROUP BY tmp_obj_type; SELECT out_obj_num; DROP TEMPORARY TABLE IF EXISTS tmp_seq_range; END character_set_client: utf8mb4 collation_connection: utf8mb4_general_ci Database Collation: utf8_general_ci 1 row in set (0.004 sec) MariaDB [vb_bng] >
            Elkin Andrei Elkin added a comment -

            naresh.chandra@copart.com, hi.

            What do you mean the same issue?
            In your comment I don't see anything related to the sequence table type, nor any crash stack is provided.

            At any rate this ticket is closed so the best way to write about an issue is to create a new one, which would
            make you to fill in your server version etc, with a reference to the current one
            if it makes sense in your opinion.
            Naturally we'd prefer a how-to-repeat in the description.

            Thank you for trying to report on an issue!

            Elkin Andrei Elkin added a comment - naresh.chandra@copart.com , hi. What do you mean the same issue? In your comment I don't see anything related to the sequence table type, nor any crash stack is provided. At any rate this ticket is closed so the best way to write about an issue is to create a new one, which would make you to fill in your server version etc, with a reference to the current one if it makes sense in your opinion. Naturally we'd prefer a how-to-repeat in the description. Thank you for trying to report on an issue!
            naresh.chandra@copart.com Naresh Chandra made changes -
            Attachment screenshot-1.png [ 74191 ]
            naresh.chandra@copart.com Naresh Chandra added a comment - - edited

            Hi Andrei,

            Because, of the nextval function, we got the issue. There is a call get_object_number() in the binlog file, when we try to restore binary logs then we got the above issues.

            WHEN in_obj_type = 'PAYMENT' THEN CONCAT('VP-',nextval(vb_bng.pymt_num_seq))

            naresh.chandra@copart.com Naresh Chandra added a comment - - edited Hi Andrei, Because, of the nextval function, we got the issue. There is a call get_object_number() in the binlog file, when we try to restore binary logs then we got the above issues. WHEN in_obj_type = 'PAYMENT' THEN CONCAT('VP-', nextval (vb_bng.pymt_num_seq))

            People

              Elkin Andrei Elkin
              elenst Elena Stepanova
              Votes:
              1 Vote for this issue
              Watchers:
              8 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.