From c0ddd00b5aa03555e8676d38f1a7ecc117165ddc Mon Sep 17 00:00:00 2001
From: "Bradley C. Kuszmaul" <bradley@tokutek.com>
Date: Sun, 4 May 2008 16:56:15 +0000
Subject: [PATCH] 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
---
 Makefile.new                |  41 +++++++++++
 newbrt/Makefile             |  17 ++---
 newbrt/brt-internal.h       |   4 +-
 newbrt/brt-serialize-test.c |   2 +-
 newbrt/brt-serialize.c      |  10 ++-
 newbrt/brt-test-cursor.c    |  22 +++---
 newbrt/brt-test-named-db.c  |   2 +-
 newbrt/brt-test.c           | 102 +++++++++++----------------
 newbrt/brt-test0.c          |   2 +-
 newbrt/brt-test1.c          |   2 +-
 newbrt/brt-test2.c          |   2 +-
 newbrt/brt-test5.c          |   2 +-
 newbrt/brt.c                |  17 ++---
 newbrt/cachetable-test.c    |  18 ++---
 newbrt/cachetable-test2.c   |   2 +-
 newbrt/crc.c                |  11 +++
 newbrt/crc.h                |   6 +-
 newbrt/omt.c                |   2 +-
 newbrt/randdb4.c            | 137 ------------------------------------
 newbrt/recover.c            |  10 +--
 src/Makefile                |   2 +-
 21 files changed, 150 insertions(+), 263 deletions(-)
 create mode 100644 Makefile.new
 create mode 100644 newbrt/crc.c
 delete mode 100644 newbrt/randdb4.c

diff --git a/Makefile.new b/Makefile.new
new file mode 100644
index 00000000000..65e87210106
--- /dev/null
+++ b/Makefile.new
@@ -0,0 +1,41 @@
+# 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) 
+
diff --git a/newbrt/Makefile b/newbrt/Makefile
index e397000ea75..5d8595afafc 100644
--- a/newbrt/Makefile
+++ b/newbrt/Makefile
@@ -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
 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
 
@@ -85,8 +85,6 @@ REGRESSION_TESTS = \
 BINS =  $(REGRESSION_TESTS) \
         benchmark-test \
         brtdump \
-        randbrt \
-        randdb4 \
         tdb_logprint \
 # This line intentially kept commented so I can have a \ on the end of the previous line
 
@@ -95,6 +93,7 @@ OFILES = \
   brt-verify.o \
   brt.o \
   cachetable.o \
+  crc.o \
   fifo.o \
   fingerprint.o \
   key.o \
@@ -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
 key.o: brttypes.h key.h
 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)
 brt-test-helpers.o: $(BRT_INTERNAL_H_INCLUDES) toku_assert.h
 test-del-inorder: $(TEST_OFILES)
@@ -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.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
-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)
 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)
@@ -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-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
-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)
 fingerprint.o: $(BRT_INTERNAL_H_INCLUDES)
 mempool.o: toku_assert.h mempool.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: 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
 
 
@@ -236,10 +235,6 @@ clean:
 	rm -rf $(BINS) *.o *.bb *.bbg *.da *.gcov *.gcno *.gcda
 	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.
 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
diff --git a/newbrt/brt-internal.h b/newbrt/brt-internal.h
index cbc7e462df2..310cc54bd3b 100644
--- a/newbrt/brt-internal.h
+++ b/newbrt/brt-internal.h
@@ -8,7 +8,7 @@
 #include "fifo.h"
 #include "yerror.h"
 #include "brt.h"
-#include "crc.h"
+ #include "crc.h"
 #include "list.h"
 #include "mempool.h"
 #include "kv-pair.h"
@@ -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);
 
+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
 #define BRT_LAYOUT_VERSION 6
 
diff --git a/newbrt/brt-serialize-test.c b/newbrt/brt-serialize-test.c
index 260ccfd6d83..fdcfbae9f10 100644
--- a/newbrt/brt-serialize-test.c
+++ b/newbrt/brt-serialize-test.c
@@ -15,7 +15,7 @@ static void test_serialize(void) {
     //    struct brt source_brt;
     int nodesize = 1024;
     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;
     const u_int32_t randval = random();
     assert(fd>=0);
diff --git a/newbrt/brt-serialize.c b/newbrt/brt-serialize.c
index 90b09abeb76..0738c0938e4 100644
--- a/newbrt/brt-serialize.c
+++ b/newbrt/brt-serialize.c
@@ -1,8 +1,6 @@
 /* -*- mode: C; c-basic-offset: 4 -*- */
 #ident "Copyright (c) 2007, 2008 Tokutek Inc.  All rights reserved."
 
-#define _XOPEN_SOURCE 500
-
 #include "toku_assert.h"
 #include "brt-internal.h"
 #include "key.h"
@@ -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) {
-    u_int32_t v1,v2;
+    u_int32_t v1=0,v2=0;
     int r;
     if ((r = read_int(fd, at, &v1))) 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) {
     FIFO result;
     int r = toku_fifo_create(&result);
     if (r) return r;
-    u_int32_t count;
+    u_int32_t count=0;
     if ((r=read_int(fd, &at, &count))) return r;
     u_int32_t i;
     for (i=0; i<count; i++) {
 	char type;
 	TXNID xid;
-	u_int32_t keylen, vallen;
-	char *key, *val;
+	u_int32_t keylen=0, vallen=0;
+	char *key=0, *val=0;
 	if ((r=read_char(fd, &at, &type))) return r;
 	if ((r=read_uint64_t(fd, &at, &xid))) return r;
 	if ((r=read_int(fd, &at, &keylen))) return r;
diff --git a/newbrt/brt-test-cursor.c b/newbrt/brt-test-cursor.c
index 819e4fafb3e..3288a97e38e 100644
--- a/newbrt/brt-test-cursor.c
+++ b/newbrt/brt-test-cursor.c
@@ -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) {
-    BRT_CURSOR cursor;
+    BRT_CURSOR cursor=0;
     int r;
     DBT kbt, vbt;
 
@@ -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) {
-    BRT_CURSOR cursor;
+    BRT_CURSOR cursor=0;
     int r;
     DBT kbt, vbt;
     long long v;
@@ -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) {
-    BRT_CURSOR cursor;
+    BRT_CURSOR cursor=0;
     int r;
     DBT kbt, vbt;
     long long v;
@@ -280,7 +280,7 @@ static void test_brt_cursor_rfirst(int n, DB *db) {
 }
 
 static void assert_cursor_walk(BRT brt, int n) {
-    BRT_CURSOR cursor;
+    BRT_CURSOR cursor=0;
     int i;
     int r;
 
@@ -352,7 +352,7 @@ static void test_brt_cursor_walk(int n, DB *db) {
 }
 
 static void assert_cursor_rwalk(BRT brt, int n) {
-    BRT_CURSOR cursor;
+    BRT_CURSOR cursor=0;
     int i;
     int r;
 
@@ -424,7 +424,7 @@ static void test_brt_cursor_rwalk(int n, DB *db) {
 }
 
 static void assert_cursor_walk_inorder(BRT brt, int n) {
-    BRT_CURSOR cursor;
+    BRT_CURSOR cursor=0;
     int i;
     int r;
     char *prevkey;
@@ -513,7 +513,7 @@ static void test_brt_cursor_rand(int n, DB *db) {
 static void test_brt_cursor_split(int n, DB *db) {
     CACHETABLE ct;
     BRT brt;
-    BRT_CURSOR cursor;
+    BRT_CURSOR cursor=0;
     int r;
     int keyseqnum;
     int i;
@@ -726,7 +726,7 @@ static void test_brt_cursor_set(int n, int cursor_op, DB *db) {
     int r;
     CACHETABLE ct;
     BRT brt;
-    BRT_CURSOR cursor;
+    BRT_CURSOR cursor=0;
 
     unlink(fname);
 
@@ -798,7 +798,7 @@ static void test_brt_cursor_set_range(int n, DB *db) {
     int r;
     CACHETABLE ct;
     BRT brt;
-    BRT_CURSOR cursor;
+    BRT_CURSOR cursor=0;
 
     unlink(fname);
 
@@ -864,7 +864,7 @@ static void test_brt_cursor_delete(int n, DB *db) {
     int error;
     CACHETABLE ct;
     BRT brt;
-    BRT_CURSOR cursor;
+    BRT_CURSOR cursor=0;
 
     unlink(fname);
 
@@ -925,7 +925,7 @@ static void test_brt_cursor_get_both(int n, DB *db) {
     int error;
     CACHETABLE ct;
     BRT brt;
-    BRT_CURSOR cursor;
+    BRT_CURSOR cursor=0;
 
     unlink(fname);
 
diff --git a/newbrt/brt-test-named-db.c b/newbrt/brt-test-named-db.c
index d53d4411f24..036fb2d23c6 100644
--- a/newbrt/brt-test-named-db.c
+++ b/newbrt/brt-test-named-db.c
@@ -11,7 +11,7 @@ static TOKUTXN const null_txn = 0;
 static DB * const null_db = 0;
 
 static void test_named_db (void) {
-    const char *n0 = "brt-test-named-db-0.brt";
+    const char *n0 = __FILE__ "0.brt";
     CACHETABLE ct;
     BRT t0;
     int r;
diff --git a/newbrt/brt-test.c b/newbrt/brt-test.c
index e105c9dfbda..1efc05c01d8 100644
--- a/newbrt/brt-test.c
+++ b/newbrt/brt-test.c
@@ -20,11 +20,12 @@
 static TOKUTXN const null_txn = 0;
 static DB * const null_db = 0;
 
+static char fname[] = __FILE__ ".brt";
+
 static void test_dump_empty_db (void) {
     BRT t;
     CACHETABLE ct;
     int r;
-    char fname[]="testbrt.brt";
     toku_memory_check=1;
     r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER);
     assert(r==0);
@@ -39,8 +40,8 @@ static void test_dump_empty_db (void) {
 
 /* Test running multiple trees in different files */
 static void test_multiple_files_of_size (int size) {
-    const char *n0 = "test0.brt";
-    const char *n1 = "test1.brt";
+    const char *n0 = __FILE__ "test0.brt";
+    const char *n1 = __FILE__ "test1.brt";
     CACHETABLE ct;
     BRT t0,t1;
     int r,i;
@@ -106,8 +107,8 @@ static void test_multiple_files (void) {
 }
 
 static void test_multiple_dbs (void) {
-    const char *n0 = "test0.brt";
-    const char *n1 = "test1.brt";
+    const char *n0 = __FILE__ "test0.brt";
+    const char *n1 = __FILE__ "test1.brt";
     CACHETABLE ct;
     BRT t0,t1;
     int r;
@@ -163,7 +164,7 @@ static void test_multiple_dbs (void) {
 static void test_multiple_dbs_many (void) {
     enum { MANYN = 16 };
     int i, r;
-    const char *name = "test_mdbm.brt";
+    const char *name = __FILE__ "test_mdbm.brt";
     CACHETABLE ct;
     BRT trees[MANYN];
     if (verbose) printf("test_multiple_dbs_many:\n");
@@ -194,15 +195,14 @@ static void test_multiple_dbs_many (void) {
 static void test_multiple_brts_one_db_one_file (void) {
     enum { MANYN = 2 };
     int i, r;
-    const char *name = "test.brt";
     CACHETABLE ct;
     BRT trees[MANYN];
     if (verbose) printf("test_multiple_brts_one_db_one_file:");
     toku_memory_check_all_free();
-    unlink(name);
+    unlink(fname);
     r = toku_brt_create_cachetable(&ct, 32, ZERO_LSN, NULL_LOGGER); assert(r==0);
     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);
     }
     for (i=0; i<MANYN; i++) {
@@ -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. */
 static void  test_read_what_was_written (void) {
-    const char *n="testbrt.brt";
     CACHETABLE ct;
     BRT brt;
     int r;
@@ -241,11 +240,11 @@ static void  test_read_what_was_written (void) {
 
     if (verbose) printf("test_read_what_was_written(): "); fflush(stdout);
 
-    unlink(n);
+    unlink(fname);
     toku_memory_check_all_free();
 
     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_cachetable_close(&ct); assert(r==0);
 
@@ -253,7 +252,7 @@ static void  test_read_what_was_written (void) {
 
     /* 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_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. */
     {
@@ -268,7 +267,7 @@ static void  test_read_what_was_written (void) {
 
     /* 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_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;
@@ -344,7 +343,7 @@ static void  test_read_what_was_written (void) {
     toku_memory_check_all_free();
 
     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;
@@ -378,19 +377,18 @@ static void  test_read_what_was_written (void) {
 
 /* Test c_get(DB_LAST) on an empty tree */
 static void test_cursor_last_empty(void) {
-    const char *n="testbrt.brt";
     CACHETABLE ct;
     BRT brt;
-    BRT_CURSOR cursor;
+    BRT_CURSOR cursor=0;
     int r;
     DBT kbt, vbt;
     if (verbose) printf("%s", __FUNCTION__);
-    unlink(n);
+    unlink(fname);
     toku_memory_check_all_free();
     //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);
     //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();
     r = toku_brt_cursor(brt, &cursor, 0);            assert(r==0);
     toku_init_dbt(&kbt);
@@ -411,18 +409,17 @@ static void test_cursor_last_empty(void) {
 }
 
 static void test_cursor_next (void) {
-    const char *n="testbrt.brt";
     CACHETABLE ct;
     BRT brt;
-    BRT_CURSOR cursor;
+    BRT_CURSOR cursor=0;
     int r;
     DBT kbt, vbt;
 
-    unlink(n);
+    unlink(fname);
     toku_memory_check_all_free();
     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();
-    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();
     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);
@@ -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) {
-    const char *n="testbrt.brt";
     CACHETABLE ct;
     BRT brt;
-    BRT_CURSOR cursor;
+    BRT_CURSOR cursor=0;
     int r;
     DBT kbt, vbt;
     unsigned int i;
 
-    unlink(n);
+    unlink(fname);
     toku_memory_check_all_free();
 
     {
@@ -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);
 
     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) {
 	unsigned char a[4],b[4];
 	b[3] = a[0] = i&255;
@@ -537,7 +533,7 @@ static void test_wrongendian_compare (int wrong_p, unsigned int N) {
 
     {
 	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);
 
 	for (i=0; i<N; i++) {
@@ -591,7 +587,6 @@ static void test_large_kv(int bsize, int ksize, int vsize) {
     BRT t;
     int r;
     CACHETABLE ct;
-    char fname[]="testbrt.brt";
 
     if (verbose) printf("test_large_kv: %d %d %d\n", bsize, ksize, vsize);
 
@@ -640,7 +635,6 @@ static void test_brt_delete_empty() {
     BRT t;
     int r;
     CACHETABLE ct;
-    char fname[]="testbrt.brt";
 
     r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER);
     assert(r==0);
@@ -668,7 +662,6 @@ static void test_brt_delete_present(int n) {
     BRT t;
     int r;
     CACHETABLE ct;
-    char fname[]="testbrt.brt";
     int i;
 
     r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER);
@@ -707,7 +700,7 @@ static void test_brt_delete_present(int n) {
     }
 
     /* cursor should not find anything */
-    BRT_CURSOR cursor;
+    BRT_CURSOR cursor=0;
 
     r = toku_brt_cursor(t, &cursor, 0);
     assert(r == 0);
@@ -730,7 +723,6 @@ static void test_brt_delete_not_present(int n) {
     BRT t;
     int r;
     CACHETABLE ct;
-    char fname[]="testbrt.brt";
     int i;
 
     r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER);
@@ -777,7 +769,6 @@ static void test_brt_delete_cursor_first(int n) {
     BRT t;
     int r;
     CACHETABLE ct;
-    char fname[]="testbrt.brt";
     int i;
 
     r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER);
@@ -834,7 +825,7 @@ static void test_brt_delete_cursor_first(int n) {
     }
 
     /* cursor should find the last key: n-1 */
-    BRT_CURSOR cursor;
+    BRT_CURSOR cursor=0;
 
     r = toku_brt_cursor(t, &cursor, 0);
     assert(r == 0);
@@ -869,7 +860,6 @@ static void test_insert_delete_lookup(int n) {
     BRT t;
     int r;
     CACHETABLE ct;
-    char fname[]="testbrt.brt";
     int i;
 
     r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER);
@@ -914,10 +904,9 @@ static void test_insert_delete_lookup(int n) {
 static void test_brt_delete_both(int n) {
     if (verbose) printf("test_brt_delete_both:%d\n", n);
 
-    BRT t;
+    BRT t=0;
     int r;
     CACHETABLE ct;
-    char fname[]="testbrt.brt";
     int i;
 
     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) {
 #endif
 
     /* cursor should find only odd pairs */
-    BRT_CURSOR cursor;
+    BRT_CURSOR cursor=0;
 
     r = toku_brt_cursor(t, &cursor, 0); assert(r == 0);
 
@@ -999,7 +988,7 @@ static void test_brt_delete() {
 
 static void test_new_brt_cursor_create_close() {
     int r;
-    BRT brt;
+    BRT brt=0;
     int n = 8;
     BRT_CURSOR cursors[n];
 
@@ -1020,10 +1009,9 @@ static void test_new_brt_cursor_create_close() {
 static void test_new_brt_cursor_first(int n, int dup_mode) {
     if (verbose) printf("test_brt_cursor_first:%d\n", n);
 
-    BRT t;
+    BRT t=0;
     int r;
     CACHETABLE ct;
-    char fname[]="testbrt.brt";
     int i;
 
     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) {
         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);
 
@@ -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) {
     if (verbose) printf("test_brt_cursor_last:%d\n", n);
 
-    BRT t;
+    BRT t=0;
     int r;
     CACHETABLE ct;
-    char fname[]="testbrt.brt";
     int i;
 
     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) {
         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);
 
@@ -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) {
     if (verbose) printf("test_brt_cursor_next:%d\n", n);
 
-    BRT t;
+    BRT t=0;
     int r;
     CACHETABLE ct;
-    char fname[]="testbrt.brt";
     int i;
 
     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) {
     toku_init_dbt(&key); key.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);
 
@@ -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) {
     if (verbose) printf("test_brt_cursor_prev:%d\n", n);
 
-    BRT t;
+    BRT t=0;
     int r;
     CACHETABLE ct;
-    char fname[]="testbrt.brt";
     int i;
 
     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) {
         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);
 
@@ -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) {
     if (verbose) printf("test_brt_cursor_current:%d\n", n);
 
-    BRT t;
+    BRT t=0;
     int r;
     CACHETABLE ct;
-    char fname[]="testbrt.brt";
     int i;
 
     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) {
         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);
 
@@ -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);
 
     int r;
-    char fname[]="testbrt.brt";
     CACHETABLE ct;
-    BRT brt;
-    BRT_CURSOR cursor;
+    BRT brt=0;
+    BRT_CURSOR cursor=0;
 
     r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0);
     unlink(fname);
@@ -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);
 
     int r;
-    char fname[]="testbrt.brt";
     CACHETABLE ct;
     BRT brt;
-    BRT_CURSOR cursor;
+    BRT_CURSOR cursor=0;
 
     unlink(fname);
 
diff --git a/newbrt/brt-test0.c b/newbrt/brt-test0.c
index 26c115607e3..2fc94c37ccc 100644
--- a/newbrt/brt-test0.c
+++ b/newbrt/brt-test0.c
@@ -14,7 +14,7 @@ static void test0 (void) {
     BRT t;
     int r;
     CACHETABLE ct;
-    char fname[]="brt-test0.brt";
+    char fname[]= __FILE__ "0.brt";
     if (verbose) printf("%s:%d test0\n", __FILE__, __LINE__);
     toku_memory_check=1;
     toku_memory_check_all_free();
diff --git a/newbrt/brt-test1.c b/newbrt/brt-test1.c
index ba1e5b1b1d7..4e7a790f851 100644
--- a/newbrt/brt-test1.c
+++ b/newbrt/brt-test1.c
@@ -14,7 +14,7 @@ static void test1 (void) {
     BRT t;
     int r;
     CACHETABLE ct;
-    char fname[]="brt-test1.brt";
+    char fname[]= __FILE__ "1.brt";
     DBT k,v;
     toku_memory_check=1;
     toku_memory_check_all_free();
diff --git a/newbrt/brt-test2.c b/newbrt/brt-test2.c
index 1b15b79d9f0..0b0034d3dcc 100644
--- a/newbrt/brt-test2.c
+++ b/newbrt/brt-test2.c
@@ -15,7 +15,7 @@ static void test2 (int memcheck, int limit) {
     int r;
     int i;
     CACHETABLE ct;
-    char fname[]="brt-test2.brt";
+    char fname[]= __FILE__ "2.brt";
     toku_memory_check=memcheck;
     if (verbose) printf("%s:%d checking\n", __FILE__, __LINE__);
     toku_memory_check_all_free();
diff --git a/newbrt/brt-test5.c b/newbrt/brt-test5.c
index 40fde6d2040..ef959787b4c 100644
--- a/newbrt/brt-test5.c
+++ b/newbrt/brt-test5.c
@@ -19,7 +19,7 @@ static void test5 (void) {
     int *values;
     int i;
     CACHETABLE ct;
-    char fname[]="testbrt.brt";
+    char fname[]= __FILE__ ".brt";
     toku_memory_check_all_free();
     MALLOC_N(limit,values);
     for (i=0; i<limit; i++) values[i]=-1;
diff --git a/newbrt/brt.c b/newbrt/brt.c
index afbfc35ec43..2713241955d 100644
--- a/newbrt/brt.c
+++ b/newbrt/brt.c
@@ -434,7 +434,7 @@ static int brtleaf_split (TOKULOGGER logger, FILENUM filenum, BRT t, BRTNODE nod
 
     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);
     if (logger) {
 	node->log_lsn = lsn;
@@ -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,
 				    u_int32_t idx, LEAFENTRY le) {
     FILENUM filenum = toku_cachefile_filenum(t->cf);
-    u_int32_t newlen, newdisksize;
-    LEAFENTRY newdata;
+    u_int32_t newlen=0, newdisksize=0;
+    LEAFENTRY newdata=0;
     int r = apply_cmd_to_leaf(cmd, le, &newlen, &newdisksize, &newdata);
     if (r!=0) return r;
     if (newdata) assert(newdisksize == leafentry_disksize(newdata));
@@ -2398,9 +2398,7 @@ int toku_brt_delete_both(BRT brt, DBT *key, DBT *val, TOKUTXN txn) {
     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, BRTNODE parent_brtnode) {
+int toku_dump_brtnode (BRT brt, DISKOFF off, int depth, bytevec lorange, ITEMLEN lolen, bytevec hirange, ITEMLEN hilen) {
     int result=0;
     BRTNODE node;
     void *node_v;
@@ -2409,7 +2407,7 @@ int toku_dump_brtnode (BRT brt, DISKOFF off, int depth, bytevec lorange, ITEMLEN
     assert(r==0);
     printf("%s:%d pin %p\n", __FILE__, __LINE__, 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);
     if (node->height>0) {
 	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
 				  (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==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]),
-				  node
+				  (i==node->u.n.n_children-1) ? hilen   : toku_brt_pivot_key_len(brt, node->u.n.childkeys[i])
 				  );
 	    }
 	}
@@ -2463,7 +2460,7 @@ int toku_dump_brt (BRT brt) {
     }
     rootp = toku_calculate_root_offset_pointer(brt);
     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;
     brt->h = prev_header;
     return 0;
diff --git a/newbrt/cachetable-test.c b/newbrt/cachetable-test.c
index 37b6710cca6..e4e2fa9ad53 100644
--- a/newbrt/cachetable-test.c
+++ b/newbrt/cachetable-test.c
@@ -80,7 +80,7 @@ static void test0 (void) {
     CACHETABLE t;
     CACHEFILE f;
     int r;
-    char fname[] = "test.dat";
+    char fname[] = __FILE__ "test.dat";
     r=toku_create_cachetable(&t, 5, ZERO_LSN, NULL_LOGGER);
     assert(r==0);
     unlink(fname);
@@ -204,7 +204,7 @@ static void test_nested_pin (void) {
     int i0, i1;
     int r;
     void *vv,*vv2;
-    char fname[] = "test_ct.dat";
+    char fname[] = __FILE__ "test_ct.dat";
     r = toku_create_cachetable(&t, 1, ZERO_LSN, NULL_LOGGER);
     assert(r==0);
     unlink(fname);
@@ -262,9 +262,9 @@ static int add222_fetch (CACHEFILE cf __attribute__((__unused__)), CACHEKEY key,
 static void test_multi_filehandles (void) {
     CACHETABLE t;
     CACHEFILE f1,f2,f3;
-    char fname1[]="test_ct.dat";
-    char fname2[]="test2_ct.dat";
-    char fname3[]="test3_ct.dat";
+    char fname1[]= __FILE__ "test_ct.dat";
+    char fname2[]= __FILE__ "test2_ct.dat";
+    char fname3[]= __FILE__ "test3_ct.dat";
     int r;
     void *v;
     unlink(fname1);
@@ -318,7 +318,7 @@ static void test_dirty() {
     r = toku_create_cachetable(&t, 4, ZERO_LSN, NULL_LOGGER);
     assert(r == 0);
 
-    char *fname = "test.dat";
+    char *fname = __FILE__ "test.dat";
     unlink(fname);
     r = toku_cachetable_openf(&f, t, fname, O_RDWR|O_CREAT, 0777);   
     assert(r == 0);
@@ -426,7 +426,7 @@ static void test_size_resize() {
     r = toku_create_cachetable(&t, n*size, ZERO_LSN, NULL_LOGGER);
     assert(r == 0);
 
-    char *fname = "test.dat";
+    char *fname = __FILE__ "test.dat";
     unlink(fname);
     r = toku_cachetable_openf(&f, t, fname, O_RDWR|O_CREAT, 0777);
     assert(r == 0);
@@ -477,7 +477,7 @@ static void test_size_flush() {
     r = toku_create_cachetable(&t, n*size, ZERO_LSN, NULL_LOGGER);
     assert(r == 0);
 
-    char *fname = "test.dat";
+    char *fname = __FILE__ "test.dat";
     unlink(fname);
     r = toku_cachetable_openf(&f, t, fname, O_RDWR|O_CREAT, 0777);
     assert(r == 0);
@@ -567,7 +567,7 @@ static void test_rename (void) {
     CACHEFILE f;
     int i;
     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);
     unlink(fname);
     r = toku_cachetable_openf(&f, t, fname, O_RDWR|O_CREAT, 0777);
diff --git a/newbrt/cachetable-test2.c b/newbrt/cachetable-test2.c
index 58e028ce465..242a9c3f203 100644
--- a/newbrt/cachetable-test2.c
+++ b/newbrt/cachetable-test2.c
@@ -109,7 +109,7 @@ static void test_chaining (void) {
     long i, trial;
     r = toku_create_cachetable(&ct, N_PRESENT_LIMIT, ZERO_LSN, NULL_LOGGER);    assert(r==0);
     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);
 	unlink(fname[i]);
 	r = toku_cachetable_openf(&f[i], ct, fname[i], O_RDWR|O_CREAT, 0777);   assert(r==0);
diff --git a/newbrt/crc.c b/newbrt/crc.c
new file mode 100644
index 00000000000..e94b1dbe04b
--- /dev/null
+++ b/newbrt/crc.c
@@ -0,0 +1,11 @@
+#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"
diff --git a/newbrt/crc.h b/newbrt/crc.h
index 7076d391987..258331f8699 100644
--- a/newbrt/crc.h
+++ b/newbrt/crc.h
@@ -3,13 +3,11 @@
 
 #ident "Copyright (c) 2007, 2008 Tokutek Inc.  All rights reserved."
 
+#include <sys/types.h>
 #include <zlib.h>
 
 // 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) {
-    if (len==0) return oldcrc32;
-    else return crc32((unsigned long)oldcrc32, data, (uInt)len);
-}
+inline u_int32_t toku_crc32 (u_int32_t oldcrc32, const void *data, u_int32_t len);
 
 static const u_int32_t toku_null_crc = 0;
 
diff --git a/newbrt/omt.c b/newbrt/omt.c
index 7936775fa6d..10096b076cc 100644
--- a/newbrt/omt.c
+++ b/newbrt/omt.c
@@ -3,7 +3,7 @@
 #include <errno.h>
 #include <sys/types.h>
 
-typedef struct value *OMTVALUE;
+typedef void *OMTVALUE;
 #include "omt.h"
 #include "../newbrt/memory.h"
 #include "../newbrt/toku_assert.h"
diff --git a/newbrt/randdb4.c b/newbrt/randdb4.c
deleted file mode 100644
index cfd7b039c73..00000000000
--- a/newbrt/randdb4.c
+++ /dev/null
@@ -1,137 +0,0 @@
-/* -*- 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;
-}
diff --git a/newbrt/recover.c b/newbrt/recover.c
index fbe6c1eccfc..eb2429aaff3 100644
--- a/newbrt/recover.c
+++ b/newbrt/recover.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);
     assert(node->height>0);
     //printf("deq: %lld expected_old_fingerprint=%08x actual=%08x new=%08x\n", diskoff, oldfingerprint, node->local_fingerprint, newfingerprint);
-    bytevec actual_key, actual_data;
-    ITEMLEN actual_keylen, actual_datalen;
-    u_int32_t actual_type;
-    TXNID   actual_xid;
+    bytevec actual_key=0, actual_data=0;
+    ITEMLEN actual_keylen=0, actual_datalen=0;
+    u_int32_t actual_type=0;
+    TXNID   actual_xid=0;
     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);
     assert(r==0);
@@ -430,7 +430,7 @@ void toku_recover_fopen (LSN UU(lsn), TXNID UU(txnid), BYTESTRING fname, FILENUM
     CACHEFILE cf;
     int fd = open(fixedfname, O_RDWR, 0);
     assert(fd>=0);
-    BRT brt;
+    BRT brt=0;
     int r = toku_brt_create(&brt);
     assert(r==0);
     brt->fname = fixedfname;
diff --git a/src/Makefile b/src/Makefile
index ff79da30f06..b8b2b4a1cf4 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -73,7 +73,7 @@ ydbtrace.o tdbtrace.o: tdbtrace.h
 ydbtrace.o: ydb.c
 	$(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))
 
-- 
2.30.9