MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HugoTransactions.hpp
1 /*
2  Copyright (C) 2003-2007 MySQL AB, 2008 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 HUGO_TRANSACTIONS_HPP
20 #define HUGO_TRANSACTIONS_HPP
21 
22 
23 #include <NDBT.hpp>
24 #include <HugoCalculator.hpp>
25 #include <HugoOperations.hpp>
26 class NDBT_Stats;
27 
29 public:
31  const NdbDictionary::Index* idx = 0);
33  int loadTable(Ndb*,
34  int records,
35  int batch = 512,
36  bool allowConstraintViolation = true,
37  int doSleep = 0,
38  bool oneTrans = false,
39  int updateValue = 0,
40  bool abort = false);
41 
42  int loadTableStartFrom(Ndb*,
43  int startFrom,
44  int records,
45  int batch = 512,
46  bool allowConstraintViolation = true,
47  int doSleep = 0,
48  bool oneTrans = false,
49  int updateValue = 0,
50  bool abort = false);
51 
52  int scanReadRecords(Ndb*,
53  int records,
54  int abort = 0,
55  int parallelism = 0,
57  int scan_flags = 0);
58 
59  int scanReadRecords(Ndb*,
60  const NdbDictionary::Index*,
61  int records,
62  int abort = 0,
63  int parallelism = 0,
65  int scan_flags = 0);
66 
67  int pkReadRecords(Ndb*,
68  int records,
69  int batchsize = 1,
71  int rand = 0);
72 
73  int pkReadUnlockRecords(Ndb*,
74  int records,
75  int batchsize = 1,
77 
78  int scanUpdateRecords(Ndb*, NdbScanOperation::ScanFlag,
79  int records,
80  int abort = 0,
81  int parallelism = 0);
82 
83  int scanUpdateRecords(Ndb*,
84  int records,
85  int abort = 0,
86  int parallelism = 0);
87 
88  int scanUpdateRecords1(Ndb*,
89  int records,
90  int abort = 0,
91  int parallelism = 0);
92  int scanUpdateRecords2(Ndb*,
93  int records,
94  int abort = 0,
95  int parallelism = 0);
96  int scanUpdateRecords3(Ndb*,
97  int records,
98  int abort = 0,
99  int parallelism = 0);
100 
101  int pkUpdateRecords(Ndb*,
102  int records,
103  int batchsize = 1,
104  int doSleep = 0);
105  int pkInterpretedUpdateRecords(Ndb*,
106  int records,
107  int batchsize = 1);
108  int pkDelRecords(Ndb*,
109  int records = 0,
110  int batch = 1,
111  bool allowConstraintViolation = true,
112  int doSleep = 0);
113 
114  int pkRefreshRecords(Ndb*, int startFrom, int count = 1, int batch = 1);
115 
116  int lockRecords(Ndb*,
117  int records,
118  int percentToLock = 1,
119  int lockTime = 1000);
120 
121  int fillTable(Ndb*,
122  int batch=512);
123 
124  int fillTableStartFrom(Ndb*, int startFrom, int batch=512);
125 
129  int indexReadRecords(Ndb*,
130  const char * idxName,
131  int records,
132  int batchsize = 1);
133 
134  int indexUpdateRecords(Ndb*,
135  const char * idxName,
136  int records,
137  int batchsize = 1);
138 
139  void setRetryMax(int retryMax = 100) { m_retryMax = retryMax; }
140 
141  Uint64 m_latest_gci;
142 
143  void setStatsLatency(NDBT_Stats* stats) { m_stats_latency = stats; }
144 
145  // allows multiple threads to update separate batches
146  void setThrInfo(int thr_count, int thr_no) {
147  m_thr_count = thr_count;
148  m_thr_no = thr_no;
149  }
150 
151 protected:
152  NDBT_ResultRow row;
153  int m_defaultScanUpdateMethod;
154  int m_retryMax;
155 
156  NDBT_Stats* m_stats_latency;
157 
158  int m_thr_count; // 0 if no separation between threads
159  int m_thr_no;
160 };
161 
162 
163 
164 
165 #endif
166