Skip to content

Commit 278fb90

Browse files
committed
ndb
- merge in support for CI_BITMASK parameters in config.in and my.cnf - change to use same code path(as much as possible) for reading both config.ini and my.cnf so that the same rules are applied to config.
2 parents 1f82504 + 58ddafe commit 278fb90

File tree

8 files changed

+358
-90
lines changed

8 files changed

+358
-90
lines changed

mysql-test/suite/ndb/bug56185.ini

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[ndbd default]
2+
3+
[ndb_mgmd]
4+
Id=1
5+
Hostname=localhost
6+
7+
[ndbd]
8+
Id=2
9+
Hostname=localhost
10+
Arbitration=WaitExternal
11+
LockExecuteThreadToCPU=37-48
12+
13+
[ndbd]
14+
Id=3
15+
Hostname=localhost
16+
Arbitration=Default
17+
LockExecuteThreadToCPU=1-2
18+
19+
[mysqld]

mysql-test/suite/ndb/ndb_config_mycnf1.cnf

+11
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,14 @@ NoOfReplicas=2
1919
ndbd = 192.168.0.1,192.168.0.2,192.168.0.3,192.168.0.4
2020
ndb_mgmd = 192.168.0.1
2121
mysqld = 192.168.0.1
22+
23+
[cluster_config.bug56185]
24+
NoOfReplicas=1
25+
ndbd = localhost
26+
ndb_mgmd = localhost
27+
mysql = localhost, localhost
28+
29+
[cluster_config.ndbd.1.bug56185]
30+
LockExecuteThreadToCPU=0-65535
31+
Arbitration=Disabled
32+

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

+3
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,6 @@ tcp,3,4,55,3 tcp,3,5,55,3 tcp,3,6,55,3 tcp,4,5,55,4 tcp,4,6,55,4 tcp,5,6,55,5 tc
3232
== 17 == bug49400
3333
ERROR -- at line 25: TCP connection is a duplicate of the existing TCP link from line 14
3434
ERROR -- at line 25: Could not store section of configuration file.
35+
== 18 == bug56185
36+
0,0-65535
37+
2,37-48 1,1-2

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

+7
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,10 @@ echo == 17 == bug49400;
5454
--error 255
5555
--exec $NDB_CONFIG --no-defaults --config-file=$MYSQL_TEST_DIR/suite/ndb/bug49400.ini 2>&1
5656

57+
echo == 18 == bug56185;
58+
# Read bitmask value and enum from my.cnf
59+
--exec $NDB_CONFIG --defaults-file=$MYSQL_TEST_DIR/suite/ndb/ndb_config_mycnf1.cnf --defaults-group-suffix=.bug56185 --query=Arbitration,LockExecuteThreadToCPU --type=ndbd --mycnf
60+
61+
# Read bitmask value and enum from config.ini
62+
--exec $NDB_CONFIG --config-file=$MYSQL_TEST_DIR/suite/ndb/bug56185.ini --query=Arbitration,LockExecuteThreadToCPU --type=ndbd
63+

storage/ndb/src/mgmsrv/ConfigInfo.cpp

+23-2
Original file line numberDiff line numberDiff line change
@@ -637,9 +637,11 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
637637
"CPU list indicating which CPU will run the execution thread(s)",
638638
ConfigInfo::CI_USED,
639639
0,
640-
ConfigInfo::CI_STRING,
640+
ConfigInfo::CI_BITMASK,
641641
0,
642-
0, 0 },
642+
0,
643+
"65535"
644+
},
643645

644646
{
645647
CFG_DB_MAINT_LOCK_CPU,
@@ -3013,6 +3015,20 @@ ConfigInfo::ConfigInfo()
30133015
else if(param._default)
30143016
pinfo.put("Default", param._default);
30153017
break;
3018+
3019+
case CI_BITMASK:
3020+
assert(param._min == 0); // Bitmask can't have min value
3021+
3022+
Uint64 tmp_uint64;
3023+
require(InitConfigFileParser::convertStringToUint64(param._max,
3024+
tmp_uint64));
3025+
pinfo.put64("Max", tmp_uint64);
3026+
3027+
if(param._default == MANDATORY)
3028+
pinfo.put("Mandatory", (Uint32)1);
3029+
else if(param._default)
3030+
pinfo.put("Default", param._default);
3031+
break;
30163032
}
30173033

30183034
// Check that pinfo is really new
@@ -3043,6 +3059,7 @@ ConfigInfo::ConfigInfo()
30433059
break;
30443060
case CI_ENUM:
30453061
case CI_STRING:
3062+
case CI_BITMASK:
30463063
require(p->put(param._fname, param._default));
30473064
break;
30483065
case CI_BOOL:
@@ -3429,6 +3446,7 @@ class PrettyPrinter : public ConfigPrinter {
34293446
fprintf(m_out, "\n");
34303447
break;
34313448

3449+
case ConfigInfo::CI_BITMASK:
34323450
case ConfigInfo::CI_ENUM:
34333451
case ConfigInfo::CI_STRING:
34343452
fprintf(m_out, "%s (String)\n", param_name);
@@ -3552,6 +3570,7 @@ class XMLPrinter : public ConfigPrinter {
35523570
pairs.put("max", buf.c_str());
35533571
break;
35543572

3573+
case ConfigInfo::CI_BITMASK:
35553574
case ConfigInfo::CI_ENUM:
35563575
case ConfigInfo::CI_STRING:
35573576
pairs.put("type", "string");
@@ -3959,6 +3978,7 @@ applyDefaultValues(InitConfigFileParser::Context & ctx,
39593978
DBUG_PRINT("info",("%s=%lld #default",name,val));
39603979
break;
39613980
}
3981+
case ConfigInfo::CI_BITMASK:
39623982
case ConfigInfo::CI_STRING:{
39633983
const char * val;
39643984
require(defaults->get(name, &val));
@@ -3987,6 +4007,7 @@ applyDefaultValues(InitConfigFileParser::Context & ctx,
39874007
DBUG_PRINT("info",("%s=%lld",name,val));
39884008
break;
39894009
}
4010+
case ConfigInfo::CI_BITMASK:
39904011
case ConfigInfo::CI_ENUM:
39914012
case ConfigInfo::CI_STRING:{
39924013
const char * val;

storage/ndb/src/mgmsrv/ConfigInfo.hpp

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ class ConfigInfo {
4343
CI_INT64,
4444
CI_STRING,
4545
CI_ENUM, // String externaly, int internally
46+
CI_BITMASK, // String both externally and internally
4647
CI_SECTION
4748
};
4849
enum Status { CI_USED, ///< Active

0 commit comments

Comments
 (0)