Skip to content

Commit 94e0df2

Browse files
committed
WL#15154 patch #1 config parameters
Add boolean parameter "RequireCertificate" to [DB] section. Default is false. If true, node will fail at startup time unless it finds a TLS key and a current valid certificate. Add boolean parameter "RequireTls" to [DB] section. Default is false. If true, every transporter link involving the data node must use TLS. Add boolean parameter "RequireTls" to [TCP] sections. This is computed, and not user-setable. If either endpoint of a link has RequireTls set to true, RequireTls for the link will be set true. Add some clarifying comments to ndbinfo_plans test. Change-Id: I889d9b7563022e2ebb2eaae92c3b26b557180d40
1 parent 95ea7c8 commit 94e0df2

File tree

5 files changed

+77
-8
lines changed

5 files changed

+77
-8
lines changed

mysql-test/suite/ndb/r/ndbinfo_plans.result

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ Select tables optimized away
4545
NULL
4646

4747
## Information schema reveals row counts as seen by optimizer
48-
## (but filter out cpu-related tables where results are not predictable)
4948
set ndbinfo_show_hidden=1;
5049
SELECT table_name, table_rows, avg_row_length
5150
FROM information_schema.tables
5251
WHERE table_schema='ndbinfo' AND table_type = 'BASE TABLE'
5352
AND table_name not like '%cpu%'
53+
AND table_name not in ('ndb$config_params', 'ndb$config_values')
5454
ORDER BY table_name;
5555
TABLE_NAME TABLE_ROWS AVG_ROW_LENGTH
5656
blobs 10 84
@@ -65,8 +65,6 @@ ndb$blocks 29 20
6565
ndb$certificates 34 44
6666
ndb$columns 535 44
6767
ndb$config_nodes 34 28
68-
ndb$config_params 167 120
69-
ndb$config_values 330 24
7068
ndb$counters 200 24
7169
ndb$dblqh_tcconnect_state 19 52
7270
ndb$dbtc_apiconnect_state 25 52
@@ -109,8 +107,17 @@ ndb$threadstat 22 144
109107
ndb$transactions 5 44
110108
ndb$transporters 32 64
111109

112-
## List the tables where estimated size equals actual size.
113110
CALL populate_sizes();
111+
112+
SELECT table_name, est_rows, actual_rows from rowcounts
113+
WHERE table_name = "ndb$config_values";
114+
table_name est_rows actual_rows
115+
ndb$config_values 334 334
116+
## Note:
117+
## the estimate for config_values relies on a constant in NdbinfoTables.cpp
118+
## which must be manually maintained in order for the test to pass.
119+
##
120+
## List the tables where estimated size equals actual size.
114121
SELECT count(*) from rowcounts WHERE est_rows = actual_rows;
115122
count(*)
116123
29

mysql-test/suite/ndb/t/ndbinfo_plans.test

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,19 @@ let $extra= query_get_value(explain select count(*) from counters, Extra, 1);
3939
echo $extra;
4040

4141
## Information schema reveals row counts as seen by optimizer
42-
## (but filter out cpu-related tables where results are not predictable)
42+
# Filtered out:
43+
# * cpu-related tables, where results are not predictable
44+
# * config_params, which changes when parameters are added, but will
45+
# be accurate
46+
# * config_values, which is queried separately below, along with an
47+
# explanatory comment that is copied to the result file
4348
set ndbinfo_show_hidden=1;
4449
--horizontal_results
4550
SELECT table_name, table_rows, avg_row_length
4651
FROM information_schema.tables
4752
WHERE table_schema='ndbinfo' AND table_type = 'BASE TABLE'
4853
AND table_name not like '%cpu%'
54+
AND table_name not in ('ndb$config_params', 'ndb$config_values')
4955
ORDER BY table_name;
5056

5157
--disable_query_log
@@ -85,8 +91,17 @@ END|;
8591
--delimiter ;
8692
--enable_query_log
8793

88-
## List the tables where estimated size equals actual size.
8994
CALL populate_sizes();
95+
96+
# Query config_values separately for clarity.
97+
SELECT table_name, est_rows, actual_rows from rowcounts
98+
WHERE table_name = "ndb$config_values";
99+
## Note:
100+
## the estimate for config_values relies on a constant in NdbinfoTables.cpp
101+
## which must be manually maintained in order for the test to pass.
102+
103+
##
104+
## List the tables where estimated size equals actual size.
90105
SELECT count(*) from rowcounts WHERE est_rows = actual_rows;
91106
SELECT table_name from rowcounts WHERE est_rows = actual_rows
92107
ORDER BY table_name;

storage/ndb/include/mgmapi/mgmapi_config_parameters.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#define CFG_TOTAL_SEND_BUFFER_MEMORY 9
3939
#define CFG_LOCATION_DOMAIN_ID 10
4040
#define CFG_NODE_DEDICATED 11
41+
#define CFG_NODE_REQUIRE_CERT 12
4142

4243
/**
4344
* DB config parameters
@@ -267,6 +268,7 @@
267268

268269
#define CFG_DB_TRANS_ERROR_LOGLEVEL 679
269270
#define CFG_DB_ENCRYPTED_FILE_SYSTEM 680
271+
#define CFG_DB_REQUIRE_TLS 681
270272

271273
#define CFG_NODE_ARBIT_RANK 200
272274
#define CFG_NODE_ARBIT_DELAY 201
@@ -323,6 +325,7 @@
323325
#define CFG_TCP_MAXSEG_SIZE 459
324326
#define CFG_TCP_BIND_INADDR_ANY 460
325327
#define CFG_TCP_SPINTIME 461
328+
#define CFG_TCP_REQUIRE_TLS 462
326329

327330
#define CFG_SHM_SEND_SIGNAL_ID 500
328331
#define CFG_SHM_CHECKSUM 501

storage/ndb/src/common/debugger/NdbinfoTables.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,7 @@ DECLARE_NDBINFO_TABLE(TC_TIME_TRACK_STATS, 15) =
635635
DECLARE_NDBINFO_TABLE(CONFIG_VALUES,3) =
636636
{ { "config_values", 3, 0,
637637
[] (const Ndbinfo::Counts &c) {
638-
return c.data_nodes * 165; // 165 = current number of config parameters
638+
return c.data_nodes * 167; // 167 = current number of config parameters
639639
},
640640
"Configuration parameter values" },
641641
{

storage/ndb/src/common/mgmcommon/ConfigInfo.cpp

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,6 +486,18 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
486486
"1",
487487
STR_VALUE(MAX_DATA_NODE_ID) },
488488

489+
{
490+
CFG_NODE_REQUIRE_CERT,
491+
"RequireCertificate",
492+
DB_TOKEN,
493+
"Require valid TLS key and certificate at startup time",
494+
ConfigInfo::CI_USED,
495+
false,
496+
ConfigInfo::CI_BOOL,
497+
"false",
498+
"false",
499+
"true" },
500+
489501
{
490502
CFG_DB_SERVER_PORT,
491503
"ServerPort",
@@ -1898,6 +1910,19 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
18981910
"0",
18991911
"1"},
19001912

1913+
{
1914+
CFG_DB_REQUIRE_TLS,
1915+
"RequireTls",
1916+
DB_TOKEN,
1917+
"Require TLS authenticated secure connections",
1918+
ConfigInfo::CI_USED,
1919+
0,
1920+
ConfigInfo::CI_BOOL,
1921+
"false",
1922+
"false",
1923+
"true"
1924+
},
1925+
19011926
{
19021927
CFG_EXTRA_SEND_BUFFER_MEMORY,
19031928
"ExtraSendBufferMemory",
@@ -3486,6 +3511,19 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
34863511
"2000"
34873512
},
34883513

3514+
{
3515+
CFG_TCP_REQUIRE_TLS,
3516+
"RequireTls",
3517+
"TCP",
3518+
"Use TLS authenticated secure connections for TCP transporter links",
3519+
ConfigInfo::CI_INTERNAL,
3520+
0,
3521+
ConfigInfo::CI_BOOL,
3522+
"false",
3523+
"false",
3524+
"true"
3525+
},
3526+
34893527
{
34903528
CFG_TCP_RECEIVE_BUFFER_SIZE,
34913529
"ReceiveBufferMemory",
@@ -6303,6 +6341,8 @@ add_a_connection(Vector<ConfigInfo::ConfigRuleSection>&sections,
63036341
Uint32 wan = 0;
63046342
Uint32 location_domain1 = 0;
63056343
Uint32 location_domain2 = 0;
6344+
Uint32 reqTls1 = 0;
6345+
Uint32 reqTls2 = 0;
63066346
require(ctx.m_config->get("Node", nodeId1, &tmp));
63076347
tmp->get("HostName", &hostname1);
63086348
tmp->get("LocationDomainId", &location_domain1);
@@ -6318,6 +6358,7 @@ add_a_connection(Vector<ConfigInfo::ConfigRuleSection>&sections,
63186358
return ret == 0 ? true : false;
63196359
}
63206360
}
6361+
tmp->get("RequireTls", &reqTls1);
63216362

63226363
require(ctx.m_config->get("Node", nodeId2, &tmp));
63236364
tmp->get("HostName", &hostname2);
@@ -6345,7 +6386,8 @@ add_a_connection(Vector<ConfigInfo::ConfigRuleSection>&sections,
63456386
return ret == 0 ? true : false;
63466387
}
63476388
}
6348-
6389+
tmp->get("RequireTls", &reqTls2);
6390+
63496391
char buf[16];
63506392
s.m_sectionData= new Properties(true);
63516393
BaseString::snprintf(buf, sizeof(buf), "%u", nodeId1);
@@ -6372,6 +6414,8 @@ add_a_connection(Vector<ConfigInfo::ConfigRuleSection>&sections,
63726414
s.m_sectionData->put("TCP_SND_BUF_SIZE", 4194304);
63736415
s.m_sectionData->put("TCP_MAXSEG_SIZE", 61440);
63746416
}
6417+
6418+
s.m_sectionData->put("RequireTls", reqTls1 | reqTls2);
63756419
}
63766420

63776421
sections.push_back(s);

0 commit comments

Comments
 (0)