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; version 2 of the License.
7
This program is distributed in the hope that it will be useful,
8
but WITHOUT ANY WARRANTY; without even the implied warranty of
9
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
GNU General Public License for more details.
12
You should have received a copy of the GNU General Public License
13
along with this program; if not, write to the Free Software
14
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
16
#include <NdbRestarts.hpp>
20
#include <kernel/ndb_limits.h>
21
#include <signaldata/DumpStateOrd.hpp>
25
int restartRandomNodeGraceful(NdbRestarter&, const NdbRestarts::NdbRestart*);
26
int restartRandomNodeAbort(NdbRestarter&, const NdbRestarts::NdbRestart*);
27
int restartRandomNodeError(NdbRestarter&, const NdbRestarts::NdbRestart*);
28
int restartRandomNodeInitial(NdbRestarter&, const NdbRestarts::NdbRestart*);
29
int restartNFDuringNR(NdbRestarter&, const NdbRestarts::NdbRestart*);
30
int restartMasterNodeError(NdbRestarter&, const NdbRestarts::NdbRestart*);
31
int twoNodeFailure(NdbRestarter&, const NdbRestarts::NdbRestart*);
32
int fiftyPercentFail(NdbRestarter&, const NdbRestarts::NdbRestart*);
33
int twoMasterNodeFailure(NdbRestarter&, const NdbRestarts::NdbRestart*);
34
int restartAllNodesGracfeul(NdbRestarter&, const NdbRestarts::NdbRestart*);
35
int restartAllNodesAbort(NdbRestarter&, const NdbRestarts::NdbRestart*);
36
int restartAllNodesError9999(NdbRestarter&, const NdbRestarts::NdbRestart*);
37
int fiftyPercentStopAndWait(NdbRestarter&, const NdbRestarts::NdbRestart*);
38
int restartNodeDuringLCP(NdbRestarter& _restarter,
39
const NdbRestarts::NdbRestart* _restart);
40
int stopOnError(NdbRestarter&, const NdbRestarts::NdbRestart*);
41
int getRandomNodeId(NdbRestarter& _restarter);
44
* Define list of restarts
46
* - function perfoming the restart
47
* - required number of nodes
49
* - arg1, used depending of restart
50
* - arg2, used depending of restart
53
const NdbRestarts::NdbRestart NdbRestarts::m_restarts[] = {
54
/*********************************************************
56
* NODE RESTARTS with 1 node restarted
58
*********************************************************/
60
* Restart a randomly selected node
61
* with graceful shutdown
63
NdbRestart("RestartRandomNode",
65
restartRandomNodeGraceful,
68
* Restart a randomly selected node
69
* with immediate(abort) shutdown
71
NdbRestart("RestartRandomNodeAbort",
73
restartRandomNodeAbort,
76
* Restart a randomly selected node
80
NdbRestart("RestartRandomNodeError",
82
restartRandomNodeError,
85
* Restart the master node
88
NdbRestart("RestartMasterNodeError",
90
restartMasterNodeError,
93
* Restart a randomly selected node without fileystem
96
NdbRestart("RestartRandomNodeInitial",
98
restartRandomNodeInitial,
101
* Restart a randomly selected node and then
102
* crash it while restarting
105
NdbRestart("RestartNFDuringNR",
111
* Set StopOnError and crash the node by sending
115
NdbRestart("StopOnError",
120
/*********************************************************
122
* MULTIPLE NODE RESTARTS with more than 1 node
124
*********************************************************/
126
* 2 nodes restart, select nodes to restart randomly and restart
127
* with a small random delay between restarts
129
NdbRestart("TwoNodeFailure",
130
MULTIPLE_NODE_RESTART,
134
* 2 nodes restart, select master nodes and restart with
135
* a small random delay between restarts
138
NdbRestart("TwoMasterNodeFailure",
139
MULTIPLE_NODE_RESTART,
140
twoMasterNodeFailure,
143
NdbRestart("FiftyPercentFail",
144
MULTIPLE_NODE_RESTART,
148
/*********************************************************
152
*********************************************************/
154
* Restart all nodes with graceful shutdown
158
NdbRestart("RestartAllNodes",
160
restartAllNodesGracfeul,
163
* Restart all nodes immediately without
166
NdbRestart("RestartAllNodesAbort",
168
restartAllNodesAbort,
171
* Restart all nodes with error insert 9999
172
* TODO! We can later add more errors like 9998, 9997 etc.
174
NdbRestart("RestartAllNodesError9999",
176
restartAllNodesError9999,
179
* Stop 50% of all nodes with error insert 9999
180
* Wait for a random number of minutes
181
* Stop the rest of the nodes and then start all again
183
NdbRestart("FiftyPercentStopAndWait",
185
fiftyPercentStopAndWait,
188
* Restart a master node during LCP with error inserts.
190
NdbRestart("RestartNodeDuringLCP",
192
restartNodeDuringLCP,
196
const int NdbRestarts::m_NoOfRestarts = sizeof(m_restarts) / sizeof(NdbRestart);
199
const NdbRestarts::NdbErrorInsert NdbRestarts::m_errors[] = {
200
NdbErrorInsert("Error9999", 9999)
203
const int NdbRestarts::m_NoOfErrors = sizeof(m_errors) / sizeof(NdbErrorInsert);
205
NdbRestarts::NdbRestart::NdbRestart(const char* _name,
206
NdbRestartType _type,
212
m_restartFunc = _func;
213
m_numRequiredNodes = _requiredNodes;
218
int NdbRestarts::getNumRestarts(){
219
return m_NoOfRestarts;
222
const NdbRestarts::NdbRestart* NdbRestarts::getRestart(int _num){
223
if (_num >= m_NoOfRestarts)
226
return &m_restarts[_num];
229
const NdbRestarts::NdbRestart* NdbRestarts::getRestart(const char* _name){
230
for(int i = 0; i < m_NoOfRestarts; i++){
231
if (strcmp(m_restarts[i].m_name, _name) == 0){
232
return &m_restarts[i];
235
g_err << "The restart \""<< _name << "\" not found in NdbRestarts" << endl;
240
int NdbRestarts::executeRestart(const NdbRestarts::NdbRestart* _restart,
241
unsigned int _timeout){
242
// Check that there are enough nodes in the cluster
244
NdbRestarter restarter;
245
if (_restart->m_numRequiredNodes > restarter.getNumDbNodes()){
246
g_err << "This test requires " << _restart->m_numRequiredNodes << " nodes "
247
<< "there are only "<< restarter.getNumDbNodes() <<" nodes in cluster"
251
if (restarter.waitClusterStarted(120) != 0){
252
// If cluster is not started when we shall peform restart
253
// the restart can not be executed and the test fails
257
int res = _restart->m_restartFunc(restarter, _restart);
259
// Sleep a little waiting for nodes to react to command
260
NdbSleep_SecSleep(2);
263
// If timeout == 0 wait for ever
264
while(restarter.waitClusterStarted(60) != 0)
265
g_err << "Cluster is not started after restart. Waiting 60s more..."
268
if (restarter.waitClusterStarted(_timeout) != 0){
269
g_err<<"Cluster failed to start" << endl;
277
int NdbRestarts::executeRestart(int _num,
278
unsigned int _timeout){
279
const NdbRestarts::NdbRestart* r = getRestart(_num);
283
int res = executeRestart(r, _timeout);
287
int NdbRestarts::executeRestart(const char* _name,
288
unsigned int _timeout){
289
const NdbRestarts::NdbRestart* r = getRestart(_name);
293
int res = executeRestart(r, _timeout);
297
void NdbRestarts::listRestarts(NdbRestartType _type){
298
for(int i = 0; i < m_NoOfRestarts; i++){
299
if (m_restarts[i].m_type == _type)
300
ndbout << " " << m_restarts[i].m_name << ", min "
301
<< m_restarts[i].m_numRequiredNodes
306
void NdbRestarts::listRestarts(){
307
ndbout << "NODE RESTARTS" << endl;
308
listRestarts(NODE_RESTART);
309
ndbout << "MULTIPLE NODE RESTARTS" << endl;
310
listRestarts(MULTIPLE_NODE_RESTART);
311
ndbout << "SYSTEM RESTARTS" << endl;
312
listRestarts(SYSTEM_RESTART);
315
NdbRestarts::NdbErrorInsert::NdbErrorInsert(const char* _name,
319
m_errorNo = _errorNo;
322
int NdbRestarts::getNumErrorInserts(){
326
const NdbRestarts::NdbErrorInsert* NdbRestarts::getError(int _num){
327
if (_num >= m_NoOfErrors)
329
return &m_errors[_num];
332
const NdbRestarts::NdbErrorInsert* NdbRestarts::getRandomError(){
333
int randomId = myRandom48(m_NoOfErrors);
334
return &m_errors[randomId];
341
* IMPLEMENTATION OF THE DIFFERENT RESTARTS
342
* Each function should perform it's action
343
* and the returned NDBT_OK or NDBT_FAILED
348
#define CHECK(b, m) { int _xx = b; if (!(_xx)) { \
349
ndbout << "ERR: "<< m \
350
<< " " << "File: " << __FILE__ \
351
<< " (Line: " << __LINE__ << ")" << "- " << _xx << endl; \
352
return NDBT_FAILED; } }
356
int restartRandomNodeGraceful(NdbRestarter& _restarter,
357
const NdbRestarts::NdbRestart* _restart){
359
myRandom48Init(NdbTick_CurrentMillisecond());
360
int randomId = myRandom48(_restarter.getNumDbNodes());
361
int nodeId = _restarter.getDbNodeId(randomId);
363
g_info << _restart->m_name << ": node = "<<nodeId << endl;
365
CHECK(_restarter.restartOneDbNode(nodeId) == 0,
366
"Could not restart node "<<nodeId);
371
int restartRandomNodeAbort(NdbRestarter& _restarter,
372
const NdbRestarts::NdbRestart* _restart){
374
myRandom48Init(NdbTick_CurrentMillisecond());
375
int randomId = myRandom48(_restarter.getNumDbNodes());
376
int nodeId = _restarter.getDbNodeId(randomId);
378
g_info << _restart->m_name << ": node = "<<nodeId << endl;
380
CHECK(_restarter.restartOneDbNode(nodeId, false, false, true) == 0,
381
"Could not restart node "<<nodeId);
386
int restartRandomNodeError(NdbRestarter& _restarter,
387
const NdbRestarts::NdbRestart* _restart){
389
myRandom48Init(NdbTick_CurrentMillisecond());
390
int randomId = myRandom48(_restarter.getNumDbNodes());
391
int nodeId = _restarter.getDbNodeId(randomId);
393
ndbout << _restart->m_name << ": node = "<<nodeId << endl;
395
CHECK(_restarter.insertErrorInNode(nodeId, 9999) == 0,
396
"Could not restart node "<<nodeId);
401
int restartMasterNodeError(NdbRestarter& _restarter,
402
const NdbRestarts::NdbRestart* _restart){
404
int nodeId = _restarter.getDbNodeId(0);
406
g_info << _restart->m_name << ": node = "<<nodeId << endl;
408
CHECK(_restarter.insertErrorInNode(nodeId, 39999) == 0,
409
"Could not restart node "<<nodeId);
414
int restartRandomNodeInitial(NdbRestarter& _restarter,
415
const NdbRestarts::NdbRestart* _restart){
417
myRandom48Init(NdbTick_CurrentMillisecond());
418
int randomId = myRandom48(_restarter.getNumDbNodes());
419
int nodeId = _restarter.getDbNodeId(randomId);
421
g_info << _restart->m_name << ": node = "<<nodeId << endl;
423
CHECK(_restarter.restartOneDbNode(nodeId, true) == 0,
424
"Could not restart node "<<nodeId);
429
int twoNodeFailure(NdbRestarter& _restarter,
430
const NdbRestarts::NdbRestart* _restart){
432
myRandom48Init(NdbTick_CurrentMillisecond());
433
int randomId = myRandom48(_restarter.getNumDbNodes());
434
int nodeId = _restarter.getDbNodeId(randomId);
435
g_info << _restart->m_name << ": node = "<< nodeId << endl;
437
CHECK(_restarter.insertErrorInNode(nodeId, 9999) == 0,
438
"Could not restart node "<< nodeId);
440
// Create random value, max 10 secs
442
int seconds = (myRandom48(max)) + 1;
443
g_info << "Waiting for " << seconds << "(" << max
444
<< ") secs " << endl;
445
NdbSleep_SecSleep(seconds);
447
nodeId = _restarter.getRandomNodeOtherNodeGroup(nodeId, rand());
448
g_info << _restart->m_name << ": node = "<< nodeId << endl;
450
CHECK(_restarter.insertErrorInNode(nodeId, 9999) == 0,
451
"Could not restart node "<< nodeId);
456
int twoMasterNodeFailure(NdbRestarter& _restarter,
457
const NdbRestarts::NdbRestart* _restart){
459
int nodeId = _restarter.getDbNodeId(0);
460
g_info << _restart->m_name << ": node = "<< nodeId << endl;
462
CHECK(_restarter.insertErrorInNode(nodeId, 39999) == 0,
463
"Could not restart node "<< nodeId);
465
// Create random value, max 10 secs
467
int seconds = (myRandom48(max)) + 1;
468
g_info << "Waiting for " << seconds << "(" << max
469
<< ") secs " << endl;
470
NdbSleep_SecSleep(seconds);
472
nodeId = _restarter.getDbNodeId(0);
473
g_info << _restart->m_name << ": node = "<< nodeId << endl;
475
CHECK(_restarter.insertErrorInNode(nodeId, 39999) == 0,
476
"Could not restart node "<< nodeId);
481
int get50PercentOfNodes(NdbRestarter& restarter,
483
// For now simply return all nodes with even node id
484
// TODO Check nodegroup and return one node from each
486
int num50Percent = restarter.getNumDbNodes() / 2;
487
assert(num50Percent <= MAX_NDB_NODES);
489
// Calculate which nodes to stop, select all even nodes
490
for (int i = 0; i < num50Percent; i++){
491
_nodes[i] = restarter.getDbNodeId(i*2);
496
int fiftyPercentFail(NdbRestarter& _restarter,
497
const NdbRestarts::NdbRestart* _restart){
500
int nodes[MAX_NDB_NODES];
502
int numNodes = get50PercentOfNodes(_restarter, nodes);
504
// Stop the nodes, with nostart and abort
505
for (int i = 0; i < numNodes; i++){
506
g_info << "Stopping node "<< nodes[i] << endl;
507
int res = _restarter.restartOneDbNode(nodes[i], false, true, true);
508
CHECK(res == 0, "Could not stop node: "<< nodes[i]);
511
CHECK(_restarter.waitNodesNoStart(nodes, numNodes) == 0,
514
// Order all nodes to start
515
ndbout << "Starting all nodes" << endl;
516
CHECK(_restarter.startAll() == 0,
517
"Could not start all nodes");
523
int restartAllNodesGracfeul(NdbRestarter& _restarter,
524
const NdbRestarts::NdbRestart* _restart){
526
g_info << _restart->m_name << endl;
529
CHECK(_restarter.restartAll() == 0,
530
"Could not restart all nodes");
536
int restartAllNodesAbort(NdbRestarter& _restarter,
537
const NdbRestarts::NdbRestart* _restart){
539
g_info << _restart->m_name << endl;
542
CHECK(_restarter.restartAll(false, false, true) == 0,
543
"Could not restart all nodes");
548
int restartAllNodesError9999(NdbRestarter& _restarter,
549
const NdbRestarts::NdbRestart* _restart){
551
g_info << _restart->m_name << endl;
553
// Restart with error insert
554
CHECK(_restarter.insertErrorInAllNodes(9999) == 0,
555
"Could not restart all nodes ");
560
int fiftyPercentStopAndWait(NdbRestarter& _restarter,
561
const NdbRestarts::NdbRestart* _restart){
563
int nodes[MAX_NDB_NODES];
564
int numNodes = get50PercentOfNodes(_restarter, nodes);
566
// Stop the nodes, with nostart and abort
567
for (int i = 0; i < numNodes; i++){
568
g_info << "Stopping node "<<nodes[i] << endl;
569
int res = _restarter.restartOneDbNode(nodes[i], false, true, true);
570
CHECK(res == 0, "Could not stop node: "<< nodes[i]);
573
CHECK(_restarter.waitNodesNoStart(nodes, numNodes) == 0,
576
// Create random value, max 120 secs
578
int seconds = (myRandom48(max)) + 1;
579
g_info << "Waiting for " << seconds << "(" << max
580
<< ") secs " << endl;
581
NdbSleep_SecSleep(seconds);
585
CHECK(_restarter.restartAll() == 0,
586
"Could not restart all nodes");
588
g_info << _restart->m_name << endl;
594
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_err << _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);