Skip to content

Commit d1d3254

Browse files
committed
WL#12086: cryptographically signed SET statements.
1 parent 2eb9b74 commit d1d3254

28 files changed

+683
-80
lines changed

include/map_helpers.h

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
22
33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License, version 2.0,
@@ -274,6 +274,12 @@ class collation_unordered_set
274274
Malloc_allocator<Key>>(
275275
/*bucket_count=*/10, Collation_hasher(cs), Collation_key_equal(cs),
276276
Malloc_allocator<>(psi_key)) {}
277+
collation_unordered_set(std::initializer_list<Key> il, CHARSET_INFO *cs,
278+
PSI_memory_key psi_key)
279+
: std::unordered_set<Key, Collation_hasher, Collation_key_equal,
280+
Malloc_allocator<Key>>(
281+
il, /*bucket_count=*/10, Collation_hasher(cs),
282+
Collation_key_equal(cs), Malloc_allocator<>(psi_key)) {}
277283
};
278284

279285
/** std::unordered_set, but allocated on a MEM_ROOT. */

mysql-test/r/all_persisted_variables.result

+4-4
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,17 @@ include/assert.inc ['Expect 554 variables in the table. Due to open Bugs, we are
4242

4343
# Test SET PERSIST
4444

45-
include/assert.inc [Expect 361 persisted variables in the table. Due to open Bugs, we are checking for 356]
45+
include/assert.inc [Expect 359 persisted variables in the table. Due to open Bugs, we are checking for 354]
4646

4747
************************************************************
4848
* 3. Restart server, it must preserve the persisted variable
4949
* settings. Verify persisted configuration.
5050
************************************************************
5151
# restart
5252

53-
include/assert.inc [Expect 356 persisted variables in persisted_variables table.]
54-
include/assert.inc [Expect 356 persisted variables shown as PERSISTED in variables_info table.]
55-
include/assert.inc [Expect 356 persisted variables with matching peristed and global values.]
53+
include/assert.inc [Expect 354 persisted variables in persisted_variables table.]
54+
include/assert.inc [Expect 354 persisted variables shown as PERSISTED in variables_info table.]
55+
include/assert.inc [Expect 354 persisted variables with matching peristed and global values.]
5656

5757
************************************************************
5858
* 4. Test RESET PERSIST IF EXISTS. Verify persisted variable

mysql-test/r/mysqld--help-notwin.result

+4
Original file line numberDiff line numberDiff line change
@@ -897,6 +897,9 @@ The following options may be given as the first argument:
897897
--performance-schema-users-size=#
898898
Maximum number of instrumented users. Use 0 to disable,
899899
-1 for automated scaling.
900+
--persist-only-admin-x509-subject[=name]
901+
The client peer certificate name required to enable
902+
setting all system variables via SET PERSIST[_ONLY]
900903
--persisted-globals-load
901904
When this option is enabled, config file mysqld-auto.cnf
902905
is read and applied to server, else this file is ignored
@@ -1568,6 +1571,7 @@ performance-schema-session-connect-attrs-size -1
15681571
performance-schema-setup-actors-size -1
15691572
performance-schema-setup-objects-size -1
15701573
performance-schema-users-size -1
1574+
persist-only-admin-x509-subject
15711575
persisted-globals-load TRUE
15721576
port ####
15731577
port-open-timeout 0

mysql-test/r/mysqld--help-win.result

+4
Original file line numberDiff line numberDiff line change
@@ -897,6 +897,9 @@ The following options may be given as the first argument:
897897
--performance-schema-users-size=#
898898
Maximum number of instrumented users. Use 0 to disable,
899899
-1 for automated scaling.
900+
--persist-only-admin-x509-subject[=name]
901+
The client peer certificate name required to enable
902+
setting all system variables via SET PERSIST[_ONLY]
900903
--persisted-globals-load
901904
When this option is enabled, config file mysqld-auto.cnf
902905
is read and applied to server, else this file is ignored
@@ -1576,6 +1579,7 @@ performance-schema-session-connect-attrs-size -1
15761579
performance-schema-setup-actors-size -1
15771580
performance-schema-setup-objects-size -1
15781581
performance-schema-users-size -1
1582+
persist-only-admin-x509-subject
15791583
persisted-globals-load TRUE
15801584
port ####
15811585
port-open-timeout 0

mysql-test/r/persisted_variables_bugs.result

-4
Original file line numberDiff line numberDiff line change
@@ -243,12 +243,8 @@ RESET PERSIST;
243243
SET PERSIST mandatory_roles= default;
244244
# Restart server and check if server starts
245245
# restart
246-
SET PERSIST keyring_operations= default;
247-
# Restart server and check if server starts
248-
# restart
249246
SELECT * FROM performance_schema.persisted_variables ORDER BY 1;
250247
VARIABLE_NAME VARIABLE_VALUE
251-
keyring_operations ON
252248
mandatory_roles
253249
RESET PERSIST;
254250
#

mysql-test/suite/binlog_nogtid/r/binlog_persist_only_variables.result

+6-4
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ SET PERSIST_ONLY log_bin_index = @@GLOBAL.log_bin_index;
6363
ERROR HY000: Variable 'log_bin_index' is a non persistent read only variable
6464
SET PERSIST_ONLY log_bin_trust_function_creators = @@GLOBAL.log_bin_trust_function_creators;
6565
SET PERSIST_ONLY log_bin_use_v1_row_events = @@GLOBAL.log_bin_use_v1_row_events;
66+
ERROR HY000: Variable 'log_bin_use_v1_row_events' is a non persistent variable
6667
SET PERSIST_ONLY log_slave_updates = @@GLOBAL.log_slave_updates;
6768
SET PERSIST_ONLY log_slow_slave_statements = @@GLOBAL.log_slow_slave_statements;
6869
SET PERSIST_ONLY log_statements_unsafe_for_binlog = @@GLOBAL.log_statements_unsafe_for_binlog;
@@ -119,16 +120,16 @@ SET PERSIST_ONLY sync_master_info = @@GLOBAL.sync_master_info;
119120
SET PERSIST_ONLY sync_relay_log = @@GLOBAL.sync_relay_log;
120121
SET PERSIST_ONLY sync_relay_log_info = @@GLOBAL.sync_relay_log_info;
121122

122-
include/assert.inc ['Expect 70 persisted variables in persisted_variables table.']
123+
include/assert.inc ['Expect 69 persisted variables in persisted_variables table.']
123124

124125
############################################################
125126
# 2. Restart server, it must preserve the persisted variable
126127
# settings. Verify persisted configuration.
127128
# restart
128129

129-
include/assert.inc ['Expect 70 persisted variables in persisted_variables table.']
130-
include/assert.inc ['Expect 70 persisted variables shown as PERSISTED in variables_info table.']
131-
include/assert.inc ['Expect 70 persisted variables with matching peristed and global values.']
130+
include/assert.inc ['Expect 69 persisted variables in persisted_variables table.']
131+
include/assert.inc ['Expect 69 persisted variables shown as PERSISTED in variables_info table.']
132+
include/assert.inc ['Expect 69 persisted variables with matching peristed and global values.']
132133

133134
############################################################
134135
# 3. Test RESET PERSIST. Verify persisted variable settings
@@ -168,6 +169,7 @@ RESET PERSIST log_bin_index;
168169
ERROR HY000: Variable log_bin_index does not exist in persisted config file
169170
RESET PERSIST log_bin_trust_function_creators;
170171
RESET PERSIST log_bin_use_v1_row_events;
172+
ERROR HY000: Variable log_bin_use_v1_row_events does not exist in persisted config file
171173
RESET PERSIST log_slave_updates;
172174
RESET PERSIST log_slow_slave_statements;
173175
RESET PERSIST log_statements_unsafe_for_binlog;

mysql-test/suite/binlog_nogtid/r/binlog_persist_variables.result

+7-4
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ SET PERSIST log_bin_index = @@GLOBAL.log_bin_index;
6464
ERROR HY000: Variable 'log_bin_index' is a read only variable
6565
SET PERSIST log_bin_trust_function_creators = @@GLOBAL.log_bin_trust_function_creators;
6666
SET PERSIST log_bin_use_v1_row_events = @@GLOBAL.log_bin_use_v1_row_events;
67+
ERROR HY000: Variable 'log_bin_use_v1_row_events' is a non persistent variable
6768
SET PERSIST log_slave_updates = @@GLOBAL.log_slave_updates;
6869
ERROR HY000: Variable 'log_slave_updates' is a read only variable
6970
SET PERSIST log_slow_slave_statements = @@GLOBAL.log_slow_slave_statements;
@@ -124,16 +125,16 @@ SET PERSIST sync_master_info = @@GLOBAL.sync_master_info;
124125
SET PERSIST sync_relay_log = @@GLOBAL.sync_relay_log;
125126
SET PERSIST sync_relay_log_info = @@GLOBAL.sync_relay_log_info;
126127

127-
include/assert.inc ['Expect 65 persisted variables in persisted_variables table.']
128+
include/assert.inc ['Expect 64 persisted variables in persisted_variables table.']
128129

129130
############################################################
130131
# 2. Restart server, it must preserve the persisted variable
131132
# settings. Verify persisted configuration.
132133
# restart
133134

134-
include/assert.inc ['Expect 65 persisted variables in persisted_variables table.']
135-
include/assert.inc ['Expect 65 persisted variables shown as PERSISTED in variables_info table.']
136-
include/assert.inc ['Expect 65 persisted variables with matching peristed and global values.']
135+
include/assert.inc ['Expect 64 persisted variables in persisted_variables table.']
136+
include/assert.inc ['Expect 64 persisted variables shown as PERSISTED in variables_info table.']
137+
include/assert.inc ['Expect 64 persisted variables with matching peristed and global values.']
137138

138139
############################################################
139140
# 3. Test RESET PERSIST IF EXISTS. Verify persisted variable
@@ -180,6 +181,8 @@ Warnings:
180181
Warning 3615 Variable log_bin_index does not exist in persisted config file
181182
RESET PERSIST IF EXISTS log_bin_trust_function_creators;
182183
RESET PERSIST IF EXISTS log_bin_use_v1_row_events;
184+
Warnings:
185+
Warning 3615 Variable log_bin_use_v1_row_events does not exist in persisted config file
183186
RESET PERSIST IF EXISTS log_slave_updates;
184187
Warnings:
185188
Warning 3615 Variable log_slave_updates does not exist in persisted config file

mysql-test/suite/binlog_nogtid/t/binlog_persist_only_variables.test

+11-11
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,14 @@ while ( $varid <= $countvars )
6969
--let $varnames= `SELECT varname FROM rplvars WHERE id=$varid`
7070

7171
# Following variables are non persistent read only variables.
72-
if (`SELECT '$varnames' IN ('gtid_executed', 'gtid_owned', 'log_bin', 'log_bin_basename', 'log_bin_index', 'relay_log', 'relay_log_basename', 'relay_log_index', 'relay_log_info_file', 'slave_load_tmpdir')`)
72+
if (`SELECT '$varnames' IN ('gtid_executed', 'gtid_owned', 'log_bin', 'log_bin_basename', 'log_bin_index', 'relay_log', 'relay_log_basename', 'relay_log_index', 'relay_log_info_file', 'slave_load_tmpdir', 'log_bin_use_v1_row_events')`)
7373
{
7474
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
7575
}
7676
--eval SET PERSIST_ONLY $varnames = @@GLOBAL.$varnames
7777

7878
# TODO: Remove/update this once Bug#27322592 is FIXED.
79-
if (`SELECT '$varnames' IN ('binlog_direct_non_transactional_updates', 'binlog_order_commits', 'binlog_rows_query_log_events', 'log_bin_trust_function_creators', 'log_bin_use_v1_row_events', 'log_slow_slave_statements', 'log_statements_unsafe_for_binlog', 'master_verify_checksum', 'slave_allow_batching', 'slave_compressed_protocol', 'slave_preserve_commit_order', 'slave_sql_verify_checksum', 'relay_log_purge', 'rpl_semi_sync_master_enabled', 'rpl_semi_sync_master_wait_no_slave', 'rpl_semi_sync_slave_enabled', 'binlog_gtid_simple_recovery', 'log_slave_updates', 'relay_log_recovery')`)
79+
if (`SELECT '$varnames' IN ('binlog_direct_non_transactional_updates', 'binlog_order_commits', 'binlog_rows_query_log_events', 'log_bin_trust_function_creators', 'log_slow_slave_statements', 'log_statements_unsafe_for_binlog', 'master_verify_checksum', 'slave_allow_batching', 'slave_compressed_protocol', 'slave_preserve_commit_order', 'slave_sql_verify_checksum', 'relay_log_purge', 'rpl_semi_sync_master_enabled', 'rpl_semi_sync_master_wait_no_slave', 'rpl_semi_sync_slave_enabled', 'binlog_gtid_simple_recovery', 'log_slave_updates', 'relay_log_recovery')`)
8080
{
8181
--disable_query_log
8282
--eval SELECT varvalue INTO @varvalues FROM rplvars WHERE id=$varid
@@ -88,8 +88,8 @@ while ( $varid <= $countvars )
8888
}
8989

9090
--echo
91-
--let $assert_text= 'Expect 70 persisted variables in persisted_variables table.'
92-
--let $assert_cond= [SELECT COUNT(*) as count FROM performance_schema.persisted_variables, count, 1] = 70
91+
--let $assert_text= 'Expect 69 persisted variables in persisted_variables table.'
92+
--let $assert_cond= [SELECT COUNT(*) as count FROM performance_schema.persisted_variables, count, 1] = 69
9393
--source include/assert.inc
9494

9595

@@ -101,16 +101,16 @@ while ( $varid <= $countvars )
101101
--source include/wait_until_connected_again.inc
102102

103103
--echo
104-
--let $assert_text= 'Expect 70 persisted variables in persisted_variables table.'
105-
--let $assert_cond= [SELECT COUNT(*) as count FROM performance_schema.persisted_variables, count, 1] = 70
104+
--let $assert_text= 'Expect 69 persisted variables in persisted_variables table.'
105+
--let $assert_cond= [SELECT COUNT(*) as count FROM performance_schema.persisted_variables, count, 1] = 69
106106
--source include/assert.inc
107107

108-
--let $assert_text= 'Expect 70 persisted variables shown as PERSISTED in variables_info table.'
109-
--let $assert_cond= [SELECT COUNT(*) as count FROM performance_schema.variables_info WHERE variable_source="PERSISTED", count, 1] = 70
108+
--let $assert_text= 'Expect 69 persisted variables shown as PERSISTED in variables_info table.'
109+
--let $assert_cond= [SELECT COUNT(*) as count FROM performance_schema.variables_info WHERE variable_source="PERSISTED", count, 1] = 69
110110
--source include/assert.inc
111111

112-
--let $assert_text= 'Expect 70 persisted variables with matching peristed and global values.'
113-
--let $assert_cond= [SELECT COUNT(*) as count FROM performance_schema.variables_info vi JOIN performance_schema.persisted_variables pv JOIN performance_schema.global_variables gv ON vi.variable_name=pv.variable_name AND vi.variable_name=gv.variable_name AND pv.variable_value=gv.variable_value WHERE vi.variable_source="PERSISTED", count, 1] = 70
112+
--let $assert_text= 'Expect 69 persisted variables with matching peristed and global values.'
113+
--let $assert_cond= [SELECT COUNT(*) as count FROM performance_schema.variables_info vi JOIN performance_schema.persisted_variables pv JOIN performance_schema.global_variables gv ON vi.variable_name=pv.variable_name AND vi.variable_name=gv.variable_name AND pv.variable_value=gv.variable_value WHERE vi.variable_source="PERSISTED", count, 1] = 69
114114
--source include/assert.inc
115115

116116

@@ -123,7 +123,7 @@ while ( $varid <= $countvars )
123123
{
124124
--let $varnames= `SELECT varname FROM rplvars WHERE id=$varid`
125125

126-
if (`SELECT '$varnames' IN ('gtid_executed', 'gtid_owned', 'log_bin', 'log_bin_basename', 'log_bin_index', 'relay_log', 'relay_log_basename', 'relay_log_index', 'relay_log_info_file', 'slave_load_tmpdir')`)
126+
if (`SELECT '$varnames' IN ('gtid_executed', 'gtid_owned', 'log_bin', 'log_bin_basename', 'log_bin_index', 'relay_log', 'relay_log_basename', 'relay_log_index', 'relay_log_info_file', 'slave_load_tmpdir', 'log_bin_use_v1_row_events')`)
127127
{
128128
--error ER_VAR_DOES_NOT_EXIST
129129
}

mysql-test/suite/binlog_nogtid/t/binlog_persist_variables.test

+9-9
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ while ( $varid <= $countvars )
7070
--let $varnames= `SELECT varname FROM rplvars WHERE id=$varid;`
7171

7272
# Following variables are either non persistent or read only variables.
73-
if (`SELECT '$varnames' IN ('binlog_gtid_simple_recovery', 'gtid_executed', 'gtid_next', 'gtid_owned', 'log_bin', 'log_bin_basename', 'log_bin_index', 'log_slave_updates', 'relay_log', 'relay_log_basename', 'relay_log_index', 'relay_log_index', 'relay_log_info_file', 'relay_log_recovery', 'relay_log_space_limit', 'slave_load_tmpdir', 'slave_load_tmpdir', 'slave_skip_errors')`)
73+
if (`SELECT '$varnames' IN ('binlog_gtid_simple_recovery', 'gtid_executed', 'gtid_next', 'gtid_owned', 'log_bin', 'log_bin_basename', 'log_bin_index', 'log_slave_updates', 'relay_log', 'relay_log_basename', 'relay_log_index', 'relay_log_index', 'relay_log_info_file', 'relay_log_recovery', 'relay_log_space_limit', 'slave_load_tmpdir', 'slave_load_tmpdir', 'slave_skip_errors', 'log_bin_use_v1_row_events')`)
7474
{
7575
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
7676
}
@@ -80,8 +80,8 @@ while ( $varid <= $countvars )
8080
}
8181

8282
--echo
83-
--let $assert_text= 'Expect 65 persisted variables in persisted_variables table.'
84-
--let $assert_cond= [SELECT COUNT(*) as count FROM performance_schema.persisted_variables, count, 1] = 65
83+
--let $assert_text= 'Expect 64 persisted variables in persisted_variables table.'
84+
--let $assert_cond= [SELECT COUNT(*) as count FROM performance_schema.persisted_variables, count, 1] = 64
8585
--source include/assert.inc
8686

8787
--echo
@@ -92,16 +92,16 @@ while ( $varid <= $countvars )
9292
--source include/wait_until_connected_again.inc
9393

9494
--echo
95-
--let $assert_text= 'Expect 65 persisted variables in persisted_variables table.'
96-
--let $assert_cond= [SELECT COUNT(*) as count FROM performance_schema.persisted_variables, count, 1] = 65
95+
--let $assert_text= 'Expect 64 persisted variables in persisted_variables table.'
96+
--let $assert_cond= [SELECT COUNT(*) as count FROM performance_schema.persisted_variables, count, 1] = 64
9797
--source include/assert.inc
9898

99-
--let $assert_text= 'Expect 65 persisted variables shown as PERSISTED in variables_info table.'
100-
--let $assert_cond= [SELECT COUNT(*) as count FROM performance_schema.variables_info WHERE variable_source="PERSISTED", count, 1] = 65
99+
--let $assert_text= 'Expect 64 persisted variables shown as PERSISTED in variables_info table.'
100+
--let $assert_cond= [SELECT COUNT(*) as count FROM performance_schema.variables_info WHERE variable_source="PERSISTED", count, 1] = 64
101101
--source include/assert.inc
102102

103-
--let $assert_text= 'Expect 65 persisted variables with matching peristed and global values.'
104-
--let $assert_cond= [SELECT COUNT(*) as count FROM performance_schema.variables_info vi JOIN performance_schema.persisted_variables pv JOIN performance_schema.global_variables gv ON vi.variable_name=pv.variable_name AND vi.variable_name=gv.variable_name AND pv.variable_value=gv.variable_value WHERE vi.variable_source="PERSISTED", count, 1] = 65
103+
--let $assert_text= 'Expect 64 persisted variables with matching peristed and global values.'
104+
--let $assert_cond= [SELECT COUNT(*) as count FROM performance_schema.variables_info vi JOIN performance_schema.persisted_variables pv JOIN performance_schema.global_variables gv ON vi.variable_name=pv.variable_name AND vi.variable_name=gv.variable_name AND pv.variable_value=gv.variable_value WHERE vi.variable_source="PERSISTED", count, 1] = 64
105105
--source include/assert.inc
106106

107107

0 commit comments

Comments
 (0)