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
37df5deb
Commit
37df5deb
authored
Jun 28, 2004
by
tomas@poseidon.ndb.mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adopting mysql-test-run to new ndb config
+ added option to ndb_waiter to wait for NO CONTACT
parent
1860613c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
37 deletions
+38
-37
mysql-test/mysql-test-run.sh
mysql-test/mysql-test-run.sh
+1
-1
mysql-test/ndb/ndbcluster.sh
mysql-test/ndb/ndbcluster.sh
+23
-31
ndb/tools/waiter.cpp
ndb/tools/waiter.cpp
+14
-5
No files found.
mysql-test/mysql-test-run.sh
View file @
37df5deb
...
@@ -1450,7 +1450,7 @@ then
...
@@ -1450,7 +1450,7 @@ then
then
then
echo
"Starting ndbcluster"
echo
"Starting ndbcluster"
./ndb/ndbcluster
--port-base
=
$NDBCLUSTER_PORT
--small
--discless
--initial
--data-dir
=
$MYSQL_TEST_DIR
/var
||
exit
1
./ndb/ndbcluster
--port-base
=
$NDBCLUSTER_PORT
--small
--discless
--initial
--data-dir
=
$MYSQL_TEST_DIR
/var
||
exit
1
export
NDB_CONNECTSTRING
=
`
cat
Ndb.cfg
`
export
NDB_CONNECTSTRING
=
"host=localhost:
$NDBCLUSTER_PORT
"
else
else
export
NDB_CONNECTSTRING
=
"
$USE_RUNNING_NDBCLUSTER
"
export
NDB_CONNECTSTRING
=
"
$USE_RUNNING_NDBCLUSTER
"
echo
"Using ndbcluster at
$NDB_CONNECTSTRING
"
echo
"Using ndbcluster at
$NDB_CONNECTSTRING
"
...
...
mysql-test/ndb/ndbcluster.sh
View file @
37df5deb
...
@@ -81,9 +81,9 @@ while test $# -gt 0; do
...
@@ -81,9 +81,9 @@ while test $# -gt 0; do
shift
shift
done
done
fs_ndb
=
$fsdir
/ndbcluster
fs_ndb
=
$fsdir
/ndbcluster
-
$port_base
fs_name_1
=
$fs_ndb
/node-1-fs
-
$port_base
fs_name_1
=
$fs_ndb
/node-1-fs
fs_name_2
=
$fs_ndb
/node-2-fs
-
$port_base
fs_name_2
=
$fs_ndb
/node-2-fs
NDB_HOME
=
NDB_HOME
=
export
NDB_CONNECTSTRING
export
NDB_CONNECTSTRING
...
@@ -100,12 +100,14 @@ if [ ! -x $exec_mgmtsrv ]; then
...
@@ -100,12 +100,14 @@ if [ ! -x $exec_mgmtsrv ]; then
exit
1
exit
1
fi
fi
ndb_host
=
"localhost"
ndb_mgmd_port
=
$port_base
export
NDB_CONNECTSTRING
=
"host=
$ndb_host
:
$ndb_mgmd_port
"
start_default_ndbcluster
()
{
start_default_ndbcluster
()
{
# do some checks
# do some checks
NDB_CONNECTSTRING
=
if
[
$initial_ndb
]
;
then
if
[
$initial_ndb
]
;
then
[
-d
$fs_ndb
]
||
mkdir
$fs_ndb
[
-d
$fs_ndb
]
||
mkdir
$fs_ndb
[
-d
$fs_name_1
]
||
mkdir
$fs_name_1
[
-d
$fs_name_1
]
||
mkdir
$fs_name_1
...
@@ -118,11 +120,7 @@ fi
...
@@ -118,11 +120,7 @@ fi
# set som help variables
# set som help variables
ndb_host
=
"localhost"
ndb_mgmd_port
=
$port_base
port_transporter
=
`
expr
$ndb_mgmd_port
+ 2
`
port_transporter
=
`
expr
$ndb_mgmd_port
+ 2
`
export
NDB_CONNECTSTRING
=
"host=
$ndb_host
:
$ndb_mgmd_port
"
# Start management server as deamon
# Start management server as deamon
...
@@ -143,29 +141,29 @@ sed \
...
@@ -143,29 +141,29 @@ sed \
>
"
$fs_ndb
/config.ini"
>
"
$fs_ndb
/config.ini"
fi
fi
rm
-f
Ndb.cfg
rm
-f
$cfgfile
2>&1 |
cat
>
/dev/null
rm
-f
$fs_ndb
/
Ndb.cfg
rm
-f
$fs_ndb
/
$cfgfile
2>&1 |
cat
>
/dev/null
if
(
cd
$fs_ndb
;
$exec_mgmtsrvr
-d
-c
config.ini
)
;
then
:
;
else
if
(
cd
$fs_ndb
;
$exec_mgmtsrvr
-d
-c
config.ini
)
;
then
:
;
else
echo
"Unable to start
$exec_mgmtsrvr
from
`
pwd
`
"
echo
"Unable to start
$exec_mgmtsrvr
from
`
pwd
`
"
exit
1
exit
1
fi
fi
cat
`
find
$fs_ndb
-name
'ndb_*.pid'
`
>
$pidfile
cat
`
find
$fs_ndb
-name
'ndb_*.pid'
`
>
$
fs_ndb
/
$
pidfile
# Start database node
# Start database node
echo
"Starting ndbd"
echo
"Starting ndbd"
(
cd
$fs_ndb
;
$exec_ndb
-d
$flags_ndb
&
)
(
cd
$fs_ndb
;
$exec_ndb
-d
$flags_ndb
&
)
cat
`
find
$fs_ndb
-name
'ndb_*.pid'
`
>
$pidfile
cat
`
find
$fs_ndb
-name
'ndb_*.pid'
`
>
$
fs_ndb
/
$
pidfile
# Start database node
# Start database node
echo
"Starting ndbd"
echo
"Starting ndbd"
(
cd
$fs_ndb
;
$exec_ndb
-d
$flags_ndb
&
)
(
cd
$fs_ndb
;
$exec_ndb
-d
$flags_ndb
&
)
cat
`
find
$fs_ndb
-name
'ndb_*.pid'
`
>
$pidfile
cat
`
find
$fs_ndb
-name
'ndb_*.pid'
`
>
$
fs_ndb
/
$
pidfile
# test if Ndb Cluster starts properly
# test if Ndb Cluster starts properly
...
@@ -175,14 +173,14 @@ if ( $exec_waiter ) | grep "NDBT_ProgramExit: 0 - OK"; then :; else
...
@@ -175,14 +173,14 @@ if ( $exec_waiter ) | grep "NDBT_ProgramExit: 0 - OK"; then :; else
exit
1
exit
1
fi
fi
cat
`
find
$fs_ndb
-name
'ndb_*.pid'
`
>
$pidfile
cat
`
find
$fs_ndb
-name
'ndb_*.pid'
`
>
$
fs_ndb
/
$
pidfile
status_ndbcluster
status_ndbcluster
}
}
status_ndbcluster
()
{
status_ndbcluster
()
{
# Start management client
# Start management client
echo
"show"
|
$exec_mgmtclient
$ndb_host
$ndb_mgmd_port
echo
"show"
|
$exec_mgmtclient
}
}
stop_default_ndbcluster
()
{
stop_default_ndbcluster
()
{
...
@@ -191,26 +189,20 @@ stop_default_ndbcluster() {
...
@@ -191,26 +189,20 @@ stop_default_ndbcluster() {
# exit 0
# exit 0
#fi
#fi
if
[
!
-f
$cfgfile
]
;
then
#if [ ! -f $cfgfile ] ; then
echo
"
$cfgfile
missing"
# echo "$cfgfile missing"
exit
1
# exit 1
fi
#fi
ndb_host
=
`
cat
$cfgfile
|
sed
-e
"s,.*host=
\(
.*
\)\:
.*,
\1
,1"
`
ndb_mgmd_port
=
`
cat
$cfgfile
|
sed
-e
"s,.*host=
$ndb_host
\:\(
[0-9]*
\)
.*,
\1
,1"
`
# Start management client
# Start management client
exec_mgmtclient
=
"
$exec_mgmtclient
--try-reconnect=1
$ndb_host
$ndb_mgmd_port
"
exec_mgmtclient
=
"
$exec_mgmtclient
--try-reconnect=1"
echo
"
$exec_mgmtclient
"
echo
"all stop"
|
$exec_mgmtclient
sleep
5
echo
"all stop"
|
$exec_mgmtclient
2>&1 |
cat
>
/dev/null
if
[
-f
$pidfile
]
;
then
if
[
-f
$
fs_ndb
/
$
pidfile
]
;
then
kill
`
cat
$pidfile
`
2> /dev/null
kill
-9
`
cat
$fs_ndb
/
$pidfile
`
2> /dev/null
rm
$pidfile
rm
$
fs_ndb
/
$
pidfile
fi
fi
}
}
...
...
ndb/tools/waiter.cpp
View file @
37df5deb
...
@@ -27,16 +27,21 @@
...
@@ -27,16 +27,21 @@
#include <NDBT.hpp>
#include <NDBT.hpp>
int
int
waitClusterStarted
(
const
char
*
_addr
,
unsigned
int
_timeout
=
120
);
waitClusterStatus
(
const
char
*
_addr
,
ndb_mgm_node_status
_status
=
NDB_MGM_NODE_STATUS_STARTED
,
unsigned
int
_timeout
=
120
);
int
main
(
int
argc
,
const
char
**
argv
){
int
main
(
int
argc
,
const
char
**
argv
){
const
char
*
_hostName
=
NULL
;
const
char
*
_hostName
=
NULL
;
int
_no_contact
=
0
;
int
_help
=
0
;
int
_help
=
0
;
struct
getargs
args
[]
=
{
struct
getargs
args
[]
=
{
{
"no-contact"
,
0
,
arg_flag
,
&
_no_contact
,
"Wait for cluster no contact"
,
""
},
{
"usage"
,
'?'
,
arg_flag
,
&
_help
,
"Print help"
,
""
}
{
"usage"
,
'?'
,
arg_flag
,
&
_help
,
"Print help"
,
""
}
};
};
int
num_args
=
sizeof
(
args
)
/
sizeof
(
args
[
0
]);
int
num_args
=
sizeof
(
args
)
/
sizeof
(
args
[
0
]);
int
optind
=
0
;
int
optind
=
0
;
char
desc
[]
=
char
desc
[]
=
...
@@ -86,7 +91,10 @@ int main(int argc, const char** argv){
...
@@ -86,7 +91,10 @@ int main(int argc, const char** argv){
}
}
}
}
if
(
waitClusterStarted
(
_hostName
)
!=
0
)
if
(
_no_contact
)
{
if
(
waitClusterStatus
(
_hostName
,
NDB_MGM_NODE_STATUS_NO_CONTACT
)
!=
0
)
return
NDBT_ProgramExit
(
NDBT_FAILED
);
}
else
if
(
waitClusterStatus
(
_hostName
)
!=
0
)
return
NDBT_ProgramExit
(
NDBT_FAILED
);
return
NDBT_ProgramExit
(
NDBT_FAILED
);
return
NDBT_ProgramExit
(
NDBT_OK
);
return
NDBT_ProgramExit
(
NDBT_OK
);
...
@@ -164,9 +172,10 @@ getStatus(){
...
@@ -164,9 +172,10 @@ getStatus(){
}
}
int
int
waitClusterStarted
(
const
char
*
_addr
,
unsigned
int
_timeout
)
waitClusterStatus
(
const
char
*
_addr
,
ndb_mgm_node_status
_status
,
unsigned
int
_timeout
)
{
{
ndb_mgm_node_status
_status
=
NDB_MGM_NODE_STATUS_STARTED
;
int
_startphase
=
-
1
;
int
_startphase
=
-
1
;
int
_nodes
[
MAX_NDB_NODES
];
int
_nodes
[
MAX_NDB_NODES
];
...
@@ -290,7 +299,7 @@ waitClusterStarted(const char* _addr, unsigned int _timeout)
...
@@ -290,7 +299,7 @@ waitClusterStarted(const char* _addr, unsigned int _timeout)
allInState
=
false
;
allInState
=
false
;
}
}
}
}
g_info
<<
"Waiting for cluster enter state"
g_info
<<
"Waiting for cluster enter state
"
<<
ndb_mgm_get_node_status_string
(
_status
)
<<
endl
;
<<
ndb_mgm_get_node_status_string
(
_status
)
<<
endl
;
NdbSleep_SecSleep
(
1
);
NdbSleep_SecSleep
(
1
);
attempts
++
;
attempts
++
;
...
...
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