~ubuntu-branches/ubuntu/precise/mysql-5.5/precise-201203300109

« back to all changes in this revision

Viewing changes to storage/ndb/src/kernel/vm/ClusterConfiguration.hpp

  • Committer: Package Import Robot
  • Author(s): Clint Byrum
  • Date: 2011-11-08 11:31:13 UTC
  • Revision ID: package-import@ubuntu.com-20111108113113-3ulw01fvi4vn8m25
Tags: upstream-5.5.17
ImportĀ upstreamĀ versionĀ 5.5.17

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (C) 2003 MySQL AB
 
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 as published by
 
5
   the Free Software Foundation; version 2 of the License.
 
6
 
 
7
   This program is distributed in the hope that it will be useful,
 
8
   but WITHOUT ANY WARRANTY; without even the implied warranty of
 
9
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
10
   GNU General Public License for more details.
 
11
 
 
12
   You should have received a copy of the GNU General Public License
 
13
   along with this program; if not, write to the Free Software
 
14
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
15
 
 
16
#ifndef ClusterConfiguration_H
 
17
#define ClusterConfiguration_H
 
18
 
 
19
#include <kernel_types.h>
 
20
#include <ndb_limits.h>
 
21
#include <Properties.hpp>
 
22
#include <ErrorReporter.hpp>
 
23
#include <signaldata/CmvmiCfgConf.hpp>
 
24
#include <signaldata/SetLogLevelOrd.hpp>
 
25
#include <NodeInfo.hpp>
 
26
 
 
27
// MaxNumber of sizealteration records in each block
 
28
// MaxNumber of blocks with sizealteration, (size of array)
 
29
#define MAX_SIZEALT_RECORD 16    
 
30
#define MAX_SIZEALT_BLOCKS 8     
 
31
 
 
32
enum NdbBlockName { ACC = 0, DICT, DIH, LQH, TC, TUP, TUX, NDB_SIZEALT_OFF };
 
33
//  NDB_SIZEALT_OFF is used for block without sizealteration
 
34
//  IMPORTANT to assign NDB_SIZEALT_OFF as largest value
 
35
 
 
36
struct VarSize {
 
37
  int   nrr;
 
38
  bool   valid;
 
39
};
 
40
 
 
41
struct SizeAlt { 
 
42
  unsigned int   noOfTables;
 
43
  unsigned int   noOfIndexes;
 
44
  unsigned int   noOfReplicas;
 
45
  unsigned int   noOfNDBNodes;
 
46
  unsigned int   noOfAPINodes;
 
47
  unsigned int   noOfMGMNodes;
 
48
  unsigned int   noOfNodes;
 
49
  unsigned int   noOfDiskLessNodes;
 
50
  unsigned int   noOfAttributes;
 
51
  unsigned int   noOfOperations;
 
52
  unsigned int   noOfTransactions;
 
53
  unsigned int   noOfIndexPages;
 
54
  unsigned int   noOfDataPages;
 
55
  unsigned int   noOfDiskBufferPages;
 
56
  unsigned int   noOfFreeClusters;
 
57
  unsigned int   noOfDiskClusters;
 
58
  unsigned int   noOfScanRecords;
 
59
  bool       exist;
 
60
  VarSize    varSize[MAX_SIZEALT_BLOCKS][MAX_SIZEALT_RECORD];
 
61
  unsigned short blockNo[MAX_SIZEALT_BLOCKS];
 
62
  LogLevel logLevel;
 
63
};
 
64
 
 
65
 
 
66
class ClusterConfiguration
 
67
{
 
68
public:
 
69
  
 
70
  struct NodeData {
 
71
    NodeData() { 
 
72
      nodeId = MAX_NODES+1;
 
73
      nodeType = NodeInfo::INVALID;
 
74
      arbitRank = ~0;
 
75
    }
 
76
    NodeId nodeId;
 
77
    NodeInfo::NodeType nodeType;
 
78
    unsigned arbitRank;
 
79
  };
 
80
  
 
81
  struct ClusterData
 
82
  {    
 
83
    SizeAlt  SizeAltData;
 
84
    NodeData nodeData[MAX_NODES];
 
85
    Uint32   ispValues[5][CmvmiCfgConf::NO_OF_WORDS];
 
86
  };
 
87
  
 
88
  ClusterConfiguration();
 
89
  ~ClusterConfiguration();
 
90
  const ClusterData& clusterData() const;
 
91
  
 
92
  void init(const Properties & p, const Properties & db);
 
93
protected:
 
94
 
 
95
private:
 
96
 
 
97
  ClusterData the_clusterData;
 
98
 
 
99
  void calcSizeAlteration();
 
100
 
 
101
};
 
102
 
 
103
#endif // ClusterConfiguration_H
 
104