Commit 8917e591 authored by Bradley C. Kuszmaul's avatar Bradley C. Kuszmaul

rollback for 5 now runs (but the files are wrong). Started working on a...

rollback for 5 now runs (but the files are wrong).  Started working on a brtdump that will help debug this stuff.  Right away I see important file differences after recover (the unused memory and unnamed root are wrong). Addresses #27.

git-svn-id: file:///svn/tokudb@1731 c7de825b-a66e-492c-adef-691d508d4ae1
parent 9a37bcad
...@@ -107,7 +107,7 @@ check-fanout: ...@@ -107,7 +107,7 @@ check-fanout:
let BRT_FANOUT=BRT_FANOUT+1; \ let BRT_FANOUT=BRT_FANOUT+1; \
done done
pma-test benchmark-test brt-test brt-serialize-test: LDFLAGS+=-lz pma-test benchmark-test brt-test brt-serialize-test brtdump: LDFLAGS+=-lz
# pma: PROF_FLAGS=-fprofile-arcs -ftest-coverage # pma: PROF_FLAGS=-fprofile-arcs -ftest-coverage
BRT_INTERNAL_H_INCLUDES = brt-internal.h cachetable.h fifo.h pma.h brt.h brttypes.h yerror.h ybt.h log.h ../include/db.h kv-pair.h memory.h crc.h BRT_INTERNAL_H_INCLUDES = brt-internal.h cachetable.h fifo.h pma.h brt.h brttypes.h yerror.h ybt.h log.h ../include/db.h kv-pair.h memory.h crc.h
...@@ -150,6 +150,8 @@ benchmark-test.o: brt.h ../include/db.h ...@@ -150,6 +150,8 @@ benchmark-test.o: brt.h ../include/db.h
test-primes: test-primes.o primes.o test-primes: test-primes.o primes.o
brtdump: brtdump.o brt-serialize.o memory.o pma.o key.o fingerprint.o log.o log_code.o roll.o cachetable.o primes.o brt.o ybt.o fifo.o mempool.o brt-verify.o
checko2: checko2:
ifeq ($(OPTFLAGS),-O2) ifeq ($(OPTFLAGS),-O2)
@echo OPTFLAGS=$(OPTFLAGS) ok @echo OPTFLAGS=$(OPTFLAGS) ok
......
...@@ -641,8 +641,8 @@ static int handle_split_of_child (BRT t, BRTNODE node, int childnum, ...@@ -641,8 +641,8 @@ static int handle_split_of_child (BRT t, BRTNODE node, int childnum,
node->u.n.n_cursors[childnum+1] = 0; node->u.n.n_cursors[childnum+1] = 0;
fixup_child_fingerprint(node, childnum, childa); fixup_child_fingerprint(node, childnum, childa);
fixup_child_fingerprint(node, childnum+1, childb); fixup_child_fingerprint(node, childnum+1, childb);
toku_fifo_create(&node->u.n.buffers[childnum]); r=toku_fifo_create(&node->u.n.buffers[childnum]); assert(r==0); // ??? SHould handle this error case
toku_fifo_create(&node->u.n.buffers[childnum+1]); r=toku_fifo_create(&node->u.n.buffers[childnum+1]); assert(r==0);
node->u.n.n_bytes_in_buffer[childnum] = 0; node->u.n.n_bytes_in_buffer[childnum] = 0;
node->u.n.n_bytes_in_buffer[childnum+1] = 0; node->u.n.n_bytes_in_buffer[childnum+1] = 0;
......
/* Tell me the diff between two brt files. */
#include <assert.h>
#include <fcntl.h>
#include "key.h"
#include "brt-internal.h"
void dump_header (int f) {
struct brt_header *h;
int r;
r = toku_deserialize_brtheader_from (f, 0, &h); assert(r==0);
printf("brtheader:\n");
printf(" dirty=%d\n", h->dirty);
printf(" nodesize=%d\n", h->nodesize);
printf(" freelist=%lld\n", h->freelist);
printf(" unused_memory=%lld\n", h->unused_memory);
printf(" unnamed_root=%lld\n", h->unnamed_root);
}
int main (int argc, const char *argv[]) {
assert(argc==2);
const char *n = argv[1];
int f = open(n, O_RDONLY); assert(f>=0);
dump_header(f);
return 0;
}
...@@ -183,6 +183,9 @@ void toku_recover_newbrtnode (struct logtype_newbrtnode *c) { ...@@ -183,6 +183,9 @@ void toku_recover_newbrtnode (struct logtype_newbrtnode *c) {
n->u.n.n_children = 0; n->u.n.n_children = 0;
n->u.n.totalchildkeylens = 0; n->u.n.totalchildkeylens = 0;
n->u.n.n_bytes_in_buffers = 0; n->u.n.n_bytes_in_buffers = 0;
int i;
for (i=0; i<TREE_FANOUT+1; i++)
n->u.n.n_bytes_in_buffer[i]=0;
} }
// Now put it in the cachetable // Now put it in the cachetable
toku_cachetable_put(pair->cf, c->diskoff, n, toku_serialize_brtnode_size(n), toku_brtnode_flush_callback, toku_brtnode_fetch_callback, 0); toku_cachetable_put(pair->cf, c->diskoff, n, toku_serialize_brtnode_size(n), toku_brtnode_flush_callback, toku_brtnode_fetch_callback, 0);
...@@ -205,6 +208,7 @@ int toku_rollback_newbrtnode (struct logtype_newbrtnode *le, TOKUTXN txn) { ...@@ -205,6 +208,7 @@ int toku_rollback_newbrtnode (struct logtype_newbrtnode *le, TOKUTXN txn) {
int toku_rollback_addchild (struct logtype_addchild *le, TOKUTXN txn) ABORTIT int toku_rollback_addchild (struct logtype_addchild *le, TOKUTXN txn) ABORTIT
void toku_recover_addchild (struct logtype_addchild *le) { void toku_recover_addchild (struct logtype_addchild *le) {
printf("%s:%d %s\n", __FILE__, __LINE__, __FUNCTION__);
struct cf_pair *pair; struct cf_pair *pair;
int r = find_cachefile(le->filenum, &pair); int r = find_cachefile(le->filenum, &pair);
assert(r==0); assert(r==0);
...@@ -229,7 +233,7 @@ void toku_recover_addchild (struct logtype_addchild *le) { ...@@ -229,7 +233,7 @@ void toku_recover_addchild (struct logtype_addchild *le) {
node->u.n.childinfos[le->childnum].subtree_fingerprint = 0; node->u.n.childinfos[le->childnum].subtree_fingerprint = 0;
node->u.n.childkeys [le->childnum] = 0; node->u.n.childkeys [le->childnum] = 0;
node->u.n.children [le->childnum] = -1; node->u.n.children [le->childnum] = -1;
node->u.n.buffers [le->childnum] = 0; r= toku_fifo_create(&node->u.n.buffers[le->childnum]); assert(r==0);
node->u.n.n_bytes_in_buffer[le->childnum] = 0; node->u.n.n_bytes_in_buffer[le->childnum] = 0;
node->u.n.n_cursors[le->childnum] = 0; node->u.n.n_cursors[le->childnum] = 0;
node->u.n.n_children++; node->u.n.n_children++;
...@@ -265,6 +269,7 @@ void toku_recover_setpivot (struct logtype_setpivot *le) { ...@@ -265,6 +269,7 @@ void toku_recover_setpivot (struct logtype_setpivot *le) {
BRTNODE node = node_v; BRTNODE node = node_v;
assert(node->height>0); assert(node->height>0);
node->u.n.childkeys[le->childnum] = kv_pair_malloc(le->pivotkey.data, le->pivotkey.len, 0, 0); node->u.n.childkeys[le->childnum] = kv_pair_malloc(le->pivotkey.data, le->pivotkey.len, 0, 0);
node->u.n.totalchildkeylens += toku_brt_pivot_key_len(pair->brt, node->u.n.childkeys[le->childnum]);
r = toku_cachetable_unpin(pair->cf, le->diskoff, 1, toku_serialize_brtnode_size(node)); r = toku_cachetable_unpin(pair->cf, le->diskoff, 1, toku_serialize_brtnode_size(node));
assert(r==0); 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