20
20
#include <my_pthread.h> /* because of signal() */
21
21
#include <sys/stat.h>
23
#ifdef LATER_HAVE_NDBCLUSTER_DB
24
#include "../ndb/src/mgmclient/ndb_mgmclient.h"
27
23
#define ADMIN_VERSION "8.42"
28
24
#define MAX_MYSQL_VAR 256
29
25
#define SHUTDOWN_DEF_TIMEOUT 3600 /* Wait for shutdown */
43
39
static uint opt_count_iterations= 0, my_end_arg;
44
40
static ulong opt_connect_timeout, opt_shutdown_timeout;
45
41
static char * unix_port=0;
46
#ifdef LATER_HAVE_NDBCLUSTER_DB
47
static my_bool opt_ndbcluster=0;
48
static char *opt_ndb_connectstring=0;
52
44
static char *shared_memory_base_name=0;
100
92
ADMIN_PING, ADMIN_EXTENDED_STATUS, ADMIN_FLUSH_STATUS,
101
93
ADMIN_FLUSH_PRIVILEGES, ADMIN_START_SLAVE, ADMIN_STOP_SLAVE,
102
94
ADMIN_FLUSH_THREADS, ADMIN_OLD_PASSWORD
103
#ifdef LATER_HAVE_NDBCLUSTER_DB
107
96
static const char *command_names[]= {
108
97
"create", "drop", "shutdown",
113
102
"ping", "extended-status", "flush-status",
114
103
"flush-privileges", "start-slave", "stop-slave",
115
104
"flush-threads","old-password",
116
#ifdef LATER_HAVE_NDBCLUSTER_DB
210
196
{"shutdown_timeout", OPT_SHUTDOWN_TIMEOUT, "", (uchar**) &opt_shutdown_timeout,
211
197
(uchar**) &opt_shutdown_timeout, 0, GET_ULONG, REQUIRED_ARG,
212
198
SHUTDOWN_DEF_TIMEOUT, 0, 3600*12, 0, 1, 0},
213
#ifdef LATER_HAVE_NDBCLUSTER_DB
214
{"ndbcluster", OPT_NDBCLUSTER, ""
215
"", (uchar**) &opt_ndbcluster,
216
(uchar**) &opt_ndbcluster, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
217
{"ndb-connectstring", OPT_NDB_CONNECTSTRING, ""
218
"", (uchar**) &opt_ndb_connectstring,
219
(uchar**) &opt_ndb_connectstring, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
221
199
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
946
924
mysql->reconnect=1; /* Automatic reconnect is default */
948
#ifdef LATER_HAVE_NDBCLUSTER_DB
953
my_printf_error(0, "Too few arguments to ndb-mgm", error_flags);
957
Ndb_mgmclient_handle cmd=
958
ndb_mgmclient_handle_create(opt_ndb_connectstring);
959
ndb_mgmclient_execute(cmd, --argc, ++argv);
960
ndb_mgmclient_handle_destroy(cmd);
967
927
my_printf_error(0, "Unknown command: '%-.60s'", error_flags, argv[0]);