1 /* Copyright 2008 Sun Microsystems, Inc.
2     All rights reserved. Use is subject to license terms.
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 Street, Fifth Floor, Boston, MA 02110-1301, USA */
23 
24 #ifndef DICT_TAKEOVER_HPP
25 #define DICT_TAKEOVER_HPP
26 
27 #include "SignalData.hpp"
28 
29 // see comments in Dbdict.hpp
30 
31 class DictTakeoverReq {
32   friend class Dbdict;
33 public:
34   STATIC_CONST( SignalLength = 1 );
35   STATIC_CONST( GSN = GSN_DICT_TAKEOVER_REQ );
36 private:
37   Uint32 senderRef;
38 };
39 
40 class DictTakeoverConf {
41   friend class Dbdict;
42 public:
43   STATIC_CONST( SignalLength = 10 );
44   STATIC_CONST( GSN = GSN_DICT_TAKEOVER_CONF );
45 private:
46   Uint32 senderRef;
47   Uint32 clientRef;
48   Uint32 trans_key;
49   Uint32 trans_state;
50   Uint32 op_count;
51   union
52   {
53     Uint32 rollforward_op; // Preferred starting point for rollforward
54     Uint32 lowest_op;      // Next operation to be ended (removed)
55   };
56   union {
57     Uint32 rollforward_op_state;
58     Uint32 lowest_op_state;
59   };
60   union {
61     Uint32 rollback_op; // Preferred starting point for rollback
62     Uint32 highest_op;  // Last parsed operation
63   };
64   union {
65     Uint32 rollback_op_state;
66     Uint32 highest_op_state;
67   };
68   // Highest/lowest op is needed if new master is missing one operation
69   union {
70     Uint32 lowest_op_impl_req_gsn;
71     Uint32 highest_op_impl_req_gsn;
72   };
73 };
74 
75 struct DictTakeoverRef {
76   STATIC_CONST( SignalLength = 3 );
77   STATIC_CONST( GSN = GSN_DICT_TAKEOVER_REF );
78 
79   Uint32 senderRef;
80   union { Uint32 masterRef, senderData; };
81   Uint32 errorCode;
82   enum ErrorCode
83   {
84     NoError = 0,
85     NoTransaction = 1,
86     NF_FakeErrorREF = 2
87   };
88 };
89 
90 
91 #endif
92