1860.2.2
by Stewart Smith
add initial implementation of storage_engine_api_tester. It's a storage engine with a bunch of asserts on state transations to test that the upper layer is calling the StorageEngine API correctly. |
1 |
/*
|
2 |
Copyright (C) 2010 Stewart Smith
|
|
3 |
||
4 |
This program is free software; you can redistribute it and/or
|
|
5 |
modify it under the terms of the GNU General Public License
|
|
6 |
as published by the Free Software Foundation; either version 2
|
|
7 |
of the License, or (at your option) any later version.
|
|
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 Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
17 |
*/
|
|
18 |
||
2173.2.1
by Monty Taylor
Fixes incorrect usage of include |
19 |
#include <config.h> |
1860.2.2
by Stewart Smith
add initial implementation of storage_engine_api_tester. It's a storage engine with a bunch of asserts on state transations to test that the upper layer is calling the StorageEngine API correctly. |
20 |
#include <drizzled/table.h> |
21 |
#include <drizzled/error.h> |
|
22 |
#include <drizzled/plugin/transactional_storage_engine.h> |
|
1947.1.13
by Stewart Smith
add SEAPITester test for incorrect txn log contents on LOCK WAIT TIMEOUT |
23 |
#include <drizzled/session.h> // for mark_transaction_to_rollback |
1860.2.2
by Stewart Smith
add initial implementation of storage_engine_api_tester. It's a storage engine with a bunch of asserts on state transations to test that the upper layer is calling the StorageEngine API correctly. |
24 |
#include <string> |
25 |
#include <map> |
|
26 |
#include <fstream> |
|
27 |
#include <drizzled/message/table.pb.h> |
|
2173.2.1
by Monty Taylor
Fixes incorrect usage of include |
28 |
#include <drizzled/internal/m_string.h> |
1860.2.2
by Stewart Smith
add initial implementation of storage_engine_api_tester. It's a storage engine with a bunch of asserts on state transations to test that the upper layer is calling the StorageEngine API correctly. |
29 |
|
2173.2.1
by Monty Taylor
Fixes incorrect usage of include |
30 |
#include <drizzled/global_charset_info.h> |
1860.2.2
by Stewart Smith
add initial implementation of storage_engine_api_tester. It's a storage engine with a bunch of asserts on state transations to test that the upper layer is calling the StorageEngine API correctly. |
31 |
|
32 |
#include <boost/unordered_map.hpp> |
|
33 |
||
2077.3.1
by Stewart Smith
add storing of history of engine states to storage_engine_api_tester. We get a DATA_DICTIONARY table that lists the states and a function to clear it. |
34 |
#include "engine_state_history.h" |
35 |
||
1860.2.2
by Stewart Smith
add initial implementation of storage_engine_api_tester. It's a storage engine with a bunch of asserts on state transations to test that the upper layer is calling the StorageEngine API correctly. |
36 |
using namespace std; |
37 |
using namespace drizzled; |
|
38 |
||
39 |
string engine_state; |
|
2077.3.1
by Stewart Smith
add storing of history of engine states to storage_engine_api_tester. We get a DATA_DICTIONARY table that lists the states and a function to clear it. |
40 |
|
1860.2.2
by Stewart Smith
add initial implementation of storage_engine_api_tester. It's a storage engine with a bunch of asserts on state transations to test that the upper layer is calling the StorageEngine API correctly. |
41 |
typedef multimap<string, string> state_multimap; |
42 |
typedef multimap<string, string>::value_type state_pair; |
|
43 |
typedef multimap<string, string>::iterator state_multimap_iter; |
|
44 |
state_multimap engine_state_transitions; |
|
1860.2.8
by Stewart Smith
update state transitions in Storage Engine API tester to match reality (well, mostly). The series of calls is rather screwy. also implement Cursor states and enough to run a simple SELECT statement. |
45 |
state_multimap cursor_state_transitions; |
46 |
||
1860.2.14
by Stewart Smith
in Storage Engine API Tester: add cursor_states_to_dot utility |
47 |
void load_engine_state_transitions(state_multimap &states); |
48 |
void load_cursor_state_transitions(state_multimap &states); |
|
1860.2.11
by Stewart Smith
add small noinst program to generate a dot graph of the Storage Engine API states from the transition multimap |
49 |
|
1947.1.2
by Stewart Smith
storage_engine_api_tester starts to become a filter to a 'real' engine (innobase) verifying the call sequence of things rather than just an isolated engine that does nothing. We also need to get access at some more things from StorageEngine. Yes, they should be protected - but C++ is being hateful to me. |
50 |
plugin::TransactionalStorageEngine *realEngine; |
51 |
||
1947.1.13
by Stewart Smith
add SEAPITester test for incorrect txn log contents on LOCK WAIT TIMEOUT |
52 |
/* ERROR INJECTION For SEAPITESTER
|
53 |
-------------------------------
|
|
54 |
||
55 |
IF you add a new error injection, document it here!
|
|
2170.6.9
by Stewart Smith
add error inject test in SEAPITester to test if doStartIndexScan error is being checked. The test case we add is for MIN() |
56 |
You test via error_injected variable.
|
1947.1.13
by Stewart Smith
add SEAPITester test for incorrect txn log contents on LOCK WAIT TIMEOUT |
57 |
|
58 |
Conflicting error inject numbers will lead to tears
|
|
59 |
(not Borsch, Vodka and Tears - that's quite nice).
|
|
60 |
||
2170.6.9
by Stewart Smith
add error inject test in SEAPITester to test if doStartIndexScan error is being checked. The test case we add is for MIN() |
61 |
0 - DISABLED
|
62 |
||
1947.1.13
by Stewart Smith
add SEAPITester test for incorrect txn log contents on LOCK WAIT TIMEOUT |
63 |
1 - doInsertRecord(): every 2nd row, LOCK_WAIT_TIMEOUT.
|
64 |
2 - doInsertRecord(): every 2nd row, DEADLOCK.
|
|
1947.1.15
by Stewart Smith
add error insert for rnd_next causing lock wait timeout in SEAPITester. This means we can write a test (included) that tests stmt rollback for txn log in large INSERT SELECT. Result file isn't valid yet due to test failing |
65 |
3 - rnd_next(): every 2nd row, LOCK_WAIT_TIMEOUT
|
2170.6.9
by Stewart Smith
add error inject test in SEAPITester to test if doStartIndexScan error is being checked. The test case we add is for MIN() |
66 |
4 - doStartIndexScan returns an error.
|
1947.1.13
by Stewart Smith
add SEAPITester test for incorrect txn log contents on LOCK WAIT TIMEOUT |
67 |
*/
|
68 |
static uint32_t error_injected= 0; |
|
69 |
||
70 |
#include <drizzled/function/math/int.h> |
|
71 |
#include <drizzled/plugin/function.h> |
|
72 |
||
73 |
class SEAPITesterErrorInjectFunc :public Item_int_func |
|
74 |
{
|
|
75 |
public: |
|
76 |
int64_t val_int(); |
|
77 |
SEAPITesterErrorInjectFunc() :Item_int_func() {} |
|
78 |
||
79 |
const char *func_name() const |
|
80 |
{
|
|
81 |
return "seapitester_error_inject"; |
|
82 |
}
|
|
83 |
||
84 |
void fix_length_and_dec() |
|
85 |
{
|
|
86 |
max_length= 4; |
|
87 |
}
|
|
88 |
||
89 |
bool check_argument_count(int n) |
|
90 |
{
|
|
91 |
return (n == 1); |
|
92 |
}
|
|
93 |
};
|
|
94 |
||
95 |
||
96 |
int64_t SEAPITesterErrorInjectFunc::val_int() |
|
97 |
{
|
|
98 |
assert(fixed == true); |
|
99 |
uint32_t err_to_inject= args[0]->val_int(); |
|
100 |
||
101 |
error_injected= err_to_inject; |
|
102 |
||
103 |
return error_injected; |
|
104 |
}
|
|
105 |
||
1947.1.2
by Stewart Smith
storage_engine_api_tester starts to become a filter to a 'real' engine (innobase) verifying the call sequence of things rather than just an isolated engine that does nothing. We also need to get access at some more things from StorageEngine. Yes, they should be protected - but C++ is being hateful to me. |
106 |
static plugin::TransactionalStorageEngine *getRealEngine() |
107 |
{
|
|
108 |
return down_cast<plugin::TransactionalStorageEngine*>(plugin::StorageEngine::findByName("INNODB")); |
|
109 |
}
|
|
110 |
||
1860.2.2
by Stewart Smith
add initial implementation of storage_engine_api_tester. It's a storage engine with a bunch of asserts on state transations to test that the upper layer is calling the StorageEngine API correctly. |
111 |
static inline void ENGINE_NEW_STATE(const string &new_state) |
112 |
{
|
|
113 |
state_multimap_iter cur= engine_state_transitions.find(engine_state); |
|
114 |
if (engine_state_transitions.count(engine_state) == 0) |
|
115 |
{
|
|
116 |
cerr << "ERROR: Invalid engine state: " << engine_state << endl |
|
117 |
<< "This should *NEVER* happen." |
|
118 |
<< endl |
|
119 |
<< "i.e. you've really screwed it up and you should be ashamed of " |
|
120 |
<< "yourself." << endl; |
|
121 |
assert(engine_state_transitions.count(engine_state)); |
|
122 |
}
|
|
123 |
||
124 |
for(cur= engine_state_transitions.lower_bound(engine_state); |
|
125 |
cur != engine_state_transitions.upper_bound(engine_state); |
|
126 |
cur++) |
|
127 |
{
|
|
128 |
if (new_state.compare((*cur).second) == 0) |
|
129 |
break; |
|
130 |
}
|
|
131 |
||
132 |
if (cur == engine_state_transitions.end() |
|
133 |
|| new_state.compare((*cur).second)) |
|
134 |
{
|
|
135 |
cerr << "ERROR: Invalid Storage Engine state transition!" << endl |
|
136 |
<< "Cannot go from " << engine_state << " to " << new_state << endl; |
|
137 |
assert(false); |
|
138 |
}
|
|
139 |
||
140 |
engine_state= new_state; |
|
2077.3.1
by Stewart Smith
add storing of history of engine states to storage_engine_api_tester. We get a DATA_DICTIONARY table that lists the states and a function to clear it. |
141 |
engine_state_history.push_back(new_state); |
1860.2.2
by Stewart Smith
add initial implementation of storage_engine_api_tester. It's a storage engine with a bunch of asserts on state transations to test that the upper layer is calling the StorageEngine API correctly. |
142 |
|
143 |
cerr << "\tENGINE STATE : " << engine_state << endl; |
|
144 |
}
|
|
145 |
||
146 |
static const string engine_name("STORAGE_ENGINE_API_TESTER"); |
|
1947.1.3
by Stewart Smith
initial go at having SEAPITesterCursor wrap innobase cursor. does basic insert and table scan. |
147 |
namespace drizzled { |
1860.2.2
by Stewart Smith
add initial implementation of storage_engine_api_tester. It's a storage engine with a bunch of asserts on state transations to test that the upper layer is calling the StorageEngine API correctly. |
148 |
class SEAPITesterCursor : public drizzled::Cursor |
149 |
{
|
|
1947.1.3
by Stewart Smith
initial go at having SEAPITesterCursor wrap innobase cursor. does basic insert and table scan. |
150 |
friend class drizzled::Cursor; |
1860.2.2
by Stewart Smith
add initial implementation of storage_engine_api_tester. It's a storage engine with a bunch of asserts on state transations to test that the upper layer is calling the StorageEngine API correctly. |
151 |
public: |
1947.1.3
by Stewart Smith
initial go at having SEAPITesterCursor wrap innobase cursor. does basic insert and table scan. |
152 |
drizzled::Cursor *realCursor; |
153 |
||
1860.2.2
by Stewart Smith
add initial implementation of storage_engine_api_tester. It's a storage engine with a bunch of asserts on state transations to test that the upper layer is calling the StorageEngine API correctly. |
154 |
SEAPITesterCursor(drizzled::plugin::StorageEngine &engine_arg, |
1860.2.18
by Stewart Smith
merge trunk |
155 |
drizzled::Table &table_arg) |
1860.2.2
by Stewart Smith
add initial implementation of storage_engine_api_tester. It's a storage engine with a bunch of asserts on state transations to test that the upper layer is calling the StorageEngine API correctly. |
156 |
: Cursor(engine_arg, table_arg) |
1947.1.3
by Stewart Smith
initial go at having SEAPITesterCursor wrap innobase cursor. does basic insert and table scan. |
157 |
{ cursor_state= "Cursor()"; realCursor= NULL;} |
158 |
||
1860.2.2
by Stewart Smith
add initial implementation of storage_engine_api_tester. It's a storage engine with a bunch of asserts on state transations to test that the upper layer is calling the StorageEngine API correctly. |
159 |
~SEAPITesterCursor() |
1947.1.3
by Stewart Smith
initial go at having SEAPITesterCursor wrap innobase cursor. does basic insert and table scan. |
160 |
{ delete realCursor;} |
1860.2.2
by Stewart Smith
add initial implementation of storage_engine_api_tester. It's a storage engine with a bunch of asserts on state transations to test that the upper layer is calling the StorageEngine API correctly. |
161 |
|
1947.1.7
by Stewart Smith
actually make storage_engine_api_tester rnd_pos test actually use our engine. Modify our wrapper so taht it does go through all the correct things. OH MY THE BUGS (or weird ways that the API gets called |
162 |
int close(); |
1947.1.15
by Stewart Smith
add error insert for rnd_next causing lock wait timeout in SEAPITester. This means we can write a test (included) that tests stmt rollback for txn log in large INSERT SELECT. Result file isn't valid yet due to test failing |
163 |
int rnd_next(unsigned char *buf) { |
164 |
static int count= 0; |
|
165 |
CURSOR_NEW_STATE("::rnd_next()"); |
|
166 |
||
167 |
if (error_injected == 3 && (count++ % 2)) |
|
168 |
{
|
|
2153.1.2
by Stewart Smith
replace mark_transaction_to_rollback() with Session::markTransactionForRollback() |
169 |
user_session->markTransactionForRollback(false); |
1947.1.15
by Stewart Smith
add error insert for rnd_next causing lock wait timeout in SEAPITester. This means we can write a test (included) that tests stmt rollback for txn log in large INSERT SELECT. Result file isn't valid yet due to test failing |
170 |
return HA_ERR_LOCK_WAIT_TIMEOUT; |
171 |
}
|
|
172 |
return realCursor->rnd_next(buf); |
|
173 |
}
|
|
174 |
||
1947.1.5
by Stewart Smith
add update record and rnd_pos ability to SEAPITester. This means we can do the rnd_pos test |
175 |
int rnd_pos(unsigned char* buf, unsigned char* pos) { CURSOR_NEW_STATE("::rnd_pos()"); return realCursor->rnd_pos(buf, pos); } |
1947.1.7
by Stewart Smith
actually make storage_engine_api_tester rnd_pos test actually use our engine. Modify our wrapper so taht it does go through all the correct things. OH MY THE BUGS (or weird ways that the API gets called |
176 |
void position(const unsigned char *record); |
177 |
int info(uint32_t flag); |
|
178 |
||
179 |
int reset(); |
|
180 |
||
1860.2.2
by Stewart Smith
add initial implementation of storage_engine_api_tester. It's a storage engine with a bunch of asserts on state transations to test that the upper layer is calling the StorageEngine API correctly. |
181 |
void get_auto_increment(uint64_t, uint64_t, uint64_t, uint64_t*, uint64_t*) {} |
1947.1.3
by Stewart Smith
initial go at having SEAPITesterCursor wrap innobase cursor. does basic insert and table scan. |
182 |
int doStartTableScan(bool scan) { CURSOR_NEW_STATE("::doStartTableScan()"); return realCursor->doStartTableScan(scan); } |
183 |
int doEndTableScan() { CURSOR_NEW_STATE("::doEndTableScan()"); return realCursor->doEndTableScan(); } |
|
184 |
||
2170.6.5
by Stewart Smith
fill in index access methods in SEAPITester. |
185 |
const char *index_type(uint32_t key_number); |
186 |
||
187 |
int doStartIndexScan(uint32_t, bool); |
|
188 |
int index_read(unsigned char *buf, const unsigned char *key_ptr, |
|
189 |
uint32_t key_len, drizzled::ha_rkey_function find_flag); |
|
190 |
int index_read_idx_map(unsigned char * buf, |
|
191 |
uint32_t index, |
|
192 |
const unsigned char * key, |
|
193 |
drizzled::key_part_map keypart_map, |
|
194 |
drizzled::ha_rkey_function find_flag); |
|
195 |
||
196 |
int index_next(unsigned char * buf); |
|
197 |
int doEndIndexScan(); |
|
198 |
int index_prev(unsigned char * buf); |
|
199 |
int index_first(unsigned char * buf); |
|
200 |
int index_last(unsigned char * buf); |
|
201 |
||
2170.6.6
by Stewart Smith
fix up a few more index bits in SEAPITester Cursor impl |
202 |
bool primary_key_is_clustered() |
203 |
{
|
|
204 |
return realCursor->primary_key_is_clustered(); |
|
205 |
}
|
|
206 |
||
2170.6.5
by Stewart Smith
fill in index access methods in SEAPITester. |
207 |
|
2087.4.2
by Brian Aker
Modify TableIdentifier to fit with the rest of the identifiers. |
208 |
int doOpen(const identifier::Table &identifier, int mode, uint32_t test_if_locked); |
1860.2.8
by Stewart Smith
update state transitions in Storage Engine API tester to match reality (well, mostly). The series of calls is rather screwy. also implement Cursor states and enough to run a simple SELECT statement. |
209 |
|
210 |
THR_LOCK_DATA **store_lock(Session *, |
|
211 |
THR_LOCK_DATA **to, |
|
212 |
enum thr_lock_type); |
|
213 |
||
1947.1.7
by Stewart Smith
actually make storage_engine_api_tester rnd_pos test actually use our engine. Modify our wrapper so taht it does go through all the correct things. OH MY THE BUGS (or weird ways that the API gets called |
214 |
int external_lock(Session *session, int lock_type); |
215 |
||
1947.1.3
by Stewart Smith
initial go at having SEAPITesterCursor wrap innobase cursor. does basic insert and table scan. |
216 |
int doInsertRecord(unsigned char *buf) |
1860.2.12
by Stewart Smith
Add test to Storage Engine API Tester for rolling back a INSERT statement that goes awry... or at least that we get some state transitions correct. |
217 |
{
|
1947.1.13
by Stewart Smith
add SEAPITester test for incorrect txn log contents on LOCK WAIT TIMEOUT |
218 |
static int i=0; |
1860.2.12
by Stewart Smith
Add test to Storage Engine API Tester for rolling back a INSERT statement that goes awry... or at least that we get some state transitions correct. |
219 |
CURSOR_NEW_STATE("::doInsertRecord()"); |
1947.1.13
by Stewart Smith
add SEAPITester test for incorrect txn log contents on LOCK WAIT TIMEOUT |
220 |
|
221 |
if (error_injected == 1 && (i++ % 2)) |
|
222 |
{
|
|
2153.1.2
by Stewart Smith
replace mark_transaction_to_rollback() with Session::markTransactionForRollback() |
223 |
user_session->markTransactionForRollback(false); |
1947.1.13
by Stewart Smith
add SEAPITester test for incorrect txn log contents on LOCK WAIT TIMEOUT |
224 |
return HA_ERR_LOCK_WAIT_TIMEOUT; |
225 |
}
|
|
226 |
||
227 |
if (error_injected == 2 && (i++ % 2)) |
|
228 |
{
|
|
2153.1.2
by Stewart Smith
replace mark_transaction_to_rollback() with Session::markTransactionForRollback() |
229 |
user_session->markTransactionForRollback(true); |
1947.1.13
by Stewart Smith
add SEAPITester test for incorrect txn log contents on LOCK WAIT TIMEOUT |
230 |
return HA_ERR_LOCK_DEADLOCK; |
231 |
}
|
|
232 |
||
1947.1.3
by Stewart Smith
initial go at having SEAPITesterCursor wrap innobase cursor. does basic insert and table scan. |
233 |
return realCursor->doInsertRecord(buf); |
1860.2.12
by Stewart Smith
Add test to Storage Engine API Tester for rolling back a INSERT statement that goes awry... or at least that we get some state transitions correct. |
234 |
}
|
1860.2.8
by Stewart Smith
update state transitions in Storage Engine API tester to match reality (well, mostly). The series of calls is rather screwy. also implement Cursor states and enough to run a simple SELECT statement. |
235 |
|
1947.1.5
by Stewart Smith
add update record and rnd_pos ability to SEAPITester. This means we can do the rnd_pos test |
236 |
int doUpdateRecord(const unsigned char *old_row, unsigned char *new_row) |
237 |
{
|
|
238 |
CURSOR_NEW_STATE("::doUpdateRecord()"); |
|
239 |
return realCursor->doUpdateRecord(old_row, new_row); |
|
240 |
}
|
|
241 |
||
2170.6.1
by Stewart Smith
support Cursor::scan_time() in storage_engine_api_tester |
242 |
double scan_time() |
243 |
{
|
|
244 |
CURSOR_NEW_STATE("::scan_time()"); |
|
245 |
CURSOR_NEW_STATE("locked"); |
|
246 |
return realCursor->scan_time(); |
|
247 |
}
|
|
248 |
||
2170.6.2
by Stewart Smith
support Cursor::extra() in storage_engine_api_tester |
249 |
int extra(enum ha_extra_function operation) |
250 |
{
|
|
251 |
return realCursor->extra(operation); |
|
252 |
}
|
|
253 |
||
1860.2.8
by Stewart Smith
update state transitions in Storage Engine API tester to match reality (well, mostly). The series of calls is rather screwy. also implement Cursor states and enough to run a simple SELECT statement. |
254 |
private: |
255 |
string cursor_state; |
|
256 |
void CURSOR_NEW_STATE(const string &new_state); |
|
1947.1.13
by Stewart Smith
add SEAPITester test for incorrect txn log contents on LOCK WAIT TIMEOUT |
257 |
Session* user_session; |
1860.2.2
by Stewart Smith
add initial implementation of storage_engine_api_tester. It's a storage engine with a bunch of asserts on state transations to test that the upper layer is calling the StorageEngine API correctly. |
258 |
};
|
259 |
||
2087.4.2
by Brian Aker
Modify TableIdentifier to fit with the rest of the identifiers. |
260 |
int SEAPITesterCursor::doOpen(const identifier::Table &identifier, int mode, uint32_t test_if_locked) |
1947.1.7
by Stewart Smith
actually make storage_engine_api_tester rnd_pos test actually use our engine. Modify our wrapper so taht it does go through all the correct things. OH MY THE BUGS (or weird ways that the API gets called |
261 |
{
|
262 |
CURSOR_NEW_STATE("::doOpen()"); |
|
263 |
||
264 |
int r= realCursor->doOpen(identifier, mode, test_if_locked); |
|
265 |
||
266 |
ref_length= realCursor->ref_length; |
|
267 |
||
268 |
return r; |
|
269 |
}
|
|
270 |
||
271 |
int SEAPITesterCursor::reset() |
|
272 |
{
|
|
273 |
CURSOR_NEW_STATE("::reset()"); |
|
274 |
CURSOR_NEW_STATE("::doOpen()"); |
|
275 |
||
276 |
return realCursor->reset(); |
|
277 |
}
|
|
278 |
||
279 |
int SEAPITesterCursor::close() |
|
280 |
{
|
|
281 |
CURSOR_NEW_STATE("::close()"); |
|
282 |
CURSOR_NEW_STATE("Cursor()"); |
|
283 |
||
284 |
return realCursor->close(); |
|
285 |
}
|
|
286 |
||
287 |
void SEAPITesterCursor::position(const unsigned char *record) |
|
288 |
{
|
|
289 |
CURSOR_NEW_STATE("::position()"); |
|
290 |
||
291 |
/* We need to use the correct buffer for upper layer */
|
|
292 |
realCursor->ref= ref; |
|
293 |
||
294 |
realCursor->position(record); |
|
295 |
}
|
|
296 |
||
297 |
int SEAPITesterCursor::info(uint32_t flag) |
|
298 |
{
|
|
2170.6.4
by Stewart Smith
fix SEAPITester ::info() support by properly copying back errkey for HA_STATUS_ERRKEY and ha_statistics from the real cursor |
299 |
int r; |
1947.1.7
by Stewart Smith
actually make storage_engine_api_tester rnd_pos test actually use our engine. Modify our wrapper so taht it does go through all the correct things. OH MY THE BUGS (or weird ways that the API gets called |
300 |
CURSOR_NEW_STATE("::info()"); |
301 |
CURSOR_NEW_STATE("locked"); |
|
302 |
||
2170.6.4
by Stewart Smith
fix SEAPITester ::info() support by properly copying back errkey for HA_STATUS_ERRKEY and ha_statistics from the real cursor |
303 |
r= realCursor->info(flag); |
304 |
||
305 |
if (flag & (HA_STATUS_VARIABLE|HA_STATUS_AUTO|HA_STATUS_CONST)) |
|
306 |
{
|
|
307 |
stats= realCursor->stats; |
|
308 |
}
|
|
309 |
||
310 |
if (flag & HA_STATUS_ERRKEY) |
|
311 |
errkey= realCursor->errkey; |
|
312 |
||
313 |
return r; |
|
1947.1.7
by Stewart Smith
actually make storage_engine_api_tester rnd_pos test actually use our engine. Modify our wrapper so taht it does go through all the correct things. OH MY THE BUGS (or weird ways that the API gets called |
314 |
}
|
315 |
||
2170.6.5
by Stewart Smith
fill in index access methods in SEAPITester. |
316 |
const char * SEAPITesterCursor::index_type(uint32_t key_number) |
317 |
{
|
|
318 |
CURSOR_NEW_STATE("::index_type()"); |
|
319 |
return realCursor->index_type(key_number); |
|
320 |
}
|
|
321 |
||
322 |
int SEAPITesterCursor::doStartIndexScan(uint32_t keynr, bool scan) |
|
323 |
{
|
|
324 |
int r; |
|
325 |
CURSOR_NEW_STATE("::doStartIndexScan()"); |
|
2170.6.9
by Stewart Smith
add error inject test in SEAPITester to test if doStartIndexScan error is being checked. The test case we add is for MIN() |
326 |
|
327 |
if (error_injected == 4) |
|
328 |
{
|
|
2170.6.11
by Stewart Smith
add SEAPITester Cursor state for error in dostartIndexScan() |
329 |
CURSOR_NEW_STATE("::doStartIndexScan() ERROR"); |
330 |
CURSOR_NEW_STATE("locked"); |
|
2170.6.9
by Stewart Smith
add error inject test in SEAPITester to test if doStartIndexScan error is being checked. The test case we add is for MIN() |
331 |
return HA_ERR_LOCK_DEADLOCK; |
332 |
}
|
|
333 |
||
2170.6.5
by Stewart Smith
fill in index access methods in SEAPITester. |
334 |
r= realCursor->doStartIndexScan(keynr, scan); |
335 |
||
336 |
active_index= realCursor->get_index(); |
|
337 |
||
338 |
return r; |
|
339 |
}
|
|
340 |
||
341 |
int SEAPITesterCursor::index_read(unsigned char *buf, |
|
342 |
const unsigned char *key_ptr, |
|
343 |
uint32_t key_len, |
|
344 |
drizzled::ha_rkey_function find_flag) |
|
345 |
{
|
|
346 |
CURSOR_NEW_STATE("::index_read()"); |
|
347 |
CURSOR_NEW_STATE("::doStartIndexScan()"); |
|
348 |
return realCursor->index_read(buf, key_ptr, key_len, find_flag); |
|
349 |
}
|
|
350 |
||
351 |
int SEAPITesterCursor::index_read_idx_map(unsigned char * buf, |
|
352 |
uint32_t index, |
|
353 |
const unsigned char * key, |
|
354 |
drizzled::key_part_map keypart_map, |
|
355 |
drizzled::ha_rkey_function find_flag) |
|
356 |
{
|
|
357 |
CURSOR_NEW_STATE("::index_read_idx_map()"); |
|
358 |
CURSOR_NEW_STATE("locked"); |
|
359 |
return realCursor->index_read_idx_map(buf, index, key, keypart_map, find_flag); |
|
360 |
}
|
|
361 |
||
362 |
int SEAPITesterCursor::index_next(unsigned char * buf) |
|
363 |
{
|
|
364 |
CURSOR_NEW_STATE("::index_next()"); |
|
365 |
CURSOR_NEW_STATE("::doStartIndexScan()"); |
|
366 |
return realCursor->index_next(buf); |
|
367 |
}
|
|
368 |
||
369 |
int SEAPITesterCursor::doEndIndexScan() |
|
370 |
{
|
|
371 |
CURSOR_NEW_STATE("::doEndIndexScan()"); |
|
372 |
CURSOR_NEW_STATE("locked"); |
|
373 |
int r= realCursor->doEndIndexScan(); |
|
374 |
||
375 |
active_index= realCursor->get_index(); |
|
376 |
||
377 |
return r; |
|
378 |
}
|
|
379 |
||
380 |
int SEAPITesterCursor::index_prev(unsigned char * buf) |
|
381 |
{
|
|
382 |
CURSOR_NEW_STATE("::index_prev()"); |
|
383 |
CURSOR_NEW_STATE("::doStartIndexScan()"); |
|
384 |
return realCursor->index_prev(buf); |
|
385 |
}
|
|
386 |
||
387 |
int SEAPITesterCursor::index_first(unsigned char * buf) |
|
388 |
{
|
|
389 |
CURSOR_NEW_STATE("::index_first()"); |
|
390 |
CURSOR_NEW_STATE("::doStartIndexScan()"); |
|
391 |
return realCursor->index_first(buf); |
|
392 |
}
|
|
393 |
||
394 |
int SEAPITesterCursor::index_last(unsigned char * buf) |
|
395 |
{
|
|
396 |
CURSOR_NEW_STATE("::index_last()"); |
|
397 |
CURSOR_NEW_STATE("::doStartIndexScan()"); |
|
398 |
return realCursor->index_last(buf); |
|
399 |
}
|
|
400 |
||
1947.1.7
by Stewart Smith
actually make storage_engine_api_tester rnd_pos test actually use our engine. Modify our wrapper so taht it does go through all the correct things. OH MY THE BUGS (or weird ways that the API gets called |
401 |
int SEAPITesterCursor::external_lock(Session *session, int lock_type) |
402 |
{
|
|
403 |
CURSOR_NEW_STATE("::external_lock()"); |
|
404 |
CURSOR_NEW_STATE("locked"); |
|
405 |
||
1947.1.13
by Stewart Smith
add SEAPITester test for incorrect txn log contents on LOCK WAIT TIMEOUT |
406 |
user_session= session; |
407 |
||
1947.1.7
by Stewart Smith
actually make storage_engine_api_tester rnd_pos test actually use our engine. Modify our wrapper so taht it does go through all the correct things. OH MY THE BUGS (or weird ways that the API gets called |
408 |
return realCursor->external_lock(session, lock_type); |
409 |
}
|
|
410 |
||
1860.2.8
by Stewart Smith
update state transitions in Storage Engine API tester to match reality (well, mostly). The series of calls is rather screwy. also implement Cursor states and enough to run a simple SELECT statement. |
411 |
THR_LOCK_DATA **SEAPITesterCursor::store_lock(Session *session, |
412 |
THR_LOCK_DATA **to, |
|
413 |
enum thr_lock_type lock_type) |
|
414 |
||
415 |
{
|
|
416 |
CURSOR_NEW_STATE("::store_lock()"); |
|
417 |
||
1947.1.3
by Stewart Smith
initial go at having SEAPITesterCursor wrap innobase cursor. does basic insert and table scan. |
418 |
return realCursor->store_lock(session, to, lock_type); |
1860.2.8
by Stewart Smith
update state transitions in Storage Engine API tester to match reality (well, mostly). The series of calls is rather screwy. also implement Cursor states and enough to run a simple SELECT statement. |
419 |
}
|
420 |
||
421 |
void SEAPITesterCursor::CURSOR_NEW_STATE(const string &new_state) |
|
422 |
{
|
|
423 |
state_multimap_iter cur= cursor_state_transitions.find(cursor_state); |
|
424 |
if (cursor_state_transitions.count(cursor_state) == 0) |
|
425 |
{
|
|
426 |
cerr << "ERROR: Invalid Cursor state: " << cursor_state << endl |
|
427 |
<< "This should *NEVER* happen." |
|
428 |
<< endl |
|
429 |
<< "i.e. you've really screwed it up and you should be ashamed of " |
|
430 |
<< "yourself." << endl; |
|
431 |
assert(cursor_state_transitions.count(cursor_state)); |
|
432 |
}
|
|
433 |
||
434 |
for(cur= cursor_state_transitions.lower_bound(cursor_state); |
|
435 |
cur != cursor_state_transitions.upper_bound(cursor_state); |
|
436 |
cur++) |
|
437 |
{
|
|
438 |
if (new_state.compare((*cur).second) == 0) |
|
439 |
break; |
|
440 |
}
|
|
441 |
||
442 |
if (cur == cursor_state_transitions.end() |
|
443 |
|| new_state.compare((*cur).second)) |
|
444 |
{
|
|
445 |
cerr << "ERROR: Invalid Cursor state transition!" << endl |
|
1947.1.15
by Stewart Smith
add error insert for rnd_next causing lock wait timeout in SEAPITester. This means we can write a test (included) that tests stmt rollback for txn log in large INSERT SELECT. Result file isn't valid yet due to test failing |
446 |
<< "Cursor " << this << "Cannot go from " |
447 |
<< cursor_state << " to " << new_state << endl; |
|
1860.2.8
by Stewart Smith
update state transitions in Storage Engine API tester to match reality (well, mostly). The series of calls is rather screwy. also implement Cursor states and enough to run a simple SELECT statement. |
448 |
assert(false); |
449 |
}
|
|
450 |
||
451 |
cursor_state= new_state; |
|
452 |
||
1947.1.15
by Stewart Smith
add error insert for rnd_next causing lock wait timeout in SEAPITester. This means we can write a test (included) that tests stmt rollback for txn log in large INSERT SELECT. Result file isn't valid yet due to test failing |
453 |
cerr << "\t\tCursor " << this << " STATE : " << cursor_state << endl; |
1860.2.8
by Stewart Smith
update state transitions in Storage Engine API tester to match reality (well, mostly). The series of calls is rather screwy. also implement Cursor states and enough to run a simple SELECT statement. |
454 |
}
|
455 |
||
1947.1.3
by Stewart Smith
initial go at having SEAPITesterCursor wrap innobase cursor. does basic insert and table scan. |
456 |
} /* namespace drizzled */ |
457 |
||
1860.2.2
by Stewart Smith
add initial implementation of storage_engine_api_tester. It's a storage engine with a bunch of asserts on state transations to test that the upper layer is calling the StorageEngine API correctly. |
458 |
static const char *api_tester_exts[] = { |
459 |
NULL
|
|
460 |
};
|
|
461 |
||
1947.1.4
by Stewart Smith
have SEAPITester be a friend of StorageEngine instead of changing 'protected' to 'public' for some methods. |
462 |
namespace drizzled { |
463 |
namespace plugin { |
|
1860.2.2
by Stewart Smith
add initial implementation of storage_engine_api_tester. It's a storage engine with a bunch of asserts on state transations to test that the upper layer is calling the StorageEngine API correctly. |
464 |
class SEAPITester : public drizzled::plugin::TransactionalStorageEngine |
465 |
{
|
|
466 |
public: |
|
1947.1.7
by Stewart Smith
actually make storage_engine_api_tester rnd_pos test actually use our engine. Modify our wrapper so taht it does go through all the correct things. OH MY THE BUGS (or weird ways that the API gets called |
467 |
/* BUG: Currently flags are just copy&pasted from innobase. Instead, we
|
468 |
need to have a call somewhere.
|
|
469 |
*/
|
|
1860.2.2
by Stewart Smith
add initial implementation of storage_engine_api_tester. It's a storage engine with a bunch of asserts on state transations to test that the upper layer is calling the StorageEngine API correctly. |
470 |
SEAPITester(const string &name_arg) |
471 |
: drizzled::plugin::TransactionalStorageEngine(name_arg, |
|
1947.1.7
by Stewart Smith
actually make storage_engine_api_tester rnd_pos test actually use our engine. Modify our wrapper so taht it does go through all the correct things. OH MY THE BUGS (or weird ways that the API gets called |
472 |
HTON_NULL_IN_KEY | |
473 |
HTON_CAN_INDEX_BLOBS | |
|
474 |
HTON_PRIMARY_KEY_IN_READ_INDEX | |
|
475 |
HTON_PARTIAL_COLUMN_READ | |
|
476 |
HTON_TABLE_SCAN_ON_INDEX | |
|
477 |
HTON_HAS_FOREIGN_KEYS | |
|
478 |
HTON_HAS_DOES_TRANSACTIONS) |
|
1860.2.2
by Stewart Smith
add initial implementation of storage_engine_api_tester. It's a storage engine with a bunch of asserts on state transations to test that the upper layer is calling the StorageEngine API correctly. |
479 |
{
|
480 |
ENGINE_NEW_STATE("::SEAPITester()"); |
|
481 |
}
|
|
482 |
||
483 |
~SEAPITester() |
|
484 |
{
|
|
485 |
ENGINE_NEW_STATE("::~SEAPITester()"); |
|
486 |
}
|
|
487 |
||
488 |
const char **bas_ext() const { |
|
489 |
return api_tester_exts; |
|
490 |
}
|
|
491 |
||
1860.2.18
by Stewart Smith
merge trunk |
492 |
virtual Cursor *create(Table &table) |
1860.2.2
by Stewart Smith
add initial implementation of storage_engine_api_tester. It's a storage engine with a bunch of asserts on state transations to test that the upper layer is calling the StorageEngine API correctly. |
493 |
{
|
1947.1.3
by Stewart Smith
initial go at having SEAPITesterCursor wrap innobase cursor. does basic insert and table scan. |
494 |
SEAPITesterCursor *c= new SEAPITesterCursor(*this, table); |
495 |
Cursor *realCursor= getRealEngine()->create(table); |
|
496 |
c->realCursor= realCursor; |
|
497 |
||
498 |
return c; |
|
1860.2.2
by Stewart Smith
add initial implementation of storage_engine_api_tester. It's a storage engine with a bunch of asserts on state transations to test that the upper layer is calling the StorageEngine API correctly. |
499 |
}
|
500 |
||
501 |
int doCreateTable(Session&, |
|
502 |
Table&, |
|
2087.4.2
by Brian Aker
Modify TableIdentifier to fit with the rest of the identifiers. |
503 |
const drizzled::identifier::Table &identifier, |
2224.4.2
by Brian Aker
Merge in work around making all passing of table as const. |
504 |
const drizzled::message::Table& create_proto); |
1860.2.2
by Stewart Smith
add initial implementation of storage_engine_api_tester. It's a storage engine with a bunch of asserts on state transations to test that the upper layer is calling the StorageEngine API correctly. |
505 |
|
2087.4.2
by Brian Aker
Modify TableIdentifier to fit with the rest of the identifiers. |
506 |
int doDropTable(Session&, const identifier::Table &identifier); |
1860.2.2
by Stewart Smith
add initial implementation of storage_engine_api_tester. It's a storage engine with a bunch of asserts on state transations to test that the upper layer is calling the StorageEngine API correctly. |
507 |
|
1947.1.2
by Stewart Smith
storage_engine_api_tester starts to become a filter to a 'real' engine (innobase) verifying the call sequence of things rather than just an isolated engine that does nothing. We also need to get access at some more things from StorageEngine. Yes, they should be protected - but C++ is being hateful to me. |
508 |
int doRenameTable(drizzled::Session& session, |
2087.4.2
by Brian Aker
Modify TableIdentifier to fit with the rest of the identifiers. |
509 |
const drizzled::identifier::Table& from, |
510 |
const drizzled::identifier::Table& to) |
|
1947.1.2
by Stewart Smith
storage_engine_api_tester starts to become a filter to a 'real' engine (innobase) verifying the call sequence of things rather than just an isolated engine that does nothing. We also need to get access at some more things from StorageEngine. Yes, they should be protected - but C++ is being hateful to me. |
511 |
{ return getRealEngine()->renameTable(session, from, to); } |
1860.2.2
by Stewart Smith
add initial implementation of storage_engine_api_tester. It's a storage engine with a bunch of asserts on state transations to test that the upper layer is calling the StorageEngine API correctly. |
512 |
|
513 |
int doGetTableDefinition(Session& , |
|
2087.4.2
by Brian Aker
Modify TableIdentifier to fit with the rest of the identifiers. |
514 |
const identifier::Table &, |
1860.2.8
by Stewart Smith
update state transitions in Storage Engine API tester to match reality (well, mostly). The series of calls is rather screwy. also implement Cursor states and enough to run a simple SELECT statement. |
515 |
drizzled::message::Table &); |
1860.2.2
by Stewart Smith
add initial implementation of storage_engine_api_tester. It's a storage engine with a bunch of asserts on state transations to test that the upper layer is calling the StorageEngine API correctly. |
516 |
|
2087.4.2
by Brian Aker
Modify TableIdentifier to fit with the rest of the identifiers. |
517 |
bool doDoesTableExist(Session&, const identifier::Table &identifier); |
1860.2.2
by Stewart Smith
add initial implementation of storage_engine_api_tester. It's a storage engine with a bunch of asserts on state transations to test that the upper layer is calling the StorageEngine API correctly. |
518 |
|
519 |
void doGetTableIdentifiers(drizzled::CachedDirectory &, |
|
2087.4.1
by Brian Aker
Merge in schema identifier. |
520 |
const drizzled::identifier::Schema &, |
2087.4.2
by Brian Aker
Modify TableIdentifier to fit with the rest of the identifiers. |
521 |
drizzled::identifier::Table::vector &); |
1860.2.2
by Stewart Smith
add initial implementation of storage_engine_api_tester. It's a storage engine with a bunch of asserts on state transations to test that the upper layer is calling the StorageEngine API correctly. |
522 |
|
523 |
virtual int doStartTransaction(Session *session, |
|
524 |
start_transaction_option_t options); |
|
525 |
virtual void doStartStatement(Session *session); |
|
526 |
virtual void doEndStatement(Session *session); |
|
527 |
||
528 |
virtual int doSetSavepoint(Session*, |
|
529 |
drizzled::NamedSavepoint &) |
|
1947.1.20
by Stewart Smith
start a test for SEAPITester for savepoints. Taking David's small test case r.e. txn log and savepoints and adding engine_state transitions for savepoints. Currently, from looking at the log you can see that the calls are never made to the engine and the test case fails (because the savepoint wasn't created |
530 |
{
|
531 |
ENGINE_NEW_STATE("SET SAVEPOINT"); |
|
1947.1.23
by Stewart Smith
fix up savepoint states in SEAPITester |
532 |
ENGINE_NEW_STATE("In Transaction"); |
1947.1.20
by Stewart Smith
start a test for SEAPITester for savepoints. Taking David's small test case r.e. txn log and savepoints and adding engine_state transitions for savepoints. Currently, from looking at the log you can see that the calls are never made to the engine and the test case fails (because the savepoint wasn't created |
533 |
return 0; } |
1860.2.2
by Stewart Smith
add initial implementation of storage_engine_api_tester. It's a storage engine with a bunch of asserts on state transations to test that the upper layer is calling the StorageEngine API correctly. |
534 |
virtual int doRollbackToSavepoint(Session*, |
535 |
drizzled::NamedSavepoint &) |
|
1947.1.20
by Stewart Smith
start a test for SEAPITester for savepoints. Taking David's small test case r.e. txn log and savepoints and adding engine_state transitions for savepoints. Currently, from looking at the log you can see that the calls are never made to the engine and the test case fails (because the savepoint wasn't created |
536 |
{
|
537 |
ENGINE_NEW_STATE("ROLLBACK TO SAVEPOINT"); |
|
1947.1.23
by Stewart Smith
fix up savepoint states in SEAPITester |
538 |
ENGINE_NEW_STATE("In Transaction"); |
1947.1.20
by Stewart Smith
start a test for SEAPITester for savepoints. Taking David's small test case r.e. txn log and savepoints and adding engine_state transitions for savepoints. Currently, from looking at the log you can see that the calls are never made to the engine and the test case fails (because the savepoint wasn't created |
539 |
return 0; } |
1860.2.2
by Stewart Smith
add initial implementation of storage_engine_api_tester. It's a storage engine with a bunch of asserts on state transations to test that the upper layer is calling the StorageEngine API correctly. |
540 |
virtual int doReleaseSavepoint(Session*, |
541 |
drizzled::NamedSavepoint &) |
|
1947.1.20
by Stewart Smith
start a test for SEAPITester for savepoints. Taking David's small test case r.e. txn log and savepoints and adding engine_state transitions for savepoints. Currently, from looking at the log you can see that the calls are never made to the engine and the test case fails (because the savepoint wasn't created |
542 |
{
|
543 |
ENGINE_NEW_STATE("RELEASE SAVEPOINT"); |
|
1947.1.23
by Stewart Smith
fix up savepoint states in SEAPITester |
544 |
ENGINE_NEW_STATE("In Transaction"); |
1947.1.20
by Stewart Smith
start a test for SEAPITester for savepoints. Taking David's small test case r.e. txn log and savepoints and adding engine_state transitions for savepoints. Currently, from looking at the log you can see that the calls are never made to the engine and the test case fails (because the savepoint wasn't created |
545 |
return 0; } |
1860.2.2
by Stewart Smith
add initial implementation of storage_engine_api_tester. It's a storage engine with a bunch of asserts on state transations to test that the upper layer is calling the StorageEngine API correctly. |
546 |
virtual int doCommit(Session*, bool); |
547 |
||
548 |
virtual int doRollback(Session*, bool); |
|
1947.1.7
by Stewart Smith
actually make storage_engine_api_tester rnd_pos test actually use our engine. Modify our wrapper so taht it does go through all the correct things. OH MY THE BUGS (or weird ways that the API gets called |
549 |
|
550 |
uint32_t max_supported_record_length(void) const { |
|
551 |
ENGINE_NEW_STATE("::max_supported_record_length()"); |
|
552 |
return getRealEngine()->max_supported_record_length(); |
|
553 |
}
|
|
554 |
||
555 |
uint32_t max_supported_keys(void) const { |
|
556 |
ENGINE_NEW_STATE("::max_supported_keys()"); |
|
557 |
return getRealEngine()->max_supported_keys(); |
|
558 |
}
|
|
559 |
||
560 |
uint32_t max_supported_key_parts(void) const { |
|
561 |
ENGINE_NEW_STATE("::max_supported_key_parts()"); |
|
562 |
return getRealEngine()->max_supported_key_parts(); |
|
563 |
}
|
|
564 |
||
565 |
uint32_t max_supported_key_length(void) const { |
|
566 |
ENGINE_NEW_STATE("::max_supported_key_length()"); |
|
567 |
return getRealEngine()->max_supported_key_length(); |
|
568 |
}
|
|
569 |
||
570 |
uint32_t max_supported_key_part_length(void) const { |
|
571 |
ENGINE_NEW_STATE("::max_supported_key_part_length()"); |
|
572 |
return getRealEngine()->max_supported_key_part_length(); |
|
573 |
}
|
|
574 |
||
2170.6.7
by Stewart Smith
move index_flags() to engine where it belongs in SEAPITester |
575 |
/* just copied from innobase... */
|
576 |
uint32_t index_flags(enum ha_key_alg) const |
|
577 |
{
|
|
578 |
return (HA_READ_NEXT | |
|
579 |
HA_READ_PREV | |
|
580 |
HA_READ_RANGE | |
|
581 |
HA_READ_ORDER | |
|
582 |
HA_KEYREAD_ONLY); |
|
583 |
}
|
|
584 |
||
1860.2.2
by Stewart Smith
add initial implementation of storage_engine_api_tester. It's a storage engine with a bunch of asserts on state transations to test that the upper layer is calling the StorageEngine API correctly. |
585 |
};
|
586 |
||
2087.4.2
by Brian Aker
Modify TableIdentifier to fit with the rest of the identifiers. |
587 |
bool SEAPITester::doDoesTableExist(Session &session, const identifier::Table &identifier) |
1947.1.2
by Stewart Smith
storage_engine_api_tester starts to become a filter to a 'real' engine (innobase) verifying the call sequence of things rather than just an isolated engine that does nothing. We also need to get access at some more things from StorageEngine. Yes, they should be protected - but C++ is being hateful to me. |
588 |
{
|
589 |
return getRealEngine()->doDoesTableExist(session, identifier); |
|
590 |
}
|
|
591 |
||
592 |
void SEAPITester::doGetTableIdentifiers(drizzled::CachedDirectory &cd, |
|
2087.4.1
by Brian Aker
Merge in schema identifier. |
593 |
const drizzled::identifier::Schema &si, |
2087.4.2
by Brian Aker
Modify TableIdentifier to fit with the rest of the identifiers. |
594 |
drizzled::identifier::Table::vector &ti) |
1947.1.2
by Stewart Smith
storage_engine_api_tester starts to become a filter to a 'real' engine (innobase) verifying the call sequence of things rather than just an isolated engine that does nothing. We also need to get access at some more things from StorageEngine. Yes, they should be protected - but C++ is being hateful to me. |
595 |
{
|
596 |
return getRealEngine()->doGetTableIdentifiers(cd, si, ti); |
|
597 |
}
|
|
598 |
||
599 |
int SEAPITester::doCreateTable(Session& session, |
|
600 |
Table& table, |
|
2087.4.2
by Brian Aker
Modify TableIdentifier to fit with the rest of the identifiers. |
601 |
const drizzled::identifier::Table &identifier, |
2224.4.2
by Brian Aker
Merge in work around making all passing of table as const. |
602 |
const drizzled::message::Table& create_proto) |
1860.2.2
by Stewart Smith
add initial implementation of storage_engine_api_tester. It's a storage engine with a bunch of asserts on state transations to test that the upper layer is calling the StorageEngine API correctly. |
603 |
{
|
604 |
ENGINE_NEW_STATE("::doCreateTable()"); |
|
605 |
||
1947.1.2
by Stewart Smith
storage_engine_api_tester starts to become a filter to a 'real' engine (innobase) verifying the call sequence of things rather than just an isolated engine that does nothing. We also need to get access at some more things from StorageEngine. Yes, they should be protected - but C++ is being hateful to me. |
606 |
int r= getRealEngine()->doCreateTable(session, table, identifier, create_proto); |
1860.2.2
by Stewart Smith
add initial implementation of storage_engine_api_tester. It's a storage engine with a bunch of asserts on state transations to test that the upper layer is calling the StorageEngine API correctly. |
607 |
|
608 |
ENGINE_NEW_STATE("::SEAPITester()"); |
|
1947.1.2
by Stewart Smith
storage_engine_api_tester starts to become a filter to a 'real' engine (innobase) verifying the call sequence of things rather than just an isolated engine that does nothing. We also need to get access at some more things from StorageEngine. Yes, they should be protected - but C++ is being hateful to me. |
609 |
return r; |
1860.2.2
by Stewart Smith
add initial implementation of storage_engine_api_tester. It's a storage engine with a bunch of asserts on state transations to test that the upper layer is calling the StorageEngine API correctly. |
610 |
}
|
611 |
||
2087.4.2
by Brian Aker
Modify TableIdentifier to fit with the rest of the identifiers. |
612 |
int SEAPITester::doDropTable(Session& session, const identifier::Table &identifier) |
1860.2.2
by Stewart Smith
add initial implementation of storage_engine_api_tester. It's a storage engine with a bunch of asserts on state transations to test that the upper layer is calling the StorageEngine API correctly. |
613 |
{
|
1947.1.2
by Stewart Smith
storage_engine_api_tester starts to become a filter to a 'real' engine (innobase) verifying the call sequence of things rather than just an isolated engine that does nothing. We also need to get access at some more things from StorageEngine. Yes, they should be protected - but C++ is being hateful to me. |
614 |
return getRealEngine()->doDropTable(session, identifier); |
1860.2.2
by Stewart Smith
add initial implementation of storage_engine_api_tester. It's a storage engine with a bunch of asserts on state transations to test that the upper layer is calling the StorageEngine API correctly. |
615 |
}
|
616 |
||
1947.1.2
by Stewart Smith
storage_engine_api_tester starts to become a filter to a 'real' engine (innobase) verifying the call sequence of things rather than just an isolated engine that does nothing. We also need to get access at some more things from StorageEngine. Yes, they should be protected - but C++ is being hateful to me. |
617 |
int SEAPITester::doGetTableDefinition(Session& session, |
2087.4.2
by Brian Aker
Modify TableIdentifier to fit with the rest of the identifiers. |
618 |
const identifier::Table &identifier, |
1860.2.8
by Stewart Smith
update state transitions in Storage Engine API tester to match reality (well, mostly). The series of calls is rather screwy. also implement Cursor states and enough to run a simple SELECT statement. |
619 |
drizzled::message::Table &table) |
620 |
{
|
|
1947.1.2
by Stewart Smith
storage_engine_api_tester starts to become a filter to a 'real' engine (innobase) verifying the call sequence of things rather than just an isolated engine that does nothing. We also need to get access at some more things from StorageEngine. Yes, they should be protected - but C++ is being hateful to me. |
621 |
return getRealEngine()->doGetTableDefinition(session, identifier, table); |
1860.2.8
by Stewart Smith
update state transitions in Storage Engine API tester to match reality (well, mostly). The series of calls is rather screwy. also implement Cursor states and enough to run a simple SELECT statement. |
622 |
}
|
623 |
||
1947.1.2
by Stewart Smith
storage_engine_api_tester starts to become a filter to a 'real' engine (innobase) verifying the call sequence of things rather than just an isolated engine that does nothing. We also need to get access at some more things from StorageEngine. Yes, they should be protected - but C++ is being hateful to me. |
624 |
int SEAPITester::doStartTransaction(Session *session, |
625 |
start_transaction_option_t opt) |
|
1860.2.2
by Stewart Smith
add initial implementation of storage_engine_api_tester. It's a storage engine with a bunch of asserts on state transations to test that the upper layer is calling the StorageEngine API correctly. |
626 |
{
|
627 |
ENGINE_NEW_STATE("BEGIN"); |
|
1947.1.1
by Stewart Smith
extent Storage Engine API Tester plugin to test simple multi statement transactions and expand around COMMIT/ROLLBACK of individual statements. |
628 |
ENGINE_NEW_STATE("In Transaction"); |
1860.2.2
by Stewart Smith
add initial implementation of storage_engine_api_tester. It's a storage engine with a bunch of asserts on state transations to test that the upper layer is calling the StorageEngine API correctly. |
629 |
|
1947.1.2
by Stewart Smith
storage_engine_api_tester starts to become a filter to a 'real' engine (innobase) verifying the call sequence of things rather than just an isolated engine that does nothing. We also need to get access at some more things from StorageEngine. Yes, they should be protected - but C++ is being hateful to me. |
630 |
return getRealEngine()->startTransaction(session, opt); |
1860.2.2
by Stewart Smith
add initial implementation of storage_engine_api_tester. It's a storage engine with a bunch of asserts on state transations to test that the upper layer is calling the StorageEngine API correctly. |
631 |
}
|
632 |
||
1947.1.2
by Stewart Smith
storage_engine_api_tester starts to become a filter to a 'real' engine (innobase) verifying the call sequence of things rather than just an isolated engine that does nothing. We also need to get access at some more things from StorageEngine. Yes, they should be protected - but C++ is being hateful to me. |
633 |
void SEAPITester::doStartStatement(Session *session) |
1860.2.2
by Stewart Smith
add initial implementation of storage_engine_api_tester. It's a storage engine with a bunch of asserts on state transations to test that the upper layer is calling the StorageEngine API correctly. |
634 |
{
|
635 |
ENGINE_NEW_STATE("START STATEMENT"); |
|
1947.1.2
by Stewart Smith
storage_engine_api_tester starts to become a filter to a 'real' engine (innobase) verifying the call sequence of things rather than just an isolated engine that does nothing. We also need to get access at some more things from StorageEngine. Yes, they should be protected - but C++ is being hateful to me. |
636 |
return getRealEngine()->startStatement(session); |
1860.2.2
by Stewart Smith
add initial implementation of storage_engine_api_tester. It's a storage engine with a bunch of asserts on state transations to test that the upper layer is calling the StorageEngine API correctly. |
637 |
}
|
638 |
||
1947.1.2
by Stewart Smith
storage_engine_api_tester starts to become a filter to a 'real' engine (innobase) verifying the call sequence of things rather than just an isolated engine that does nothing. We also need to get access at some more things from StorageEngine. Yes, they should be protected - but C++ is being hateful to me. |
639 |
void SEAPITester::doEndStatement(Session *session) |
1860.2.2
by Stewart Smith
add initial implementation of storage_engine_api_tester. It's a storage engine with a bunch of asserts on state transations to test that the upper layer is calling the StorageEngine API correctly. |
640 |
{
|
641 |
ENGINE_NEW_STATE("END STATEMENT"); |
|
1947.1.2
by Stewart Smith
storage_engine_api_tester starts to become a filter to a 'real' engine (innobase) verifying the call sequence of things rather than just an isolated engine that does nothing. We also need to get access at some more things from StorageEngine. Yes, they should be protected - but C++ is being hateful to me. |
642 |
return getRealEngine()->endStatement(session); |
1860.2.2
by Stewart Smith
add initial implementation of storage_engine_api_tester. It's a storage engine with a bunch of asserts on state transations to test that the upper layer is calling the StorageEngine API correctly. |
643 |
}
|
644 |
||
1947.1.2
by Stewart Smith
storage_engine_api_tester starts to become a filter to a 'real' engine (innobase) verifying the call sequence of things rather than just an isolated engine that does nothing. We also need to get access at some more things from StorageEngine. Yes, they should be protected - but C++ is being hateful to me. |
645 |
int SEAPITester::doCommit(Session *session, bool all) |
1860.2.2
by Stewart Smith
add initial implementation of storage_engine_api_tester. It's a storage engine with a bunch of asserts on state transations to test that the upper layer is calling the StorageEngine API correctly. |
646 |
{
|
2070.5.1
by Stewart Smith
make the all parameter in TransactionalStorageEngine::doCommit() not be a lie. In Transactionservices, work out if we're commiting the full transaction instead of each engine having to do session_test_options for autocommit/begin. |
647 |
if (all) |
1947.1.1
by Stewart Smith
extent Storage Engine API Tester plugin to test simple multi statement transactions and expand around COMMIT/ROLLBACK of individual statements. |
648 |
{
|
649 |
ENGINE_NEW_STATE("COMMIT"); |
|
650 |
ENGINE_NEW_STATE("::SEAPITester()"); |
|
651 |
}
|
|
652 |
else
|
|
653 |
{
|
|
654 |
ENGINE_NEW_STATE("COMMIT STATEMENT"); |
|
655 |
ENGINE_NEW_STATE("In Transaction"); |
|
656 |
}
|
|
1947.1.2
by Stewart Smith
storage_engine_api_tester starts to become a filter to a 'real' engine (innobase) verifying the call sequence of things rather than just an isolated engine that does nothing. We also need to get access at some more things from StorageEngine. Yes, they should be protected - but C++ is being hateful to me. |
657 |
return getRealEngine()->commit(session, all); |
1860.2.2
by Stewart Smith
add initial implementation of storage_engine_api_tester. It's a storage engine with a bunch of asserts on state transations to test that the upper layer is calling the StorageEngine API correctly. |
658 |
}
|
659 |
||
1947.1.2
by Stewart Smith
storage_engine_api_tester starts to become a filter to a 'real' engine (innobase) verifying the call sequence of things rather than just an isolated engine that does nothing. We also need to get access at some more things from StorageEngine. Yes, they should be protected - but C++ is being hateful to me. |
660 |
int SEAPITester::doRollback(Session *session, bool all) |
1860.2.2
by Stewart Smith
add initial implementation of storage_engine_api_tester. It's a storage engine with a bunch of asserts on state transations to test that the upper layer is calling the StorageEngine API correctly. |
661 |
{
|
2070.6.1
by Stewart Smith
make the all parameter in TransactionalStorageEngine::doRollback() not be a lie. In Transactionservices, work out if we're commiting the full transaction instead of each engine having to do session_test_options for rollback. |
662 |
if (all) |
1947.1.12
by Stewart Smith
also need correct code in doRollback for strange-arse stupid way we do autocommit. |
663 |
{
|
664 |
ENGINE_NEW_STATE("ROLLBACK"); |
|
665 |
ENGINE_NEW_STATE("::SEAPITester()"); |
|
666 |
}
|
|
667 |
else
|
|
1947.1.1
by Stewart Smith
extent Storage Engine API Tester plugin to test simple multi statement transactions and expand around COMMIT/ROLLBACK of individual statements. |
668 |
{
|
669 |
ENGINE_NEW_STATE("ROLLBACK STATEMENT"); |
|
670 |
ENGINE_NEW_STATE("In Transaction"); |
|
671 |
}
|
|
1947.1.12
by Stewart Smith
also need correct code in doRollback for strange-arse stupid way we do autocommit. |
672 |
|
1947.1.2
by Stewart Smith
storage_engine_api_tester starts to become a filter to a 'real' engine (innobase) verifying the call sequence of things rather than just an isolated engine that does nothing. We also need to get access at some more things from StorageEngine. Yes, they should be protected - but C++ is being hateful to me. |
673 |
return getRealEngine()->rollback(session, all); |
1860.2.2
by Stewart Smith
add initial implementation of storage_engine_api_tester. It's a storage engine with a bunch of asserts on state transations to test that the upper layer is calling the StorageEngine API correctly. |
674 |
}
|
675 |
||
1947.1.4
by Stewart Smith
have SEAPITester be a friend of StorageEngine instead of changing 'protected' to 'public' for some methods. |
676 |
} /* namespace plugin */ |
677 |
} /* namespace drizzled */ |
|
678 |
||
1860.2.2
by Stewart Smith
add initial implementation of storage_engine_api_tester. It's a storage engine with a bunch of asserts on state transations to test that the upper layer is calling the StorageEngine API correctly. |
679 |
static int seapi_tester_init(drizzled::module::Context &context) |
680 |
{
|
|
1860.2.11
by Stewart Smith
add small noinst program to generate a dot graph of the Storage Engine API states from the transition multimap |
681 |
load_engine_state_transitions(engine_state_transitions); |
1860.2.14
by Stewart Smith
in Storage Engine API Tester: add cursor_states_to_dot utility |
682 |
load_cursor_state_transitions(cursor_state_transitions); |
1860.2.2
by Stewart Smith
add initial implementation of storage_engine_api_tester. It's a storage engine with a bunch of asserts on state transations to test that the upper layer is calling the StorageEngine API correctly. |
683 |
engine_state= "INIT"; |
684 |
||
1947.1.4
by Stewart Smith
have SEAPITester be a friend of StorageEngine instead of changing 'protected' to 'public' for some methods. |
685 |
context.add(new plugin::SEAPITester(engine_name)); |
1947.1.13
by Stewart Smith
add SEAPITester test for incorrect txn log contents on LOCK WAIT TIMEOUT |
686 |
|
687 |
context.add(new plugin::Create_function<SEAPITesterErrorInjectFunc>("seapitester_error_inject")); |
|
688 |
||
2077.3.1
by Stewart Smith
add storing of history of engine states to storage_engine_api_tester. We get a DATA_DICTIONARY table that lists the states and a function to clear it. |
689 |
engine_state_history_table_initialize(context); |
690 |
||
1860.2.2
by Stewart Smith
add initial implementation of storage_engine_api_tester. It's a storage engine with a bunch of asserts on state transations to test that the upper layer is calling the StorageEngine API correctly. |
691 |
return 0; |
692 |
}
|
|
693 |
||
694 |
DRIZZLE_DECLARE_PLUGIN
|
|
695 |
{
|
|
696 |
DRIZZLE_VERSION_ID, |
|
697 |
"SEAPITESTER", |
|
698 |
"1.0", |
|
699 |
"Stewart Smith", |
|
700 |
"Test the Storage Engine API callls are in correct order", |
|
701 |
PLUGIN_LICENSE_GPL, |
|
702 |
seapi_tester_init, /* Plugin Init */ |
|
2095.3.1
by Monty Taylor
Re-purpose the old plugin sysvar slot in the struct to be a depends list. |
703 |
NULL, /* depends */ |
1860.2.2
by Stewart Smith
add initial implementation of storage_engine_api_tester. It's a storage engine with a bunch of asserts on state transations to test that the upper layer is calling the StorageEngine API correctly. |
704 |
NULL /* config options */ |
705 |
}
|
|
706 |
DRIZZLE_DECLARE_PLUGIN_END; |