MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
NdbMixRestarter.hpp
1 /*
2  Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; version 2 of the License.
7 
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.
12 
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
16 */
17 
18 #ifndef NDBT_MIX_RESTARTER_HPP
19 #define NDBT_MIX_RESTARTER_HPP
20 
21 #include <mgmapi.h>
22 #include <Vector.hpp>
23 #include <BaseString.hpp>
24 #include "NdbRestarter.hpp"
25 #include "NDBT_Test.hpp"
26 
27 #define NMR_SR "SR"
28 #define NMR_SR_THREADS "SR_ThreadCount"
29 #define NMR_SR_THREADS_STOPPED "SR_ThreadsStoppedCount"
30 #define NMR_SR_VALIDATE_THREADS "SR_ValidateThreadCount"
31 #define NMR_SR_VALIDATE_THREADS_DONE "SR_ValidateThreadsDoneCount"
32 
34 {
35 public:
36  enum RestartTypeMask
37  {
38  RTM_RestartCluster = 0x01,
39  RTM_RestartNode = 0x02,
40  RTM_RestartNodeInitial = 0x04,
41  RTM_StopNode = 0x08,
42  RTM_StopNodeInitial = 0x10,
43  RTM_StartNode = 0x20,
44 
45  RTM_COUNT = 6,
46 
47  RTM_ALL = 0xFF,
48  RTM_SR = RTM_RestartCluster,
49  RTM_NR = 0x2 | 0x4 | 0x8 | 0x10 | 0x20
50  };
51 
52  enum SR_State {
53  SR_RUNNING = 0,
54  SR_STOPPING = 1,
55  SR_STOPPED = 2,
56  SR_VALIDATING = 3
57  };
58 
59  NdbMixRestarter(unsigned * seed = 0, const char* _addr = 0);
60  ~NdbMixRestarter();
61 
62  void setRestartTypeMask(Uint32 mask);
63  int runUntilStopped(NDBT_Context* ctx, NDBT_Step* step, Uint32 freq);
64  int runPeriod(NDBT_Context* ctx, NDBT_Step* step, Uint32 time, Uint32 freq);
65 
66  int init(NDBT_Context* ctx, NDBT_Step* step);
67  int dostep(NDBT_Context* ctx, NDBT_Step* step);
68  int finish(NDBT_Context* ctx, NDBT_Step* step);
69 
70 private:
71  unsigned * seed;
72  unsigned ownseed;
73  Uint32 m_mask;
75  int restart_cluster(NDBT_Context* ctx, NDBT_Step* step, bool abort = true);
76 };
77 
78 #endif