1 /*
2    Copyright (c) 2004, 2021, Oracle and/or its affiliates.
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 CNTR_START_HPP
26 #define CNTR_START_HPP
27 
28 #include <NodeBitmask.hpp>
29 
30 #define JAM_FILE_ID 191
31 
32 
33 /**
34  *
35  */
36 class CntrStartReq {
37   /**
38    * Sender(s) / Reciver(s)
39    */
40   friend class Ndbcntr;
41 
42   friend bool printCNTR_START_REQ(FILE*, const Uint32 *, Uint32, Uint16);
43 
44 public:
45   STATIC_CONST( SignalLength = 3 );
46 private:
47 
48   Uint32 nodeId;
49   Uint32 startType;
50   Uint32 lastGci;
51 };
52 
53 class CntrStartRef {
54   /**
55    * Sender(s) / Reciver(s)
56    */
57   friend class Ndbcntr;
58 
59   friend bool printCNTR_START_REF(FILE*, const Uint32 *, Uint32, Uint16);
60 public:
61   STATIC_CONST( SignalLength = 2 );
62 
63   enum ErrorCode {
64     OK = 0,
65     NotMaster = 1,
66     StopInProgress = 2
67   };
68 private:
69 
70   Uint32 errorCode;
71   Uint32 masterNodeId;
72 };
73 
74 class CntrStartConf {
75   /**
76    * Sender(s) / Reciver(s)
77    */
78   friend class Ndbcntr;
79   friend struct UpgradeStartup;
80 
81   friend bool printCNTR_START_CONF(FILE*, const Uint32 *, Uint32, Uint16);
82 
83 public:
84   STATIC_CONST( SignalLength = 4 + 2 * NdbNodeBitmask::Size );
85 
86 private:
87 
88   Uint32 startType;
89   Uint32 startGci;
90   Uint32 masterNodeId;
91   Uint32 noStartNodes;
92   Uint32 startedNodes[NdbNodeBitmask::Size];
93   Uint32 startingNodes[NdbNodeBitmask::Size];
94 };
95 
96 struct CntrWaitRep
97 {
98   Uint32 nodeId;
99   Uint32 waitPoint;
100   Uint32 request;
101   Uint32 sp;
102 
103   enum Request
104   {
105     WaitFor = 1,
106     Grant = 2
107   };
108 
109   STATIC_CONST( SignalLength = 4 );
110 
111   enum WaitPos
112   {
113     ZWAITPOINT_4_1  = 1
114     ,ZWAITPOINT_4_2 = 2
115     ,ZWAITPOINT_5_1 = 3
116     ,ZWAITPOINT_5_2 = 4
117     ,ZWAITPOINT_6_1 = 5
118     ,ZWAITPOINT_6_2 = 6
119     ,ZWAITPOINT_7_1 = 7
120     ,ZWAITPOINT_7_2 = 8
121     ,ZWAITPOINT_4_2_TO = 9 // We are forced to TO (during SR)
122   };
123 };
124 
125 
126 #undef JAM_FILE_ID
127 
128 #endif
129