1
/* Copyright (C) 2003 MySQL AB
3
This program is free software; you can redistribute it and/or modify
4
it under the terms of the GNU General Public License as published by
5
the Free Software Foundation; either version 2 of the License, or
6
(at your option) any later version.
8
This program is distributed in the hope that it will be useful,
9
but WITHOUT ANY WARRANTY; without even the implied warranty of
10
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
GNU General Public License for more details.
13
You should have received a copy of the GNU General Public License
14
along with this program; if not, write to the Free Software
15
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
17
#include <NdbRestarts.hpp>
21
#include <kernel/ndb_limits.h>
22
#include <signaldata/DumpStateOrd.hpp>
26
int restartRandomNodeGraceful(NdbRestarter&, const NdbRestarts::NdbRestart*);
27
int restartRandomNodeAbort(NdbRestarter&, const NdbRestarts::NdbRestart*);
28
int restartRandomNodeError(NdbRestarter&, const NdbRestarts::NdbRestart*);
29
int restartRandomNodeInitial(NdbRestarter&, const NdbRestarts::NdbRestart*);
30
int restartNFDuringNR(NdbRestarter&, const NdbRestarts::NdbRestart*);
31
int restartMasterNodeError(NdbRestarter&, const NdbRestarts::NdbRestart*);
32
int twoNodeFailure(NdbRestarter&, const NdbRestarts::NdbRestart*);
33
int fiftyPercentFail(NdbRestarter&, const NdbRestarts::NdbRestart*);
34
int twoMasterNodeFailure(NdbRestarter&, const NdbRestarts::NdbRestart*);
35
int restartAllNodesGracfeul(NdbRestarter&, const NdbRestarts::NdbRestart*);
36
int restartAllNodesAbort(NdbRestarter&, const NdbRestarts::NdbRestart*);
37
int restartAllNodesError9999(NdbRestarter&, const NdbRestarts::NdbRestart*);
38
int fiftyPercentStopAndWait(NdbRestarter&, const NdbRestarts::NdbRestart*);
39
int restartNodeDuringLCP(NdbRestarter& _restarter,
40
const NdbRestarts::NdbRestart* _restart);
41
int stopOnError(NdbRestarter&, const NdbRestarts::NdbRestart*);
42
int getRandomNodeId(NdbRestarter& _restarter);
45
* Define list of restarts
47
* - function perfoming the restart
48
* - required number of nodes
50
* - arg1, used depending of restart
51
* - arg2, used depending of restart
54
const NdbRestarts::NdbRestart NdbRestarts::m_restarts[] = {
55
/*********************************************************
57
* NODE RESTARTS with 1 node restarted
59
*********************************************************/
61
* Restart a randomly selected node
62
* with graceful shutdown
64
NdbRestart("RestartRandomNode",
66
restartRandomNodeGraceful,
69
* Restart a randomly selected node
70
* with immediate(abort) shutdown
72
NdbRestart("RestartRandomNodeAbort",
74
restartRandomNodeAbort,
77
* Restart a randomly selected node
81
NdbRestart("RestartRandomNodeError",
83
restartRandomNodeError,
86
* Restart the master node
89
NdbRestart("RestartMasterNodeError",
91
restartMasterNodeError,
94
* Restart a randomly selected node without fileystem
97
NdbRestart("RestartRandomNodeInitial",
99
restartRandomNodeInitial,
102
* Restart a randomly selected node and then
103
* crash it while restarting
106
NdbRestart("RestartNFDuringNR",
112
* Set StopOnError and crash the node by sending
116
NdbRestart("StopOnError",
121
/*********************************************************
123
* MULTIPLE NODE RESTARTS with more than 1 node
125
*********************************************************/
127
* 2 nodes restart, select nodes to restart randomly and restart
128
* with a small random delay between restarts
130
NdbRestart("TwoNodeFailure",
131
MULTIPLE_NODE_RESTART,
135
* 2 nodes restart, select master nodes and restart with
136
* a small random delay between restarts
139
NdbRestart("TwoMasterNodeFailure",
140
MULTIPLE_NODE_RESTART,
141
twoMasterNodeFailure,
144
NdbRestart("FiftyPercentFail",
145
MULTIPLE_NODE_RESTART,
149
/*********************************************************
153
*********************************************************/
155
* Restart all nodes with graceful shutdown
159
NdbRestart("RestartAllNodes",
161
restartAllNodesGracfeul,
164
* Restart all nodes immediately without
167
NdbRestart("RestartAllNodesAbort",
169
restartAllNodesAbort,
172
* Restart all nodes with error insert 9999
173
* TODO! We can later add more errors like 9998, 9997 etc.
175
NdbRestart("RestartAllNodesError9999",
177
restartAllNodesError9999,
180
* Stop 50% of all nodes with error insert 9999
181
* Wait for a random number of minutes
182
* Stop the rest of the nodes and then start all again
184
NdbRestart("FiftyPercentStopAndWait",
186
fiftyPercentStopAndWait,
189
* Restart a master node during LCP with error inserts.
191
NdbRestart("RestartNodeDuringLCP",
193
restartNodeDuringLCP,
197
const int NdbRestarts::m_NoOfRestarts = sizeof(m_restarts) / sizeof(NdbRestart);
200
const NdbRestarts::NdbErrorInsert NdbRestarts::m_errors[] = {
201
NdbErrorInsert("Error9999", 9999)
204
const int NdbRestarts::m_NoOfErrors = sizeof(m_errors) / sizeof(NdbErrorInsert);
206
NdbRestarts::NdbRestart::NdbRestart(const char* _name,
207
NdbRestartType _type,
213
m_restartFunc = _func;
214
m_numRequiredNodes = _requiredNodes;
219
int NdbRestarts::getNumRestarts(){
220
return m_NoOfRestarts;
223
const NdbRestarts::NdbRestart* NdbRestarts::getRestart(int _num){
224
if (_num >= m_NoOfRestarts)
227
return &m_restarts[_num];
230
const NdbRestarts::NdbRestart* NdbRestarts::getRestart(const char* _name){
231
for(int i = 0; i < m_NoOfRestarts; i++){
232
if (strcmp(m_restarts[i].m_name, _name) == 0){
233
return &m_restarts[i];
236
g_err << "The restart \""<< _name << "\" not found in NdbRestarts" << endl;
241
int NdbRestarts::executeRestart(const NdbRestarts::NdbRestart* _restart,
242
unsigned int _timeout){
243
// Check that there are enough nodes in the cluster
245
NdbRestarter restarter;
246
if (_restart->m_numRequiredNodes > restarter.getNumDbNodes()){
247
g_err << "This test requires " << _restart->m_numRequiredNodes << " nodes "
248
<< "there are only "<< restarter.getNumDbNodes() <<" nodes in cluster"
252
if (restarter.waitClusterStarted(120) != 0){
253
// If cluster is not started when we shall peform restart
254
// the restart can not be executed and the test fails
258
int res = _restart->m_restartFunc(restarter, _restart);
260
// Sleep a little waiting for nodes to react to command
261
NdbSleep_SecSleep(2);
264
// If timeout == 0 wait for ever
265
while(restarter.waitClusterStarted(60) != 0)
266
g_err << "Cluster is not started after restart. Waiting 60s more..."
269
if (restarter.waitClusterStarted(_timeout) != 0){
270
g_err<<"Cluster failed to start" << endl;
278
int NdbRestarts::executeRestart(int _num,
279
unsigned int _timeout){
280
const NdbRestarts::NdbRestart* r = getRestart(_num);
284
int res = executeRestart(r, _timeout);
288
int NdbRestarts::executeRestart(const char* _name,
289
unsigned int _timeout){
290
const NdbRestarts::NdbRestart* r = getRestart(_name);
294
int res = executeRestart(r, _timeout);
298
void NdbRestarts::listRestarts(NdbRestartType _type){
299
for(int i = 0; i < m_NoOfRestarts; i++){
300
if (m_restarts[i].m_type == _type)
301
ndbout << " " << m_restarts[i].m_name << ", min "
302
<< m_restarts[i].m_numRequiredNodes
307
void NdbRestarts::listRestarts(){
308
ndbout << "NODE RESTARTS" << endl;
309
listRestarts(NODE_RESTART);
310
ndbout << "MULTIPLE NODE RESTARTS" << endl;
311
listRestarts(MULTIPLE_NODE_RESTART);
312
ndbout << "SYSTEM RESTARTS" << endl;
313
listRestarts(SYSTEM_RESTART);
316
NdbRestarts::NdbErrorInsert::NdbErrorInsert(const char* _name,
320
m_errorNo = _errorNo;
323
int NdbRestarts::getNumErrorInserts(){
327
const NdbRestarts::NdbErrorInsert* NdbRestarts::getError(int _num){
328
if (_num >= m_NoOfErrors)
330
return &m_errors[_num];
333
const NdbRestarts::NdbErrorInsert* NdbRestarts::getRandomError(){
334
int randomId = myRandom48(m_NoOfErrors);
335
return &m_errors[randomId];
342
* IMPLEMENTATION OF THE DIFFERENT RESTARTS
343
* Each function should perform it's action
344
* and the returned NDBT_OK or NDBT_FAILED
349
#define CHECK(b, m) { int _xx = b; if (!(_xx)) { \
350
ndbout << "ERR: "<< m \
351
<< " " << "File: " << __FILE__ \
352
<< " (Line: " << __LINE__ << ")" << "- " << _xx << endl; \
353
return NDBT_FAILED; } }
357
int restartRandomNodeGraceful(NdbRestarter& _restarter,
358
const NdbRestarts::NdbRestart* _restart){
360
myRandom48Init(NdbTick_CurrentMillisecond());
361
int randomId = myRandom48(_restarter.getNumDbNodes());
362
int nodeId = _restarter.getDbNodeId(randomId);
364
g_info << _restart->m_name << ": node = "<<nodeId << endl;
366
CHECK(_restarter.restartOneDbNode(nodeId) == 0,
367
"Could not restart node "<<nodeId);
372
int restartRandomNodeAbort(NdbRestarter& _restarter,
373
const NdbRestarts::NdbRestart* _restart){
375
myRandom48Init(NdbTick_CurrentMillisecond());
376
int randomId = myRandom48(_restarter.getNumDbNodes());
377
int nodeId = _restarter.getDbNodeId(randomId);
379
g_info << _restart->m_name << ": node = "<<nodeId << endl;
381
CHECK(_restarter.restartOneDbNode(nodeId, false, false, true) == 0,
382
"Could not restart node "<<nodeId);
387
int restartRandomNodeError(NdbRestarter& _restarter,
388
const NdbRestarts::NdbRestart* _restart){
390
myRandom48Init(NdbTick_CurrentMillisecond());
391
int randomId = myRandom48(_restarter.getNumDbNodes());
392
int nodeId = _restarter.getDbNodeId(randomId);
394
ndbout << _restart->m_name << ": node = "<<nodeId << endl;
396
CHECK(_restarter.insertErrorInNode(nodeId, 9999) == 0,
397
"Could not restart node "<<nodeId);
402
int restartMasterNodeError(NdbRestarter& _restarter,
403
const NdbRestarts::NdbRestart* _restart){
405
int nodeId = _restarter.getDbNodeId(0);
407
g_info << _restart->m_name << ": node = "<<nodeId << endl;
409
CHECK(_restarter.insertErrorInNode(nodeId, 39999) == 0,
410
"Could not restart node "<<nodeId);
415
int restartRandomNodeInitial(NdbRestarter& _restarter,
416
const NdbRestarts::NdbRestart* _restart){
418
myRandom48Init(NdbTick_CurrentMillisecond());
419
int randomId = myRandom48(_restarter.getNumDbNodes());
420
int nodeId = _restarter.getDbNodeId(randomId);
422
g_info << _restart->m_name << ": node = "<<nodeId << endl;
424
CHECK(_restarter.restartOneDbNode(nodeId, true) == 0,
425
"Could not restart node "<<nodeId);
430
int twoNodeFailure(NdbRestarter& _restarter,
431
const NdbRestarts::NdbRestart* _restart){
433
myRandom48Init(NdbTick_CurrentMillisecond());
434
int randomId = myRandom48(_restarter.getNumDbNodes());
435
int nodeId = _restarter.getDbNodeId(randomId);
436
g_info << _restart->m_name << ": node = "<< nodeId << endl;
438
CHECK(_restarter.insertErrorInNode(nodeId, 9999) == 0,
439
"Could not restart node "<< nodeId);
441
// Create random value, max 10 secs
443
int seconds = (myRandom48(max)) + 1;
444
g_info << "Waiting for " << seconds << "(" << max
445
<< ") secs " << endl;
446
NdbSleep_SecSleep(seconds);
448
nodeId = _restarter.getRandomNodeOtherNodeGroup(nodeId, rand());
449
g_info << _restart->m_name << ": node = "<< nodeId << endl;
451
CHECK(_restarter.insertErrorInNode(nodeId, 9999) == 0,
452
"Could not restart node "<< nodeId);
457
int twoMasterNodeFailure(NdbRestarter& _restarter,
458
const NdbRestarts::NdbRestart* _restart){
460
int nodeId = _restarter.getDbNodeId(0);
461
g_info << _restart->m_name << ": node = "<< nodeId << endl;
463
CHECK(_restarter.insertErrorInNode(nodeId, 39999) == 0,
464
"Could not restart node "<< nodeId);
466
// Create random value, max 10 secs
468
int seconds = (myRandom48(max)) + 1;
469
g_info << "Waiting for " << seconds << "(" << max
470
<< ") secs " << endl;
471
NdbSleep_SecSleep(seconds);
473
nodeId = _restarter.getDbNodeId(0);
474
g_info << _restart->m_name << ": node = "<< nodeId << endl;
476
CHECK(_restarter.insertErrorInNode(nodeId, 39999) == 0,
477
"Could not restart node "<< nodeId);
482
int get50PercentOfNodes(NdbRestarter& restarter,
484
// For now simply return all nodes with even node id
485
// TODO Check nodegroup and return one node from each
487
int num50Percent = restarter.getNumDbNodes() / 2;
488
assert(num50Percent <= MAX_NDB_NODES);
490
// Calculate which nodes to stop, select all even nodes
491
for (int i = 0; i < num50Percent; i++){
492
_nodes[i] = restarter.getDbNodeId(i*2);
497
int fiftyPercentFail(NdbRestarter& _restarter,
498
const NdbRestarts::NdbRestart* _restart){
501
int nodes[MAX_NDB_NODES];
503
int numNodes = get50PercentOfNodes(_restarter, nodes);
505
// Stop the nodes, with nostart and abort
506
for (int i = 0; i < numNodes; i++){
507
g_info << "Stopping node "<< nodes[i] << endl;
508
int res = _restarter.restartOneDbNode(nodes[i], false, true, true);
509
CHECK(res == 0, "Could not stop node: "<< nodes[i]);
512
CHECK(_restarter.waitNodesNoStart(nodes, numNodes) == 0,
515
// Order all nodes to start
516
ndbout << "Starting all nodes" << endl;
517
CHECK(_restarter.startAll() == 0,
518
"Could not start all nodes");
524
int restartAllNodesGracfeul(NdbRestarter& _restarter,
525
const NdbRestarts::NdbRestart* _restart){
527
g_info << _restart->m_name << endl;
530
CHECK(_restarter.restartAll() == 0,
531
"Could not restart all nodes");
537
int restartAllNodesAbort(NdbRestarter& _restarter,
538
const NdbRestarts::NdbRestart* _restart){
540
g_info << _restart->m_name << endl;
543
CHECK(_restarter.restartAll(false, false, true) == 0,
544
"Could not restart all nodes");
549
int restartAllNodesError9999(NdbRestarter& _restarter,
550
const NdbRestarts::NdbRestart* _restart){
552
g_info << _restart->m_name << endl;
554
// Restart with error insert
555
CHECK(_restarter.insertErrorInAllNodes(9999) == 0,
556
"Could not restart all nodes ");
561
int fiftyPercentStopAndWait(NdbRestarter& _restarter,
562
const NdbRestarts::NdbRestart* _restart){
564
int nodes[MAX_NDB_NODES];
565
int numNodes = get50PercentOfNodes(_restarter, nodes);
567
// Stop the nodes, with nostart and abort
568
for (int i = 0; i < numNodes; i++){
569
g_info << "Stopping node "<<nodes[i] << endl;
570
int res = _restarter.restartOneDbNode(nodes[i], false, true, true);
571
CHECK(res == 0, "Could not stop node: "<< nodes[i]);
574
CHECK(_restarter.waitNodesNoStart(nodes, numNodes) == 0,
577
// Create random value, max 120 secs
579
int seconds = (myRandom48(max)) + 1;
580
g_info << "Waiting for " << seconds << "(" << max
581
<< ") secs " << endl;
582
NdbSleep_SecSleep(seconds);
586
CHECK(_restarter.restartAll() == 0,
587
"Could not restart all nodes");
589
g_info << _restart->m_name << endl;
595
NFDuringNR_codes[] = {
623
int restartNFDuringNR(NdbRestarter& _restarter,
624
const NdbRestarts::NdbRestart* _restart){
626
myRandom48Init(NdbTick_CurrentMillisecond());
628
const int sz = sizeof(NFDuringNR_codes)/sizeof(NFDuringNR_codes[0]);
629
for(i = 0; i<sz; i++){
630
int randomId = myRandom48(_restarter.getNumDbNodes());
631
int nodeId = _restarter.getDbNodeId(randomId);
632
int error = NFDuringNR_codes[i];
634
g_info << _restart->m_name << ": node = " << nodeId
635
<< " error code = " << error << endl;
637
CHECK(_restarter.restartOneDbNode(nodeId, false, true, true) == 0,
638
"Could not restart node "<< nodeId);
640
CHECK(_restarter.waitNodesNoStart(&nodeId, 1) == 0,
641
"waitNodesNoStart failed");
643
int val[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 } ;
644
CHECK(_restarter.dumpStateOneNode(nodeId, val, 2) == 0,
645
"failed to set RestartOnErrorInsert");
647
CHECK(_restarter.insertErrorInNode(nodeId, error) == 0,
648
"failed to set error insert");
650
CHECK(_restarter.startNodes(&nodeId, 1) == 0,
651
"failed to start node");
653
NdbSleep_SecSleep(3);
655
//CHECK(_restarter.waitNodesNoStart(&nodeId, 1) == 0,
656
// "waitNodesNoStart failed");
657
_restarter.waitNodesNoStart(&nodeId, 1);
659
CHECK(_restarter.startNodes(&nodeId, 1) == 0,
660
"failed to start node");
662
CHECK(_restarter.waitNodesStarted(&nodeId, 1) == 0,
663
"waitNodesStarted failed");
668
if(_restarter.getNumDbNodes() < 4)
672
if(NdbEnv_GetEnv("USER", buf, 256) == 0 || strcmp(buf, "ejonore") != 0)
675
for(i = 0; i<sz; i++){
676
const int randomId = myRandom48(_restarter.getNumDbNodes());
677
int nodeId = _restarter.getDbNodeId(randomId);
678
const int error = NFDuringNR_codes[i];
680
const int masterNodeId = _restarter.getMasterNodeId();
681
CHECK(masterNodeId > 0, "getMasterNodeId failed");
684
int rand = myRandom48(1000);
685
crashNodeId = _restarter.getRandomNodeOtherNodeGroup(nodeId, rand);
686
} while(crashNodeId == masterNodeId);
688
CHECK(crashNodeId > 0, "getMasterNodeId failed");
690
g_info << _restart->m_name << " restarting node = " << nodeId
691
<< " error code = " << error
692
<< " crash node = " << crashNodeId << endl;
694
CHECK(_restarter.restartOneDbNode(nodeId, false, true, true) == 0,
695
"Could not restart node "<< nodeId);
697
CHECK(_restarter.waitNodesNoStart(&nodeId, 1) == 0,
698
"waitNodesNoStart failed");
700
int val[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
701
CHECK(_restarter.dumpStateOneNode(crashNodeId, val, 2) == 0,
702
"failed to set RestartOnErrorInsert");
704
CHECK(_restarter.insertErrorInNode(crashNodeId, error) == 0,
705
"failed to set error insert");
707
CHECK(_restarter.startNodes(&nodeId, 1) == 0,
708
"failed to start node");
710
CHECK(_restarter.waitClusterStarted() == 0,
711
"waitClusterStarted failed");
718
NRDuringLCP_Master_codes[] = {
719
7009, // Insert system error in master when local checkpoint is idle.
720
7010, // Insert system error in master when local checkpoint is in the
721
// state clcpStatus = CALCULATE_KEEP_GCI.
722
7013, // Insert system error in master when local checkpoint is in the
723
// state clcpStatus = COPY_GCI before sending COPY_GCIREQ.
724
7014, // Insert system error in master when local checkpoint is in the
725
// state clcpStatus = TC_CLOPSIZE before sending TC_CLOPSIZEREQ.
726
7015, // Insert system error in master when local checkpoint is in the
727
// state clcpStatus = START_LCP_ROUND before sending START_LCP_ROUND.
728
7019, // Insert system error in master when local checkpoint is in the
729
// state clcpStatus = IDLE before sending CONTINUEB(ZCHECK_TC_COUNTER).
730
7075, // Master. Don't send any LCP_FRAG_ORD(last=true)
731
// And crash when all have "not" been sent
732
7021, // Crash in master when receiving START_LCP_REQ
733
7023, // Crash in master when sending START_LCP_CONF
734
7025, // Crash in master when receiving LCP_FRAG_REP
735
7026, // Crash in master when changing state to LCP_TAB_COMPLETED
736
7027 // Crash in master when changing state to LCP_TAB_SAVED
740
NRDuringLCP_NonMaster_codes[] = {
741
7020, // Insert system error in local checkpoint participant at reception
743
8000, // Crash particpant when receiving TCGETOPSIZEREQ
744
8001, // Crash particpant when receiving TC_CLOPSIZEREQ
745
5010, // Crash any when receiving LCP_FRAGORD
746
7022, // Crash in !master when receiving START_LCP_REQ
747
7024, // Crash in !master when sending START_LCP_CONF
748
7016, // Crash in !master when receiving LCP_FRAG_REP
749
7017, // Crash in !master when changing state to LCP_TAB_COMPLETED
750
7018 // Crash in !master when changing state to LCP_TAB_SAVED
753
int restartNodeDuringLCP(NdbRestarter& _restarter,
754
const NdbRestarts::NdbRestart* _restart) {
757
int val = DumpStateOrd::DihMinTimeBetweenLCP;
758
CHECK(_restarter.dumpStateAllNodes(&val, 1) == 0,
759
"Failed to set LCP to min value"); // Set LCP to min val
760
int sz = sizeof(NRDuringLCP_Master_codes)/
761
sizeof(NRDuringLCP_Master_codes[0]);
762
for(i = 0; i<sz; i++) {
764
int error = NRDuringLCP_Master_codes[i];
765
int masterNodeId = _restarter.getMasterNodeId();
767
CHECK(masterNodeId > 0, "getMasterNodeId failed");
769
ndbout << _restart->m_name << " restarting master node = " << masterNodeId
770
<< " error code = " << error << endl;
773
int val[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
774
CHECK(_restarter.dumpStateAllNodes(val, 2) == 0,
775
"failed to set RestartOnErrorInsert");
778
CHECK(_restarter.insertErrorInNode(masterNodeId, error) == 0,
779
"failed to set error insert");
781
CHECK(_restarter.waitNodesNoStart(&masterNodeId, 1, 300) == 0,
782
"failed to wait no start");
784
CHECK(_restarter.startNodes(&masterNodeId, 1) == 0,
785
"failed to start node");
787
CHECK(_restarter.waitClusterStarted(300) == 0,
788
"waitClusterStarted failed");
791
int val = DumpStateOrd::DihMinTimeBetweenLCP;
792
CHECK(_restarter.dumpStateOneNode(masterNodeId, &val, 1) == 0,
793
"failed to set error insert");
798
sz = sizeof(NRDuringLCP_NonMaster_codes)/
799
sizeof(NRDuringLCP_NonMaster_codes[0]);
800
for(i = 0; i<sz; i++) {
802
int error = NRDuringLCP_NonMaster_codes[i];
803
int nodeId = getRandomNodeId(_restarter);
804
int masterNodeId = _restarter.getMasterNodeId();
805
CHECK(masterNodeId > 0, "getMasterNodeId failed");
807
while (nodeId == masterNodeId) {
808
nodeId = getRandomNodeId(_restarter);
811
ndbout << _restart->m_name << " restarting non-master node = " << nodeId
812
<< " error code = " << error << endl;
814
int val[] = { DumpStateOrd::CmvmiSetRestartOnErrorInsert, 1 };
815
CHECK(_restarter.dumpStateAllNodes(val, 2) == 0,
816
"failed to set RestartOnErrorInsert");
818
CHECK(_restarter.insertErrorInNode(nodeId, error) == 0,
819
"failed to set error insert");
821
CHECK(_restarter.waitNodesNoStart(&nodeId, 1, 300) == 0,
822
"failed to wait no start");
824
CHECK(_restarter.startNodes(&nodeId, 1) == 0,
825
"failed to start node");
827
CHECK(_restarter.waitClusterStarted(300) == 0,
828
"waitClusterStarted failed");
831
int val = DumpStateOrd::DihMinTimeBetweenLCP;
832
CHECK(_restarter.dumpStateOneNode(nodeId, &val, 1) == 0,
833
"failed to set error insert");
840
int stopOnError(NdbRestarter& _restarter,
841
const NdbRestarts::NdbRestart* _restart){
843
myRandom48Init(NdbTick_CurrentMillisecond());
845
int randomId = myRandom48(_restarter.getNumDbNodes());
846
int nodeId = _restarter.getDbNodeId(randomId);
849
g_info << _restart->m_name << ": node = " << nodeId
852
CHECK(_restarter.waitClusterStarted(300) == 0,
853
"waitClusterStarted failed");
855
int val = DumpStateOrd::NdbcntrTestStopOnError;
856
CHECK(_restarter.dumpStateOneNode(nodeId, &val, 1) == 0,
857
"failed to set NdbcntrTestStopOnError");
859
NdbSleep_SecSleep(3);
861
CHECK(_restarter.waitClusterStarted(300) == 0,
862
"waitClusterStarted failed");
868
int getRandomNodeId(NdbRestarter& _restarter) {
869
myRandom48Init(NdbTick_CurrentMillisecond());
870
int randomId = myRandom48(_restarter.getNumDbNodes());
871
int nodeId = _restarter.getDbNodeId(randomId);