2
#include <ndb_global.h>
8
static struct my_option my_long_options[] =
10
NDB_STD_OPTS("ndb_logevent_listen"),
11
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
17
"This program list all properties of table(s) in NDB Cluster.\n"\
18
" ex: desc T1 T2 T4\n";
19
ndb_std_print_version();
20
my_print_help(my_long_options);
21
my_print_variables(my_long_options);
24
int filter[] = { 15, NDB_MGM_EVENT_CATEGORY_BACKUP,
25
15, NDB_MGM_EVENT_CATEGORY_CONNECTION,
26
15, NDB_MGM_EVENT_CATEGORY_NODE_RESTART,
27
15, NDB_MGM_EVENT_CATEGORY_STARTUP,
28
15, NDB_MGM_EVENT_CATEGORY_SHUTDOWN,
29
15, NDB_MGM_EVENT_CATEGORY_STATISTIC,
30
15, NDB_MGM_EVENT_CATEGORY_ERROR,
31
15, NDB_MGM_EVENT_CATEGORY_CHECKPOINT,
32
15, NDB_MGM_EVENT_CATEGORY_CONGESTION,
36
main(int argc, char** argv)
39
const char *load_default_groups[]= { "mysql_cluster",0 };
40
load_defaults("my",load_default_groups,&argc,&argv);
43
opt_debug= "d:t:O,/tmp/ndb_desc.trace";
45
if ((ho_error=handle_options(&argc, &argv, my_long_options,
46
ndb_std_get_one_option)))
47
return NDBT_ProgramExit(NDBT_WRONGARGS);
49
NdbMgmHandle handle= ndb_mgm_create_handle();
50
ndb_mgm_set_connectstring(handle, opt_connect_str);
54
if (ndb_mgm_connect(handle,0,0,0) == -1)
56
ndbout_c("Failed to connect");
60
NdbLogEventHandle le = ndb_mgm_create_logevent_handle(handle, filter);
63
ndbout_c("Failed to create logevent handle");
67
struct ndb_logevent event;
70
int r= ndb_logevent_get_next(le, &event,5000);
73
ndbout_c("Error while getting next event");
80
ndbout_c("Got event: %d", event.type);
83
ndb_mgm_destroy_logevent_handle(&le);
84
ndb_mgm_disconnect(handle);