Commit 4b6e1f0b authored by Leif Walsh's avatar Leif Walsh Committed by Yoni Fogel

committed too much

git-svn-id: file:///svn/toku/tokudb@35542 c7de825b-a66e-492c-adef-691d508d4ae1
parent 43628dab
/* -*- mode: C; c-basic-offset: 4 -*- */ /* -*- mode: C; c-basic-offset: 4 -*- */
#ident "$Id$" #ident "$Id: orthopush-flush.c 35539 2011-10-11 02:13:02Z leifwalsh $"
#ident "Copyright (c) 2007-2011 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007-2011 Tokutek Inc. All rights reserved."
#include "test.h" #include "test.h"
...@@ -33,13 +33,14 @@ rand_bytes(void *dest, int size) ...@@ -33,13 +33,14 @@ rand_bytes(void *dest, int size)
} }
} }
#if 0
static void static void
rand_bytes_limited(void *dest, int size) rand_bytes_limited(void *dest, int size)
{ {
long *l; long *l;
for (l = dest; (unsigned int) size >= (sizeof *l); ++l, size -= (sizeof *l)) { for (l = dest; (unsigned int) size >= (sizeof *l); ++l, size -= (sizeof *l)) {
char c = random() & 0xff; char c = random() & 0xff;
unsigned int i = 0; int i = 0;
for (char *p = (char *) l; i < (sizeof *l); ++i) { for (char *p = (char *) l; i < (sizeof *l); ++i) {
*p = c; *p = c;
} }
...@@ -49,6 +50,7 @@ rand_bytes_limited(void *dest, int size) ...@@ -49,6 +50,7 @@ rand_bytes_limited(void *dest, int size)
*p = c; *p = c;
} }
} }
#endif
static void static void
insert_random_message(NONLEAF_CHILDINFO bnc, BRT_MSG_S **save, bool *is_fresh_out, XIDS xids, int pfx) insert_random_message(NONLEAF_CHILDINFO bnc, BRT_MSG_S **save, bool *is_fresh_out, XIDS xids, int pfx)
...@@ -83,6 +85,7 @@ insert_random_message(NONLEAF_CHILDINFO bnc, BRT_MSG_S **save, bool *is_fresh_ou ...@@ -83,6 +85,7 @@ insert_random_message(NONLEAF_CHILDINFO bnc, BRT_MSG_S **save, bool *is_fresh_ou
assert_zero(r); assert_zero(r);
} }
#if 0
static void static void
insert_random_message_to_leaf(BRT t, BASEMENTNODE blb, LEAFENTRY *save, XIDS xids, int pfx) insert_random_message_to_leaf(BRT t, BASEMENTNODE blb, LEAFENTRY *save, XIDS xids, int pfx)
{ {
...@@ -94,6 +97,7 @@ insert_random_message_to_leaf(BRT t, BASEMENTNODE blb, LEAFENTRY *save, XIDS xid ...@@ -94,6 +97,7 @@ insert_random_message_to_leaf(BRT t, BASEMENTNODE blb, LEAFENTRY *save, XIDS xid
rand_bytes_limited((char *) key + (sizeof pfx), keylen); rand_bytes_limited((char *) key + (sizeof pfx), keylen);
rand_bytes(val, vallen); rand_bytes(val, vallen);
MSN msn = next_dummymsn(); MSN msn = next_dummymsn();
bool is_fresh = (random() & 0x100) == 0;
DBT *keydbt, *valdbt; DBT *keydbt, *valdbt;
keydbt = toku_xmalloc(sizeof *keydbt); keydbt = toku_xmalloc(sizeof *keydbt);
...@@ -159,6 +163,7 @@ insert_random_update_message(NONLEAF_CHILDINFO bnc, BRT_MSG_S **save, bool *is_f ...@@ -159,6 +163,7 @@ insert_random_update_message(NONLEAF_CHILDINFO bnc, BRT_MSG_S **save, bool *is_f
NULL, dummy_cmp); NULL, dummy_cmp);
assert_zero(r); assert_zero(r);
} }
#endif
const int M = 1024 * 1024; const int M = 1024 * 1024;
...@@ -417,6 +422,7 @@ flush_to_internal_multiple(BRT t) { ...@@ -417,6 +422,7 @@ flush_to_internal_multiple(BRT t) {
toku_free(child_messages_is_fresh); toku_free(child_messages_is_fresh);
} }
#if 0
static void static void
flush_to_leaf(BRT t, bool make_leaf_up_to_date, bool use_flush) { flush_to_leaf(BRT t, bool make_leaf_up_to_date, bool use_flush) {
int r; int r;
...@@ -451,7 +457,7 @@ flush_to_leaf(BRT t, bool make_leaf_up_to_date, bool use_flush) { ...@@ -451,7 +457,7 @@ flush_to_leaf(BRT t, bool make_leaf_up_to_date, bool use_flush) {
u_int32_t keylen; u_int32_t keylen;
char *key = le_key_and_len(child_messages[i], &keylen); char *key = le_key_and_len(child_messages[i], &keylen);
DBT keydbt; DBT keydbt;
if (dummy_cmp(NULL, toku_fill_dbt(&keydbt, key, keylen), &childkeys[i%8]) > 0) { if (dummy_cmp(NULL, toku_fill_dbt(&keydbt, key, keylen), childkeys[i%8]) > 0) {
toku_fill_dbt(&childkeys[i%8], key, keylen); toku_fill_dbt(&childkeys[i%8], key, keylen);
} }
} }
...@@ -484,13 +490,9 @@ flush_to_leaf(BRT t, bool make_leaf_up_to_date, bool use_flush) { ...@@ -484,13 +490,9 @@ flush_to_leaf(BRT t, bool make_leaf_up_to_date, bool use_flush) {
toku_apply_cmd_to_leaf(t, child, parent_messages[i], &made_change, &workdone, NULL, NULL); toku_apply_cmd_to_leaf(t, child, parent_messages[i], &made_change, &workdone, NULL, NULL);
} }
} }
for (i = 0; i < 8; ++i) { child->stale_ancestor_messages_applied = true;
BLB(child, i)->stale_ancestor_messages_applied = true;
}
} else { } else {
for (i = 0; i < 8; ++i) { child->stale_ancestor_messages_applied = false;
BLB(child, i)->stale_ancestor_messages_applied = false;
}
} }
if (use_flush) { if (use_flush) {
...@@ -499,9 +501,9 @@ flush_to_leaf(BRT t, bool make_leaf_up_to_date, bool use_flush) { ...@@ -499,9 +501,9 @@ flush_to_leaf(BRT t, bool make_leaf_up_to_date, bool use_flush) {
BRTNODE XMALLOC(parentnode); BRTNODE XMALLOC(parentnode);
BLOCKNUM parentblocknum = { 17 }; BLOCKNUM parentblocknum = { 17 };
toku_initialize_empty_brtnode(parentnode, parentblocknum, 1, 1, BRT_LAYOUT_VERSION, 4*M, 0); toku_initialize_empty_brtnode(parentnode, parentblocknum, 1, 1, BRT_LAYOUT_VERSION, 4*M, 0);
destroy_nonleaf_childinfo(BNC(parentnode, 0)); destroy_nonleaf_childinfo(BNC(parent, 0));
set_BNC(parentnode, 0, parent_bnc); set_BNC(parent, 0, parent_bnc);
BP_STATE(parentnode, 0) = PT_AVAIL; BP_STATE(parent, 0) = PT_AVAIL;
struct ancestors ancestors = { .node = parentnode, .childnum = 0, .next = NULL }; struct ancestors ancestors = { .node = parentnode, .childnum = 0, .next = NULL };
const struct pivot_bounds infinite_bounds = { .lower_bound_exclusive = NULL, .upper_bound_inclusive = NULL }; const struct pivot_bounds infinite_bounds = { .lower_bound_exclusive = NULL, .upper_bound_inclusive = NULL };
maybe_apply_ancestors_messages_to_node(t, child, &ancestors, &infinite_bounds); maybe_apply_ancestors_messages_to_node(t, child, &ancestors, &infinite_bounds);
...@@ -587,6 +589,7 @@ flush_to_leaf(BRT t, bool make_leaf_up_to_date, bool use_flush) { ...@@ -587,6 +589,7 @@ flush_to_leaf(BRT t, bool make_leaf_up_to_date, bool use_flush) {
toku_free(parent_messages_is_fresh); toku_free(parent_messages_is_fresh);
toku_free(child_messages_is_fresh); toku_free(child_messages_is_fresh);
} }
#endif
int int
test_main (int argc, const char *argv[]) { test_main (int argc, const char *argv[]) {
...@@ -608,6 +611,7 @@ test_main (int argc, const char *argv[]) { ...@@ -608,6 +611,7 @@ test_main (int argc, const char *argv[]) {
for (int i = 0; i < 10; ++i) { for (int i = 0; i < 10; ++i) {
flush_to_internal_multiple(t); flush_to_internal_multiple(t);
} }
#if 0
r = toku_brt_set_update(t, orthopush_flush_update_fun); assert(r==0); r = toku_brt_set_update(t, orthopush_flush_update_fun); assert(r==0);
for (int i = 0; i < 10; ++i) { for (int i = 0; i < 10; ++i) {
flush_to_leaf(t, false, false); flush_to_leaf(t, false, false);
...@@ -615,6 +619,7 @@ test_main (int argc, const char *argv[]) { ...@@ -615,6 +619,7 @@ test_main (int argc, const char *argv[]) {
flush_to_leaf(t, true, false); flush_to_leaf(t, true, false);
flush_to_leaf(t, true, true); flush_to_leaf(t, true, true);
} }
#endif
r = toku_close_brt(t, 0); assert(r==0); r = toku_close_brt(t, 0); assert(r==0);
r = toku_cachetable_close(&ct); assert(r==0); r = toku_cachetable_close(&ct); assert(r==0);
......
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