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 READ_NODESCONF_HPP
26 #define READ_NODESCONF_HPP
27 
28 #include <NodeBitmask.hpp>
29 
30 #define JAM_FILE_ID 199
31 
32 
33 class ReadNodesReq
34 {
35   friend class Qmgr;
36   friend class Ndbcntr;
37 public:
38   STATIC_CONST( OldSignalLength = 1);
39   STATIC_CONST( SignalLength = 2);
40 private:
41   Uint32 myRef;
42   Uint32 myVersion;
43 };
44 
45 /**
46  * This signals is sent by Qmgr to NdbCntr
47  *   and then from NdbCntr sent to: dih, dict, lqh, tc
48  *
49  * NOTE Only noOfNodes & allNodes are valid when sent from Qmgr
50  */
51 class ReadNodesConf {
52   /**
53    * Sender(s)
54    */
55   friend class Qmgr;
56 
57   /**
58    * Sender(s) / Reciver(s)
59    */
60   friend class Ndbcntr;
61 
62   /**
63    * Reciver(s)
64    */
65   friend class Dbdih;
66   friend class Dbdict;
67   friend class Dblqh;
68   friend class Dbtc;
69   friend class Trix;
70   friend class Backup;
71   friend class Suma;
72   friend class LocalProxy;
73   friend class Dbinfo;
74   friend class Dbspj;
75 
76   friend bool printREAD_NODES_CONF(FILE*, const Uint32 *, Uint32, Uint16);
77 public:
78   STATIC_CONST( SignalLength = 3);
79 private:
80 
81   Uint32 noOfNodes;
82   Uint32 ndynamicId;
83 
84   /**
85    *
86    * NOTE Not valid when send from Qmgr
87    */
88   Uint32 masterNodeId;
89 
90   // Below bitmasks are not part of signal.
91   // All five are sent in first section.
92 
93   /**
94    * This array defines all the ndb nodes in the system
95    */
96   NdbNodeBitmask definedNodes;
97 
98   /**
99    * This array describes wheather the nodes are currently active
100    *
101    * NOTE Not valid when send from Qmgr
102    */
103   NdbNodeBitmask inactiveNodes;
104 
105   NdbNodeBitmask clusterNodes;  // From Qmgr
106   NdbNodeBitmask startingNodes; // From Cntr
107   NdbNodeBitmask startedNodes;  // From Cntr
108 };
109 
110 class ReadNodesConf_v1 {
111   /**
112    * Sender(s)
113    */
114   friend class Qmgr;
115 
116   /**
117    * Sender(s) / Reciver(s)
118    */
119   friend class Ndbcntr;
120 
121   /**
122    * Reciver(s)
123    */
124   friend class Dbdih;
125   friend class Dbdict;
126   friend class Dblqh;
127   friend class Dbtc;
128   friend class Trix;
129   friend class Backup;
130   friend class Suma;
131   friend class LocalProxy;
132   friend class Dbinfo;
133   friend class Dbspj;
134 
135   friend bool printREAD_NODES_CONF(FILE*, const Uint32 *, Uint32, Uint16);
136 public:
137   STATIC_CONST( SignalLength = 3 + 5 * NdbNodeBitmask48::Size);
138 private:
139 
140   Uint32 noOfNodes;
141   Uint32 ndynamicId;
142 
143   /**
144    *
145    * NOTE Not valid when send from Qmgr
146    */
147   Uint32 masterNodeId;
148 
149   /**
150    * This array defines all the ndb nodes in the system
151    */
152   union {
153     Uint32 allNodes[NdbNodeBitmask48::Size];
154     Uint32 definedNodes[NdbNodeBitmask48::Size];
155   };
156 
157   /**
158    * This array describes wheather the nodes are currently active
159    *
160    * NOTE Not valid when send from Qmgr
161    */
162   Uint32 inactiveNodes[NdbNodeBitmask48::Size];
163 
164   Uint32 clusterNodes[NdbNodeBitmask48::Size];  // From Qmgr
165   Uint32 startingNodes[NdbNodeBitmask48::Size]; // From Cntr
166   Uint32 startedNodes[NdbNodeBitmask48::Size];  // From Cntr
167 };
168 
169 
170 #undef JAM_FILE_ID
171 
172 #endif
173