1 /* Copyright (c) 2008, 2021, Oracle and/or its affiliates.
2 
3    This program is free software; you can redistribute it and/or modify
4    it under the terms of the GNU General Public License, version 2.0,
5    as published by the Free Software Foundation.
6 
7    This program is also distributed with certain software (including
8    but not limited to OpenSSL) that is licensed under separate terms,
9    as designated in a particular file or component or in included license
10    documentation.  The authors of MySQL hereby grant you an additional
11    permission to link the program and your derivative works with the
12    separately licensed software that they have included with MySQL.
13 
14    This program is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17    GNU General Public License, version 2.0, for more details.
18 
19    You should have received a copy of the GNU General Public License
20    along with this program; if not, write to the Free Software
21    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
22 
23 #ifndef DICT_TAKEOVER_HPP
24 #define DICT_TAKEOVER_HPP
25 
26 #include "SignalData.hpp"
27 
28 #define JAM_FILE_ID 68
29 
30 
31 // see comments in Dbdict.hpp
32 
33 class DictTakeoverReq {
34   friend class Dbdict;
35 public:
36   STATIC_CONST( SignalLength = 1 );
37   STATIC_CONST( GSN = GSN_DICT_TAKEOVER_REQ );
38 private:
39   Uint32 senderRef;
40 };
41 
42 class DictTakeoverConf {
43   friend class Dbdict;
44 public:
45   STATIC_CONST( SignalLength = 10 );
46   STATIC_CONST( GSN = GSN_DICT_TAKEOVER_CONF );
47 private:
48   Uint32 senderRef;
49   Uint32 clientRef;
50   Uint32 trans_key;
51   Uint32 trans_state;
52   Uint32 op_count;
53   union
54   {
55     Uint32 rollforward_op; // Preferred starting point for rollforward
56     Uint32 lowest_op;      // Next operation to be ended (removed)
57   };
58   union {
59     Uint32 rollforward_op_state;
60     Uint32 lowest_op_state;
61   };
62   union {
63     Uint32 rollback_op; // Preferred starting point for rollback
64     Uint32 highest_op;  // Last parsed operation
65   };
66   union {
67     Uint32 rollback_op_state;
68     Uint32 highest_op_state;
69   };
70   // Highest/lowest op is needed if new master is missing one operation
71   union {
72     Uint32 lowest_op_impl_req_gsn;
73     Uint32 highest_op_impl_req_gsn;
74   };
75 };
76 
77 struct DictTakeoverRef {
78   STATIC_CONST( SignalLength = 3 );
79   STATIC_CONST( GSN = GSN_DICT_TAKEOVER_REF );
80 
81   Uint32 senderRef;
82   union { Uint32 masterRef, senderData; };
83   Uint32 errorCode;
84   enum ErrorCode
85   {
86     NoError = 0,
87     NoTransaction = 1,
88     NF_FakeErrorREF = 2
89   };
90 };
91 
92 
93 
94 #undef JAM_FILE_ID
95 
96 #endif
97