MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
StopReq.hpp
1 /*
2  Copyright (C) 2003, 2005, 2006 MySQL AB
3  All rights reserved. Use is subject to license terms.
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; version 2 of the License.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program; if not, write to the Free Software
16  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18 
19 #ifndef STOP_REQ_HPP
20 #define STOP_REQ_HPP
21 
22 #include "SignalData.hpp"
23 
24 class StopReq
25 {
29  friend class Ndbcntr;
30 
34  friend class MgmtSrvr;
35 
36 public:
37  STATIC_CONST( SignalLength = 9 + NdbNodeBitmask::Size);
38 
39 public:
40  Uint32 senderRef;
41  Uint32 senderData;
42 
43  Uint32 requestInfo;
44  Uint32 singleuser; // Indicates whether or not to enter
45  // single user mode.
46  // Only in conjunction with system stop
47  Uint32 singleUserApi; // allowed api in singleuser
48 
49  Int32 apiTimeout; // Timeout before api transactions are refused
50  Int32 transactionTimeout; // Timeout before transactions are aborted
51  Int32 readOperationTimeout; // Timeout before read operations are aborted
52  Int32 operationTimeout; // Timeout before all operations are aborted
53 
54  Uint32 nodes[NdbNodeBitmask::Size];
55 
56  static void setSystemStop(Uint32 & requestInfo, bool value);
57  static void setPerformRestart(Uint32 & requestInfo, bool value);
58  static void setNoStart(Uint32 & requestInfo, bool value);
59  static void setInitialStart(Uint32 & requestInfo, bool value);
63  static void setStopAbort(Uint32 & requestInfo, bool value);
64  static void setStopNodes(Uint32 & requestInfo, bool value);
65 
66  static bool getSystemStop(const Uint32 & requestInfo);
67  static bool getPerformRestart(const Uint32 & requestInfo);
68  static bool getNoStart(const Uint32 & requestInfo);
69  static bool getInitialStart(const Uint32 & requestInfo);
70  static bool getStopAbort(const Uint32 & requestInfo);
71  static bool getStopNodes(const Uint32 & requestInfo);
72 };
73 
74 struct StopConf
75 {
76  STATIC_CONST( SignalLength = 2 );
77  Uint32 senderData;
78  union {
79  Uint32 nodeState;
80  Uint32 nodeId;
81  };
82 };
83 
84 class StopRef
85 {
89  friend class MgmtSrvr;
90 
94  friend class Ndbcntr;
95 
96 public:
97  STATIC_CONST( SignalLength = 3 );
98 
99  enum ErrorCode {
100  OK = 0,
101  NodeShutdownInProgress = 1,
102  SystemShutdownInProgress = 2,
103  NodeShutdownWouldCauseSystemCrash = 3,
104  TransactionAbortFailed = 4,
105  UnsupportedNodeShutdown = 5,
106  MultiNodeShutdownNotMaster = 6
107  };
108 
109 public:
110  Uint32 senderData;
111  Uint32 errorCode;
112  Uint32 masterNodeId;
113 };
114 
115 inline
116 bool
117 StopReq::getSystemStop(const Uint32 & requestInfo)
118 {
119  return requestInfo & 1;
120 }
121 
122 inline
123 bool
124 StopReq::getPerformRestart(const Uint32 & requestInfo)
125 {
126  return requestInfo & 2;
127 }
128 
129 inline
130 bool
131 StopReq::getNoStart(const Uint32 & requestInfo)
132 {
133  return requestInfo & 4;
134 }
135 
136 inline
137 bool
138 StopReq::getInitialStart(const Uint32 & requestInfo)
139 {
140  return requestInfo & 8;
141 }
142 
143 inline
144 bool
145 StopReq::getStopAbort(const Uint32 & requestInfo)
146 {
147  return requestInfo & 32;
148 }
149 
150 inline
151 bool
152 StopReq::getStopNodes(const Uint32 & requestInfo)
153 {
154  return requestInfo & 64;
155 }
156 
157 
158 inline
159 void
160 StopReq::setSystemStop(Uint32 & requestInfo, bool value)
161 {
162  if(value)
163  requestInfo |= 1;
164  else
165  requestInfo &= ~1;
166 }
167 
168 inline
169 void
170 StopReq::setPerformRestart(Uint32 & requestInfo, bool value)
171 {
172  if(value)
173  requestInfo |= 2;
174  else
175  requestInfo &= ~2;
176 }
177 
178 inline
179 void
180 StopReq::setNoStart(Uint32 & requestInfo, bool value)
181 {
182  if(value)
183  requestInfo |= 4;
184  else
185  requestInfo &= ~4;
186 }
187 
188 inline
189 void
190 StopReq::setInitialStart(Uint32 & requestInfo, bool value)
191 {
192  if(value)
193  requestInfo |= 8;
194  else
195  requestInfo &= ~8;
196 }
197 
198 inline
199 void
200 StopReq::setStopAbort(Uint32 & requestInfo, bool value)
201 {
202  if(value)
203  requestInfo |= 32;
204  else
205  requestInfo &= ~32;
206 }
207 
208 inline
209 void
210 StopReq::setStopNodes(Uint32 & requestInfo, bool value)
211 {
212  if(value)
213  requestInfo |= 64;
214  else
215  requestInfo &= ~64;
216 }
217 
218 #endif
219