1 /*
2    Copyright (c) 2003, 2013, 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 WAIT_GCP_HPP
26 #define WAIT_GCP_HPP
27 
28 #define JAM_FILE_ID 49
29 
30 
31 /**
32  * This signal is sent by anyone to local DIH
33  *
34  * If local DIH is not master, it forwards it to master DIH
35  *   and start acting as a proxy
36  *
37  */
38 class WaitGCPReq {
39 
40   /**
41    * Sender(s) / Reciver(s)
42    */
43   friend class Dbdih;
44 
45   /**
46    * Sender
47    */
48   friend class Ndbcntr;
49   friend class Dbdict;
50   friend class Backup;
51   friend class Trix;
52 
53 public:
54   STATIC_CONST( SignalLength = 3 );
55 public:
56   enum RequestType {
57     Complete = 1,           ///< Wait for a GCP to complete
58     CompleteForceStart = 2, ///< Wait for a GCP to complete start one if needed
59     CompleteIfRunning = 3,  ///< Wait for ongoing GCP
60     CurrentGCI        = 8,  ///< Immediately return current GCI
61     BlockStartGcp     = 9,
62     UnblockStartGcp   = 10,
63     WaitEpoch         = 11, // If GCP is blocked, wait for epoch to not start
64     RestartGCI        = 12  // Return restart GCI
65   };
66 
67   Uint32 senderRef;
68   Uint32 senderData;
69   Uint32 requestType;
70 };
71 
72 class WaitGCPConf {
73 
74   /**
75    * Sender(s) / Reciver(s)
76    */
77   friend class Dbdih;
78 
79   /**
80    * Reciver(s)
81    */
82   friend class Ndbcntr;
83   friend class Dbdict;
84   friend class Backup;
85   friend class Trix;
86 
87 public:
88   STATIC_CONST( SignalLength = 4 );
89 
90 public:
91   Uint32 senderData;
92   Uint32 gci_hi;
93   Uint32 blockStatus;
94   Uint32 gci_lo;
95 };
96 
97 class WaitGCPRef {
98 
99   /**
100    * Sender(s) / Reciver(s)
101    */
102   friend class Dbdih;
103 
104   /**
105    * Reciver(s)
106    */
107   friend class Ndbcntr;
108   friend class Dbdict;
109   friend class Backup;
110   friend class Trix;
111   friend class NdbDictInterface;
112 
113 public:
114   STATIC_CONST( SignalLength = 2 );
115 
116   enum ErrorCode {
117     StopOK = 0,
118     NF_CausedAbortOfProcedure = 1,
119     NoWaitGCPRecords = 2,
120     NF_MasterTakeOverInProgress = 3
121   };
122 
123 private:
124   Uint32 errorCode;
125   Uint32 senderData;
126 };
127 
128 
129 #undef JAM_FILE_ID
130 
131 #endif
132