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 -*- */
#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."
#include "test.h"
......@@ -33,13 +33,14 @@ rand_bytes(void *dest, int size)
}
}
#if 0
static void
rand_bytes_limited(void *dest, int size)
{
long *l;
for (l = dest; (unsigned int) size >= (sizeof *l); ++l, size -= (sizeof *l)) {
char c = random() & 0xff;
unsigned int i = 0;
int i = 0;
for (char *p = (char *) l; i < (sizeof *l); ++i) {
*p = c;
}
......@@ -49,6 +50,7 @@ rand_bytes_limited(void *dest, int size)
*p = c;
}
}
#endif
static void
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
assert_zero(r);
}
#if 0
static void
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
rand_bytes_limited((char *) key + (sizeof pfx), keylen);
rand_bytes(val, vallen);
MSN msn = next_dummymsn();
bool is_fresh = (random() & 0x100) == 0;
DBT *keydbt, *valdbt;
keydbt = toku_xmalloc(sizeof *keydbt);
......@@ -159,6 +163,7 @@ insert_random_update_message(NONLEAF_CHILDINFO bnc, BRT_MSG_S **save, bool *is_f
NULL, dummy_cmp);
assert_zero(r);
}
#endif
const int M = 1024 * 1024;
......@@ -417,6 +422,7 @@ flush_to_internal_multiple(BRT t) {
toku_free(child_messages_is_fresh);
}
#if 0
static void
flush_to_leaf(BRT t, bool make_leaf_up_to_date, bool use_flush) {
int r;
......@@ -451,7 +457,7 @@ flush_to_leaf(BRT t, bool make_leaf_up_to_date, bool use_flush) {
u_int32_t keylen;
char *key = le_key_and_len(child_messages[i], &keylen);
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);
}
}
......@@ -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);
}
}
for (i = 0; i < 8; ++i) {
BLB(child, i)->stale_ancestor_messages_applied = true;
}
child->stale_ancestor_messages_applied = true;
} else {
for (i = 0; i < 8; ++i) {
BLB(child, i)->stale_ancestor_messages_applied = false;
}
child->stale_ancestor_messages_applied = false;
}
if (use_flush) {
......@@ -499,9 +501,9 @@ flush_to_leaf(BRT t, bool make_leaf_up_to_date, bool use_flush) {
BRTNODE XMALLOC(parentnode);
BLOCKNUM parentblocknum = { 17 };
toku_initialize_empty_brtnode(parentnode, parentblocknum, 1, 1, BRT_LAYOUT_VERSION, 4*M, 0);
destroy_nonleaf_childinfo(BNC(parentnode, 0));
set_BNC(parentnode, 0, parent_bnc);
BP_STATE(parentnode, 0) = PT_AVAIL;
destroy_nonleaf_childinfo(BNC(parent, 0));
set_BNC(parent, 0, parent_bnc);
BP_STATE(parent, 0) = PT_AVAIL;
struct ancestors ancestors = { .node = parentnode, .childnum = 0, .next = 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);
......@@ -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(child_messages_is_fresh);
}
#endif
int
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) {
flush_to_internal_multiple(t);
}
#if 0
r = toku_brt_set_update(t, orthopush_flush_update_fun); assert(r==0);
for (int i = 0; i < 10; ++i) {
flush_to_leaf(t, false, false);
......@@ -615,6 +619,7 @@ test_main (int argc, const char *argv[]) {
flush_to_leaf(t, true, false);
flush_to_leaf(t, true, true);
}
#endif
r = toku_close_brt(t, 0); 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