1 /*
2    Copyright (C) 2003, 2005, 2006, 2008 MySQL AB, 2008, 2009 Sun Microsystems, Inc.
3     All rights reserved. Use is subject to license terms.
4 
5    This program is free software; you can redistribute it and/or modify
6    it under the terms of the GNU General Public License, version 2.0,
7    as published by the Free Software Foundation.
8 
9    This program is also distributed with certain software (including
10    but not limited to OpenSSL) that is licensed under separate terms,
11    as designated in a particular file or component or in included license
12    documentation.  The authors of MySQL hereby grant you an additional
13    permission to link the program and your derivative works with the
14    separately licensed software that they have included with MySQL.
15 
16    This program is distributed in the hope that it will be useful,
17    but WITHOUT ANY WARRANTY; without even the implied warranty of
18    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19    GNU General Public License, version 2.0, for more details.
20 
21    You should have received a copy of the GNU General Public License
22    along with this program; if not, write to the Free Software
23    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
24 */
25 
26 #ifndef LCP_SIGNAL_DATA_HPP
27 #define LCP_SIGNAL_DATA_HPP
28 
29 #include "SignalData.hpp"
30 #include <NodeBitmask.hpp>
31 
32 struct StartLcpReq {
33   /**
34    * Sender(s)
35    */
36   friend class Dbdih;
37 
38   /**
39    * Sender(s) / Receiver(s)
40    */
41 
42   /**
43    * Receiver(s)
44    */
45   friend class Dblqh;
46 
47   friend bool printSTART_LCP_REQ(FILE *, const Uint32 *, Uint32, Uint16);
48 public:
49 
50   STATIC_CONST( SignalLength = 2 + 2 * NdbNodeBitmask::Size );
51   Uint32 senderRef;
52   Uint32 lcpId;
53 
54   NdbNodeBitmask participatingDIH;
55   NdbNodeBitmask participatingLQH;
56 };
57 
58 class StartLcpConf {
59   /**
60    * Sender(s)
61    */
62   friend class Dblqh;
63 
64   /**
65    * Sender(s) / Receiver(s)
66    */
67 
68   /**
69    * Receiver(s)
70    */
71   friend class Dbdih;
72 
73   friend bool printSTART_LCP_CONF(FILE *, const Uint32 *, Uint32, Uint16);
74 public:
75 
76   STATIC_CONST( SignalLength = 2 );
77 private:
78   Uint32 senderRef;
79   Uint32 lcpId;
80 };
81 
82 /**
83  * This signals is sent by Dbdih to Dblqh
84  * to order checkpointing of a certain
85  * fragment.
86  */
87 class LcpFragOrd {
88   /**
89    * Sender(s)
90    */
91   friend class Dbdih;
92   friend class Lgman;
93   friend class Pgman;
94   friend class Dbtup;
95 
96   /**
97    * Sender(s) / Receiver(s)
98    */
99 
100   /**
101    * Receiver(s)
102    */
103   friend class Dblqh;
104   friend class DblqhProxy;
105   friend class PgmanProxy;
106 
107   friend bool printLCP_FRAG_ORD(FILE *, const Uint32 *, Uint32, Uint16);
108 public:
109   STATIC_CONST( SignalLength = 6 );
110 private:
111 
112   Uint32 tableId;
113   Uint32 fragmentId;
114   Uint32 lcpNo;
115   Uint32 lcpId;
116   Uint32 lastFragmentFlag;
117   Uint32 keepGci;
118 };
119 
120 
121 struct LcpFragRep {
122   /**
123    * Sender(s) and receiver(s)
124    */
125   friend class Dbdih;
126 
127   /**
128    * Sender(s)
129    */
130   friend class Dblqh;
131   friend class DblqhProxy;
132 
133   friend bool printLCP_FRAG_REP(FILE *, const Uint32 *, Uint32, Uint16);
134 
135   STATIC_CONST( SignalLength = 7 );
136   STATIC_CONST( BROADCAST_REQ = 0 );
137 
138   Uint32 nodeId;
139   Uint32 lcpId;
140   Uint32 lcpNo;
141   Uint32 tableId;
142   Uint32 fragId;
143   Uint32 maxGciCompleted;
144   Uint32 maxGciStarted;
145 };
146 
147 class LcpCompleteRep {
148   /**
149    * Sender(s) and receiver(s)
150    */
151   friend class Dbdih;
152 
153   /**
154    * Sender(s)
155    */
156   friend class Dblqh;
157   friend class DblqhProxy;
158 
159   friend bool printLCP_COMPLETE_REP(FILE *, const Uint32 *, Uint32, Uint16);
160 public:
161   STATIC_CONST( SignalLength = 3 );
162 
163 private:
164   Uint32 nodeId;
165   Uint32 blockNo;
166   Uint32 lcpId;
167 };
168 
169 struct LcpPrepareReq
170 {
171   Uint32 senderData;
172   Uint32 senderRef;
173   Uint32 lcpNo;
174   Uint32 tableId;
175   Uint32 fragmentId;
176   Uint32 lcpId;
177   Uint32 backupPtr;
178   Uint32 backupId;
179 
180   STATIC_CONST( SignalLength = 8 );
181 };
182 
183 struct LcpPrepareRef
184 {
185   Uint32 senderData;
186   Uint32 senderRef;
187   Uint32 tableId;
188   Uint32 fragmentId;
189   Uint32 errorCode;
190 
191   STATIC_CONST( SignalLength = 5 );
192 };
193 
194 struct LcpPrepareConf
195 {
196   Uint32 senderData;
197   Uint32 senderRef;
198   Uint32 tableId;
199   Uint32 fragmentId;
200 
201   STATIC_CONST( SignalLength = 4 );
202 };
203 
204 struct EndLcpReq
205 {
206   Uint32 senderData;
207   Uint32 senderRef;
208   Uint32 backupPtr;
209   Uint32 backupId;
210   // extra word for LQH worker to proxy
211   Uint32 proxyBlockNo;
212 
213   STATIC_CONST( SignalLength = 4 );
214 };
215 
216 struct EndLcpRef
217 {
218   Uint32 senderData;
219   Uint32 senderRef;
220   Uint32 errorCode;
221 
222   STATIC_CONST( SignalLength = 3 );
223 };
224 
225 struct EndLcpConf
226 {
227   Uint32 senderData;
228   Uint32 senderRef;
229 
230   STATIC_CONST( SignalLength = 2 );
231 };
232 
233 #endif
234