MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FailRep.hpp
1 /*
2  Copyright (c) 2003, 2010, 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 as published by
6  the Free Software Foundation; version 2 of the License.
7 
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with this program; if not, write to the Free Software
15  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
16 */
17 
18 #ifndef FAIL_REP_HPP
19 #define FAIL_REP_HPP
20 
21 #include "SignalData.hpp"
22 #include <NodeBitmask.hpp>
23 
27 class FailRep {
31  friend class Qmgr;
32  friend class Ndbcntr;
33 
37  friend bool printFAIL_REP(FILE *, const Uint32 *, Uint32, Uint16);
38 
39 public:
40  STATIC_CONST( OrigSignalLength = 2 );
41  STATIC_CONST( PartitionedExtraLength = 1 + NdbNodeBitmask::Size );
42  STATIC_CONST( SourceExtraLength = 1 );
43  STATIC_CONST( SignalLength = OrigSignalLength + SourceExtraLength );
44 
45  enum FailCause {
46  ZOWN_FAILURE=0,
47  ZOTHER_NODE_WHEN_WE_START=1,
48  ZIN_PREP_FAIL_REQ=2,
49  ZSTART_IN_REGREQ=3,
50  ZHEARTBEAT_FAILURE=4,
51  ZLINK_FAILURE=5,
52  ZOTHERNODE_FAILED_DURING_START=6,
53  ZMULTI_NODE_SHUTDOWN = 7,
54  ZPARTITIONED_CLUSTER = 8,
55  ZCONNECT_CHECK_FAILURE = 9
56  };
57 
58  Uint32 getFailSourceNodeId(Uint32 sigLen) const
59  {
60  /* Get failSourceNodeId from signal given length
61  * 2 cases of 2 existing cases :
62  * 1) Old node, no source id
63  * 2) New node, source id
64  * a) ZPARTITIONED_CLUSTER, extra info
65  * b) Other error, no extra info
66  */
67  if (failCause == ZPARTITIONED_CLUSTER)
68  {
69  return (sigLen == (SignalLength + PartitionedExtraLength)) ?
70  partitioned.partitionFailSourceNodeId :
71  0;
72  }
73 
74  return (sigLen == SignalLength) ? failSourceNodeId :
75  0;
76  }
77 
78 private:
79 
80  Uint32 failNodeId;
81  Uint32 failCause;
85  union {
86  struct
87  {
88  Uint32 president;
89  Uint32 partition[NdbNodeBitmask::Size];
90  Uint32 partitionFailSourceNodeId;
91  } partitioned;
92  Uint32 failSourceNodeId;
93  };
94 };
95 
96 
97 #endif