Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
45c94a28
Commit
45c94a28
authored
Aug 24, 2004
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
enables case insensitivity in ndb config file
parent
a8f24dc7
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
43 deletions
+47
-43
ndb/include/util/Properties.hpp
ndb/include/util/Properties.hpp
+1
-1
ndb/src/common/mgmcommon/ConfigInfo.cpp
ndb/src/common/mgmcommon/ConfigInfo.cpp
+21
-24
ndb/src/common/mgmcommon/InitConfigFileParser.cpp
ndb/src/common/mgmcommon/InitConfigFileParser.cpp
+5
-5
ndb/src/common/util/Properties.cpp
ndb/src/common/util/Properties.cpp
+20
-13
No files found.
ndb/include/util/Properties.hpp
View file @
45c94a28
...
...
@@ -55,7 +55,7 @@ public:
static
const
char
delimiter
=
':'
;
static
const
char
version
[];
Properties
();
Properties
(
bool
case_insensitive
=
false
);
Properties
(
const
Properties
&
);
Properties
(
const
Property
*
,
int
len
);
virtual
~
Properties
();
...
...
ndb/src/common/mgmcommon/ConfigInfo.cpp
View file @
45c94a28
...
...
@@ -160,14 +160,14 @@ const int ConfigInfo::m_NoOfRules = sizeof(m_SectionRules)/sizeof(SectionRule);
* Config Rules declarations
****************************************************************************/
static
bool
add_node_connections
(
Vector
<
ConfigInfo
::
ConfigRuleSection
>&
sections
,
struct
InitConfigFileParser
::
Context
&
ctx
,
const
char
*
rule_data
);
struct
InitConfigFileParser
::
Context
&
ctx
,
const
char
*
rule_data
);
static
bool
add_server_ports
(
Vector
<
ConfigInfo
::
ConfigRuleSection
>&
sections
,
struct
InitConfigFileParser
::
Context
&
ctx
,
const
char
*
rule_data
);
struct
InitConfigFileParser
::
Context
&
ctx
,
const
char
*
rule_data
);
static
bool
check_node_vs_replicas
(
Vector
<
ConfigInfo
::
ConfigRuleSection
>&
sections
,
struct
InitConfigFileParser
::
Context
&
ctx
,
const
char
*
rule_data
);
struct
InitConfigFileParser
::
Context
&
ctx
,
const
char
*
rule_data
);
const
ConfigInfo
::
ConfigRule
ConfigInfo
::
m_ConfigRules
[]
=
{
...
...
@@ -439,7 +439,7 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
8192
,
0
,
MAX_INT_RNIL
},
},
{
CFG_DB_NO_TRIGGERS
,
...
...
@@ -1892,21 +1892,19 @@ const int ConfigInfo::m_NoOfParams = sizeof(m_ParamInfo) / sizeof(ParamInfo);
****************************************************************************/
static
void
require
(
bool
v
)
{
if
(
!
v
)
abort
();}
ConfigInfo
::
ConfigInfo
()
{
ConfigInfo
::
ConfigInfo
()
:
m_info
(
true
),
m_systemDefaults
(
true
)
{
int
i
;
Properties
*
section
;
const
Properties
*
oldpinfo
;
m_info
.
setCaseInsensitiveNames
(
true
);
m_systemDefaults
.
setCaseInsensitiveNames
(
true
);
for
(
i
=
0
;
i
<
m_NoOfParams
;
i
++
)
{
const
ParamInfo
&
param
=
m_ParamInfo
[
i
];
// Create new section if it did not exist
if
(
!
m_info
.
getCopy
(
param
.
_section
,
&
section
))
{
Properties
newsection
;
newsection
.
setCaseInsensitiveNames
(
true
);
Properties
newsection
(
true
);
m_info
.
put
(
param
.
_section
,
&
newsection
);
}
...
...
@@ -1914,7 +1912,7 @@ ConfigInfo::ConfigInfo() {
m_info
.
getCopy
(
param
.
_section
,
&
section
);
// Create pinfo (parameter info) entry
Properties
pinfo
;
Properties
pinfo
(
true
)
;
pinfo
.
put
(
"Id"
,
param
.
_paramId
);
pinfo
.
put
(
"Fname"
,
param
.
_fname
);
pinfo
.
put
(
"Description"
,
param
.
_description
);
...
...
@@ -1942,8 +1940,7 @@ ConfigInfo::ConfigInfo() {
if
(
param
.
_type
!=
ConfigInfo
::
SECTION
){
Properties
*
p
;
if
(
!
m_systemDefaults
.
getCopy
(
param
.
_section
,
&
p
)){
p
=
new
Properties
();
p
->
setCaseInsensitiveNames
(
true
);
p
=
new
Properties
(
true
);
}
if
(
param
.
_type
!=
STRING
&&
param
.
_default
!=
UNDEFINED
&&
...
...
@@ -2834,7 +2831,7 @@ fixDepricated(InitConfigFileParser::Context & ctx, const char * data){
* Transform old values to new values
* Transform new values to old values (backward compatible)
*/
Properties
tmp
;
Properties
tmp
(
true
)
;
Properties
::
Iterator
it
(
ctx
.
m_currentSection
);
for
(
name
=
it
.
first
();
name
!=
NULL
;
name
=
it
.
next
())
{
const
DepricationTransform
*
p
=
&
f_deprication
[
0
];
...
...
@@ -2966,8 +2963,8 @@ add_node_connections(Vector<ConfigInfo::ConfigRuleSection>§ions,
{
Uint32
i
;
Properties
*
props
=
ctx
.
m_config
;
Properties
p_connections
;
Properties
p_connections2
;
Properties
p_connections
(
true
)
;
Properties
p_connections2
(
true
)
;
for
(
i
=
0
;;
i
++
){
const
Properties
*
tmp
;
...
...
@@ -2987,8 +2984,8 @@ add_node_connections(Vector<ConfigInfo::ConfigRuleSection>§ions,
Uint32
nNodes
;
ctx
.
m_userProperties
.
get
(
"NoOfNodes"
,
&
nNodes
);
Properties
p_db_nodes
;
Properties
p_api_mgm_nodes
;
Properties
p_db_nodes
(
true
)
;
Properties
p_api_mgm_nodes
(
true
)
;
Uint32
i_db
=
0
,
i_api_mgm
=
0
,
n
;
for
(
i
=
0
,
n
=
0
;
n
<
nNodes
;
i
++
){
...
...
@@ -3014,7 +3011,7 @@ add_node_connections(Vector<ConfigInfo::ConfigRuleSection>§ions,
if
(
!
p_connections2
.
get
(
""
,
nodeId1
+
nodeId2
<<
16
,
&
dummy
))
{
ConfigInfo
::
ConfigRuleSection
s
;
s
.
m_sectionType
=
BaseString
(
"TCP"
);
s
.
m_sectionData
=
new
Properties
;
s
.
m_sectionData
=
new
Properties
(
true
)
;
char
buf
[
16
];
snprintf
(
buf
,
sizeof
(
buf
),
"%u"
,
nodeId1
);
s
.
m_sectionData
->
put
(
"NodeId1"
,
buf
);
...
...
@@ -3031,7 +3028,7 @@ add_node_connections(Vector<ConfigInfo::ConfigRuleSection>§ions,
if
(
!
p_db_nodes
.
get
(
""
,
j
,
&
nodeId2
))
break
;
ConfigInfo
::
ConfigRuleSection
s
;
s
.
m_sectionType
=
BaseString
(
"TCP"
);
s
.
m_sectionData
=
new
Properties
;
s
.
m_sectionData
=
new
Properties
(
true
)
;
char
buf
[
16
];
snprintf
(
buf
,
sizeof
(
buf
),
"%u"
,
nodeId1
);
s
.
m_sectionData
->
put
(
"NodeId1"
,
buf
);
...
...
@@ -3052,7 +3049,7 @@ static bool add_server_ports(Vector<ConfigInfo::ConfigRuleSection>§ions,
{
#if 0
Properties * props= ctx.m_config;
Properties computers;
Properties computers
(true)
;
Uint32 port_base = NDB_BASE_PORT+2;
Uint32 nNodes;
...
...
ndb/src/common/mgmcommon/InitConfigFileParser.cpp
View file @
45c94a28
...
...
@@ -43,10 +43,10 @@ InitConfigFileParser::~InitConfigFileParser() {
// Read Config File
//****************************************************************************
InitConfigFileParser
::
Context
::
Context
(
const
ConfigInfo
*
info
)
:
m_configValues
(
1000
,
20
)
{
:
m_configValues
(
1000
,
20
)
,
m_userProperties
(
true
)
{
m_config
=
new
Properties
();
m_defaults
=
new
Properties
();
m_config
=
new
Properties
(
true
);
m_defaults
=
new
Properties
(
true
);
}
InitConfigFileParser
::
Context
::~
Context
(){
...
...
@@ -115,7 +115,7 @@ InitConfigFileParser::parseConfig(FILE * file) {
snprintf
(
ctx
.
fname
,
sizeof
(
ctx
.
fname
),
section
);
free
(
section
);
ctx
.
type
=
InitConfigFileParser
::
DefaultSection
;
ctx
.
m_sectionLineno
=
ctx
.
m_lineno
;
ctx
.
m_currentSection
=
new
Properties
();
ctx
.
m_currentSection
=
new
Properties
(
true
);
ctx
.
m_userDefaults
=
NULL
;
ctx
.
m_currentInfo
=
m_info
->
getInfo
(
ctx
.
fname
);
ctx
.
m_systemDefaults
=
m_info
->
getDefaults
(
ctx
.
fname
);
...
...
@@ -137,7 +137,7 @@ InitConfigFileParser::parseConfig(FILE * file) {
free
(
section
);
ctx
.
type
=
InitConfigFileParser
::
Section
;
ctx
.
m_sectionLineno
=
ctx
.
m_lineno
;
ctx
.
m_currentSection
=
new
Properties
();
ctx
.
m_currentSection
=
new
Properties
(
true
);
ctx
.
m_userDefaults
=
getSection
(
ctx
.
fname
,
ctx
.
m_defaults
);
ctx
.
m_currentInfo
=
m_info
->
getInfo
(
ctx
.
fname
);
ctx
.
m_systemDefaults
=
m_info
->
getDefaults
(
ctx
.
fname
);
...
...
ndb/src/common/util/Properties.cpp
View file @
45c94a28
...
...
@@ -56,7 +56,7 @@ class PropertiesImpl {
PropertiesImpl
(
const
PropertiesImpl
&
);
// Not implemented
PropertiesImpl
&
operator
=
(
const
PropertiesImpl
&
);
// Not implemented
public:
PropertiesImpl
(
Properties
*
);
PropertiesImpl
(
Properties
*
,
bool
case_insensitive
);
PropertiesImpl
(
Properties
*
,
const
PropertiesImpl
&
);
~
PropertiesImpl
();
...
...
@@ -69,6 +69,7 @@ public:
bool
m_insensitive
;
int
(
*
compare
)(
const
char
*
s1
,
const
char
*
s2
);
void
setCaseInsensitiveNames
(
bool
value
);
void
grow
(
int
sizeToAdd
);
PropertyImpl
*
get
(
const
char
*
name
)
const
;
...
...
@@ -113,9 +114,9 @@ Property::~Property(){
/**
* Methods for Properties
*/
Properties
::
Properties
(){
Properties
::
Properties
(
bool
case_insensitive
){
parent
=
0
;
impl
=
new
PropertiesImpl
(
this
);
impl
=
new
PropertiesImpl
(
this
,
case_insensitive
);
}
Properties
::
Properties
(
const
Properties
&
org
){
...
...
@@ -124,7 +125,7 @@ Properties::Properties(const Properties & org){
}
Properties
::
Properties
(
const
Property
*
anArray
,
int
arrayLen
){
impl
=
new
PropertiesImpl
(
this
);
impl
=
new
PropertiesImpl
(
this
,
false
);
put
(
anArray
,
arrayLen
);
}
...
...
@@ -479,13 +480,12 @@ Properties::unpack(const Uint32 * buf, Uint32 bufLen){
/**
* Methods for PropertiesImpl
*/
PropertiesImpl
::
PropertiesImpl
(
Properties
*
p
){
PropertiesImpl
::
PropertiesImpl
(
Properties
*
p
,
bool
case_insensitive
){
this
->
properties
=
p
;
items
=
0
;
size
=
25
;
content
=
new
PropertyImpl
*
[
size
];
this
->
m_insensitive
=
false
;
this
->
compare
=
strcmp
;
setCaseInsensitiveNames
(
case_insensitive
);
}
PropertiesImpl
::
PropertiesImpl
(
Properties
*
p
,
const
PropertiesImpl
&
org
){
...
...
@@ -506,6 +506,15 @@ PropertiesImpl::~PropertiesImpl(){
delete
[]
content
;
}
void
PropertiesImpl
::
setCaseInsensitiveNames
(
bool
value
){
m_insensitive
=
value
;
if
(
value
)
compare
=
strcasecmp
;
else
compare
=
strcmp
;
}
void
PropertiesImpl
::
grow
(
int
sizeToAdd
){
PropertyImpl
**
newContent
=
new
PropertyImpl
*
[
size
+
sizeToAdd
];
...
...
@@ -523,9 +532,11 @@ PropertiesImpl::get(const char * name) const {
return
0
;
}
for
(
unsigned
int
i
=
0
;
i
<
tmp
->
items
;
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
tmp
->
items
;
i
++
)
{
if
((
*
compare
)(
tmp
->
content
[
i
]
->
name
,
short_name
)
==
0
)
return
tmp
->
content
[
i
];
}
return
0
;
}
...
...
@@ -1110,11 +1121,7 @@ Properties::getCopy(const char * name, Uint32 no, Properties ** value) const {
void
Properties
::
setCaseInsensitiveNames
(
bool
value
){
impl
->
m_insensitive
=
value
;
if
(
value
)
impl
->
compare
=
strcasecmp
;
else
impl
->
compare
=
strcmp
;
impl
->
setCaseInsensitiveNames
(
value
);
}
bool
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment