bool g_StopServer; bool g_RestartServer; extern EventLogger g_eventLogger; extern int global_mgmt_server_check; enum ndb_mgmd_options { OPT_INTERACTIVE = NDB_STD_OPTIONS_LAST, OPT_NO_NODEID_CHECKS, OPT_NO_DAEMON }; NDB_STD_OPTS_VARS; static struct my_option my_long_options[] = { NDB_STD_OPTS("ndb_mgmd"), { "config-file", 'f', "Specify cluster configuration file", (gptr*) &opt_config_filename, (gptr*) &opt_config_filename, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "print-full-config", 'P', "Print full config and exit", (gptr*) &g_print_full_config, (gptr*) &g_print_full_config, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "daemon", 'd', "Run ndb_mgmd in daemon mode (default)", (gptr*) &opt_daemon, (gptr*) &opt_daemon, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0 }, { "interactive", OPT_INTERACTIVE, "Run interactive. Not supported but provided for testing purposes", (gptr*) &opt_interactive, (gptr*) &opt_interactive, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "no-nodeid-checks", OPT_NO_NODEID_CHECKS, "Do not provide any node id checks",
for (unsigned i= 0; i < tabs1.size(); i++) if (tabs1[i]) { HugoTransactions hugoTrans(*tabs1[i]); if (hugoTrans.compare(ndb, tabs2[i]->getName(), 0)) return -1; } return 0; } NDB_STD_OPTS_VARS; static const char* _dbname = "TEST_DB"; static struct my_option my_long_options[] = { NDB_STD_OPTS(""), { "database", 'd', "Name of database table is in", &_dbname, &_dbname, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; int main(int argc, char** argv) { NDB_INIT(argv[0]); const char *load_default_groups[]= { "mysql_cluster",0 }; load_defaults("my",load_default_groups,&argc,&argv); int ho_error; #ifndef DBUG_OFF
#include <ndb_global.h> #include <ndb_opts.h> #include <NdbOut.hpp> #include <NdbApi.hpp> #include <NDBT.hpp> NDB_STD_OPTS_VARS; static const char* _dbname = "TEST_DB"; const char *load_default_groups[]= { "mysql_cluster",0 }; static struct my_option my_long_options[] = { NDB_STD_OPTS("ndb_desc"), { "database", 'd', "Name of database table is in", &_dbname, &_dbname, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; static void usage() { #ifdef NOT_USED char desc[] = "tabname\n"\ "This program will drop one table in Ndb\n"; #endif ndb_std_print_version(); print_defaults(MYSQL_CONFIG_NAME,load_default_groups); puts("");
static int select_count(Ndb* pNdb, const NdbDictionary::Table* pTab, int parallelism, Uint64* count_rows, NdbOperation::LockMode lock); static const char* _dbname = "TEST_DB"; static int _parallelism = 240; static int _lock = 0; const char *load_default_groups[]= { "mysql_cluster",0 }; static struct my_option my_long_options[] = { NDB_STD_OPTS("ndb_select_count"), { "database", 'd', "Name of database table is in", (uchar**) &_dbname, (uchar**) &_dbname, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "parallelism", 'p', "parallelism", (uchar**) &_parallelism, (uchar**) &_parallelism, 0, GET_INT, REQUIRED_ARG, 240, 0, 0, 0, 0, 0 }, { "lock", 'l', "Read(0), Read-hold(1), Exclusive(2)", (uchar**) &_lock, (uchar**) &_lock, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} };
OPT_FIELDS_OPTIONALLY_ENCLOSED_BY, OPT_LINES_TERMINATED_BY, OPT_APPEND, OPT_VERBOSE }; static const char *opt_fields_enclosed_by= NULL; static const char *opt_fields_terminated_by= NULL; static const char *opt_fields_optionally_enclosed_by= NULL; static const char *opt_lines_terminated_by= NULL; static const char *tab_path= NULL; static int opt_append; static struct my_option my_long_options[] = { NDB_STD_OPTS("ndb_restore"), { "connect", 'c', "same as --connect-string", &opt_connect_str, &opt_connect_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "nodeid", 'n', "Backup files from node with id", &ga_nodeId, &ga_nodeId, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "backupid", 'b', "Backup id", &ga_backupId, &ga_backupId, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "restore_data", 'r', "Restore table data/logs into NDB Cluster using NDBAPI", &_restore_data, &_restore_data, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "restore_meta", 'm', "Restore meta data into NDB Cluster using NDBAPI",
static int waitClusterStatus(const char* _addr, ndb_mgm_node_status _status); static int _no_contact = 0; static int _not_started = 0; static int _single_user = 0; static int _timeout = 120; static const char* _wait_nodes = 0; static const char* _nowait_nodes = 0; static NdbNodeBitmask nowait_nodes_bitmask; const char *load_default_groups[]= { "mysql_cluster",0 }; static struct my_option my_long_options[] = { NDB_STD_OPTS("ndb_waiter"), { "no-contact", 'n', "Wait for cluster no contact", (uchar**) &_no_contact, (uchar**) &_no_contact, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "not-started", NDB_OPT_NOSHORT, "Wait for cluster not started", (uchar**) &_not_started, (uchar**) &_not_started, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "single-user", NDB_OPT_NOSHORT, "Wait for cluster to enter single user mode", (uchar**) &_single_user, (uchar**) &_single_user, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "timeout", 't', "Timeout to wait in seconds", (uchar**) &_timeout, (uchar**) &_timeout, 0, GET_INT, REQUIRED_ARG, 120, 0, 0, 0, 0, 0 }, { "wait-nodes", 'w', "Node ids to wait on, e.g. '1,2-4'", (uchar**) &_wait_nodes, (uchar**) &_wait_nodes, 0,
if (_parsable) exit(0); } NDB_STD_OPTS_VARS; static const char* _dbname = "TEST_DB"; static int _loops; static int _type; enum options_ndb_show_tables { OPT_SHOW_TMP_STATUS=256 }; static struct my_option my_long_options[] = { NDB_STD_OPTS("ndb_show_tables"), { "database", 'd', "Name of database table is in", (uchar**) &_dbname, (uchar**) &_dbname, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "loops", 'l', "loops", (uchar**) &_loops, (uchar**) &_loops, 0, GET_INT, REQUIRED_ARG, 1, 0, 0, 0, 0, 0 }, { "type", 't', "type", (uchar**) &_type, (uchar**) &_type, 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "unqualified", 'u', "Use unqualified table names", (uchar**) &_unqualified, (uchar**) &_unqualified, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "parsable", 'p', "Return output suitable for mysql LOAD DATA INFILE", (uchar**) &_parsable, (uchar**) &_parsable, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
static const char * g_field_delimiter=","; static const char * g_row_delimiter=" "; static const char * g_config_file = 0; static int g_mycnf = 0; const char *load_default_groups[]= { "mysql_cluster",0 }; NDB_STD_OPTS_VARS; int g_print_full_config; typedef ndb_mgm_configuration_iterator Iter; static struct my_option my_long_options[] = { NDB_STD_OPTS("ndb_config"), { "nodes", 256, "Print nodes", (uchar**) &g_nodes, (uchar**) &g_nodes, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, { "connections", 256, "Print connections", (uchar**) &g_connections, (uchar**) &g_connections, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, { "query", 'q', "Query option(s)", (uchar**) &g_query, (uchar**) &g_query, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, { "host", 256, "Host", (uchar**) &g_host, (uchar**) &g_host, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, { "type", 258, "Type of node/connection", (uchar**) &g_type, (uchar**) &g_type, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include <mgmapi.h> #include <ndb_global.h> #include <ndb_opts.h> #include <NDBT.hpp> static struct my_option my_long_options[] = { NDB_STD_OPTS("eventlog"), { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; int filter[] = { 15, NDB_MGM_EVENT_CATEGORY_BACKUP, 15, NDB_MGM_EVENT_CATEGORY_CONNECTION, 15, NDB_MGM_EVENT_CATEGORY_NODE_RESTART, 15, NDB_MGM_EVENT_CATEGORY_STARTUP, 15, NDB_MGM_EVENT_CATEGORY_SHUTDOWN, 15, NDB_MGM_EVENT_CATEGORY_STATISTIC, 15, NDB_MGM_EVENT_CATEGORY_ERROR, 15, NDB_MGM_EVENT_CATEGORY_CHECKPOINT, 15, NDB_MGM_EVENT_CATEGORY_CONGESTION, 0 };
{ CHK2(dosys() == 0, "at loop " << loop); } } CHK1(ret == 0); } while (0); dodisconnect(); return ret; } static struct my_option my_long_options[] = { NDB_STD_OPTS("ndb_index_stat"), // stats options { "database", 'd', "Name of database table is in", (uchar**) &_dbname, (uchar**) &_dbname, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "delete", NDB_OPT_NOSHORT, "Delete index stats of given table" " and stop any configured auto update", (uchar **)&_delete, (uchar **)&_delete, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "update", NDB_OPT_NOSHORT, "Update index stats of given table" " and restart any configured auto update", (uchar **)&_update, (uchar **)&_update, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 },
int _verbose = 1; int _help = 0; int _batch = 128; int _records = 1000; int _loops = 100; int _loops_per_query = 100; int _depth = 4; unsigned int _seed = 0; static const char * _options = ""; static const char * _db = "TEST_DB"; extern const char *load_default_groups[]; static struct my_option my_long_options[] = { NDB_STD_OPTS("hugoJoin"), { "database", 'd', "Database", (uchar**) &_db, (uchar**) &_db, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, { "options", 'o', "comma separated list of options", (uchar**) &_options, (uchar**) &_options, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, { "loops", 'l', "Loops", (uchar**) &_loops, 0, 0, GET_INT, REQUIRED_ARG, _loops, 0, 0, 0, 0, 0}, { "verbose", 'v', "verbosity", (uchar**) &_verbose, 0, 0, GET_INT, REQUIRED_ARG, _verbose, 0, 0, 0, 0, 0}, { "loops_per_query", 'q', "Recreate query each #loops", (uchar**) &_loops_per_query, 0, 0, GET_INT, REQUIRED_ARG, _loops_per_query, 0, 0, 0, 0, 0},
{ g_dump << "result: "<< (ret == 0 ? "ok" : "failed") << endl; flush(g_dump); if (fclose(g_dump_file) != 0) { g_err << opt_dump_file << ": write failed: " << strerror(errno) << endl; } g_dump_file = 0; } return ret; } static struct my_option my_long_options[] = { NDB_STD_OPTS("ndb_blob_tool"), { "database", 'd', "Name of database table is in", (uchar**) &opt_dbname, (uchar**) &opt_dbname, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 }, { "check-orphans", NDB_OPT_NOSHORT, "Check for orphan blob parts", (uchar **)&opt_check_orphans, (uchar **)&opt_check_orphans, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "delete-orphans", NDB_OPT_NOSHORT, "Delete orphan blob parts", (uchar **)&opt_delete_orphans, (uchar **)&opt_delete_orphans, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, { "dump-file", NDB_OPT_NOSHORT, "Write orphan keys (table key and part number) into file", (uchar **)&opt_dump_file, (uchar **)&opt_dump_file, 0,