Commit c0ddd00b authored by Bradley C. Kuszmaul's avatar Bradley C. Kuszmaul

Hacking makefiles. Also make the filenames used by the tests work more reliably. Addresses #782.

git-svn-id: file:///svn/tokudb@3792 c7de825b-a66e-492c-adef-691d508d4ae1
parent 0d00eb5d
# ROOT is the the name of the root of the tokudb make directory heirarchy, starting at the cwd
ROOT =
default: build
VGRIND = valgrind
OPTFLAGS = -O3
CFLAGS = $(OPTFLAGS) -Wall -W -Wcast-align -Wbad-function-cast -Wextra -Wmissing-noreturn -Wmissing-format-attribute -g3 -ggdb3 -Werror -fPIC -Wshadow -fvisibility=hidden
CPPFLAGS = -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_XOPEN_SOURCE=500
LDFLAGS = -lz
DIRS = newbrt
# src cxx utils db-benchmark-test db-benchmark-test-cxx
include $(patsubst %,%/Makefile.include,$(DIRS))
build: $(BINS)
check: $(CHECKS)
ifeq ($(VERBOSE),2)
VERBVERBOSE=-v
MAYBEATSIGN=
else
ifeq ($(VERBOSE),1)
VERBVERBOSE=-q
MAYBEATSIGN=
else
VERBVERBOSE=-q
MAYBEATSIGN=@
endif
endif
ifeq ($(CYGWIN),cygwin)
else
FPICFLAGS = -fPIC
# valgrind is not present on cygwin
VGRIND = valgrind --quiet --error-exitcode=1 --leak-check=yes
endif
%.check: %
$(VGRIND) ./$< $(VERBVERBOSE)
...@@ -32,7 +32,7 @@ endif ...@@ -32,7 +32,7 @@ endif
CFLAGS = -Wall -W -Wcast-align -Wbad-function-cast -Wextra -Wmissing-noreturn -Wmissing-format-attribute $(OPTFLAGS) -g3 -ggdb3 $(GCOV_FLAGS) $(PROF_FLAGS) -Werror $(FPICFLAGS) -Wshadow -fvisibility=hidden CFLAGS = -Wall -W -Wcast-align -Wbad-function-cast -Wextra -Wmissing-noreturn -Wmissing-format-attribute $(OPTFLAGS) -g3 -ggdb3 $(GCOV_FLAGS) $(PROF_FLAGS) -Werror $(FPICFLAGS) -Wshadow -fvisibility=hidden
LDFLAGS = $(OPTFLAGS) -g $(GCOV_FLAGS) $(PROF_FLAGS) LDFLAGS = $(OPTFLAGS) -g $(GCOV_FLAGS) $(PROF_FLAGS)
CPPFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE CPPFLAGS += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_XOPEN_SOURCE=500
leafentry.o: CFLAGS+=-Wconversion leafentry.o: CFLAGS+=-Wconversion
...@@ -85,8 +85,6 @@ REGRESSION_TESTS = \ ...@@ -85,8 +85,6 @@ REGRESSION_TESTS = \
BINS = $(REGRESSION_TESTS) \ BINS = $(REGRESSION_TESTS) \
benchmark-test \ benchmark-test \
brtdump \ brtdump \
randbrt \
randdb4 \
tdb_logprint \ tdb_logprint \
# This line intentially kept commented so I can have a \ on the end of the previous line # This line intentially kept commented so I can have a \ on the end of the previous line
...@@ -95,6 +93,7 @@ OFILES = \ ...@@ -95,6 +93,7 @@ OFILES = \
brt-verify.o \ brt-verify.o \
brt.o \ brt.o \
cachetable.o \ cachetable.o \
crc.o \
fifo.o \ fifo.o \
fingerprint.o \ fingerprint.o \
key.o \ key.o \
...@@ -172,7 +171,7 @@ HFILES = $(wildcard *.h) ...@@ -172,7 +171,7 @@ HFILES = $(wildcard *.h)
BRT_INTERNAL_H_INCLUDES = brt-internal.h cachetable.h fifo.h omt.h brt.h brt-search.h brttypes.h yerror.h ybt.h log.h ../include/db.h kv-pair.h memory.h crc.h mempool.h leafentry.h BRT_INTERNAL_H_INCLUDES = brt-internal.h cachetable.h fifo.h omt.h brt.h brt-search.h brttypes.h yerror.h ybt.h log.h ../include/db.h kv-pair.h memory.h crc.h mempool.h leafentry.h
key.o: brttypes.h key.h key.o: brttypes.h key.h
list-test: list-test.o toku_assert.o list-test: list-test.o toku_assert.o
test-brt-delete-both: ybt.o brt.o fifo.o omt.o memory.o leafentry.o brt-serialize.o cachetable.o ybt.o key.o primes.o toku_assert.o log.o mempool.o brt-verify.o fingerprint.o log_code.o roll.o test-brt-delete-both: $(OFILES)
test-inc-split: $(TEST_OFILES) test-inc-split: $(TEST_OFILES)
brt-test-helpers.o: $(BRT_INTERNAL_H_INCLUDES) toku_assert.h brt-test-helpers.o: $(BRT_INTERNAL_H_INCLUDES) toku_assert.h
test-del-inorder: $(TEST_OFILES) test-del-inorder: $(TEST_OFILES)
...@@ -181,7 +180,7 @@ ybt.o: ybt.h brttypes.h ../include/db.h ...@@ -181,7 +180,7 @@ ybt.o: ybt.h brttypes.h ../include/db.h
ybt-test: ybt-test.o ybt.o memory.o toku_assert.o ybt-test: ybt-test.o ybt.o memory.o toku_assert.o
ybt-test.o: ybt.h ../include/db.h ybt-test.o: ybt.h ../include/db.h
cachetable.o: brttypes.h cachetable.h hashfun.h memory.h primes.h toku_assert.h $(BRT_INTERNAL_H_INCLUDES) log_header.h cachetable.o: brttypes.h cachetable.h hashfun.h memory.h primes.h toku_assert.h $(BRT_INTERNAL_H_INCLUDES) log_header.h
brt-test0 brt-test1 brt-test2 brt-test3 brt-test4 brt-test5 test-brt-overflow brt-test-named-db brt-test-cursor brt-test-cursor-2 brt-test: ybt.o brt.o fifo.o omt.o leafentry.o memory.o brt-serialize.o cachetable.o ybt.o key.o primes.o toku_assert.o log.o mempool.o brt-verify.o fingerprint.o log_code.o roll.o brt-test0 brt-test1 brt-test2 brt-test3 brt-test4 brt-test5 test-brt-overflow brt-test-named-db brt-test-cursor brt-test-cursor-2 brt-test: $(OFILES)
log.o: log_header.h log-internal.h log.h wbuf.h crc.h brttypes.h $(BRT_INTERNAL_H_INCLUDES) log.o: log_header.h log-internal.h log.h wbuf.h crc.h brttypes.h $(BRT_INTERNAL_H_INCLUDES)
logformat: logformat.o toku_assert.o logformat: logformat.o toku_assert.o
brt-test0.o brt-test1.o brt-test2.o brt-test3.o brt-test4.o brt-test5.o test-brt-overflow.h brt-test-named-db.o brt-test-cursor.o brt-test-cursor-2.o brt-test.o brt.o: brt.h brt-search.h ../include/db.h fifo.h omt.h brttypes.h cachetable.h memory.h $(BRT_INTERNAL_H_INCLUDES) brt-test0.o brt-test1.o brt-test2.o brt-test3.o brt-test4.o brt-test5.o test-brt-overflow.h brt-test-named-db.o brt-test-cursor.o brt-test-cursor-2.o brt-test.o brt.o: brt.h brt-search.h ../include/db.h fifo.h omt.h brttypes.h cachetable.h memory.h $(BRT_INTERNAL_H_INCLUDES)
...@@ -194,7 +193,7 @@ fifo-test: fifo.o memory.o toku_assert.o ybt.o ...@@ -194,7 +193,7 @@ fifo-test: fifo.o memory.o toku_assert.o ybt.o
brt-serialize.o: $(BRT_INTERNAL_H_INCLUDES) key.h wbuf.h rbuf.h brt-serialize.o: $(BRT_INTERNAL_H_INCLUDES) key.h wbuf.h rbuf.h
brt-bigtest: memory.o ybt.o brt.o omt.o cachetable.o key.o fifo.o brt-serialize.o brt-bigtest: memory.o ybt.o brt.o omt.o cachetable.o key.o fifo.o brt-serialize.o
brt-bigtest.o: brt.h brt-search.h ../include/db.h brt-bigtest.o: brt.h brt-search.h ../include/db.h
log-test6 log-test5 log-test4 log-test3 log-test2 log-test: log.o memory.o leafentry.o toku_assert.o roll.o log_code.o brt-serialize.o brt.o cachetable.o omt.o ybt.o fifo.o key.o fingerprint.o brt-verify.o mempool.o primes.o log-test6 log-test5 log-test4 log-test3 log-test2 log-test: $(OFILES)
brt-verify.o: $(BRT_INTERNAL_H_INCLUDES) brt-verify.o: $(BRT_INTERNAL_H_INCLUDES)
fingerprint.o: $(BRT_INTERNAL_H_INCLUDES) fingerprint.o: $(BRT_INTERNAL_H_INCLUDES)
mempool.o: toku_assert.h mempool.h mempool.o: toku_assert.h mempool.h
...@@ -203,7 +202,7 @@ toku_assert.o: toku_assert.h ...@@ -203,7 +202,7 @@ toku_assert.o: toku_assert.h
omt-test.o: toku_assert.h memory.h toku_assert.h ../include/db.h brttypes.h omt-test.o: toku_assert.h memory.h toku_assert.h ../include/db.h brttypes.h
omt-test: omt-test.o omt.o memory.o toku_assert.o omt-test: omt-test.o omt.o memory.o toku_assert.o
brt-serialize-test: brt-serialize-test.o brt-serialize.o leafentry.o memory.o fifo.o omt.o key.o ybt.o brt.o cachetable.o primes.o toku_assert.o log.o mempool.o brt-verify.o fingerprint.o log_code.o roll.o brt-serialize-test: $(OFILES) brt-serialize-test.o
test_toku_malloc_plain_free: memory.o toku_assert.o test_toku_malloc_plain_free: memory.o toku_assert.o
...@@ -236,10 +235,6 @@ clean: ...@@ -236,10 +235,6 @@ clean:
rm -rf $(BINS) *.o *.bb *.bbg *.da *.gcov *.gcno *.gcda rm -rf $(BINS) *.o *.bb *.bbg *.da *.gcov *.gcno *.gcda
rm -rf test_oexcl.c.tmp *.brt rm -rf test_oexcl.c.tmp *.brt
randdb4: LOADLIBES=-ldb
randdb4: randdb4.o toku_assert.o
randbrt: brt.o fifo.o cachetable.o memory.o brt-serialize.o
# After doing (cd ../src/tests;make test_log5.recover), run these. The files should have no differences. # After doing (cd ../src/tests;make test_log5.recover), run these. The files should have no differences.
testdump: brtdump testdump: brtdump
./brtdump ../src/tests/dir.test_log5.c.tdb.recover/foo.db > dump.r && ./brtdump ../src/tests/dir.test_log5.c.tdb/foo.db > dump.o && diff dump.o dump.r ./brtdump ../src/tests/dir.test_log5.c.tdb.recover/foo.db > dump.r && ./brtdump ../src/tests/dir.test_log5.c.tdb/foo.db > dump.o && diff dump.o dump.r
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include "fifo.h" #include "fifo.h"
#include "yerror.h" #include "yerror.h"
#include "brt.h" #include "brt.h"
#include "crc.h" #include "crc.h"
#include "list.h" #include "list.h"
#include "mempool.h" #include "mempool.h"
#include "kv-pair.h" #include "kv-pair.h"
...@@ -225,6 +225,8 @@ void *mempool_malloc_from_omt(OMT omt, struct mempool *mp, size_t size); ...@@ -225,6 +225,8 @@ void *mempool_malloc_from_omt(OMT omt, struct mempool *mp, size_t size);
void toku_verify_all_in_mempool(BRTNODE node); void toku_verify_all_in_mempool(BRTNODE node);
int toku_verify_brtnode (BRT brt, DISKOFF off, bytevec lorange, ITEMLEN lolen, bytevec hirange, ITEMLEN hilen, int recurse) ;
// Diff from 5 to 6: Added leafentry_estimate // Diff from 5 to 6: Added leafentry_estimate
#define BRT_LAYOUT_VERSION 6 #define BRT_LAYOUT_VERSION 6
......
...@@ -15,7 +15,7 @@ static void test_serialize(void) { ...@@ -15,7 +15,7 @@ static void test_serialize(void) {
// struct brt source_brt; // struct brt source_brt;
int nodesize = 1024; int nodesize = 1024;
struct brtnode sn, *dn; struct brtnode sn, *dn;
int fd = open("brt-serialize-test.brt", O_RDWR|O_CREAT, 0777); int fd = open(__FILE__ "brt", O_RDWR|O_CREAT, 0777);
int r; int r;
const u_int32_t randval = random(); const u_int32_t randval = random();
assert(fd>=0); assert(fd>=0);
......
/* -*- mode: C; c-basic-offset: 4 -*- */ /* -*- mode: C; c-basic-offset: 4 -*- */
#ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved."
#define _XOPEN_SOURCE 500
#include "toku_assert.h" #include "toku_assert.h"
#include "brt-internal.h" #include "brt-internal.h"
#include "key.h" #include "key.h"
...@@ -680,7 +678,7 @@ int read_char (int fd, off_t *at, char *result) { ...@@ -680,7 +678,7 @@ int read_char (int fd, off_t *at, char *result) {
} }
int read_uint64_t (int fd, off_t *at, u_int64_t *result) { int read_uint64_t (int fd, off_t *at, u_int64_t *result) {
u_int32_t v1,v2; u_int32_t v1=0,v2=0;
int r; int r;
if ((r = read_int(fd, at, &v1))) return r; if ((r = read_int(fd, at, &v1))) return r;
if ((r = read_int(fd, at, &v2))) return r; if ((r = read_int(fd, at, &v2))) return r;
...@@ -704,14 +702,14 @@ int toku_deserialize_fifo_at (int fd, off_t at, FIFO *fifo) { ...@@ -704,14 +702,14 @@ int toku_deserialize_fifo_at (int fd, off_t at, FIFO *fifo) {
FIFO result; FIFO result;
int r = toku_fifo_create(&result); int r = toku_fifo_create(&result);
if (r) return r; if (r) return r;
u_int32_t count; u_int32_t count=0;
if ((r=read_int(fd, &at, &count))) return r; if ((r=read_int(fd, &at, &count))) return r;
u_int32_t i; u_int32_t i;
for (i=0; i<count; i++) { for (i=0; i<count; i++) {
char type; char type;
TXNID xid; TXNID xid;
u_int32_t keylen, vallen; u_int32_t keylen=0, vallen=0;
char *key, *val; char *key=0, *val=0;
if ((r=read_char(fd, &at, &type))) return r; if ((r=read_char(fd, &at, &type))) return r;
if ((r=read_uint64_t(fd, &at, &xid))) return r; if ((r=read_uint64_t(fd, &at, &xid))) return r;
if ((r=read_int(fd, &at, &keylen))) return r; if ((r=read_int(fd, &at, &keylen))) return r;
......
...@@ -29,7 +29,7 @@ static int test_brt_cursor_keycompare(DB *db __attribute__((unused)), const DBT ...@@ -29,7 +29,7 @@ static int test_brt_cursor_keycompare(DB *db __attribute__((unused)), const DBT
} }
static void assert_cursor_notfound(BRT brt, int position) { static void assert_cursor_notfound(BRT brt, int position) {
BRT_CURSOR cursor; BRT_CURSOR cursor=0;
int r; int r;
DBT kbt, vbt; DBT kbt, vbt;
...@@ -46,7 +46,7 @@ static void assert_cursor_notfound(BRT brt, int position) { ...@@ -46,7 +46,7 @@ static void assert_cursor_notfound(BRT brt, int position) {
} }
static void assert_cursor_value(BRT brt, int position, long long value) { static void assert_cursor_value(BRT brt, int position, long long value) {
BRT_CURSOR cursor; BRT_CURSOR cursor=0;
int r; int r;
DBT kbt, vbt; DBT kbt, vbt;
long long v; long long v;
...@@ -72,7 +72,7 @@ static void assert_cursor_value(BRT brt, int position, long long value) { ...@@ -72,7 +72,7 @@ static void assert_cursor_value(BRT brt, int position, long long value) {
} }
static void assert_cursor_first_last(BRT brt, long long firstv, long long lastv) { static void assert_cursor_first_last(BRT brt, long long firstv, long long lastv) {
BRT_CURSOR cursor; BRT_CURSOR cursor=0;
int r; int r;
DBT kbt, vbt; DBT kbt, vbt;
long long v; long long v;
...@@ -280,7 +280,7 @@ static void test_brt_cursor_rfirst(int n, DB *db) { ...@@ -280,7 +280,7 @@ static void test_brt_cursor_rfirst(int n, DB *db) {
} }
static void assert_cursor_walk(BRT brt, int n) { static void assert_cursor_walk(BRT brt, int n) {
BRT_CURSOR cursor; BRT_CURSOR cursor=0;
int i; int i;
int r; int r;
...@@ -352,7 +352,7 @@ static void test_brt_cursor_walk(int n, DB *db) { ...@@ -352,7 +352,7 @@ static void test_brt_cursor_walk(int n, DB *db) {
} }
static void assert_cursor_rwalk(BRT brt, int n) { static void assert_cursor_rwalk(BRT brt, int n) {
BRT_CURSOR cursor; BRT_CURSOR cursor=0;
int i; int i;
int r; int r;
...@@ -424,7 +424,7 @@ static void test_brt_cursor_rwalk(int n, DB *db) { ...@@ -424,7 +424,7 @@ static void test_brt_cursor_rwalk(int n, DB *db) {
} }
static void assert_cursor_walk_inorder(BRT brt, int n) { static void assert_cursor_walk_inorder(BRT brt, int n) {
BRT_CURSOR cursor; BRT_CURSOR cursor=0;
int i; int i;
int r; int r;
char *prevkey; char *prevkey;
...@@ -513,7 +513,7 @@ static void test_brt_cursor_rand(int n, DB *db) { ...@@ -513,7 +513,7 @@ static void test_brt_cursor_rand(int n, DB *db) {
static void test_brt_cursor_split(int n, DB *db) { static void test_brt_cursor_split(int n, DB *db) {
CACHETABLE ct; CACHETABLE ct;
BRT brt; BRT brt;
BRT_CURSOR cursor; BRT_CURSOR cursor=0;
int r; int r;
int keyseqnum; int keyseqnum;
int i; int i;
...@@ -726,7 +726,7 @@ static void test_brt_cursor_set(int n, int cursor_op, DB *db) { ...@@ -726,7 +726,7 @@ static void test_brt_cursor_set(int n, int cursor_op, DB *db) {
int r; int r;
CACHETABLE ct; CACHETABLE ct;
BRT brt; BRT brt;
BRT_CURSOR cursor; BRT_CURSOR cursor=0;
unlink(fname); unlink(fname);
...@@ -798,7 +798,7 @@ static void test_brt_cursor_set_range(int n, DB *db) { ...@@ -798,7 +798,7 @@ static void test_brt_cursor_set_range(int n, DB *db) {
int r; int r;
CACHETABLE ct; CACHETABLE ct;
BRT brt; BRT brt;
BRT_CURSOR cursor; BRT_CURSOR cursor=0;
unlink(fname); unlink(fname);
...@@ -864,7 +864,7 @@ static void test_brt_cursor_delete(int n, DB *db) { ...@@ -864,7 +864,7 @@ static void test_brt_cursor_delete(int n, DB *db) {
int error; int error;
CACHETABLE ct; CACHETABLE ct;
BRT brt; BRT brt;
BRT_CURSOR cursor; BRT_CURSOR cursor=0;
unlink(fname); unlink(fname);
...@@ -925,7 +925,7 @@ static void test_brt_cursor_get_both(int n, DB *db) { ...@@ -925,7 +925,7 @@ static void test_brt_cursor_get_both(int n, DB *db) {
int error; int error;
CACHETABLE ct; CACHETABLE ct;
BRT brt; BRT brt;
BRT_CURSOR cursor; BRT_CURSOR cursor=0;
unlink(fname); unlink(fname);
......
...@@ -11,7 +11,7 @@ static TOKUTXN const null_txn = 0; ...@@ -11,7 +11,7 @@ static TOKUTXN const null_txn = 0;
static DB * const null_db = 0; static DB * const null_db = 0;
static void test_named_db (void) { static void test_named_db (void) {
const char *n0 = "brt-test-named-db-0.brt"; const char *n0 = __FILE__ "0.brt";
CACHETABLE ct; CACHETABLE ct;
BRT t0; BRT t0;
int r; int r;
......
...@@ -20,11 +20,12 @@ ...@@ -20,11 +20,12 @@
static TOKUTXN const null_txn = 0; static TOKUTXN const null_txn = 0;
static DB * const null_db = 0; static DB * const null_db = 0;
static char fname[] = __FILE__ ".brt";
static void test_dump_empty_db (void) { static void test_dump_empty_db (void) {
BRT t; BRT t;
CACHETABLE ct; CACHETABLE ct;
int r; int r;
char fname[]="testbrt.brt";
toku_memory_check=1; toku_memory_check=1;
r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER);
assert(r==0); assert(r==0);
...@@ -39,8 +40,8 @@ static void test_dump_empty_db (void) { ...@@ -39,8 +40,8 @@ static void test_dump_empty_db (void) {
/* Test running multiple trees in different files */ /* Test running multiple trees in different files */
static void test_multiple_files_of_size (int size) { static void test_multiple_files_of_size (int size) {
const char *n0 = "test0.brt"; const char *n0 = __FILE__ "test0.brt";
const char *n1 = "test1.brt"; const char *n1 = __FILE__ "test1.brt";
CACHETABLE ct; CACHETABLE ct;
BRT t0,t1; BRT t0,t1;
int r,i; int r,i;
...@@ -106,8 +107,8 @@ static void test_multiple_files (void) { ...@@ -106,8 +107,8 @@ static void test_multiple_files (void) {
} }
static void test_multiple_dbs (void) { static void test_multiple_dbs (void) {
const char *n0 = "test0.brt"; const char *n0 = __FILE__ "test0.brt";
const char *n1 = "test1.brt"; const char *n1 = __FILE__ "test1.brt";
CACHETABLE ct; CACHETABLE ct;
BRT t0,t1; BRT t0,t1;
int r; int r;
...@@ -163,7 +164,7 @@ static void test_multiple_dbs (void) { ...@@ -163,7 +164,7 @@ static void test_multiple_dbs (void) {
static void test_multiple_dbs_many (void) { static void test_multiple_dbs_many (void) {
enum { MANYN = 16 }; enum { MANYN = 16 };
int i, r; int i, r;
const char *name = "test_mdbm.brt"; const char *name = __FILE__ "test_mdbm.brt";
CACHETABLE ct; CACHETABLE ct;
BRT trees[MANYN]; BRT trees[MANYN];
if (verbose) printf("test_multiple_dbs_many:\n"); if (verbose) printf("test_multiple_dbs_many:\n");
...@@ -194,15 +195,14 @@ static void test_multiple_dbs_many (void) { ...@@ -194,15 +195,14 @@ static void test_multiple_dbs_many (void) {
static void test_multiple_brts_one_db_one_file (void) { static void test_multiple_brts_one_db_one_file (void) {
enum { MANYN = 2 }; enum { MANYN = 2 };
int i, r; int i, r;
const char *name = "test.brt";
CACHETABLE ct; CACHETABLE ct;
BRT trees[MANYN]; BRT trees[MANYN];
if (verbose) printf("test_multiple_brts_one_db_one_file:"); if (verbose) printf("test_multiple_brts_one_db_one_file:");
toku_memory_check_all_free(); toku_memory_check_all_free();
unlink(name); unlink(fname);
r = toku_brt_create_cachetable(&ct, 32, ZERO_LSN, NULL_LOGGER); assert(r==0); r = toku_brt_create_cachetable(&ct, 32, ZERO_LSN, NULL_LOGGER); assert(r==0);
for (i=0; i<MANYN; i++) { for (i=0; i<MANYN; i++) {
r = toku_open_brt(name, 0, (i==0), &trees[i], 1<<12, ct, null_txn, toku_default_compare_fun, null_db); r = toku_open_brt(fname, 0, (i==0), &trees[i], 1<<12, ct, null_txn, toku_default_compare_fun, null_db);
assert(r==0); assert(r==0);
} }
for (i=0; i<MANYN; i++) { for (i=0; i<MANYN; i++) {
...@@ -233,7 +233,6 @@ static void test_multiple_brts_one_db_one_file (void) { ...@@ -233,7 +233,6 @@ static void test_multiple_brts_one_db_one_file (void) {
/* Check to see if data can be read that was written. */ /* Check to see if data can be read that was written. */
static void test_read_what_was_written (void) { static void test_read_what_was_written (void) {
const char *n="testbrt.brt";
CACHETABLE ct; CACHETABLE ct;
BRT brt; BRT brt;
int r; int r;
...@@ -241,11 +240,11 @@ static void test_read_what_was_written (void) { ...@@ -241,11 +240,11 @@ static void test_read_what_was_written (void) {
if (verbose) printf("test_read_what_was_written(): "); fflush(stdout); if (verbose) printf("test_read_what_was_written(): "); fflush(stdout);
unlink(n); unlink(fname);
toku_memory_check_all_free(); toku_memory_check_all_free();
r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0); r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0);
r = toku_open_brt(n, 0, 1, &brt, 1<<12, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0); r = toku_open_brt(fname, 0, 1, &brt, 1<<12, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0);
r = toku_close_brt(brt, 0); assert(r==0); r = toku_close_brt(brt, 0); assert(r==0);
r = toku_cachetable_close(&ct); assert(r==0); r = toku_cachetable_close(&ct); assert(r==0);
...@@ -253,7 +252,7 @@ static void test_read_what_was_written (void) { ...@@ -253,7 +252,7 @@ static void test_read_what_was_written (void) {
/* Now see if we can read an empty tree in. */ /* Now see if we can read an empty tree in. */
r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0); r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0);
r = toku_open_brt(n, 0, 0, &brt, 1<<12, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0); r = toku_open_brt(fname, 0, 0, &brt, 1<<12, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0);
/* See if we can put something in it. */ /* See if we can put something in it. */
{ {
...@@ -268,7 +267,7 @@ static void test_read_what_was_written (void) { ...@@ -268,7 +267,7 @@ static void test_read_what_was_written (void) {
/* Now see if we can read it in and get the value. */ /* Now see if we can read it in and get the value. */
r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0); r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0);
r = toku_open_brt(n, 0, 0, &brt, 1<<12, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0); r = toku_open_brt(fname, 0, 0, &brt, 1<<12, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0);
{ {
DBT k,v; DBT k,v;
...@@ -344,7 +343,7 @@ static void test_read_what_was_written (void) { ...@@ -344,7 +343,7 @@ static void test_read_what_was_written (void) {
toku_memory_check_all_free(); toku_memory_check_all_free();
r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0); r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0);
r = toku_open_brt(n, 0, 0, &brt, 1<<12, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0); r = toku_open_brt(fname, 0, 0, &brt, 1<<12, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0);
{ {
DBT k,v; DBT k,v;
...@@ -378,19 +377,18 @@ static void test_read_what_was_written (void) { ...@@ -378,19 +377,18 @@ static void test_read_what_was_written (void) {
/* Test c_get(DB_LAST) on an empty tree */ /* Test c_get(DB_LAST) on an empty tree */
static void test_cursor_last_empty(void) { static void test_cursor_last_empty(void) {
const char *n="testbrt.brt";
CACHETABLE ct; CACHETABLE ct;
BRT brt; BRT brt;
BRT_CURSOR cursor; BRT_CURSOR cursor=0;
int r; int r;
DBT kbt, vbt; DBT kbt, vbt;
if (verbose) printf("%s", __FUNCTION__); if (verbose) printf("%s", __FUNCTION__);
unlink(n); unlink(fname);
toku_memory_check_all_free(); toku_memory_check_all_free();
//printf("%s:%d %d alloced\n", __FILE__, __LINE__, toku_get_n_items_malloced()); toku_print_malloced_items(); //printf("%s:%d %d alloced\n", __FILE__, __LINE__, toku_get_n_items_malloced()); toku_print_malloced_items();
r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0); r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0);
//printf("%s:%d %d alloced\n", __FILE__, __LINE__, toku_get_n_items_malloced()); toku_print_malloced_items(); //printf("%s:%d %d alloced\n", __FILE__, __LINE__, toku_get_n_items_malloced()); toku_print_malloced_items();
r = toku_open_brt(n, 0, 1, &brt, 1<<12, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0); r = toku_open_brt(fname, 0, 1, &brt, 1<<12, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0);
//printf("%s:%d %d alloced\n", __FILE__, __LINE__, toku_get_n_items_malloced()); toku_print_malloced_items(); //printf("%s:%d %d alloced\n", __FILE__, __LINE__, toku_get_n_items_malloced()); toku_print_malloced_items();
r = toku_brt_cursor(brt, &cursor, 0); assert(r==0); r = toku_brt_cursor(brt, &cursor, 0); assert(r==0);
toku_init_dbt(&kbt); toku_init_dbt(&kbt);
...@@ -411,18 +409,17 @@ static void test_cursor_last_empty(void) { ...@@ -411,18 +409,17 @@ static void test_cursor_last_empty(void) {
} }
static void test_cursor_next (void) { static void test_cursor_next (void) {
const char *n="testbrt.brt";
CACHETABLE ct; CACHETABLE ct;
BRT brt; BRT brt;
BRT_CURSOR cursor; BRT_CURSOR cursor=0;
int r; int r;
DBT kbt, vbt; DBT kbt, vbt;
unlink(n); unlink(fname);
toku_memory_check_all_free(); toku_memory_check_all_free();
r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0); r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0);
//printf("%s:%d %d alloced\n", __FILE__, __LINE__, toku_get_n_items_malloced()); toku_print_malloced_items(); //printf("%s:%d %d alloced\n", __FILE__, __LINE__, toku_get_n_items_malloced()); toku_print_malloced_items();
r = toku_open_brt(n, 0, 1, &brt, 1<<12, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0); r = toku_open_brt(fname, 0, 1, &brt, 1<<12, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0);
//printf("%s:%d %d alloced\n", __FILE__, __LINE__, toku_get_n_items_malloced()); toku_print_malloced_items(); //printf("%s:%d %d alloced\n", __FILE__, __LINE__, toku_get_n_items_malloced()); toku_print_malloced_items();
r = toku_brt_insert(brt, toku_fill_dbt(&kbt, "hello", 6), toku_fill_dbt(&vbt, "there", 6), null_txn); r = toku_brt_insert(brt, toku_fill_dbt(&kbt, "hello", 6), toku_fill_dbt(&vbt, "there", 6), null_txn);
r = toku_brt_insert(brt, toku_fill_dbt(&kbt, "byebye", 7), toku_fill_dbt(&vbt, "byenow", 7), null_txn); r = toku_brt_insert(brt, toku_fill_dbt(&kbt, "byebye", 7), toku_fill_dbt(&vbt, "byenow", 7), null_txn);
...@@ -479,15 +476,14 @@ static int wrong_compare_fun(DB *db, const DBT *a, const DBT *b) { ...@@ -479,15 +476,14 @@ static int wrong_compare_fun(DB *db, const DBT *a, const DBT *b) {
} }
static void test_wrongendian_compare (int wrong_p, unsigned int N) { static void test_wrongendian_compare (int wrong_p, unsigned int N) {
const char *n="testbrt.brt";
CACHETABLE ct; CACHETABLE ct;
BRT brt; BRT brt;
BRT_CURSOR cursor; BRT_CURSOR cursor=0;
int r; int r;
DBT kbt, vbt; DBT kbt, vbt;
unsigned int i; unsigned int i;
unlink(n); unlink(fname);
toku_memory_check_all_free(); toku_memory_check_all_free();
{ {
...@@ -502,7 +498,7 @@ static void test_wrongendian_compare (int wrong_p, unsigned int N) { ...@@ -502,7 +498,7 @@ static void test_wrongendian_compare (int wrong_p, unsigned int N) {
//printf("%s:%d WRONG=%d\n", __FILE__, __LINE__, wrong_p); //printf("%s:%d WRONG=%d\n", __FILE__, __LINE__, wrong_p);
if (0) { // ???? Why is this commented out? if (0) { // ???? Why is this commented out?
r = toku_open_brt(n, 0, 1, &brt, 1<<20, ct, null_txn, wrong_p ? wrong_compare_fun : toku_default_compare_fun, &nonce_db); assert(r==0); r = toku_open_brt(fname, 0, 1, &brt, 1<<20, ct, null_txn, wrong_p ? wrong_compare_fun : toku_default_compare_fun, &nonce_db); assert(r==0);
for (i=1; i<257; i+=255) { for (i=1; i<257; i+=255) {
unsigned char a[4],b[4]; unsigned char a[4],b[4];
b[3] = a[0] = i&255; b[3] = a[0] = i&255;
...@@ -537,7 +533,7 @@ static void test_wrongendian_compare (int wrong_p, unsigned int N) { ...@@ -537,7 +533,7 @@ static void test_wrongendian_compare (int wrong_p, unsigned int N) {
{ {
toku_cachetable_verify(ct); toku_cachetable_verify(ct);
r = toku_open_brt(n, 0, 1, &brt, 1<<20, ct, null_txn, wrong_p ? wrong_compare_fun : toku_default_compare_fun, &nonce_db); assert(r==0); r = toku_open_brt(fname, 0, 1, &brt, 1<<20, ct, null_txn, wrong_p ? wrong_compare_fun : toku_default_compare_fun, &nonce_db); assert(r==0);
toku_cachetable_verify(ct); toku_cachetable_verify(ct);
for (i=0; i<N; i++) { for (i=0; i<N; i++) {
...@@ -591,7 +587,6 @@ static void test_large_kv(int bsize, int ksize, int vsize) { ...@@ -591,7 +587,6 @@ static void test_large_kv(int bsize, int ksize, int vsize) {
BRT t; BRT t;
int r; int r;
CACHETABLE ct; CACHETABLE ct;
char fname[]="testbrt.brt";
if (verbose) printf("test_large_kv: %d %d %d\n", bsize, ksize, vsize); if (verbose) printf("test_large_kv: %d %d %d\n", bsize, ksize, vsize);
...@@ -640,7 +635,6 @@ static void test_brt_delete_empty() { ...@@ -640,7 +635,6 @@ static void test_brt_delete_empty() {
BRT t; BRT t;
int r; int r;
CACHETABLE ct; CACHETABLE ct;
char fname[]="testbrt.brt";
r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER);
assert(r==0); assert(r==0);
...@@ -668,7 +662,6 @@ static void test_brt_delete_present(int n) { ...@@ -668,7 +662,6 @@ static void test_brt_delete_present(int n) {
BRT t; BRT t;
int r; int r;
CACHETABLE ct; CACHETABLE ct;
char fname[]="testbrt.brt";
int i; int i;
r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER);
...@@ -707,7 +700,7 @@ static void test_brt_delete_present(int n) { ...@@ -707,7 +700,7 @@ static void test_brt_delete_present(int n) {
} }
/* cursor should not find anything */ /* cursor should not find anything */
BRT_CURSOR cursor; BRT_CURSOR cursor=0;
r = toku_brt_cursor(t, &cursor, 0); r = toku_brt_cursor(t, &cursor, 0);
assert(r == 0); assert(r == 0);
...@@ -730,7 +723,6 @@ static void test_brt_delete_not_present(int n) { ...@@ -730,7 +723,6 @@ static void test_brt_delete_not_present(int n) {
BRT t; BRT t;
int r; int r;
CACHETABLE ct; CACHETABLE ct;
char fname[]="testbrt.brt";
int i; int i;
r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER);
...@@ -777,7 +769,6 @@ static void test_brt_delete_cursor_first(int n) { ...@@ -777,7 +769,6 @@ static void test_brt_delete_cursor_first(int n) {
BRT t; BRT t;
int r; int r;
CACHETABLE ct; CACHETABLE ct;
char fname[]="testbrt.brt";
int i; int i;
r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER);
...@@ -834,7 +825,7 @@ static void test_brt_delete_cursor_first(int n) { ...@@ -834,7 +825,7 @@ static void test_brt_delete_cursor_first(int n) {
} }
/* cursor should find the last key: n-1 */ /* cursor should find the last key: n-1 */
BRT_CURSOR cursor; BRT_CURSOR cursor=0;
r = toku_brt_cursor(t, &cursor, 0); r = toku_brt_cursor(t, &cursor, 0);
assert(r == 0); assert(r == 0);
...@@ -869,7 +860,6 @@ static void test_insert_delete_lookup(int n) { ...@@ -869,7 +860,6 @@ static void test_insert_delete_lookup(int n) {
BRT t; BRT t;
int r; int r;
CACHETABLE ct; CACHETABLE ct;
char fname[]="testbrt.brt";
int i; int i;
r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER);
...@@ -914,10 +904,9 @@ static void test_insert_delete_lookup(int n) { ...@@ -914,10 +904,9 @@ static void test_insert_delete_lookup(int n) {
static void test_brt_delete_both(int n) { static void test_brt_delete_both(int n) {
if (verbose) printf("test_brt_delete_both:%d\n", n); if (verbose) printf("test_brt_delete_both:%d\n", n);
BRT t; BRT t=0;
int r; int r;
CACHETABLE ct; CACHETABLE ct;
char fname[]="testbrt.brt";
int i; int i;
r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0); r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0);
...@@ -958,7 +947,7 @@ static void test_brt_delete_both(int n) { ...@@ -958,7 +947,7 @@ static void test_brt_delete_both(int n) {
#endif #endif
/* cursor should find only odd pairs */ /* cursor should find only odd pairs */
BRT_CURSOR cursor; BRT_CURSOR cursor=0;
r = toku_brt_cursor(t, &cursor, 0); assert(r == 0); r = toku_brt_cursor(t, &cursor, 0); assert(r == 0);
...@@ -999,7 +988,7 @@ static void test_brt_delete() { ...@@ -999,7 +988,7 @@ static void test_brt_delete() {
static void test_new_brt_cursor_create_close() { static void test_new_brt_cursor_create_close() {
int r; int r;
BRT brt; BRT brt=0;
int n = 8; int n = 8;
BRT_CURSOR cursors[n]; BRT_CURSOR cursors[n];
...@@ -1020,10 +1009,9 @@ static void test_new_brt_cursor_create_close() { ...@@ -1020,10 +1009,9 @@ static void test_new_brt_cursor_create_close() {
static void test_new_brt_cursor_first(int n, int dup_mode) { static void test_new_brt_cursor_first(int n, int dup_mode) {
if (verbose) printf("test_brt_cursor_first:%d\n", n); if (verbose) printf("test_brt_cursor_first:%d\n", n);
BRT t; BRT t=0;
int r; int r;
CACHETABLE ct; CACHETABLE ct;
char fname[]="testbrt.brt";
int i; int i;
r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0); r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0);
...@@ -1041,7 +1029,7 @@ static void test_new_brt_cursor_first(int n, int dup_mode) { ...@@ -1041,7 +1029,7 @@ static void test_new_brt_cursor_first(int n, int dup_mode) {
r = toku_brt_insert(t, toku_fill_dbt(&key, &k, sizeof k), toku_fill_dbt(&val, &v, sizeof v), 0); assert(r == 0); r = toku_brt_insert(t, toku_fill_dbt(&key, &k, sizeof k), toku_fill_dbt(&val, &v, sizeof v), 0); assert(r == 0);
} }
BRT_CURSOR cursor; BRT_CURSOR cursor=0;
r = toku_brt_cursor(t, &cursor, 0); assert(r == 0); r = toku_brt_cursor(t, &cursor, 0); assert(r == 0);
...@@ -1075,10 +1063,9 @@ static void test_new_brt_cursor_first(int n, int dup_mode) { ...@@ -1075,10 +1063,9 @@ static void test_new_brt_cursor_first(int n, int dup_mode) {
static void test_new_brt_cursor_last(int n, int dup_mode) { static void test_new_brt_cursor_last(int n, int dup_mode) {
if (verbose) printf("test_brt_cursor_last:%d\n", n); if (verbose) printf("test_brt_cursor_last:%d\n", n);
BRT t; BRT t=0;
int r; int r;
CACHETABLE ct; CACHETABLE ct;
char fname[]="testbrt.brt";
int i; int i;
r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0); r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0);
...@@ -1096,7 +1083,7 @@ static void test_new_brt_cursor_last(int n, int dup_mode) { ...@@ -1096,7 +1083,7 @@ static void test_new_brt_cursor_last(int n, int dup_mode) {
r = toku_brt_insert(t, toku_fill_dbt(&key, &k, sizeof k), toku_fill_dbt(&val, &v, sizeof v), 0); assert(r == 0); r = toku_brt_insert(t, toku_fill_dbt(&key, &k, sizeof k), toku_fill_dbt(&val, &v, sizeof v), 0); assert(r == 0);
} }
BRT_CURSOR cursor; BRT_CURSOR cursor=0;
r = toku_brt_cursor(t, &cursor, 0); assert(r == 0); r = toku_brt_cursor(t, &cursor, 0); assert(r == 0);
...@@ -1130,10 +1117,9 @@ static void test_new_brt_cursor_last(int n, int dup_mode) { ...@@ -1130,10 +1117,9 @@ static void test_new_brt_cursor_last(int n, int dup_mode) {
static void test_new_brt_cursor_next(int n, int dup_mode) { static void test_new_brt_cursor_next(int n, int dup_mode) {
if (verbose) printf("test_brt_cursor_next:%d\n", n); if (verbose) printf("test_brt_cursor_next:%d\n", n);
BRT t; BRT t=0;
int r; int r;
CACHETABLE ct; CACHETABLE ct;
char fname[]="testbrt.brt";
int i; int i;
r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0); r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0);
...@@ -1154,7 +1140,7 @@ static void test_new_brt_cursor_next(int n, int dup_mode) { ...@@ -1154,7 +1140,7 @@ static void test_new_brt_cursor_next(int n, int dup_mode) {
toku_init_dbt(&key); key.flags = DB_DBT_REALLOC; toku_init_dbt(&key); key.flags = DB_DBT_REALLOC;
toku_init_dbt(&val); val.flags = DB_DBT_REALLOC; toku_init_dbt(&val); val.flags = DB_DBT_REALLOC;
BRT_CURSOR cursor; BRT_CURSOR cursor=0;
r = toku_brt_cursor(t, &cursor, 0); assert(r == 0); r = toku_brt_cursor(t, &cursor, 0); assert(r == 0);
...@@ -1183,10 +1169,9 @@ static void test_new_brt_cursor_next(int n, int dup_mode) { ...@@ -1183,10 +1169,9 @@ static void test_new_brt_cursor_next(int n, int dup_mode) {
static void test_new_brt_cursor_prev(int n, int dup_mode) { static void test_new_brt_cursor_prev(int n, int dup_mode) {
if (verbose) printf("test_brt_cursor_prev:%d\n", n); if (verbose) printf("test_brt_cursor_prev:%d\n", n);
BRT t; BRT t=0;
int r; int r;
CACHETABLE ct; CACHETABLE ct;
char fname[]="testbrt.brt";
int i; int i;
r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0); r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0);
...@@ -1204,7 +1189,7 @@ static void test_new_brt_cursor_prev(int n, int dup_mode) { ...@@ -1204,7 +1189,7 @@ static void test_new_brt_cursor_prev(int n, int dup_mode) {
r = toku_brt_insert(t, toku_fill_dbt(&key, &k, sizeof k), toku_fill_dbt(&val, &v, sizeof v), 0); assert(r == 0); r = toku_brt_insert(t, toku_fill_dbt(&key, &k, sizeof k), toku_fill_dbt(&val, &v, sizeof v), 0); assert(r == 0);
} }
BRT_CURSOR cursor; BRT_CURSOR cursor=0;
r = toku_brt_cursor(t, &cursor, 0); assert(r == 0); r = toku_brt_cursor(t, &cursor, 0); assert(r == 0);
...@@ -1236,10 +1221,9 @@ static void test_new_brt_cursor_prev(int n, int dup_mode) { ...@@ -1236,10 +1221,9 @@ static void test_new_brt_cursor_prev(int n, int dup_mode) {
static void test_new_brt_cursor_current(int n, int dup_mode) { static void test_new_brt_cursor_current(int n, int dup_mode) {
if (verbose) printf("test_brt_cursor_current:%d\n", n); if (verbose) printf("test_brt_cursor_current:%d\n", n);
BRT t; BRT t=0;
int r; int r;
CACHETABLE ct; CACHETABLE ct;
char fname[]="testbrt.brt";
int i; int i;
r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0); r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0);
...@@ -1257,7 +1241,7 @@ static void test_new_brt_cursor_current(int n, int dup_mode) { ...@@ -1257,7 +1241,7 @@ static void test_new_brt_cursor_current(int n, int dup_mode) {
r = toku_brt_insert(t, toku_fill_dbt(&key, &k, sizeof k), toku_fill_dbt(&val, &v, sizeof v), 0); assert(r == 0); r = toku_brt_insert(t, toku_fill_dbt(&key, &k, sizeof k), toku_fill_dbt(&val, &v, sizeof v), 0); assert(r == 0);
} }
BRT_CURSOR cursor; BRT_CURSOR cursor=0;
r = toku_brt_cursor(t, &cursor, 0); assert(r == 0); r = toku_brt_cursor(t, &cursor, 0); assert(r == 0);
...@@ -1318,10 +1302,9 @@ static void test_new_brt_cursor_set_range(int n, int dup_mode) { ...@@ -1318,10 +1302,9 @@ static void test_new_brt_cursor_set_range(int n, int dup_mode) {
if (verbose) printf("test_brt_cursor_set_range:%d %d\n", n, dup_mode); if (verbose) printf("test_brt_cursor_set_range:%d %d\n", n, dup_mode);
int r; int r;
char fname[]="testbrt.brt";
CACHETABLE ct; CACHETABLE ct;
BRT brt; BRT brt=0;
BRT_CURSOR cursor; BRT_CURSOR cursor=0;
r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0); r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0);
unlink(fname); unlink(fname);
...@@ -1377,10 +1360,9 @@ static void test_new_brt_cursor_set(int n, int cursor_op, DB *db) { ...@@ -1377,10 +1360,9 @@ static void test_new_brt_cursor_set(int n, int cursor_op, DB *db) {
if (verbose) printf("test_brt_cursor_set:%d %d %p\n", n, cursor_op, db); if (verbose) printf("test_brt_cursor_set:%d %d %p\n", n, cursor_op, db);
int r; int r;
char fname[]="testbrt.brt";
CACHETABLE ct; CACHETABLE ct;
BRT brt; BRT brt;
BRT_CURSOR cursor; BRT_CURSOR cursor=0;
unlink(fname); unlink(fname);
......
...@@ -14,7 +14,7 @@ static void test0 (void) { ...@@ -14,7 +14,7 @@ static void test0 (void) {
BRT t; BRT t;
int r; int r;
CACHETABLE ct; CACHETABLE ct;
char fname[]="brt-test0.brt"; char fname[]= __FILE__ "0.brt";
if (verbose) printf("%s:%d test0\n", __FILE__, __LINE__); if (verbose) printf("%s:%d test0\n", __FILE__, __LINE__);
toku_memory_check=1; toku_memory_check=1;
toku_memory_check_all_free(); toku_memory_check_all_free();
......
...@@ -14,7 +14,7 @@ static void test1 (void) { ...@@ -14,7 +14,7 @@ static void test1 (void) {
BRT t; BRT t;
int r; int r;
CACHETABLE ct; CACHETABLE ct;
char fname[]="brt-test1.brt"; char fname[]= __FILE__ "1.brt";
DBT k,v; DBT k,v;
toku_memory_check=1; toku_memory_check=1;
toku_memory_check_all_free(); toku_memory_check_all_free();
......
...@@ -15,7 +15,7 @@ static void test2 (int memcheck, int limit) { ...@@ -15,7 +15,7 @@ static void test2 (int memcheck, int limit) {
int r; int r;
int i; int i;
CACHETABLE ct; CACHETABLE ct;
char fname[]="brt-test2.brt"; char fname[]= __FILE__ "2.brt";
toku_memory_check=memcheck; toku_memory_check=memcheck;
if (verbose) printf("%s:%d checking\n", __FILE__, __LINE__); if (verbose) printf("%s:%d checking\n", __FILE__, __LINE__);
toku_memory_check_all_free(); toku_memory_check_all_free();
......
...@@ -19,7 +19,7 @@ static void test5 (void) { ...@@ -19,7 +19,7 @@ static void test5 (void) {
int *values; int *values;
int i; int i;
CACHETABLE ct; CACHETABLE ct;
char fname[]="testbrt.brt"; char fname[]= __FILE__ ".brt";
toku_memory_check_all_free(); toku_memory_check_all_free();
MALLOC_N(limit,values); MALLOC_N(limit,values);
for (i=0; i<limit; i++) values[i]=-1; for (i=0; i<limit; i++) values[i]=-1;
......
...@@ -434,7 +434,7 @@ static int brtleaf_split (TOKULOGGER logger, FILENUM filenum, BRT t, BRTNODE nod ...@@ -434,7 +434,7 @@ static int brtleaf_split (TOKULOGGER logger, FILENUM filenum, BRT t, BRTNODE nod
toku_omt_destroy(&old_omt); toku_omt_destroy(&old_omt);
LSN lsn; LSN lsn={0};
r = toku_log_leafsplit(logger, &lsn, 0, filenum, node->thisnodename, B->thisnodename, n_leafentries, break_at, node->nodesize, B->rand4fingerprint, (t->flags&TOKU_DB_DUPSORT)!=0); r = toku_log_leafsplit(logger, &lsn, 0, filenum, node->thisnodename, B->thisnodename, n_leafentries, break_at, node->nodesize, B->rand4fingerprint, (t->flags&TOKU_DB_DUPSORT)!=0);
if (logger) { if (logger) {
node->log_lsn = lsn; node->log_lsn = lsn;
...@@ -1364,8 +1364,8 @@ int should_compare_both_keys (BRTNODE node, BRT_CMD cmd) { ...@@ -1364,8 +1364,8 @@ int should_compare_both_keys (BRTNODE node, BRT_CMD cmd) {
static int brt_leaf_apply_cmd_once (BRT t, BRTNODE node, BRT_CMD cmd, TOKULOGGER logger, static int brt_leaf_apply_cmd_once (BRT t, BRTNODE node, BRT_CMD cmd, TOKULOGGER logger,
u_int32_t idx, LEAFENTRY le) { u_int32_t idx, LEAFENTRY le) {
FILENUM filenum = toku_cachefile_filenum(t->cf); FILENUM filenum = toku_cachefile_filenum(t->cf);
u_int32_t newlen, newdisksize; u_int32_t newlen=0, newdisksize=0;
LEAFENTRY newdata; LEAFENTRY newdata=0;
int r = apply_cmd_to_leaf(cmd, le, &newlen, &newdisksize, &newdata); int r = apply_cmd_to_leaf(cmd, le, &newlen, &newdisksize, &newdata);
if (r!=0) return r; if (r!=0) return r;
if (newdata) assert(newdisksize == leafentry_disksize(newdata)); if (newdata) assert(newdisksize == leafentry_disksize(newdata));
...@@ -2398,9 +2398,7 @@ int toku_brt_delete_both(BRT brt, DBT *key, DBT *val, TOKUTXN txn) { ...@@ -2398,9 +2398,7 @@ int toku_brt_delete_both(BRT brt, DBT *key, DBT *val, TOKUTXN txn) {
return r; return r;
} }
int toku_verify_brtnode (BRT brt, DISKOFF off, bytevec lorange, ITEMLEN lolen, bytevec hirange, ITEMLEN hilen, int recurse, BRTNODE parent_brtnode); int toku_dump_brtnode (BRT brt, DISKOFF off, int depth, bytevec lorange, ITEMLEN lolen, bytevec hirange, ITEMLEN hilen) {
int toku_dump_brtnode (BRT brt, DISKOFF off, int depth, bytevec lorange, ITEMLEN lolen, bytevec hirange, ITEMLEN hilen, BRTNODE parent_brtnode) {
int result=0; int result=0;
BRTNODE node; BRTNODE node;
void *node_v; void *node_v;
...@@ -2409,7 +2407,7 @@ int toku_dump_brtnode (BRT brt, DISKOFF off, int depth, bytevec lorange, ITEMLEN ...@@ -2409,7 +2407,7 @@ int toku_dump_brtnode (BRT brt, DISKOFF off, int depth, bytevec lorange, ITEMLEN
assert(r==0); assert(r==0);
printf("%s:%d pin %p\n", __FILE__, __LINE__, node_v); printf("%s:%d pin %p\n", __FILE__, __LINE__, node_v);
node=node_v; node=node_v;
result=toku_verify_brtnode(brt, off, lorange, lolen, hirange, hilen, 0, parent_brtnode); result=toku_verify_brtnode(brt, off, lorange, lolen, hirange, hilen, 0);
printf("%*sNode=%p\n", depth, "", node); printf("%*sNode=%p\n", depth, "", node);
if (node->height>0) { if (node->height>0) {
printf("%*sNode %lld nodesize=%d height=%d n_children=%d n_bytes_in_buffers=%d keyrange=%s %s\n", printf("%*sNode %lld nodesize=%d height=%d n_children=%d n_bytes_in_buffers=%d keyrange=%s %s\n",
...@@ -2436,8 +2434,7 @@ int toku_dump_brtnode (BRT brt, DISKOFF off, int depth, bytevec lorange, ITEMLEN ...@@ -2436,8 +2434,7 @@ int toku_dump_brtnode (BRT brt, DISKOFF off, int depth, bytevec lorange, ITEMLEN
(i==0) ? lorange : node->u.n.childkeys[i-1], (i==0) ? lorange : node->u.n.childkeys[i-1],
(i==0) ? lolen : toku_brt_pivot_key_len(brt, node->u.n.childkeys[i-1]), (i==0) ? lolen : toku_brt_pivot_key_len(brt, node->u.n.childkeys[i-1]),
(i==node->u.n.n_children-1) ? hirange : node->u.n.childkeys[i], (i==node->u.n.n_children-1) ? hirange : node->u.n.childkeys[i],
(i==node->u.n.n_children-1) ? hilen : toku_brt_pivot_key_len(brt, node->u.n.childkeys[i]), (i==node->u.n.n_children-1) ? hilen : toku_brt_pivot_key_len(brt, node->u.n.childkeys[i])
node
); );
} }
} }
...@@ -2463,7 +2460,7 @@ int toku_dump_brt (BRT brt) { ...@@ -2463,7 +2460,7 @@ int toku_dump_brt (BRT brt) {
} }
rootp = toku_calculate_root_offset_pointer(brt); rootp = toku_calculate_root_offset_pointer(brt);
printf("split_count=%d\n", split_count); printf("split_count=%d\n", split_count);
if ((r = toku_dump_brtnode(brt, *rootp, 0, 0, 0, 0, 0, null_brtnode))) goto died0; if ((r = toku_dump_brtnode(brt, *rootp, 0, 0, 0, 0, 0))) goto died0;
if ((r = toku_unpin_brt_header(brt))!=0) return r; if ((r = toku_unpin_brt_header(brt))!=0) return r;
brt->h = prev_header; brt->h = prev_header;
return 0; return 0;
......
...@@ -80,7 +80,7 @@ static void test0 (void) { ...@@ -80,7 +80,7 @@ static void test0 (void) {
CACHETABLE t; CACHETABLE t;
CACHEFILE f; CACHEFILE f;
int r; int r;
char fname[] = "test.dat"; char fname[] = __FILE__ "test.dat";
r=toku_create_cachetable(&t, 5, ZERO_LSN, NULL_LOGGER); r=toku_create_cachetable(&t, 5, ZERO_LSN, NULL_LOGGER);
assert(r==0); assert(r==0);
unlink(fname); unlink(fname);
...@@ -204,7 +204,7 @@ static void test_nested_pin (void) { ...@@ -204,7 +204,7 @@ static void test_nested_pin (void) {
int i0, i1; int i0, i1;
int r; int r;
void *vv,*vv2; void *vv,*vv2;
char fname[] = "test_ct.dat"; char fname[] = __FILE__ "test_ct.dat";
r = toku_create_cachetable(&t, 1, ZERO_LSN, NULL_LOGGER); r = toku_create_cachetable(&t, 1, ZERO_LSN, NULL_LOGGER);
assert(r==0); assert(r==0);
unlink(fname); unlink(fname);
...@@ -262,9 +262,9 @@ static int add222_fetch (CACHEFILE cf __attribute__((__unused__)), CACHEKEY key, ...@@ -262,9 +262,9 @@ static int add222_fetch (CACHEFILE cf __attribute__((__unused__)), CACHEKEY key,
static void test_multi_filehandles (void) { static void test_multi_filehandles (void) {
CACHETABLE t; CACHETABLE t;
CACHEFILE f1,f2,f3; CACHEFILE f1,f2,f3;
char fname1[]="test_ct.dat"; char fname1[]= __FILE__ "test_ct.dat";
char fname2[]="test2_ct.dat"; char fname2[]= __FILE__ "test2_ct.dat";
char fname3[]="test3_ct.dat"; char fname3[]= __FILE__ "test3_ct.dat";
int r; int r;
void *v; void *v;
unlink(fname1); unlink(fname1);
...@@ -318,7 +318,7 @@ static void test_dirty() { ...@@ -318,7 +318,7 @@ static void test_dirty() {
r = toku_create_cachetable(&t, 4, ZERO_LSN, NULL_LOGGER); r = toku_create_cachetable(&t, 4, ZERO_LSN, NULL_LOGGER);
assert(r == 0); assert(r == 0);
char *fname = "test.dat"; char *fname = __FILE__ "test.dat";
unlink(fname); unlink(fname);
r = toku_cachetable_openf(&f, t, fname, O_RDWR|O_CREAT, 0777); r = toku_cachetable_openf(&f, t, fname, O_RDWR|O_CREAT, 0777);
assert(r == 0); assert(r == 0);
...@@ -426,7 +426,7 @@ static void test_size_resize() { ...@@ -426,7 +426,7 @@ static void test_size_resize() {
r = toku_create_cachetable(&t, n*size, ZERO_LSN, NULL_LOGGER); r = toku_create_cachetable(&t, n*size, ZERO_LSN, NULL_LOGGER);
assert(r == 0); assert(r == 0);
char *fname = "test.dat"; char *fname = __FILE__ "test.dat";
unlink(fname); unlink(fname);
r = toku_cachetable_openf(&f, t, fname, O_RDWR|O_CREAT, 0777); r = toku_cachetable_openf(&f, t, fname, O_RDWR|O_CREAT, 0777);
assert(r == 0); assert(r == 0);
...@@ -477,7 +477,7 @@ static void test_size_flush() { ...@@ -477,7 +477,7 @@ static void test_size_flush() {
r = toku_create_cachetable(&t, n*size, ZERO_LSN, NULL_LOGGER); r = toku_create_cachetable(&t, n*size, ZERO_LSN, NULL_LOGGER);
assert(r == 0); assert(r == 0);
char *fname = "test.dat"; char *fname = __FILE__ "test.dat";
unlink(fname); unlink(fname);
r = toku_cachetable_openf(&f, t, fname, O_RDWR|O_CREAT, 0777); r = toku_cachetable_openf(&f, t, fname, O_RDWR|O_CREAT, 0777);
assert(r == 0); assert(r == 0);
...@@ -567,7 +567,7 @@ static void test_rename (void) { ...@@ -567,7 +567,7 @@ static void test_rename (void) {
CACHEFILE f; CACHEFILE f;
int i; int i;
int r; int r;
const char fname[] = "ct-test-rename.dat"; const char fname[] = __FILE__ "rename.dat";
r=toku_create_cachetable(&t, KEYLIMIT, ZERO_LSN, NULL_LOGGER); assert(r==0); r=toku_create_cachetable(&t, KEYLIMIT, ZERO_LSN, NULL_LOGGER); assert(r==0);
unlink(fname); unlink(fname);
r = toku_cachetable_openf(&f, t, fname, O_RDWR|O_CREAT, 0777); r = toku_cachetable_openf(&f, t, fname, O_RDWR|O_CREAT, 0777);
......
...@@ -109,7 +109,7 @@ static void test_chaining (void) { ...@@ -109,7 +109,7 @@ static void test_chaining (void) {
long i, trial; long i, trial;
r = toku_create_cachetable(&ct, N_PRESENT_LIMIT, ZERO_LSN, NULL_LOGGER); assert(r==0); r = toku_create_cachetable(&ct, N_PRESENT_LIMIT, ZERO_LSN, NULL_LOGGER); assert(r==0);
for (i=0; i<N_FILES; i++) { for (i=0; i<N_FILES; i++) {
r = snprintf(fname[i], FILENAME_LEN, "cachetabletest2.%ld.dat", i); r = snprintf(fname[i], FILENAME_LEN, __FILE__ ".%ld.dat", i);
assert(r>0 && r<FILENAME_LEN); assert(r>0 && r<FILENAME_LEN);
unlink(fname[i]); unlink(fname[i]);
r = toku_cachetable_openf(&f[i], ct, fname[i], O_RDWR|O_CREAT, 0777); assert(r==0); r = toku_cachetable_openf(&f[i], ct, fname[i], O_RDWR|O_CREAT, 0777); assert(r==0);
......
#include <sys/types.h>
#include <zlib.h>
// hack: include crc.h below so we can deprecate the call to crc32
inline u_int32_t toku_crc32 (u_int32_t oldcrc32, const void *data, u_int32_t len) {
if (len==0) return oldcrc32;
else return crc32((unsigned long)oldcrc32, data, (uInt)len);
}
// Hack
#include "crc.h"
...@@ -3,13 +3,11 @@ ...@@ -3,13 +3,11 @@
#ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved."
#include <sys/types.h>
#include <zlib.h> #include <zlib.h>
// zlib crc32 has a bug: If len==0 then it should return oldcrc32, but crc32 returns 0. // zlib crc32 has a bug: If len==0 then it should return oldcrc32, but crc32 returns 0.
static inline u_int32_t toku_crc32 (u_int32_t oldcrc32, const void *data, u_int32_t len) { inline u_int32_t toku_crc32 (u_int32_t oldcrc32, const void *data, u_int32_t len);
if (len==0) return oldcrc32;
else return crc32((unsigned long)oldcrc32, data, (uInt)len);
}
static const u_int32_t toku_null_crc = 0; static const u_int32_t toku_null_crc = 0;
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
#include <errno.h> #include <errno.h>
#include <sys/types.h> #include <sys/types.h>
typedef struct value *OMTVALUE; typedef void *OMTVALUE;
#include "omt.h" #include "omt.h"
#include "../newbrt/memory.h" #include "../newbrt/memory.h"
#include "../newbrt/toku_assert.h" #include "../newbrt/toku_assert.h"
......
/* -*- mode: C; c-basic-offset: 4 -*- */
#ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved."
/* Test random insertions using db4 */
#include "toku_assert.h"
#include <db.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <string.h>
#include <limits.h>
enum { MAX_PATHNAME_LEN = 100 };
const char dir[]="db4dir";
DB_ENV *env=0;
DB *db=0;
#if DB_VERSION_MINOR == 0
#define IF40(x,y) x
#else
#define IF40(x,y) y
#endif
void create_directory (void) {
char command[MAX_PATHNAME_LEN];
int r;
r=snprintf(command, MAX_PATHNAME_LEN, "rm -rf %s", dir);
assert(r<MAX_PATHNAME_LEN);
system(command);
r=mkdir(dir, 0777);
assert(r==0);
r=db_env_create(&env, 0);
assert(r==0);
r=env->set_cachesize(env, 0, 512*(1<<20), 0);
assert(r==0);
#if DB_VERSION_MAJOR >= 4 && DB_VERSION_MINOR >= 3
IF40((void)0,
({
unsigned int gbytes,bytes;
int ncaches;
r=env->get_cachesize(env, &gbytes, &bytes, &ncaches);
assert(r==0);
printf("Using %.2fMiB Berkeley DB Cache Size\n", gbytes*1024 + ((double)bytes/(1<<20)));
}));
#endif
r= env->open(env, dir, DB_CREATE|DB_INIT_MPOOL,0777); // No logging.
assert(r==0);
r=db_create(&db, env, 0);
assert(r==0);
IF40(
r=db->open(db, "files", 0, DB_BTREE, DB_CREATE, 0777),
r=db->open(db, 0, "files", 0, DB_BTREE, DB_CREATE, 0777));
assert(r==0);
}
int write_one (long int n1, long int n2) {
char keystring[100],valstring[100];
int keysize;
int datasize;
DB_TXN *txn=0;
DBT key,data;
int r;
keysize = snprintf(keystring, 100, "%08lx%08lx", n1, n2);
datasize = snprintf(valstring, 100, "%ld %ld %ld %ld %ld %ld", n1, n2, (long)(random()), (long)(random()), (long)(random()), (long)(random()));
memset(&key, 0, sizeof(key));
memset(&data, 0, sizeof(data));
key.data = keystring;
key.size = keysize;
data.data = valstring;
data.size = datasize;
r = db->put(db, txn, &key, &data, 0);
assert(r==0);
return keysize+datasize;
}
/* Write a sequence evenly spaced. */
long long write_sequence (int n_inserts) {
unsigned int step = UINT_MAX/n_inserts;
int i,j;
long long n_bytes=0;
printf("%d inserts, step %d\n", n_inserts, step);
for (i=0,j=0; i<n_inserts; i++,j+=step) {
n_bytes+=write_one(j, random());
}
return n_bytes;
}
long long write_random (int n_inserts) {
int i;
long long n_bytes=0;
for (i=0; i<n_inserts; i++) {
n_bytes+=write_one(random(), random());
}
return n_bytes;
}
double tdiff (struct timeval *t1, struct timeval *t0) {
return (t1->tv_sec-t0->tv_sec)+1e-6*(t1->tv_usec-t0->tv_usec);
}
int main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__unused__))) {
int n_s_inserts=200000000;
int n_inserts=50000;
struct timeval t0,t1,t00;
long long n_bytes;
int r;
create_directory();
gettimeofday(&t0, 0);
n_bytes=write_sequence(n_s_inserts);
gettimeofday(&t00, 0);
r=db->sync(db, 0); assert(r==0);
gettimeofday(&t1, 0);
{
double t = tdiff(&t1, &t0);
printf("%9d sequential inserts in %.3fs (%.3fs in sync), %.1f inserts/s. %lld bytes, %.1f bytes/s\n", n_s_inserts, t, tdiff(&t1,&t00), n_s_inserts/t, n_bytes, n_bytes/t);
}
gettimeofday(&t0, 0);
n_bytes=write_random(n_inserts);
gettimeofday(&t00, 0);
r=db->sync(db, 0); assert(r==0);
gettimeofday(&t1, 0);
{
double t = tdiff(&t1, &t0);
printf("%9d random inserts in %.3fs (%.3fs in sync), %.1f inserts/s. %lld bytes, %.1f bytes/s\n", n_inserts, t, tdiff(&t1, &t00), n_inserts/t, n_bytes, n_bytes/t);
}
gettimeofday(&t0, 0);
r=db->close(db,0); assert(r==0);
r=env->close(env,0); assert(r==0);
gettimeofday(&t1, 0);
printf("Time to close %.3fs\n", tdiff(&t1,&t0));
return 0;
}
...@@ -267,10 +267,10 @@ void toku_recover_brtdeq (LSN lsn, FILENUM filenum, DISKOFF diskoff, u_int32_t c ...@@ -267,10 +267,10 @@ void toku_recover_brtdeq (LSN lsn, FILENUM filenum, DISKOFF diskoff, u_int32_t c
recover_setup_node(filenum, diskoff, &cf, &node); recover_setup_node(filenum, diskoff, &cf, &node);
assert(node->height>0); assert(node->height>0);
//printf("deq: %lld expected_old_fingerprint=%08x actual=%08x new=%08x\n", diskoff, oldfingerprint, node->local_fingerprint, newfingerprint); //printf("deq: %lld expected_old_fingerprint=%08x actual=%08x new=%08x\n", diskoff, oldfingerprint, node->local_fingerprint, newfingerprint);
bytevec actual_key, actual_data; bytevec actual_key=0, actual_data=0;
ITEMLEN actual_keylen, actual_datalen; ITEMLEN actual_keylen=0, actual_datalen=0;
u_int32_t actual_type; u_int32_t actual_type=0;
TXNID actual_xid; TXNID actual_xid=0;
assert(childnum<(u_int32_t)node->u.n.n_children); assert(childnum<(u_int32_t)node->u.n.n_children);
r = toku_fifo_peek(BNC_BUFFER(node, childnum), &actual_key, &actual_keylen, &actual_data, &actual_datalen, &actual_type, &actual_xid); r = toku_fifo_peek(BNC_BUFFER(node, childnum), &actual_key, &actual_keylen, &actual_data, &actual_datalen, &actual_type, &actual_xid);
assert(r==0); assert(r==0);
...@@ -430,7 +430,7 @@ void toku_recover_fopen (LSN UU(lsn), TXNID UU(txnid), BYTESTRING fname, FILENUM ...@@ -430,7 +430,7 @@ void toku_recover_fopen (LSN UU(lsn), TXNID UU(txnid), BYTESTRING fname, FILENUM
CACHEFILE cf; CACHEFILE cf;
int fd = open(fixedfname, O_RDWR, 0); int fd = open(fixedfname, O_RDWR, 0);
assert(fd>=0); assert(fd>=0);
BRT brt; BRT brt=0;
int r = toku_brt_create(&brt); int r = toku_brt_create(&brt);
assert(r==0); assert(r==0);
brt->fname = fixedfname; brt->fname = fixedfname;
......
...@@ -73,7 +73,7 @@ ydbtrace.o tdbtrace.o: tdbtrace.h ...@@ -73,7 +73,7 @@ ydbtrace.o tdbtrace.o: tdbtrace.h
ydbtrace.o: ydb.c ydbtrace.o: ydb.c
$(CC) $(CFLAGS) $(CPPFLAGS) -DTOKUTRACE -c -o $@ $< $(CC) $(CFLAGS) $(CPPFLAGS) -DTOKUTRACE -c -o $@ $<
DBBINS = ydb.o errors.o elocks.o ../newbrt/brt.o ../newbrt/brt-serialize.o ../newbrt/brt-verify.o ../newbrt/cachetable.o ../newbrt/fifo.o ../newbrt/key.o ../newbrt/leafentry.o ../newbrt/memory.o ../newbrt/mempool.o ../newbrt/omt.o ../newbrt/ybt.o ../newbrt/primes.o ../newbrt/log.o ../newbrt/fingerprint.o ../newbrt/log_code.o ../newbrt/roll.o ../newbrt/toku_assert.o ../newbrt/recover.o DBBINS = ydb.o errors.o elocks.o ../newbrt/brt.o ../newbrt/brt-serialize.o ../newbrt/brt-verify.o ../newbrt/cachetable.o ../newbrt/crc.o ../newbrt/fifo.o ../newbrt/key.o ../newbrt/leafentry.o ../newbrt/memory.o ../newbrt/mempool.o ../newbrt/omt.o ../newbrt/ybt.o ../newbrt/primes.o ../newbrt/log.o ../newbrt/fingerprint.o ../newbrt/log_code.o ../newbrt/roll.o ../newbrt/toku_assert.o ../newbrt/recover.o
TDBBINS = tdbtrace.o $(patsubst ydb.o,ydbtrace.o,$(DBBINS)) TDBBINS = tdbtrace.o $(patsubst ydb.o,ydbtrace.o,$(DBBINS))
......
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