MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ClusterConfiguration.hpp
1 /*
2  Copyright (C) 2003, 2005, 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 #ifndef ClusterConfiguration_H
20 #define ClusterConfiguration_H
21 
22 #include <kernel_types.h>
23 #include <ndb_limits.h>
24 #include <Properties.hpp>
25 #include <ErrorReporter.hpp>
26 #include <signaldata/CmvmiCfgConf.hpp>
27 #include <signaldata/SetLogLevelOrd.hpp>
28 #include <NodeInfo.hpp>
29 
30 // MaxNumber of sizealteration records in each block
31 // MaxNumber of blocks with sizealteration, (size of array)
32 #define MAX_SIZEALT_RECORD 16
33 #define MAX_SIZEALT_BLOCKS 8
34 
35 enum NdbBlockName { ACC = 0, DICT, DIH, LQH, TC, TUP, TUX, NDB_SIZEALT_OFF };
36 // NDB_SIZEALT_OFF is used for block without sizealteration
37 // IMPORTANT to assign NDB_SIZEALT_OFF as largest value
38 
39 struct VarSize {
40  int nrr;
41  bool valid;
42 };
43 
44 struct SizeAlt {
45  unsigned int noOfTables;
46  unsigned int noOfIndexes;
47  unsigned int noOfReplicas;
48  unsigned int noOfNDBNodes;
49  unsigned int noOfAPINodes;
50  unsigned int noOfMGMNodes;
51  unsigned int noOfNodes;
52  unsigned int noOfDiskLessNodes;
53  unsigned int noOfAttributes;
54  unsigned int noOfOperations;
55  unsigned int noOfTransactions;
56  unsigned int noOfIndexPages;
57  unsigned int noOfDataPages;
58  unsigned int noOfDiskBufferPages;
59  unsigned int noOfFreeClusters;
60  unsigned int noOfDiskClusters;
61  unsigned int noOfScanRecords;
62  bool exist;
63  VarSize varSize[MAX_SIZEALT_BLOCKS][MAX_SIZEALT_RECORD];
64  unsigned short blockNo[MAX_SIZEALT_BLOCKS];
65  LogLevel logLevel;
66 };
67 
68 
70 {
71 public:
72 
73  struct NodeData {
74  NodeData() {
75  nodeId = MAX_NODES+1;
76  nodeType = NodeInfo::INVALID;
77  arbitRank = ~0;
78  }
79  NodeId nodeId;
80  NodeInfo::NodeType nodeType;
81  unsigned arbitRank;
82  };
83 
84  struct ClusterData
85  {
86  SizeAlt SizeAltData;
87  NodeData nodeData[MAX_NODES];
88  Uint32 ispValues[5][CmvmiCfgConf::NO_OF_WORDS];
89  };
90 
93  const ClusterData& clusterData() const;
94 
95  void init(const Properties & p, const Properties & db);
96 protected:
97 
98 private:
99 
100  ClusterData the_clusterData;
101 
102  void calcSizeAlteration();
103 
104 };
105 
106 #endif // ClusterConfiguration_H
107