MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ConfigChange.hpp
1 /* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
15 
16 #ifndef CONFIG_CHANGE_H
17 #define CONFIG_CHANGE_H
18 
19 #include "SignalData.hpp"
20 
22 {
26  friend class MgmtSrvr;
27 
31  friend class ConfigManager;
32 
33  STATIC_CONST( SignalLength = 1 );
34 
35  Uint32 length; // Length of the config data in long signal
36 };
37 
38 
40 {
44  friend class ConfigManager;
45 
49  friend class MgmtSrvr;
50 
51  STATIC_CONST( SignalLength = 1 );
52 
53  Uint32 unused;
54 };
55 
56 
58 {
62  friend class ConfigManager;
63 
67  friend class MgmtSrvr;
68 
69 
70  enum ErrorCode {
71  OK = 0,
72  ConfigChangeOnGoing = 1,
73  NotMaster = 2,
74  NoConfigData = 3,
75  ConfigNotOk = 4,
76  InternalError = 5,
77  PrepareFailed = 6,
78  IllegalConfigChange = 7,
79  FailedToUnpack = 8,
80  InvalidGeneration = 9,
81  InvalidConfigName = 10,
82  IllegalInitialState = 11,
83  IllegalInitialGeneration = 12,
84  DifferentInitial = 13,
85  NotAllStarted = 14,
86  NotPrimaryMgmNode = 15,
87  SendFailed = 16
88  };
89 
90  STATIC_CONST( SignalLength = 1 );
91 
92  static const char* errorMessage(Uint32 error) {
93  switch (error){
94  case ConfigChangeOnGoing:
95  return "Config change ongoing";
96  case NotMaster:
97  return "Not the config change master";
98  case NoConfigData:
99  return "No config data in signal";
100  case ConfigNotOk:
101  return "Config is not ok";
102  case InternalError:
103  return "ConfigChangeRef, internal error";
104  case PrepareFailed:
105  return "Prepare of config change failed";
106  case IllegalConfigChange:
107  return "Illegal configuration change";
108  case FailedToUnpack:
109  return "Failed to unpack the configuration";
110  case InvalidGeneration:
111  return "Invalid generation in configuration";
112  case InvalidConfigName:
113  return "Invalid configuration name in configuration";
114  case IllegalInitialState:
115  return "Initial config change not allowed in this state";
116  case IllegalInitialGeneration:
117  return "Initial config change with generation not 0";
118  case DifferentInitial:
119  return "Different initial config files";
120  case NotAllStarted:
121  return " Not all mgm nodes are started";
122  case NotPrimaryMgmNode:
123  return "Not primary mgm node for configuration";
124  case SendFailed:
125  return "Failed to send signal to other node";
126 
127  default:
128  return "ConfigChangeRef, unknown error";
129  }
130  }
131 
132  Uint32 errorCode;
133 };
134 
135 
137 {
141  friend class ConfigManager;
142 
143  enum RequestType {
144  Prepare,
145  Commit,
146  Abort
147  };
148 
149  STATIC_CONST( SignalLength = 3 );
150 
151  Uint32 requestType;
152  Uint32 initial; // Valid when requestType = Prepare
153  Uint32 length; // Length of the config data in long signal
154 
155 };
156 
157 
159 {
163  friend class ConfigManager;
164 
165  STATIC_CONST( SignalLength = 1 );
166 
167  Uint32 requestType;
168 };
169 
170 
172 {
176  friend class ConfigManager;
177 
178  STATIC_CONST( SignalLength = 1 );
179 
180  Uint32 errorCode;
181 };
182 
183 
185 {
189  friend class MgmtSrvr;
190 
194  friend class ConfigManager;
195 
196  STATIC_CONST( SignalLengthBeforeChecksum = 2 );
197  STATIC_CONST( SignalLength = 3 );
198 
199  Uint32 state;
200  Uint32 generation;
201  Uint32 checksum;
202 };
203 
204 
206 {
210  friend class ConfigManager;
211 
215  friend class MgmtSrvr;
216 
217  STATIC_CONST( SignalLength = 2 );
218 
219  Uint32 state;
220  Uint32 generation;
221 };
222 
223 
225 {
229  friend class ConfigManager;
230 
234  friend class MgmtSrvr;
235 
236  enum ErrorCode {
237  WrongState = 1,
238  WrongGeneration = 2,
239  WrongChecksum = 3
240  };
241 
242  static const char* errorMessage(Uint32 error) {
243  switch (error){
244  case WrongState:
245  return "Wrong state";
246  case WrongGeneration:
247  return "Wrong generation";
248  case WrongChecksum:
249  return "Wrong checksum";
250 
251  default:
252  return "ConfigCheckRef, unknown error";
253  }
254  }
255 
256  STATIC_CONST( SignalLength = 5 );
257  STATIC_CONST( SignalLengthWithConfig = 6 );
258 
259  Uint32 error;
260  Uint32 generation;
261  Uint32 expected_generation;
262  Uint32 state;
263  Uint32 expected_state;
264  Uint32 length; // Length of the config data in long signal
265 };
266 
267 #endif