mirror of
https://github.com/MariaDB/server.git
synced 2025-01-22 23:04:20 +01:00
Added multiple dictionaries, improved logic to simulate crash.
git-svn-id: file:///svn/toku/tokudb@11468 c7de825b-a66e-492c-adef-691d508d4ae1
This commit is contained in:
parent
1e8c3a4cff
commit
cded4738f5
1 changed files with 38 additions and 23 deletions
|
@ -47,6 +47,9 @@ Each iteration does:
|
|||
|
||||
***/
|
||||
|
||||
#define NUM_DICTIONARIES 5
|
||||
|
||||
|
||||
// assert that correct values are in expected rows
|
||||
static void
|
||||
verify_sequential_rows(DB* compare_db, int64_t firstkey, int64_t numkeys) {
|
||||
|
@ -115,25 +118,13 @@ drop_dead(void) {
|
|||
|
||||
|
||||
void
|
||||
run_test (int iter, int die) {
|
||||
verify_and_insert (DB* db, int iter) {
|
||||
|
||||
int oper_per_iter = 1025;
|
||||
u_int32_t flags = DB_DUP|DB_DUPSORT;
|
||||
|
||||
int64_t firstkey; // first key to verify/insert
|
||||
int64_t numkeys; // number of keys to verify/insert
|
||||
|
||||
env_startup();
|
||||
|
||||
DICTIONARY_S db_alpha;
|
||||
init_dictionary(&db_alpha, flags, "alpha");
|
||||
|
||||
if (iter == 0)
|
||||
dir_create(); // create directory if first time through
|
||||
|
||||
db_startup(&db_alpha, NULL);
|
||||
DB* db= db_alpha.db;
|
||||
|
||||
if (iter > 0){
|
||||
if (iter == 1) {
|
||||
firstkey = 0;
|
||||
|
@ -151,18 +142,42 @@ run_test (int iter, int die) {
|
|||
numkeys = oper_per_iter;
|
||||
|
||||
insert_n_fixed(db, NULL, NULL, firstkey, numkeys);
|
||||
snapshot(NULL, 1); // checkpoint all dictionaries
|
||||
}
|
||||
|
||||
#if 0
|
||||
// now scribble over previously checkpointed rows with different data
|
||||
scribble_n(firstkey, 5);
|
||||
#endif
|
||||
if (die)
|
||||
void
|
||||
run_test (int iter, int die) {
|
||||
|
||||
u_int32_t flags = DB_DUP|DB_DUPSORT;
|
||||
|
||||
int i;
|
||||
|
||||
env_startup();
|
||||
|
||||
if (iter == 0)
|
||||
dir_create(); // create directory if first time through
|
||||
|
||||
// create array of dictionaries
|
||||
// for each dictionary verify previous iterations and perform new inserts
|
||||
|
||||
DICTIONARY_S dictionaries[NUM_DICTIONARIES];
|
||||
for (i = 0; i < NUM_DICTIONARIES; i++) {
|
||||
char name[32];
|
||||
sprintf(name, "stress_%d", i);
|
||||
init_dictionary(&dictionaries[i], flags, name);
|
||||
db_startup(&dictionaries[i], NULL);
|
||||
DB* db = dictionaries[i].db;
|
||||
verify_and_insert(db, iter);
|
||||
}
|
||||
|
||||
// take checkpoint (all dictionaries)
|
||||
snapshot(NULL, 1);
|
||||
|
||||
if (die) {
|
||||
// first scribble over correct data, then die
|
||||
drop_dead();
|
||||
|
||||
db_shutdown(&db_alpha);
|
||||
|
||||
env_shutdown();
|
||||
}
|
||||
else
|
||||
env_shutdown();
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue