20 #include <NDBT_Test.hpp>
21 #include <portlib/NdbDir.hpp>
22 #include "ConfigFactory.hpp"
23 #include <NdbMgmd.hpp>
24 #include <NdbProcess.hpp>
25 #include <NDBT_Find.hpp>
26 #include <NDBT_Workingdir.hpp>
28 static bool file_exists(
const char* path, Uint32 timeout = 1)
30 g_info <<
"File '" << path <<
"' ";
37 for (Uint32
i = 0;
i < 10 * timeout;
i++)
39 if (access(path, F_OK) == 0)
41 g_info <<
"exists" << endl;
46 g_info <<
"does not exist, retrying...";
48 NdbSleep_MilliSleep(100);
50 g_info <<
"does not exist" << endl;
63 va_start(args, first);
64 while ((str = va_arg(args,
const char*)) != NULL)
66 path.
appfmt(
"%s%s", DIR_SEPARATOR, str);
87 m_name.
assfmt(
"ndb_mgmd_%d", nodeid);
89 NDBT_find_ndb_mgmd(m_exe);
102 const char* name(
void)
const
104 return m_name.
c_str();
107 const char* exe(
void)
const
109 return m_exe.
c_str();
114 g_info <<
"Starting " << name() <<
" ";
115 for (
unsigned i = 0;
i < args.args().size();
i++)
116 g_info << args.args()[
i].c_str() <<
" ";
119 m_proc = NdbProcess::create(name(),
123 return (m_proc != NULL);
126 bool start_from_config_ini(
const char* working_dir,
127 const char* first_extra_arg = NULL, ...)
130 args.add(
"--configdir=.");
131 args.add(
"-f config.ini");
132 args.add(
"--ndb-nodeid=", m_nodeid);
133 args.add(
"--nodaemon");
134 args.add(
"--log-name=", name());
135 args.add(
"--verbose");
141 const char* str = first_extra_arg;
142 va_start(extra_args, first_extra_arg);
146 }
while ((str = va_arg(extra_args,
const char*)) != NULL);
150 return start(working_dir, args);
153 bool start(
const char* working_dir,
154 const char* first_extra_arg = NULL, ...)
157 args.add(
"--configdir=.");
158 args.add(
"--ndb-nodeid=", m_nodeid);
159 args.add(
"--nodaemon");
160 args.add(
"--log-name=", name());
161 args.add(
"--verbose");
167 const char* str = first_extra_arg;
168 va_start(extra_args, first_extra_arg);
172 }
while ((str = va_arg(extra_args,
const char*)) != NULL);
176 return start(working_dir, args);
181 g_info <<
"Stopping " << name() << endl;
184 m_mgmd_client.close();
186 if (m_proc == 0 || !m_proc->stop())
188 fprintf(stderr,
"Failed to stop process %s\n", name());
192 if (!m_proc->wait(ret, 300))
194 fprintf(stderr,
"Failed to wait for process %s\n", name());
200 fprintf(stderr,
"stop ret: %u\n", ret);
211 bool wait(
int&
ret,
int timeout = 300)
213 g_info <<
"Waiting for " << name() << endl;
215 if (m_proc == 0 || !m_proc->wait(ret, timeout))
217 fprintf(stderr,
"Failed to wait for process %s\n", name());
229 const char* hostname;
230 if (!get_section_string(config, m_name.
c_str(),
"HostName", &hostname))
234 if (!get_section_uint32(config, m_name.
c_str(),
"PortNumber", &port))
238 constr.
assfmt(
"%s:%d", hostname, port);
243 int num_retries = 60,
int retry_delay_in_seconds = 1)
246 g_info <<
"Connecting to " << name() <<
" @ " << constr.
c_str() << endl;
248 return m_mgmd_client.connect(constr.
c_str(),
250 retry_delay_in_seconds);
253 bool wait_confirmed_config(
int timeout = 30)
255 if (!m_mgmd_client.is_connected())
257 g_err <<
"wait_confirmed_config: not connected!" << endl;
263 while (!m_mgmd_client.get_config(conf))
267 if (retries == timeout * 10)
269 g_err <<
"wait_confirmed_config: Failed to get config within "
270 << timeout <<
" seconds" << endl;
274 g_err <<
"Failed to get config, sleeping" << endl;
275 NdbSleep_MilliSleep(100);
278 g_info <<
"wait_confirmed_config: ok" << endl;
283 NdbMgmHandle handle() {
return m_mgmd_client.handle(); }
287 bool get_section_string(
const Properties& config,
288 const char* section_name,
290 const char** value)
const
293 if (!config.get(section_name, §ion))
296 if (!section->get(key, value))
301 bool get_section_uint32(
const Properties& config,
302 const char* section_name,
307 if (!config.get(section_name, §ion))
310 if (!section->get(key, value))
324 for (
unsigned i = 0;
i < size();
i++)
326 Mgmd* mgmd = this->operator[](
i);
337 fprintf(stderr, "CHECK(" #x ") failed at line: %d\n", \
339 return NDBT_FAILED; \
348 CHECK(ConfigFactory::write_config_ini(config,
354 for (
int i = 1;
i <= 2;
i++)
357 mgmds.push_back(mgmd);
358 CHECK(mgmd->start_from_config_ini(wd.path()));
362 for (
unsigned i = 0;
i < mgmds.size();
i++)
363 CHECK(mgmds[
i]->connect(config));
366 for (
unsigned i = 0;
i < mgmds.size();
i++)
367 CHECK(mgmds[
i]->wait_confirmed_config());
370 CHECK(file_exists(path(wd.path(),
371 "ndb_1_config.bin.1",
373 CHECK(file_exists(path(wd.path(),
374 "ndb_2_config.bin.1",
378 for (
unsigned i = 0;
i < mgmds.size();
i++)
379 CHECK(mgmds[
i]->stop());
382 for (
unsigned i = 0;
i < mgmds.size();
i++)
383 CHECK(mgmds[
i]->start_from_config_ini(wd.path()));
386 for (
unsigned i = 0;
i < mgmds.size();
i++)
387 CHECK(mgmds[
i]->connect(config));
390 CHECK(file_exists(path(wd.path(),
391 "ndb_1_config.bin.1",
393 CHECK(file_exists(path(wd.path(),
394 "ndb_2_config.bin.1",
397 CHECK(!file_exists(path(wd.path(),
398 "ndb_1_config.bin.2",
400 CHECK(!file_exists(path(wd.path(),
401 "ndb_2_config.bin.2",
412 g_err <<
"** Create config.ini" << endl;
414 CHECK(ConfigFactory::write_config_ini(config,
420 for (
int i = 1;
i <= 2;
i++)
423 mgmds.push_back(mgmd);
424 CHECK(mgmd->start_from_config_ini(wd.path()));
428 for (
unsigned i = 0;
i < mgmds.size();
i++)
429 CHECK(mgmds[
i]->connect(config));
432 for (
unsigned i = 0;
i < mgmds.size();
i++)
433 CHECK(mgmds[
i]->wait_confirmed_config());
436 CHECK(file_exists(path(wd.path(),
437 "ndb_1_config.bin.1",
439 CHECK(file_exists(path(wd.path(),
440 "ndb_2_config.bin.1",
443 g_err <<
"** Restart one ndb_mgmd at a time --reload + --initial" << endl;
444 for (
unsigned i = 0;
i < mgmds.size();
i++)
446 CHECK(mgmds[
i]->stop());
447 CHECK(mgmds[
i]->start_from_config_ini(wd.path(),
448 "--reload",
"--initial", NULL));
449 CHECK(mgmds[
i]->connect(config));
450 CHECK(mgmds[
i]->wait_confirmed_config());
453 CHECK(file_exists(path(wd.path(),
454 "ndb_1_config.bin.1",
456 CHECK(file_exists(path(wd.path(),
457 "ndb_2_config.bin.1",
460 CHECK(!file_exists(path(wd.path(),
461 "ndb_1_config.bin.2",
463 CHECK(!file_exists(path(wd.path(),
464 "ndb_2_config.bin.2",
468 g_err <<
"** Restart one ndb_mgmd at a time --initial" << endl;
469 for (
unsigned i = 0;
i < mgmds.size();
i++)
471 CHECK(mgmds[
i]->stop());
472 CHECK(mgmds[
i]->start_from_config_ini(wd.path(),
474 CHECK(mgmds[
i]->connect(config));
475 CHECK(mgmds[
i]->wait_confirmed_config());
478 CHECK(file_exists(path(wd.path(),
479 "ndb_1_config.bin.1",
481 CHECK(file_exists(path(wd.path(),
482 "ndb_2_config.bin.1",
485 CHECK(!file_exists(path(wd.path(),
486 "ndb_1_config.bin.2",
488 CHECK(!file_exists(path(wd.path(),
489 "ndb_2_config.bin.2",
493 g_err <<
"** Create config2.ini" << endl;
494 CHECK(ConfigFactory::put(config,
"ndb_mgmd", 1,
"ArbitrationDelay", 100));
495 CHECK(ConfigFactory::write_config_ini(config,
500 g_err <<
"** Restart one ndb_mgmd at a time --initial should not work" << endl;
501 for (
unsigned i = 0;
i < mgmds.size();
i++)
503 CHECK(mgmds[
i]->stop());
505 CHECK(mgmds[
i]->start_from_config_ini(wd.path(),
511 CHECK(mgmds[
i]->wait(ret));
515 for (
unsigned j = 0; j < mgmds.size(); j++)
518 tmp.
assfmt(
"ndb_%d_config.bin.1", j+1);
519 CHECK(file_exists(path(wd.path(),
521 NULL).c_str()) == (j !=
i));
525 CHECK(mgmds[
i]->start_from_config_ini(wd.path(),
529 CHECK(mgmds[
i]->connect(config));
530 CHECK(mgmds[
i]->wait_confirmed_config());
533 g_err <<
"** Reload from config2.ini" << endl;
534 for (
unsigned i = 0;
i < mgmds.size();
i++)
536 CHECK(mgmds[
i]->stop());
538 CHECK(mgmds[
i]->start_from_config_ini(wd.path(),
541 CHECK(mgmds[
i]->connect(config));
542 CHECK(mgmds[
i]->wait_confirmed_config());
545 CHECK(file_exists(path(wd.path(),
546 "ndb_1_config.bin.1",
548 CHECK(file_exists(path(wd.path(),
549 "ndb_2_config.bin.1",
553 CHECK(file_exists(path(wd.path(),
554 "ndb_1_config.bin.2",
555 NULL).c_str(), timeout));
556 CHECK(file_exists(path(wd.path(),
557 "ndb_2_config.bin.2",
558 NULL).c_str(), timeout));
560 g_err <<
"** Reload mgmd initial(from generation=2)" << endl;
561 for (
unsigned i = 0;
i < mgmds.size();
i++)
563 CHECK(mgmds[
i]->stop());
564 CHECK(mgmds[
i]->start_from_config_ini(wd.path(),
566 "--reload",
"--initial", NULL));
568 CHECK(mgmds[
i]->connect(config));
569 CHECK(mgmds[
i]->wait_confirmed_config());
572 for (
unsigned j = 0; j < mgmds.size(); j++)
575 tmp.
assfmt(
"ndb_%d_config.bin.1", j+1);
576 CHECK(file_exists(path(wd.path(),
578 NULL).c_str()) == (
i < j));
580 tmp.
assfmt(
"ndb_%d_config.bin.2", j+1);
581 CHECK(file_exists(path(wd.path(),
597 g_err <<
"** Create config.ini" << endl;
599 CHECK(ConfigFactory::write_config_ini(config,
607 mgmds.push_back(mgmd);
608 CHECK(mgmd->start_from_config_ini(wd.path()));
612 mgmds.push_back(mgmd2);
613 CHECK(mgmd2->start(wd.path(),
614 "--ndb-connectstring",
615 mgmd->connectstring(config).
c_str(),
619 for (
unsigned i = 0;
i < mgmds.size();
i++)
620 CHECK(mgmds[
i]->connect(config));
623 for (
unsigned i = 0;
i < mgmds.size();
i++)
624 CHECK(mgmds[
i]->wait_confirmed_config());
627 CHECK(file_exists(path(wd.path(),
628 "ndb_1_config.bin.1",
630 CHECK(file_exists(path(wd.path(),
631 "ndb_2_config.bin.1",
643 g_err <<
"** Create config.ini" << endl;
645 CHECK(ConfigFactory::write_config_ini(config,
652 CHECK(mgmd->start_from_config_ini(wd.path(),
"--skip-config-cache", NULL));
655 CHECK(mgmd->connect(config));
658 CHECK(mgmd->wait_confirmed_config());
661 bool bin_conf_file = file_exists(path(wd.path(),
662 "ndb_1_config.bin.1",
664 CHECK(bin_conf_file ==
false);
678 CHECK(ConfigFactory::write_config_ini(config,
685 mgmds.push_back(mgmd1);
686 CHECK(mgmd1->start_from_config_ini(wd.path(),
692 CHECK(mgmd1->connect(config));
695 CHECK(mgmd1->wait_confirmed_config());
698 CHECK(file_exists(path(wd.path(),
699 "ndb_1_config.bin.1",
706 mgmds.push_back(mgmd2);
707 CHECK(mgmd2->start_from_config_ini(wd.path(),
712 CHECK(mgmd2->connect(config));
715 CHECK(mgmd2->wait_confirmed_config());
718 CHECK(file_exists(path(wd.path(),
719 "ndb_2_config.bin.1",
725 g_err <<
"** Create config2.ini" << endl;
726 CHECK(ConfigFactory::put(config,
"ndb_mgmd", 1,
"ArbitrationDelay", 100));
727 CHECK(ConfigFactory::write_config_ini(config,
732 g_err <<
"** Reload second mgmd from config2.ini" << endl;
734 Mgmd* mgmd2 = mgmds[1];
735 CHECK(mgmd2->stop());
737 CHECK(mgmd2->start_from_config_ini(wd.path(),
740 CHECK(mgmd2->connect(config));
741 CHECK(mgmd1->wait_confirmed_config());
742 CHECK(mgmd2->wait_confirmed_config());
744 CHECK(file_exists(path(wd.path(),
745 "ndb_1_config.bin.1",
747 CHECK(file_exists(path(wd.path(),
748 "ndb_2_config.bin.1",
752 CHECK(file_exists(path(wd.path(),
753 "ndb_1_config.bin.2",
755 CHECK(file_exists(path(wd.path(),
756 "ndb_2_config.bin.2",
761 for (
unsigned i = 0;
i < mgmds.size();
i++)
762 CHECK(mgmds[
i]->stop());
775 CHECK(ConfigFactory::write_config_ini(config,
780 g_err <<
"** Start mgmd1 from config.ini" << endl;
783 mgmds.push_back(mgmd1);
784 CHECK(mgmd1->start_from_config_ini(wd.path(),
786 "--nowait-nodes=1-255",
788 CHECK(mgmd1->connect(config));
789 CHECK(mgmd1->wait_confirmed_config());
792 CHECK(file_exists(path(wd.path(),
793 "ndb_1_config.bin.1",
796 g_err <<
"** Create config2.ini" << endl;
797 CHECK(ConfigFactory::put(config,
"ndb_mgmd", 1,
"ArbitrationDelay", 100));
798 CHECK(ConfigFactory::write_config_ini(config,
803 g_err <<
"** Start mgmd2 from config2.ini" << endl;
805 mgmds.push_back(mgmd2);
806 CHECK(mgmd2->start_from_config_ini(wd.path(),
809 "--nowait-nodes=1-255",
811 CHECK(mgmd2->wait(ret));
814 CHECK(mgmd1->stop());
816 g_err <<
"** Start mgmd2 again from config2.ini" << endl;
817 CHECK(mgmd2->start_from_config_ini(wd.path(),
820 "--nowait-nodes=1-255",
824 CHECK(mgmd2->connect(config));
825 CHECK(mgmd2->wait_confirmed_config());
828 CHECK(file_exists(path(wd.path(),
829 "ndb_2_config.bin.1",
832 g_err <<
"** Start mgmd1 from config.ini, mgmd2 should shutdown" << endl;
833 CHECK(mgmd1->start_from_config_ini(wd.path(),
835 "--nowait-nodes=1-255",
837 CHECK(mgmd2->wait(ret));
840 CHECK(mgmd1->stop());
850 g_err <<
"** Create config.ini" << endl;
852 CHECK(ConfigFactory::write_config_ini(config,
858 for (
int i = 1;
i <= 2;
i++)
861 mgmds.push_back(mgmd);
862 CHECK(mgmd->start_from_config_ini(wd.path()));
866 for (
unsigned i = 0;
i < mgmds.size();
i++)
868 CHECK(mgmds[
i]->connect(config));
872 for (
unsigned i = 0;
i < mgmds.size();
i++)
874 CHECK(mgmds[
i]->wait_confirmed_config());
878 for (
unsigned i = 0;
i < mgmds.size();
i++)
880 CHECK(mgmds[
i]->stop());
884 CHECK(file_exists(path(wd.path(),
885 "ndb_1_config.bin.1",
887 CHECK(file_exists(path(wd.path(),
888 "ndb_2_config.bin.1",
891 CHECK(ConfigFactory::put(config,
"ndb_mgmd", 1,
"ArbitrationDelay", 100));
892 CHECK(ConfigFactory::write_config_ini(config,
897 int loops = ctx->getNumLoops();
898 for (
int l = 0; l < loops; l++, no++)
900 g_err << l <<
": *** Reload from config.ini" << endl;
901 for (
unsigned i = 0;
i < mgmds.size();
i++)
904 CHECK(mgmds[
i]->start_from_config_ini(wd.path(),
910 for (
unsigned i = 0;
i < mgmds.size();
i++)
912 CHECK(mgmds[
i]->connect(config));
913 CHECK(mgmds[
i]->wait_confirmed_config());
923 for (
unsigned i = 0;
i < mgmds.size();
i++)
926 p.
appfmt(
"ndb_%u_config.bin.%u",
i+1, no);
927 g_err <<
"CHECK(" << p.
c_str() <<
")" << endl;
928 CHECK(file_exists(p.
c_str(), timeout));
931 for (
unsigned i = 0;
i < mgmds.size();
i++)
933 CHECK(mgmds[
i]->stop());
940 get_status(
const char* connectstring,
944 if (!ndbmgmd.connect(connectstring))
948 if (!ndbmgmd.call(
"get status", args,
949 "node status", status, NULL,
true))
951 g_err <<
"fetch_mgmd_status: mgmd.call failed" << endl;
959 int nodeid,
const char*
name,
960 const char* expected_value)
964 key.
assfmt(
"node.%d.%s", nodeid, name);
965 if (!status.get(key.
c_str(), &value))
967 g_err <<
"value_equal: no value found for '" << name
968 <<
"." << nodeid <<
"'" << endl;
972 if (strcmp(value, expected_value))
974 g_err <<
"value_equal: found unexpected value: '" << value
975 <<
"', expected: '" << expected_value <<
"'" <<endl;
978 g_info <<
"'" << value <<
"'=='" << expected_value <<
"'" << endl;
982 #include <ndb_version.h>
987 version.
assfmt(
"%u", NDB_VERSION_D);
989 mysql_version.
assfmt(
"%u", NDB_MYSQL_VERSION_D);
994 g_err <<
"** Create config.ini" << endl;
996 CHECK(ConfigFactory::write_config_ini(config,
1002 const int nodeid1 = 1;
1004 mgmds.push_back(mgmd1);
1006 const int nodeid2 = 2;
1008 mgmds.push_back(mgmd2);
1011 CHECK(mgmd1->start_from_config_ini(wd.path()));
1012 CHECK(mgmd1->connect(config));
1015 CHECK(get_status(mgmd1->connectstring(config).
c_str(), status1));
1018 CHECK(value_equal(status1, nodeid1,
"type",
"MGM"));
1019 CHECK(value_equal(status1, nodeid1,
"status",
"CONNECTED"));
1020 CHECK(value_equal(status1, nodeid1,
"version", version.
c_str()));
1021 CHECK(value_equal(status1, nodeid1,
"mysql_version", mysql_version.
c_str()));
1022 CHECK(value_equal(status1, nodeid1,
"address", address.c_str()));
1023 CHECK(value_equal(status1, nodeid1,
"startphase",
"0"));
1024 CHECK(value_equal(status1, nodeid1,
"dynamic_id",
"0"));
1025 CHECK(value_equal(status1, nodeid1,
"node_group",
"0"));
1026 CHECK(value_equal(status1, nodeid1,
"connect_count",
"0"));
1030 CHECK(value_equal(status1, nodeid2,
"type",
"MGM"));
1031 CHECK(value_equal(status1, nodeid2,
"status",
"NO_CONTACT"));
1032 CHECK(value_equal(status1, nodeid2,
"version",
"0"));
1033 CHECK(value_equal(status1, nodeid2,
"mysql_version",
"0"));
1034 CHECK(value_equal(status1, nodeid2,
"address",
""));
1035 CHECK(value_equal(status1, nodeid2,
"startphase",
"0"));
1036 CHECK(value_equal(status1, nodeid2,
"dynamic_id",
"0"));
1037 CHECK(value_equal(status1, nodeid2,
"node_group",
"0"));
1038 CHECK(value_equal(status1, nodeid2,
"connect_count",
"0"));
1041 CHECK(mgmd2->start_from_config_ini(wd.path()));
1042 CHECK(mgmd2->connect(config));
1045 for (
unsigned i = 0;
i < mgmds.size();
i++)
1046 CHECK(mgmds[
i]->wait_confirmed_config());
1049 CHECK(get_status(mgmd2->connectstring(config).
c_str(), status2));
1052 CHECK(value_equal(status2, nodeid2,
"type",
"MGM"));
1053 CHECK(value_equal(status2, nodeid2,
"status",
"CONNECTED"));
1054 CHECK(value_equal(status2, nodeid2,
"version", version.
c_str()));
1055 CHECK(value_equal(status2, nodeid2,
"mysql_version", mysql_version.
c_str()));
1056 CHECK(value_equal(status2, nodeid2,
"address", address.c_str()));
1057 CHECK(value_equal(status2, nodeid2,
"startphase",
"0"));
1058 CHECK(value_equal(status2, nodeid2,
"dynamic_id",
"0"));
1059 CHECK(value_equal(status2, nodeid2,
"node_group",
"0"));
1060 CHECK(value_equal(status2, nodeid2,
"connect_count",
"0"));
1064 CHECK(value_equal(status2, nodeid1,
"type",
"MGM"));
1065 CHECK(value_equal(status2, nodeid1,
"status",
"CONNECTED"));
1066 CHECK(value_equal(status2, nodeid1,
"version", version.
c_str()));
1067 CHECK(value_equal(status2, nodeid1,
"mysql_version", mysql_version.
c_str()));
1068 CHECK(value_equal(status2, nodeid1,
"address", address.c_str()));
1069 CHECK(value_equal(status2, nodeid1,
"startphase",
"0"));
1070 CHECK(value_equal(status2, nodeid1,
"dynamic_id",
"0"));
1071 CHECK(value_equal(status2, nodeid1,
"node_group",
"0"));
1072 CHECK(value_equal(status2, nodeid1,
"connect_count",
"0"));
1075 CHECK(get_status(mgmd1->connectstring(config).
c_str(), status3));
1078 CHECK(value_equal(status3, nodeid1,
"type",
"MGM"));
1079 CHECK(value_equal(status3, nodeid1,
"status",
"CONNECTED"));
1080 CHECK(value_equal(status3, nodeid1,
"version", version.
c_str()));
1081 CHECK(value_equal(status3, nodeid1,
"mysql_version", mysql_version.
c_str()));
1082 CHECK(value_equal(status3, nodeid1,
"address", address.c_str()));
1083 CHECK(value_equal(status3, nodeid1,
"startphase",
"0"));
1084 CHECK(value_equal(status3, nodeid1,
"dynamic_id",
"0"));
1085 CHECK(value_equal(status3, nodeid1,
"node_group",
"0"));
1086 CHECK(value_equal(status3, nodeid1,
"connect_count",
"0"));
1090 CHECK(value_equal(status3, nodeid2,
"type",
"MGM"));
1091 CHECK(value_equal(status3, nodeid2,
"status",
"CONNECTED"));
1092 CHECK(value_equal(status3, nodeid2,
"version", version.
c_str()));
1093 CHECK(value_equal(status3, nodeid2,
"mysql_version", mysql_version.
c_str()));
1094 CHECK(value_equal(status3, nodeid2,
"address", address.c_str()));
1095 CHECK(value_equal(status3, nodeid2,
"startphase",
"0"));
1096 CHECK(value_equal(status3, nodeid2,
"dynamic_id",
"0"));
1097 CHECK(value_equal(status3, nodeid2,
"node_group",
"0"));
1098 CHECK(value_equal(status3, nodeid2,
"connect_count",
"0"));
1110 const int cnt_mgmd = 1;
1111 Properties config = ConfigFactory::create(cnt_mgmd);
1112 CHECK(ConfigFactory::write_config_ini(config,
1118 for (
int i = 1;
i <= cnt_mgmd;
i++)
1121 mgmds.push_back(mgmd);
1122 CHECK(mgmd->start_from_config_ini(wd.path()));
1126 for (
unsigned i = 0;
i < mgmds.size();
i++)
1127 CHECK(mgmds[
i]->connect(config));
1130 for (
unsigned i = 0;
i < mgmds.size();
i++)
1131 CHECK(mgmds[
i]->wait_confirmed_config());
1134 CHECK(file_exists(path(wd.path(),
1135 "ndb_1_config.bin.1",
1138 int no_of_nodes = 0;
1140 int initialstart = 0;
1144 int need_disconnect = 0;
1146 initialstart, nostart, abort, force,
1150 return res == 0 ? NDBT_OK : NDBT_FAILED;
1153 NDBT_TESTSUITE(testMgmd);
1154 DRIVER(DummyDriver);
1156 TESTCASE(
"Basic2Mgm",
1157 "Basic test with two mgmd")
1159 INITIALIZER(runTestBasic2Mgm);
1162 TESTCASE(
"Bug42015",
1163 "Test that mgmd can fetch configuration from another mgmd")
1165 INITIALIZER(runTestBug42015);
1167 TESTCASE(
"NowaitNodes",
1168 "Test that one mgmd(of 2) can start alone with usage "
1169 "of --nowait-nodes, then start the second mgmd and it should join")
1171 INITIALIZER(runTestNowaitNodes);
1173 TESTCASE(
"NowaitNodes2",
1174 "Test that one mgmd(of 2) can start alone with usage "
1175 "of --nowait-nodes, then start the second mgmd from different "
1176 "configuration and the one with lowest nodeid should shutdown")
1178 INITIALIZER(runTestNowaitNodes2);
1181 TESTCASE(
"NoCfgCache",
1182 "Test that when an mgmd is started with --skip-config-cache, "
1183 "no ndb_xx_config.xx.bin file is created, but you can "
1184 "connect to the mgm node and retrieve the config.")
1186 INITIALIZER(runTestNoConfigCache);
1189 TESTCASE(
"Bug45495",
1190 "Test that mgmd can be restarted in any order")
1192 INITIALIZER(runTestBug45495);
1195 TESTCASE(
"Bug56844",
1196 "Test that mgmd can be reloaded in parallel")
1198 INITIALIZER(runBug56844);
1200 TESTCASE(
"Bug12352191",
1201 "Test mgmd status for other mgmd")
1203 INITIALIZER(runTestBug12352191);
1205 TESTCASE(
"Bug61607",
"")
1207 INITIALIZER(runBug61607);
1210 NDBT_TESTSUITE_END(testMgmd);
1212 int main(
int argc,
const char** argv)
1215 NDBT_TESTSUITE_INSTANCE(testMgmd);
1216 testMgmd.setCreateTable(
false);
1217 testMgmd.setRunAllTables(
true);
1218 testMgmd.setConnectCluster(
false);
1219 return testMgmd.execute(argc, argv);