Commit a6837f9e authored by Yoni Fogel's avatar Yoni Fogel

Addresses #1125 [t:1125] Modified test4 to be more comprehensive, reduced...

Addresses #1125 [t:1125] Modified test4 to be more comprehensive, reduced iterations to 64 to reduce load on nightly testing

git-svn-id: file:///svn/toku/tokudb@13813 c7de825b-a66e-492c-adef-691d508d4ae1
parent 471d9906
...@@ -236,7 +236,7 @@ test_main(int argc, char *argv[]) { ...@@ -236,7 +236,7 @@ test_main(int argc, char *argv[]) {
initialize_values(); initialize_values();
int i; int i;
setup_db(); setup_db();
for (i = 0; i < 100; i++) { for (i = 0; i < 64; i++) {
test_txn_nested_jumble(i); test_txn_nested_jumble(i);
} }
close_db(); close_db();
......
...@@ -14,20 +14,25 @@ ...@@ -14,20 +14,25 @@
/********************* /*********************
* *
* Purpose of this test is to verify nested transactions (support right number of possible values) * Purpose of this test is to verify nested transactions, including support for implicit promotion
* in the presence of placeholders and branched trees of transactions.
*
create empty db create empty db
for test = 1 to MAX for test = 1 to MAX
for nesting level 0 for nesting level 0
- randomly insert or not - randomly insert or not
for nesting_level = 1 to MAX for nesting_level = 1 to MAX
- begin txn - begin txn
- randomly one of (insert, delete, do nothing) - randomly perform four operations, each of which is one of (insert, delete, do nothing)
- if insert, use a value/len unique to this txn - if insert, use a value/len unique to this txn
- query to verify - query to verify
for nesting level = MAX to 1 for nesting level = MAX to 1
- randomly abort or commit each transaction - randomly abort or commit each transaction or
- insert or delete at same level (followed by either abort/commit)
- branch (add more child txns similar to above)
- query to verify - query to verify
delete db delete db
*
*/ */
...@@ -41,6 +46,7 @@ u_int8_t types [MAX_NEST]; ...@@ -41,6 +46,7 @@ u_int8_t types [MAX_NEST];
u_int8_t currval[MAX_NEST]; u_int8_t currval[MAX_NEST];
DB_TXN *txns [MAX_NEST]; DB_TXN *txns [MAX_NEST];
DB_TXN *txn_query; DB_TXN *txn_query;
DB_TXN *patient_txn;
int which_expected; int which_expected;
static void static void
...@@ -225,11 +231,13 @@ test_txn_nested_jumble (int iteration) { ...@@ -225,11 +231,13 @@ test_txn_nested_jumble (int iteration) {
if (verbose) { fprintf(stderr, "%s (%s):%d [iteration # %d]\n", __FILE__, __FUNCTION__, __LINE__, iteration); fflush(stderr); } if (verbose) { fprintf(stderr, "%s (%s):%d [iteration # %d]\n", __FILE__, __FUNCTION__, __LINE__, iteration); fflush(stderr); }
initialize_db(); initialize_db();
r = env->txn_begin(env, NULL, &patient_txn, 0);
CKERR(r);
//BELOW IS OLD CODE
int index_of_expected_value = MAX_NEST - 1; int index_of_expected_value = MAX_NEST - 1;
int nest_level = MAX_NEST - 1; int nest_level = MAX_NEST - 1;
int min_allowed_branch_level = MAX_NEST - 2; int min_allowed_branch_level = MAX_NEST - 2;
futz_with_stack:
while (nest_level > 0) { while (nest_level > 0) {
int operation = random() % 4; int operation = random() % 4;
switch (operation) { switch (operation) {
...@@ -278,6 +286,25 @@ test_txn_nested_jumble (int iteration) { ...@@ -278,6 +286,25 @@ test_txn_nested_jumble (int iteration) {
assert(FALSE); assert(FALSE);
} }
} }
//All transactions that have touched this key are finished.
assert(nest_level == 0);
if (min_allowed_branch_level >= 0) {
//start new subtree
int max = 4;
assert(patient_txn);
txns[1] = patient_txn;
patient_txn = NULL;
maybe_insert_or_delete(1, randomize_no_placeholder_type());
int branch_level;
for (branch_level = 2; branch_level <= max; branch_level++) {
start_txn_and_maybe_insert_or_delete(branch_level);
}
nest_level = max;
min_allowed_branch_level = -1;
index_of_expected_value = nest_level;
goto futz_with_stack;
}
//Clean out dictionary //Clean out dictionary
types[0] = TYPE_DELETE; types[0] = TYPE_DELETE;
...@@ -292,7 +319,7 @@ test_main(int argc, char *argv[]) { ...@@ -292,7 +319,7 @@ test_main(int argc, char *argv[]) {
initialize_values(); initialize_values();
int i; int i;
setup_db(); setup_db();
for (i = 0; i < 100; i++) { for (i = 0; i < 64; i++) {
test_txn_nested_jumble(i); test_txn_nested_jumble(i);
} }
close_db(); close_db();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment