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

binlog_encryption.encrypted_master_switch_to_unencrypted_gtid Fails in BB 11.4+

Details

    Description

      Test binlog_encryption.encrypted_master_switch_to_unencrypted_gtid fails on buildbot sporadically starting in 11.4 with error output:

      binlog_encryption.encrypted_master_switch_to_unencrypted_gtid 'mix' w3 [ fail ]
              Test ended at 2025-03-08 22:17:20
       
      CURRENT_TEST: binlog_encryption.encrypted_master_switch_to_unencrypted_gtid
      mysqltest: At line 129: Slave without encryption configured should fail to read encrypted binlog (expected 0-1-5 but got )
       
      The result from queries just before the failure was:
      < snip >
      #####################################################
      # Part 3: restart master again without encryption
      #####################################################
      connection default;
      connection server_1;
      CREATE TABLE table3_no_encryption (
      pk INT AUTO_INCREMENT PRIMARY KEY,
      ts TIMESTAMP NULL,
      b BLOB
      ) ENGINE=MyISAM;
      INSERT INTO table3_no_encryption VALUES (NULL,NOW(),'data_no_encryption');
      INSERT INTO table3_no_encryption SELECT NULL,NOW(),b FROM table3_no_encryption;
      INSERT INTO table3_no_encryption SELECT NULL,NOW(),b FROM table3_no_encryption;
      #####################################################
      # Check: resume replication and check how it goes
      #####################################################
      connection server_2;
      start slave;
      include/wait_for_slave_io_error.inc [errno=1236]
      # Ensuring slave was unable to replicate any encrypted transactions..
      

      Attachments

        Issue Links

          Activity

            knielsen Kristian Nielsen added a comment -

            Pushed to 11.4

            knielsen Kristian Nielsen added a comment - Pushed to 11.4
            knielsen Kristian Nielsen added a comment -

            Right, I see. Yes, the test case waits for the IO thread to stop with an error, then checks the value of @@GLOBAL.gtid_slave_pos. If the SQL thread gets delayed for some reason, it is possible for the test case to read the value before the SQL thread has had time to update it. There's simply missing a wait for the SQL thread to be ready.

            Failure can be repeated reliably with the below patch that puts a small delay at the critical point in the SQL thread.

            diff --git a/sql/slave.cc b/sql/slave.cc
            index 8b5797de935..ac1c4386302 100644
            --- a/sql/slave.cc
            +++ b/sql/slave.cc
            @@ -5790,6 +5790,7 @@ pthread_handler_t handle_slave_sql(void *arg)
               /* Read queries from the IO/THREAD until this thread is killed */
             
               thd->set_command(COM_SLAVE_SQL);
            +my_sleep(500000);
               while (!sql_slave_killed(serial_rgi))
               {
                 THD_STAGE_INFO(thd, stage_reading_event_from_the_relay_log);
            

            knielsen Kristian Nielsen added a comment - Right, I see. Yes, the test case waits for the IO thread to stop with an error, then checks the value of @@GLOBAL.gtid_slave_pos . If the SQL thread gets delayed for some reason, it is possible for the test case to read the value before the SQL thread has had time to update it. There's simply missing a wait for the SQL thread to be ready. Failure can be repeated reliably with the below patch that puts a small delay at the critical point in the SQL thread. diff --git a/sql/slave.cc b/sql/slave.cc index 8b5797de935..ac1c4386302 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -5790,6 +5790,7 @@ pthread_handler_t handle_slave_sql(void *arg) /* Read queries from the IO/THREAD until this thread is killed */ thd->set_command(COM_SLAVE_SQL); +my_sleep(500000); while (!sql_slave_killed(serial_rgi)) { THD_STAGE_INFO(thd, stage_reading_event_from_the_relay_log);
            bnestere Brandon Nesterenko added a comment -

            Hi knielsen!

            Assigning to you, as the snippet that fails was added in MDEV-4991:

            --echo # Ensuring slave was unable to replicate any encrypted transactions..
            --let $gsp= `SELECT @@global.gtid_slave_pos`
            if (`SELECT strcmp("$gsp","$last_unencrypted_gtid")`)
            {
              die Slave without encryption configured should fail to read encrypted binlog (expected $last_unencrypted_gtid but got $gsp);
            }
            

            bnestere Brandon Nesterenko added a comment - Hi knielsen ! Assigning to you, as the snippet that fails was added in MDEV-4991 : --echo # Ensuring slave was unable to replicate any encrypted transactions.. --let $gsp= `SELECT @@global.gtid_slave_pos` if (`SELECT strcmp("$gsp","$last_unencrypted_gtid")`) { die Slave without encryption configured should fail to read encrypted binlog (expected $last_unencrypted_gtid but got $gsp); }

            People

              knielsen Kristian Nielsen
              bnestere Brandon Nesterenko
              Votes:
              0 Vote for this issue
              Watchers:
              1 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.