forked from facebook/mysql-5.6
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Skip reading binlog files during show binary logs
Summary: SHOW BINARY LOGS requires reading each binlog file to determine if it is encrypted. This scan holds the index lock, which can block binlog rotation when the current binlog has reached capacity. Allow reading the binlog file to be disabled during show binary logs. Reviewed By: abhinav04sharma Differential Revision: D28124075
- Loading branch information
Herman Lee
committed
Nov 18, 2023
1 parent
f674306
commit 862d1ac
Showing
10 changed files
with
144 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
mysql-test/suite/sys_vars/r/show_binlogs_encryption_basic.result
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
SET @start_global_value = @@global.show_binlogs_encryption; | ||
SELECT @start_global_value; | ||
@start_global_value | ||
1 | ||
SELECT @@session.show_binlogs_encryption; | ||
ERROR HY000: Variable 'show_binlogs_encryption' is a GLOBAL variable | ||
SET GLOBAL show_binlogs_encryption=1; | ||
SET GLOBAL show_binlogs_encryption=0; | ||
SET GLOBAL show_binlogs_encryption=true; | ||
SET GLOBAL show_binlogs_encryption=false; | ||
SET GLOBAL show_binlogs_encryption=on; | ||
SET GLOBAL show_binlogs_encryption=off; | ||
SET GLOBAL show_binlogs_encryption=1.1; | ||
ERROR 42000: Incorrect argument type to variable 'show_binlogs_encryption' | ||
SET GLOBAL show_binlogs_encryption="foo"; | ||
ERROR 42000: Variable 'show_binlogs_encryption' can't be set to the value of 'foo' | ||
SET GLOBAL show_binlogs_encryption=-1; | ||
ERROR 42000: Variable 'show_binlogs_encryption' can't be set to the value of '-1' | ||
RESET MASTER; | ||
CREATE TABLE t1 (pk INT, PRIMARY KEY (pk)) ENGINE=INNODB; | ||
INSERT INTO t1 VALUES (1); | ||
FLUSH LOGS; | ||
INSERT INTO t1 VALUES (2); | ||
FLUSH LOGS; | ||
SET GLOBAL show_binlogs_encryption=1; | ||
SHOW MASTER LOGS; | ||
Log_name File_size Encrypted | ||
1.000001 # No | ||
1.000002 # No | ||
1.000003 # No | ||
SHOW MASTER LOGS WITH GTID; | ||
Log_name File_size Encrypted Prev_gtid_set | ||
1.000001 # No # [empty] | ||
1.000002 # No # uuid:1-2 | ||
1.000003 # No # uuid:1-3 | ||
SET GLOBAL show_binlogs_encryption=0; | ||
SHOW MASTER LOGS; | ||
Log_name File_size Encrypted | ||
1.000001 # NULL | ||
1.000002 # NULL | ||
1.000003 # No | ||
SHOW MASTER LOGS WITH GTID; | ||
Log_name File_size Encrypted Prev_gtid_set | ||
1.000001 # NULL # [empty] | ||
1.000002 # NULL # uuid:1-2 | ||
1.000003 # No # uuid:1-3 | ||
DROP TABLE t1; | ||
RESET MASTER; | ||
SET GLOBAL show_binlogs_encryption = @start_global_value; |
1 change: 1 addition & 0 deletions
1
mysql-test/suite/sys_vars/t/show_binlogs_encryption_basic-master.opt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--log-bin=1 --gtid_mode=ON --enforce_gtid_consistency |
64 changes: 64 additions & 0 deletions
64
mysql-test/suite/sys_vars/t/show_binlogs_encryption_basic.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
-- source include/load_sysvars.inc | ||
|
||
SET @start_global_value = @@global.show_binlogs_encryption; | ||
SELECT @start_global_value; | ||
|
||
# | ||
# exists as global only | ||
# | ||
--Error ER_INCORRECT_GLOBAL_LOCAL_VAR | ||
SELECT @@session.show_binlogs_encryption; | ||
|
||
# | ||
# correct types | ||
# | ||
SET GLOBAL show_binlogs_encryption=1; | ||
SET GLOBAL show_binlogs_encryption=0; | ||
SET GLOBAL show_binlogs_encryption=true; | ||
SET GLOBAL show_binlogs_encryption=false; | ||
SET GLOBAL show_binlogs_encryption=on; | ||
SET GLOBAL show_binlogs_encryption=off; | ||
|
||
# | ||
# incorrect types | ||
# | ||
--error ER_WRONG_TYPE_FOR_VAR | ||
SET GLOBAL show_binlogs_encryption=1.1; | ||
--error ER_WRONG_VALUE_FOR_VAR | ||
SET GLOBAL show_binlogs_encryption="foo"; | ||
--error ER_WRONG_VALUE_FOR_VAR | ||
SET GLOBAL show_binlogs_encryption=-1; | ||
|
||
RESET MASTER; | ||
|
||
CREATE TABLE t1 (pk INT, PRIMARY KEY (pk)) ENGINE=INNODB; | ||
INSERT INTO t1 VALUES (1); | ||
FLUSH LOGS; | ||
INSERT INTO t1 VALUES (2); | ||
FLUSH LOGS; | ||
|
||
SET GLOBAL show_binlogs_encryption=1; | ||
let $master_uuid=`select @@server_uuid;`; | ||
replace_result $master_uuid uuid; replace_column 2 #; | ||
SHOW MASTER LOGS; | ||
|
||
let $master_uuid=`select @@server_uuid;`; | ||
replace_result $master_uuid uuid; replace_column 2 #; | ||
SHOW MASTER LOGS WITH GTID; | ||
|
||
SET GLOBAL show_binlogs_encryption=0; | ||
let $master_uuid=`select @@server_uuid;`; | ||
replace_result $master_uuid uuid; replace_column 2 #; | ||
SHOW MASTER LOGS; | ||
|
||
let $master_uuid=`select @@server_uuid;`; | ||
replace_result $master_uuid uuid; replace_column 2 #; | ||
SHOW MASTER LOGS WITH GTID; | ||
|
||
DROP TABLE t1; | ||
|
||
RESET MASTER; | ||
# | ||
# cleanup | ||
# | ||
SET GLOBAL show_binlogs_encryption = @start_global_value; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters