MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MasterLCP.cpp
1 /*
2  Copyright (C) 2003-2006 MySQL AB
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 as published by
7  the Free Software Foundation; version 2 of the License.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program; if not, write to the Free Software
16  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18 
19 
20 #include <signaldata/MasterLCP.hpp>
21 #include <RefConvert.hpp>
22 
23 static
24 void
25 print(char *buf, size_t buf_len, MasterLCPConf::State s){
26  switch(s){
27  case MasterLCPConf::LCP_STATUS_IDLE:
28  BaseString::snprintf(buf, buf_len, "LCP_STATUS_IDLE");
29  break;
30  case MasterLCPConf::LCP_STATUS_ACTIVE:
31  BaseString::snprintf(buf, buf_len, "LCP_STATUS_ACTIVE");
32  break;
33  case MasterLCPConf::LCP_TAB_COMPLETED:
34  BaseString::snprintf(buf, buf_len, "LCP_TAB_COMPLETED");
35  break;
36  case MasterLCPConf::LCP_TAB_SAVED:
37  BaseString::snprintf(buf, buf_len, "LCP_TAB_SAVED");
38  break;
39  }
40 }
41 
42 NdbOut &
43 operator<<(NdbOut& out, const MasterLCPConf::State& s){
44  static char buf[255];
45  print(buf, sizeof(buf), s);
46  out << buf;
47  return out;
48 }
49 
50 bool
51 printMASTER_LCP_CONF(FILE * output,
52  const Uint32 * theData,
53  Uint32 len,
54  Uint16 recBlockNo){
55 
56  MasterLCPConf * sig = (MasterLCPConf *)&theData[0];
57 
58  static char buf[255];
59  print(buf, sizeof(buf), (MasterLCPConf::State)sig->lcpState);
60  fprintf(output, " senderNode=%d failedNode=%d SenderState=%s\n",
61  sig->senderNodeId, sig->failedNodeId, buf);
62  return true;
63 }
64 
65 bool
66 printMASTER_LCP_REQ(FILE * output,
67  const Uint32 * theData,
68  Uint32 len,
69  Uint16 recBlockNo){
70 
71  MasterLCPReq * sig = (MasterLCPReq *)&theData[0];
72 
73  fprintf(output, " masterRef=(node=%d, block=%d), failedNode=%d\n",
74  refToNode(sig->masterRef), refToBlock(sig->masterRef),
75  sig->failedNodeId);
76  return true;
77 }
78 
79 bool
80 printMASTER_LCP_REF(FILE * output,
81  const Uint32 * theData,
82  Uint32 len,
83  Uint16 recBlockNo){
84 
85  MasterLCPRef * sig = (MasterLCPRef *)&theData[0];
86  fprintf(output, " senderNode=%d failedNode=%d\n",
87  sig->senderNodeId, sig->failedNodeId);
88  return true;
89 }