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
3212cc47
Commit
3212cc47
authored
Aug 26, 2004
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new parameter BackupDataDir
parent
c42ce285
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
109 additions
and
67 deletions
+109
-67
ndb/include/mgmapi/mgmapi_config_parameters.h
ndb/include/mgmapi/mgmapi_config_parameters.h
+1
-1
ndb/src/common/mgmcommon/ConfigInfo.cpp
ndb/src/common/mgmcommon/ConfigInfo.cpp
+7
-7
ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp
ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp
+4
-2
ndb/src/kernel/blocks/ndbfs/AsyncFile.hpp
ndb/src/kernel/blocks/ndbfs/AsyncFile.hpp
+1
-1
ndb/src/kernel/blocks/ndbfs/Filename.cpp
ndb/src/kernel/blocks/ndbfs/Filename.cpp
+24
-30
ndb/src/kernel/blocks/ndbfs/Filename.hpp
ndb/src/kernel/blocks/ndbfs/Filename.hpp
+6
-3
ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp
ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp
+3
-1
ndb/src/kernel/blocks/ndbfs/Ndbfs.hpp
ndb/src/kernel/blocks/ndbfs/Ndbfs.hpp
+1
-0
ndb/src/kernel/vm/Configuration.cpp
ndb/src/kernel/vm/Configuration.cpp
+54
-22
ndb/src/kernel/vm/Configuration.hpp
ndb/src/kernel/vm/Configuration.hpp
+8
-0
No files found.
ndb/include/mgmapi/mgmapi_config_parameters.h
View file @
3212cc47
...
...
@@ -90,7 +90,7 @@
#define CFG_DB_LONG_SIGNAL_BUFFER 157
#define CFG_DB_BACKUP_DATA
_PATH
158
#define CFG_DB_BACKUP_DATA
DIR
158
#define CFG_NODE_ARBIT_RANK 200
#define CFG_NODE_ARBIT_DELAY 201
...
...
ndb/src/common/mgmcommon/ConfigInfo.cpp
View file @
3212cc47
...
...
@@ -89,7 +89,7 @@ static bool fixExtConnection(InitConfigFileParser::Context & ctx, const char * d
static
bool
fixDepricated
(
InitConfigFileParser
::
Context
&
ctx
,
const
char
*
);
static
bool
saveInConfigValues
(
InitConfigFileParser
::
Context
&
ctx
,
const
char
*
);
static
bool
fixFileSystemPath
(
InitConfigFileParser
::
Context
&
ctx
,
const
char
*
data
);
static
bool
fixBackupData
Path
(
InitConfigFileParser
::
Context
&
ctx
,
const
char
*
data
);
static
bool
fixBackupData
Dir
(
InitConfigFileParser
::
Context
&
ctx
,
const
char
*
data
);
const
ConfigInfo
::
SectionRule
ConfigInfo
::
m_SectionRules
[]
=
{
...
...
@@ -145,7 +145,7 @@ ConfigInfo::m_SectionRules[] = {
{
"*"
,
applyDefaultValues
,
"system"
},
{
DB_TOKEN
,
fixFileSystemPath
,
0
},
{
DB_TOKEN
,
fixBackupData
Path
,
0
},
{
DB_TOKEN
,
fixBackupData
Dir
,
0
},
{
DB_TOKEN
,
checkDbConstraints
,
0
},
...
...
@@ -1101,8 +1101,8 @@ const ConfigInfo::ParamInfo ConfigInfo::m_ParamInfo[] = {
"1"
},
{
CFG_DB_BACKUP_DATA
_PATH
,
"BackupData
Path
"
,
CFG_DB_BACKUP_DATA
DIR
,
"BackupData
Dir
"
,
DB_TOKEN
,
"Path to where to store backups"
,
ConfigInfo
::
USED
,
...
...
@@ -2497,14 +2497,14 @@ fixFileSystemPath(InitConfigFileParser::Context & ctx, const char * data){
}
bool
fixBackupData
Path
(
InitConfigFileParser
::
Context
&
ctx
,
const
char
*
data
){
fixBackupData
Dir
(
InitConfigFileParser
::
Context
&
ctx
,
const
char
*
data
){
const
char
*
path
;
if
(
ctx
.
m_currentSection
->
get
(
"BackupData
Path
"
,
&
path
))
if
(
ctx
.
m_currentSection
->
get
(
"BackupData
Dir
"
,
&
path
))
return
true
;
if
(
ctx
.
m_currentSection
->
get
(
"FileSystemPath"
,
&
path
))
{
require
(
ctx
.
m_currentSection
->
put
(
"BackupData
Path
"
,
path
));
require
(
ctx
.
m_currentSection
->
put
(
"BackupData
Dir
"
,
path
));
return
true
;
}
...
...
ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp
View file @
3212cc47
...
...
@@ -108,8 +108,10 @@ AsyncFile::AsyncFile() :
}
void
AsyncFile
::
doStart
(
Uint32
nodeId
,
const
char
*
filesystemPath
)
{
theFileName
.
init
(
nodeId
,
filesystemPath
);
AsyncFile
::
doStart
(
Uint32
nodeId
,
const
char
*
filesystemPath
,
const
char
*
backup_path
)
{
theFileName
.
init
(
nodeId
,
filesystemPath
,
backup_path
);
// Stacksize for filesystem threads
// An 8k stack should be enough
...
...
ndb/src/kernel/blocks/ndbfs/AsyncFile.hpp
View file @
3212cc47
...
...
@@ -181,7 +181,7 @@ public:
void
execute
(
Request
*
request
);
void
doStart
(
Uint32
nodeId
,
const
char
*
fspath
);
void
doStart
(
Uint32
nodeId
,
const
char
*
fspath
,
const
char
*
backup_path
);
// its a thread so its always running
void
run
();
...
...
ndb/src/kernel/blocks/ndbfs/Filename.cpp
View file @
3212cc47
...
...
@@ -46,43 +46,31 @@ Filename::Filename() :
}
void
Filename
::
init
(
Uint32
nodeid
,
const
char
*
pFileSystemPath
){
Filename
::
init
(
Uint32
nodeid
,
const
char
*
pFileSystemPath
,
const
char
*
pBackupDirPath
){
DBUG_ENTER
(
"Filename::init"
);
if
(
pFileSystemPath
==
NULL
)
{
ERROR_SET
(
fatal
,
AFS_ERROR_NOPATH
,
""
,
" Filename::init()"
);
return
;
}
strncpy
(
theBaseDirectory
,
pFileSystemPath
,
PATH_MAX
);
// the environment variable is set,
// check that it is pointing on a valid directory
//
char
buf2
[
PATH_MAX
];
memset
(
buf2
,
0
,
sizeof
(
buf2
));
#ifdef NDB_WIN32
char
*
szFilePart
;
if
(
!
GetFullPathName
(
theBaseDirectory
,
sizeof
(
buf2
),
buf2
,
&
szFilePart
)
||
(
::
GetFileAttributes
(
theBaseDirectory
)
&
FILE_ATTRIBUTE_READONLY
))
#else
if
((
::
realpath
(
theBaseDirectory
,
buf2
)
==
NULL
)
||
(
::
access
(
theBaseDirectory
,
W_OK
)
!=
0
))
#endif
{
ERROR_SET
(
fatal
,
AFS_ERROR_INVALIDPATH
,
pFileSystemPath
,
" Filename::init()"
);
}
strncpy
(
theBaseDirectory
,
buf2
,
sizeof
(
theBaseDirectory
));
// path seems ok, add delimiter if missing
if
(
strcmp
(
&
theBaseDirectory
[
strlen
(
theBaseDirectory
)
-
1
],
DIR_SEPARATOR
)
!=
0
)
strcat
(
theBaseDirectory
,
DIR_SEPARATOR
);
snprintf
(
theFileSystemDirectory
,
sizeof
(
theFileSystemDirectory
),
"%sndb_%u_fs%s"
,
pFileSystemPath
,
nodeid
,
DIR_SEPARATOR
);
strncpy
(
theBackupDirectory
,
pBackupDirPath
,
sizeof
(
theBackupDirectory
));
snprintf
(
buf2
,
sizeof
(
buf2
),
"ndb_%u_fs%s"
,
nodeid
,
DIR_SEPARATOR
);
strcat
(
theBaseDirectory
,
buf2
);
DBUG_PRINT
(
"info"
,
(
"theFileSystemDirectory=%s"
,
theFileSystemDirectory
)
);
DBUG_PRINT
(
"info"
,
(
"theBackupDirectory=%s"
,
theBackupDirectory
)
);
#ifdef NDB_WIN32
CreateDirectory
(
the
Base
Directory
,
0
);
CreateDirectory
(
the
FileSystem
Directory
,
0
);
#else
mkdir
(
the
Base
Directory
,
S_IRUSR
|
S_IWUSR
|
S_IXUSR
|
S_IXGRP
|
S_IRGRP
);
mkdir
(
the
FileSystem
Directory
,
S_IRUSR
|
S_IWUSR
|
S_IXUSR
|
S_IXGRP
|
S_IRGRP
);
#endif
theBaseDirectory
=
0
;
DBUG_VOID_RETURN
;
}
Filename
::~
Filename
(){
...
...
@@ -94,10 +82,16 @@ Filename::set(BlockReference blockReference,
{
char
buf
[
PATH_MAX
];
theLevelDepth
=
0
;
strncpy
(
theName
,
theBaseDirectory
,
PATH_MAX
);
const
Uint32
type
=
FsOpenReq
::
getSuffix
(
filenumber
);
const
Uint32
version
=
FsOpenReq
::
getVersion
(
filenumber
);
if
(
version
==
2
)
theBaseDirectory
=
theBackupDirectory
;
else
theBaseDirectory
=
theFileSystemDirectory
;
strncpy
(
theName
,
theBaseDirectory
,
PATH_MAX
);
switch
(
version
){
case
1
:{
const
Uint32
diskNo
=
FsOpenReq
::
v1_getDisk
(
filenumber
);
...
...
ndb/src/kernel/blocks/ndbfs/Filename.hpp
View file @
3212cc47
...
...
@@ -68,12 +68,15 @@ public:
int
levels
()
const
;
const
char
*
c_str
()
const
;
void
init
(
Uint32
nodeid
,
const
char
*
fileSystemPath
);
void
init
(
Uint32
nodeid
,
const
char
*
fileSystemPath
,
const
char
*
backupDirPath
);
private:
int
theLevelDepth
;
char
theName
[
PATH_MAX
];
char
theBaseDirectory
[
PATH_MAX
];
char
theFileSystemDirectory
[
PATH_MAX
];
char
theBackupDirectory
[
PATH_MAX
];
char
*
theBaseDirectory
;
char
theDirectory
[
PATH_MAX
];
};
...
...
ndb/src/kernel/blocks/ndbfs/Ndbfs.cpp
View file @
3212cc47
...
...
@@ -58,6 +58,8 @@ Ndbfs::Ndbfs(const Configuration & conf) :
m_maxOpenedFiles
(
0
)
{
theFileSystemPath
=
conf
.
fileSystemPath
();
theBackupFilePath
=
conf
.
backupFilePath
();
theRequestPool
=
new
Pool
<
Request
>
;
const
ndb_mgm_configuration_iterator
*
p
=
conf
.
getOwnConfigIterator
();
...
...
@@ -559,7 +561,7 @@ Ndbfs::createAsyncFile(){
}
AsyncFile
*
file
=
new
AsyncFile
;
file
->
doStart
(
getOwnNodeId
(),
theFileSystemPath
);
file
->
doStart
(
getOwnNodeId
(),
theFileSystemPath
,
theBackupFilePath
);
// Put the file in list of all files
theFiles
.
push_back
(
file
);
...
...
ndb/src/kernel/blocks/ndbfs/Ndbfs.hpp
View file @
3212cc47
...
...
@@ -80,6 +80,7 @@ private:
Vector
<
AsyncFile
*>
theIdleFiles
;
// List of idle AsyncFiles
OpenFiles
theOpenFiles
;
// List of open AsyncFiles
const
char
*
theFileSystemPath
;
const
char
*
theBackupFilePath
;
// Statistics variables
Uint32
m_maxOpenedFiles
;
...
...
ndb/src/kernel/vm/Configuration.cpp
View file @
3212cc47
...
...
@@ -144,6 +144,7 @@ Configuration::Configuration()
_programName
=
0
;
_connectString
=
0
;
_fsPath
=
0
;
_backupPath
=
0
;
_initialStart
=
false
;
_daemonMode
=
false
;
m_config_retriever
=
0
;
...
...
@@ -156,6 +157,9 @@ Configuration::~Configuration(){
if
(
_fsPath
!=
NULL
)
free
(
_fsPath
);
if
(
_backupPath
!=
NULL
)
free
(
_backupPath
);
if
(
m_config_retriever
)
{
delete
m_config_retriever
;
}
...
...
@@ -237,8 +241,48 @@ Configuration::fetch_configuration(){
}
}
static
char
*
get_and_validate_path
(
ndb_mgm_configuration_iterator
&
iter
,
Uint32
param
,
const
char
*
param_string
)
{
const
char
*
path
=
NULL
;
if
(
iter
.
get
(
param
,
&
path
)){
ERROR_SET
(
fatal
,
ERR_INVALID_CONFIG
,
"Invalid configuration fetched missing "
,
param_string
);
}
if
(
path
==
0
||
strlen
(
path
)
==
0
){
ERROR_SET
(
fatal
,
ERR_INVALID_CONFIG
,
"Invalid configuration fetched. Configuration does not contain valid "
,
param_string
);
}
// check that it is pointing on a valid directory
//
char
buf2
[
PATH_MAX
];
memset
(
buf2
,
0
,
sizeof
(
buf2
));
#ifdef NDB_WIN32
char
*
szFilePart
;
if
(
!
GetFullPathName
(
path
,
sizeof
(
buf2
),
buf2
,
&
szFilePart
)
||
(
::
GetFileAttributes
(
alloc_path
)
&
FILE_ATTRIBUTE_READONLY
))
#else
if
((
::
realpath
(
path
,
buf2
)
==
NULL
)
||
(
::
access
(
buf2
,
W_OK
)
!=
0
))
#endif
{
ERROR_SET
(
fatal
,
AFS_ERROR_INVALIDPATH
,
path
,
" Filename::init()"
);
}
if
(
strcmp
(
&
buf2
[
strlen
(
buf2
)
-
1
],
DIR_SEPARATOR
))
strcat
(
buf2
,
DIR_SEPARATOR
);
return
strdup
(
buf2
);
}
void
Configuration
::
setupConfiguration
(){
DBUG_ENTER
(
"Configuration::setupConfiguration"
);
ndb_mgm_configuration
*
p
=
m_clusterConfig
;
/**
...
...
@@ -284,28 +328,14 @@ Configuration::setupConfiguration(){
}
/**
* Get
filesystem path
* Get
paths
*/
{
const
char
*
pFileSystemPath
=
NULL
;
if
(
iter
.
get
(
CFG_DB_FILESYSTEM_PATH
,
&
pFileSystemPath
)){
ERROR_SET
(
fatal
,
ERR_INVALID_CONFIG
,
"Invalid configuration fetched"
,
"FileSystemPath missing"
);
}
if
(
pFileSystemPath
==
0
||
strlen
(
pFileSystemPath
)
==
0
){
ERROR_SET
(
fatal
,
ERR_INVALID_CONFIG
,
"Invalid configuration fetched"
,
"Configuration does not contain valid filesystem path"
);
}
if
(
pFileSystemPath
[
strlen
(
pFileSystemPath
)
-
1
]
==
'/'
)
_fsPath
=
strdup
(
pFileSystemPath
);
else
{
_fsPath
=
(
char
*
)
NdbMem_Allocate
(
strlen
(
pFileSystemPath
)
+
2
);
strcpy
(
_fsPath
,
pFileSystemPath
);
strcat
(
_fsPath
,
"/"
);
}
}
if
(
_fsPath
)
free
(
_fsPath
);
_fsPath
=
get_and_validate_path
(
iter
,
CFG_DB_FILESYSTEM_PATH
,
"FileSystemPath"
);
if
(
_backupPath
)
free
(
_backupPath
);
_backupPath
=
get_and_validate_path
(
iter
,
CFG_DB_BACKUP_DATADIR
,
"BackupDataDir"
);
if
(
iter
.
get
(
CFG_DB_STOP_ON_ERROR_INSERT
,
&
m_restartOnErrorInsert
)){
ERROR_SET
(
fatal
,
ERR_INVALID_CONFIG
,
"Invalid configuration fetched"
,
...
...
@@ -327,6 +357,8 @@ Configuration::setupConfiguration(){
(
p
,
CFG_SECTION_NODE
);
calcSizeAlt
(
cf
);
DBUG_VOID_RETURN
;
}
bool
...
...
ndb/src/kernel/vm/Configuration.hpp
View file @
3212cc47
...
...
@@ -53,6 +53,7 @@ public:
// Cluster configuration
const
char
*
programName
()
const
;
const
char
*
fileSystemPath
()
const
;
const
char
*
backupFilePath
()
const
;
char
*
getConnectStringCopy
()
const
;
/**
...
...
@@ -89,6 +90,7 @@ private:
*/
char
*
_programName
;
char
*
_fsPath
;
char
*
_backupPath
;
bool
_initialStart
;
char
*
_connectString
;
bool
_daemonMode
;
...
...
@@ -108,6 +110,12 @@ Configuration::fileSystemPath() const {
return
_fsPath
;
}
inline
const
char
*
Configuration
::
backupFilePath
()
const
{
return
_backupPath
;
}
inline
bool
Configuration
::
getInitialStart
()
const
{
...
...
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