MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
testData.h
1 /*
2  Copyright (C) 2005, 2006, 2008 MySQL AB, 2008, 2009 Sun Microsystems, Inc.
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 TESTDATA_H
20 #define TESTDATA_H
21 
22 /***************************************************************
23 * I N C L U D E D F I L E S *
24 ***************************************************************/
25 #include <NdbTick.h>
26 #include <NdbThread.h>
27 #include <NDBT_Stats.hpp>
28 #include <random.h>
29 #include "testDefinitions.h"
30 
31 /***************************************************************
32 * M A C R O S *
33 ***************************************************************/
34 
35 /***************************************************************/
36 /* C O N S T A N T S */
37 /***************************************************************/
38 
39 #define NUM_TRANSACTION_TYPES 5
40 #define SESSION_LIST_LENGTH 1000
41 
42 /***************************************************************
43 * D A T A S T R U C T U R E S *
44 ***************************************************************/
45 
46 typedef struct {
47  SubscriberNumber subscriberNumber;
48  ServerId serverId;
50 
51 typedef struct {
52  SessionElement list[SESSION_LIST_LENGTH];
53  unsigned int readIndex;
54  unsigned int writeIndex;
55  unsigned int numberInList;
56 } SessionList;
57 
58 typedef struct {
59  unsigned int count;
60  unsigned int branchExecuted;
61  unsigned int rollbackExecuted;
62 
66  NDB_TICKS startTime;
67  NDBT_Stats latency;
68  unsigned int latencyCounter;
69 
70  inline void startLatency(){
71  if((latencyCounter & 127) == 127)
72  startTime = NdbTick_CurrentMillisecond();
73  }
74 
75  inline void stopLatency(){
76  if((latencyCounter & 127) == 127){
77  const NDB_TICKS tmp = NdbTick_CurrentMillisecond() - startTime;
78  latency.addObservation((double)tmp);
79  }
80  latencyCounter++;
81  }
83 
84 typedef struct {
85  RandomSequence transactionSequence;
86  RandomSequence rollbackSequenceT4;
87  RandomSequence rollbackSequenceT5;
88 
89  TransactionDefinition transactions[NUM_TRANSACTION_TYPES];
90 
91  unsigned int totalTransactions;
92 
93  double outerLoopTime;
94  double outerTps;
95 
96  SessionList activeSessions;
97 
99 
100 typedef enum{
101  Runnable,
102  Running
103 } RunState ;
104 
105 typedef struct {
106  SubscriberNumber number;
107  SubscriberSuffix suffix;
108  SubscriberName name;
109  Location location;
110  ChangedBy changed_by;
111  ChangedTime changed_time;
112  ServerId server_id;
113  ServerBit server_bit;
114  SessionDetails session_details;
115 
116  GroupId group_id;
117  ActiveSessions sessions;
118  Permission permission;
119 
120  unsigned int do_rollback;
121 
122  unsigned int branchExecuted;
123  unsigned int sessionElement;
124 } TransactionData ;
125 
126 typedef struct {
127  const class NdbRecord* subscriberTableNdbRecord;
128  const class NdbRecord* groupTableAllowReadNdbRecord;
129  const class NdbRecord* groupTableAllowInsertNdbRecord;
130  const class NdbRecord* groupTableAllowDeleteNdbRecord;
131  const class NdbRecord* sessionTableNdbRecord;
132  const class NdbInterpretedCode* incrServerReadsProg;
133  const class NdbInterpretedCode* incrServerInsertsProg;
134  const class NdbInterpretedCode* incrServerDeletesProg;
135  const class NdbRecord* serverTableNdbRecord;
137 
138 typedef struct {
139  struct NdbThread* pThread;
140 
141  unsigned long randomSeed;
142  unsigned long changedTime;
143 
144  unsigned int warmUpSeconds;
145  unsigned int testSeconds;
146  unsigned int coolDownSeconds;
147 
148  GeneratorStatistics generator;
149 
153  RunState runState;
154  double startTime;
155  TransactionData transactionData;
156  class Ndb * pNDB;
157  NdbRecordSharedData* ndbRecordSharedData;
158  bool useCombinedUpdate;
159 } ThreadData;
160 
161 /***************************************************************
162  * P U B L I C F U N C T I O N S *
163  ***************************************************************/
164 
165 /***************************************************************
166  * E X T E R N A L D A T A *
167  ***************************************************************/
168 
169 
170 
171 #endif /* TESTDATA_H */
172