~ubuntu-branches/ubuntu/precise/mysql-5.1/precise

« back to all changes in this revision

Viewing changes to storage/ndb/include/kernel/signaldata/StopReq.hpp

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Tretkowski
  • Date: 2010-03-17 14:56:02 UTC
  • Revision ID: james.westby@ubuntu.com-20100317145602-x7e30l1b2sb5s6w6
Tags: upstream-5.1.45
ImportĀ upstreamĀ versionĀ 5.1.45

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (C) 2003 MySQL AB
 
2
 
 
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.
 
6
 
 
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.
 
11
 
 
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 */
 
15
 
 
16
#ifndef STOP_REQ_HPP
 
17
#define STOP_REQ_HPP
 
18
 
 
19
#include "SignalData.hpp"
 
20
 
 
21
class StopReq 
 
22
{
 
23
  /**
 
24
   * Reciver(s)
 
25
   */
 
26
  friend class Ndbcntr;
 
27
 
 
28
  /**
 
29
   * Sender
 
30
   */
 
31
  friend class MgmtSrvr;
 
32
 
 
33
public:
 
34
  STATIC_CONST( SignalLength = 9 + NdbNodeBitmask::Size);
 
35
  
 
36
public:
 
37
  Uint32 senderRef;
 
38
  Uint32 senderData;
 
39
  
 
40
  Uint32 requestInfo;
 
41
  Uint32 singleuser;          // Indicates whether or not to enter 
 
42
                              // single user mode.
 
43
                              // Only in conjunction with system stop
 
44
  Uint32 singleUserApi;       // allowed api in singleuser
 
45
 
 
46
  Int32 apiTimeout;           // Timeout before api transactions are refused
 
47
  Int32 transactionTimeout;   // Timeout before transactions are aborted
 
48
  Int32 readOperationTimeout; // Timeout before read operations are aborted
 
49
  Int32 operationTimeout;     // Timeout before all operations are aborted
 
50
 
 
51
  Uint32 nodes[NdbNodeBitmask::Size];
 
52
 
 
53
  static void setSystemStop(Uint32 & requestInfo, bool value);
 
54
  static void setPerformRestart(Uint32 & requestInfo, bool value);
 
55
  static void setNoStart(Uint32 & requestInfo, bool value);
 
56
  static void setInitialStart(Uint32 & requestInfo, bool value);
 
57
  /**
 
58
   * Don't perform "graceful" shutdown/restart...
 
59
   */
 
60
  static void setStopAbort(Uint32 & requestInfo, bool value);
 
61
  static void setStopNodes(Uint32 & requestInfo, bool value);
 
62
 
 
63
  static bool getSystemStop(const Uint32 & requestInfo);
 
64
  static bool getPerformRestart(const Uint32 & requestInfo);
 
65
  static bool getNoStart(const Uint32 & requestInfo);
 
66
  static bool getInitialStart(const Uint32 & requestInfo);
 
67
  static bool getStopAbort(const Uint32 & requestInfo);
 
68
  static bool getStopNodes(const Uint32 & requestInfo);
 
69
};
 
70
 
 
71
struct StopConf
 
72
{
 
73
  STATIC_CONST( SignalLength = 2 );
 
74
  Uint32 senderData;
 
75
  union {
 
76
    Uint32 nodeState;
 
77
    Uint32 nodeId;
 
78
  };
 
79
};
 
80
 
 
81
class StopRef 
 
82
{
 
83
  /**
 
84
   * Reciver(s)
 
85
   */
 
86
  friend class MgmtSrvr;
 
87
  
 
88
  /**
 
89
   * Sender
 
90
   */
 
91
  friend class Ndbcntr;
 
92
 
 
93
public:
 
94
  STATIC_CONST( SignalLength = 3 );
 
95
  
 
96
  enum ErrorCode {
 
97
    OK = 0,
 
98
    NodeShutdownInProgress = 1,
 
99
    SystemShutdownInProgress = 2,
 
100
    NodeShutdownWouldCauseSystemCrash = 3,
 
101
    TransactionAbortFailed = 4,
 
102
    UnsupportedNodeShutdown = 5,
 
103
    MultiNodeShutdownNotMaster = 6
 
104
  };
 
105
  
 
106
public:
 
107
  Uint32 senderData;
 
108
  Uint32 errorCode;
 
109
  Uint32 masterNodeId;
 
110
};
 
111
 
 
112
inline
 
113
bool
 
114
StopReq::getSystemStop(const Uint32 & requestInfo)
 
115
{
 
116
  return requestInfo & 1;
 
117
}
 
118
 
 
119
inline
 
120
bool
 
121
StopReq::getPerformRestart(const Uint32 & requestInfo)
 
122
{
 
123
  return requestInfo & 2;
 
124
}
 
125
 
 
126
inline
 
127
bool
 
128
StopReq::getNoStart(const Uint32 & requestInfo)
 
129
{
 
130
  return requestInfo & 4;
 
131
}
 
132
 
 
133
inline
 
134
bool
 
135
StopReq::getInitialStart(const Uint32 & requestInfo)
 
136
{
 
137
  return requestInfo & 8;
 
138
}
 
139
 
 
140
inline
 
141
bool
 
142
StopReq::getStopAbort(const Uint32 & requestInfo)
 
143
{
 
144
  return requestInfo & 32;
 
145
}
 
146
 
 
147
inline
 
148
bool
 
149
StopReq::getStopNodes(const Uint32 & requestInfo)
 
150
{
 
151
  return requestInfo & 64;
 
152
}
 
153
 
 
154
 
 
155
inline
 
156
void
 
157
StopReq::setSystemStop(Uint32 & requestInfo, bool value)
 
158
{
 
159
  if(value)
 
160
    requestInfo |= 1;
 
161
  else
 
162
    requestInfo &= ~1;
 
163
}
 
164
 
 
165
inline
 
166
void 
 
167
StopReq::setPerformRestart(Uint32 & requestInfo, bool value)
 
168
{
 
169
  if(value)
 
170
    requestInfo |= 2;
 
171
  else
 
172
    requestInfo &= ~2;
 
173
}
 
174
 
 
175
inline
 
176
void 
 
177
StopReq::setNoStart(Uint32 & requestInfo, bool value)
 
178
{
 
179
  if(value)
 
180
    requestInfo |= 4;
 
181
  else
 
182
    requestInfo &= ~4;
 
183
}
 
184
 
 
185
inline
 
186
void
 
187
StopReq::setInitialStart(Uint32 & requestInfo, bool value)
 
188
{
 
189
  if(value)
 
190
    requestInfo |= 8;
 
191
  else
 
192
    requestInfo &= ~8;
 
193
}
 
194
 
 
195
inline
 
196
void
 
197
StopReq::setStopAbort(Uint32 & requestInfo, bool value)
 
198
{
 
199
  if(value)
 
200
    requestInfo |= 32;
 
201
  else
 
202
    requestInfo &= ~32;
 
203
}
 
204
 
 
205
inline
 
206
void
 
207
StopReq::setStopNodes(Uint32 & requestInfo, bool value)
 
208
{
 
209
  if(value)
 
210
    requestInfo |= 64;
 
211
  else
 
212
    requestInfo &= ~64;
 
213
}
 
214
 
 
215
#endif
 
216