Don't attempt to rotate any old-style binlog files if trying to set
@@binlog_checksum. The @@binlog_checksum variable is unused with the
new binlog, and there are no old-style binlog files to rotate.

Signed-off-by: Kristian Nielsen <[email protected]>
---
 .../binlog_in_engine/not_implemented_yet.result  | 14 ++++++++++++++
 .../binlog_in_engine/not_implemented_yet.test    |  9 +++++++++
 sql/log.cc                                       | 16 ++++++++++------
 3 files changed, 33 insertions(+), 6 deletions(-)

diff --git a/mysql-test/suite/binlog_in_engine/not_implemented_yet.result 
b/mysql-test/suite/binlog_in_engine/not_implemented_yet.result
index 1228afe0aad..63fab5a5d9c 100644
--- a/mysql-test/suite/binlog_in_engine/not_implemented_yet.result
+++ b/mysql-test/suite/binlog_in_engine/not_implemented_yet.result
@@ -21,3 +21,17 @@ SELECT * FROM t ORDER BY a;
 a
 DROP TRIGGER tr;
 DROP TABLE t;
+### MDEV-39604: @@binlog_checksum is not used with new binlog.
+SET @old_checksum= @@GLOBAL.binlog_checksum;
+SET GLOBAL binlog_checksum=CRC32;
+SELECT @@GLOBAL.binlog_checksum;
+@@GLOBAL.binlog_checksum
+NONE
+SET GLOBAL binlog_checksum=NONE;
+SELECT @@GLOBAL.binlog_checksum;
+@@GLOBAL.binlog_checksum
+NONE
+SET GLOBAL binlog_checksum=@old_checksum;
+SELECT @@GLOBAL.binlog_checksum;
+@@GLOBAL.binlog_checksum
+NONE
diff --git a/mysql-test/suite/binlog_in_engine/not_implemented_yet.test 
b/mysql-test/suite/binlog_in_engine/not_implemented_yet.test
index 7351c36bc78..2b34a337c51 100644
--- a/mysql-test/suite/binlog_in_engine/not_implemented_yet.test
+++ b/mysql-test/suite/binlog_in_engine/not_implemented_yet.test
@@ -32,3 +32,12 @@ COMMIT;
 SELECT * FROM t ORDER BY a;
 DROP TRIGGER tr;
 DROP TABLE t;
+
+--echo ### MDEV-39604: @@binlog_checksum is not used with new binlog.
+SET @old_checksum= @@GLOBAL.binlog_checksum;
+SET GLOBAL binlog_checksum=CRC32;
+SELECT @@GLOBAL.binlog_checksum;
+SET GLOBAL binlog_checksum=NONE;
+SELECT @@GLOBAL.binlog_checksum;
+SET GLOBAL binlog_checksum=@old_checksum;
+SELECT @@GLOBAL.binlog_checksum;
diff --git a/sql/log.cc b/sql/log.cc
index 8e2e37a83fc..3da81552f47 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -14752,14 +14752,18 @@ binlog_checksum_update(MYSQL_THD thd, struct 
st_mysql_sys_var *var,
   bool check_purge= false;
   ulong UNINIT_VAR(prev_binlog_id);
 
-  mysql_mutex_unlock(&LOCK_global_system_variables);
-  if (opt_binlog_engine_hton && value)
+  if (opt_binlog_engine_hton)
   {
-    sql_print_information("Value of binlog_checksum forced to NONE since "
-                          "binlog_storage_engine is enabled, where "
-                          "per-event checksumming is not needed");
-    value= 0;
+    if (value)
+    {
+      sql_print_information("Value of binlog_checksum forced to NONE since "
+                            "binlog_storage_engine is enabled, where "
+                            "per-event checksumming is not needed");
+    }
+    binlog_checksum_options= 0;
+    return;
   }
+  mysql_mutex_unlock(&LOCK_global_system_variables);
   mysql_mutex_lock(mysql_bin_log.get_log_lock());
   if(mysql_bin_log.is_open())
   {
-- 
2.47.3

_______________________________________________
commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to