1 /* 2 Copyright (c) 2003, 2019, 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, version 2.0, 6 as published by the Free Software Foundation. 7 8 This program is also distributed with certain software (including 9 but not limited to OpenSSL) that is licensed under separate terms, 10 as designated in a particular file or component or in included license 11 documentation. The authors of MySQL hereby grant you an additional 12 permission to link the program and your derivative works with the 13 separately licensed software that they have included with MySQL. 14 15 This program is distributed in the hope that it will be useful, 16 but WITHOUT ANY WARRANTY; without even the implied warranty of 17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 GNU General Public License, version 2.0, for more details. 19 20 You should have received a copy of the GNU General Public License 21 along with this program; if not, write to the Free Software 22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 23 */ 24 25 #ifndef CM_REG_HPP 26 #define CM_REG_HPP 27 28 #include <NodeBitmask.hpp> 29 30 #define JAM_FILE_ID 65 31 32 33 /** 34 * This is the first distributed signal 35 * (the node tries to register in the cluster) 36 */ 37 class CmRegReq { 38 /** 39 * Sender(s) & Reciver(s) 40 */ 41 friend class Qmgr; 42 43 public: 44 /** 45 * The additional two words in signal length are for backward compatibility. 46 * Older versions(< 7.6.9) also send the node bitmask(of size 2 words) while 47 * sending GSN_CM_REGREQ. Now, we can do away with sending the node bitmask 48 * since it's not used at the receiving end (execCM_REGREQ). 49 * The additional two words are cleared before sending GSN_CM_REGREQ. 50 */ 51 STATIC_CONST( SignalLength = 6 + NdbNodeBitmask48::Size ); 52 private: 53 54 Uint32 blockRef; 55 Uint32 nodeId; 56 Uint32 version; // See ndb_version.h 57 Uint32 mysql_version; 58 59 Uint32 start_type; // As specified by cmd-line or mgm, NodeState::StartType 60 Uint32 latest_gci; // 0 means no fs 61 Uint32 unused_words[NdbNodeBitmask48::Size]; 62 }; 63 64 /** 65 * The node receving this signal has been accepted into the cluster 66 */ 67 class CmRegConf { 68 /** 69 * Sender(s) & Reciver(s) 70 */ 71 friend class Qmgr; 72 73 public: 74 /** 75 * For NDB version < 7.6.9 where the node bitmask is sent 76 * in a simple signal, NdbNodeBitmask::Size is 2. 77 */ 78 STATIC_CONST( SignalLength_v1 = 5 + NdbNodeBitmask48::Size ); 79 /** 80 * For NDB version >= 7.6.9 where the node bitmask is sent 81 * in a long signal. 82 */ 83 STATIC_CONST( SignalLength = 5); 84 private: 85 86 Uint32 presidentBlockRef; 87 Uint32 presidentNodeId; 88 Uint32 presidentVersion; 89 Uint32 presidentMysqlVersion; 90 91 /** 92 * The dynamic id that the node reciving this signal has 93 */ 94 Uint32 dynamicId; 95 Uint32 allNdbNodes_v1[NdbNodeBitmask48::Size]; 96 }; 97 98 /** 99 * 100 */ 101 class CmRegRef { 102 /** 103 * Sender(s) & Reciver(s) 104 */ 105 friend class Qmgr; 106 107 public: 108 /** 109 * For NDB version < 7.6.9 where the node bitmask is sent 110 * in a simple signal, NdbNodeBitmask::Size is 2. 111 */ 112 STATIC_CONST( SignalLength_v1 = 7 + NdbNodeBitmask48::Size ); 113 /** 114 * For NDB version >= 7.6.9 where the node bitmask is sent 115 * in a long signal. 116 */ 117 STATIC_CONST( SignalLength = 7); 118 119 enum ErrorCode { 120 ZBUSY = 0, /* Only the president can send this */ 121 ZBUSY_PRESIDENT = 1,/* Only the president can send this */ 122 ZBUSY_TO_PRES = 2, /* Only the president can send this */ 123 ZNOT_IN_CFG = 3, /* Only the president can send this */ 124 ZELECTION = 4, /* Receiver is definitely not president, 125 * but we are not sure if sender ends up 126 * as president. */ 127 ZNOT_PRESIDENT = 5, /* We are not president */ 128 ZNOT_DEAD = 6, /* We are not dead when we are starting */ 129 ZINCOMPATIBLE_VERSION = 7, 130 ZINCOMPATIBLE_START_TYPE = 8, 131 ZSINGLE_USER_MODE = 9, /* The cluster is in single user mode, 132 * data node is not allowed to get added 133 * in the cluster while in single user mode */ 134 ZGENERIC = 100 /* The generic error code */ 135 }; 136 private: 137 138 Uint32 blockRef; 139 Uint32 nodeId; 140 Uint32 errorCode; 141 /** 142 * Applicable if ZELECTION 143 */ 144 Uint32 presidentCandidate; 145 Uint32 candidate_latest_gci; // 0 means non 146 147 /** 148 * Data for sending node sending node 149 */ 150 Uint32 latest_gci; 151 Uint32 start_type; 152 Uint32 skip_nodes_v1[NdbNodeBitmask48::Size]; // Nodes that do not _need_ 153 // to be part of restart 154 }; 155 156 class CmAdd { 157 /** 158 * Sender(s) & Reciver(s) 159 */ 160 friend class Qmgr; 161 162 public: 163 STATIC_CONST( SignalLength = 4 ); 164 165 private: 166 enum RequestType { 167 Prepare = 0, 168 AddCommit = 1, 169 CommitNew = 2 170 }; 171 172 Uint32 requestType; 173 Uint32 startingNodeId; 174 Uint32 startingVersion; 175 Uint32 startingMysqlVersion; 176 }; 177 178 class CmAckAdd { 179 /** 180 * Sender(s) & Reciver(s) 181 */ 182 friend class Qmgr; 183 184 public: 185 STATIC_CONST( SignalLength = 3 ); 186 187 private: 188 Uint32 senderNodeId; 189 Uint32 requestType; // see CmAdd::RequestType 190 Uint32 startingNodeId; 191 }; 192 193 class CmNodeInfoReq { 194 /** 195 * Sender(s) & Reciver(s) 196 */ 197 friend class Qmgr; 198 199 public: 200 STATIC_CONST( SignalLength = 5 ); 201 202 private: 203 /** 204 * This is information for sending node (starting node) 205 */ 206 Uint32 nodeId; 207 Uint32 dynamicId; 208 Uint32 version; 209 Uint32 mysql_version; 210 Uint32 lqh_workers; // added in telco-6.4 211 }; 212 213 class CmNodeInfoRef { 214 /** 215 * Sender(s) & Reciver(s) 216 */ 217 friend class Qmgr; 218 219 public: 220 STATIC_CONST( SignalLength = 3 ); 221 222 enum ErrorCode { 223 NotRunning = 1 224 }; 225 226 private: 227 Uint32 nodeId; 228 Uint32 errorCode; 229 }; 230 231 class CmNodeInfoConf { 232 /** 233 * Sender(s) & Reciver(s) 234 */ 235 friend class Qmgr; 236 237 public: 238 STATIC_CONST( SignalLength = 5 ); 239 240 private: 241 Uint32 nodeId; 242 Uint32 dynamicId; 243 Uint32 version; 244 Uint32 mysql_version; 245 Uint32 lqh_workers; // added in telco-6.4 246 }; 247 248 249 #undef JAM_FILE_ID 250 251 #endif 252