Commit 4fc04593 authored by Rich Prohaska's avatar Rich Prohaska Committed by Yoni Fogel

build the liux bdb versions of db-benchmark-test and scanscan. closes #1320

git-svn-id: file:///svn/toku/tokudb.1032b@8300 c7de825b-a66e-492c-adef-691d508d4ae1
parent 0c05437c
......@@ -22,8 +22,8 @@ include $(TOKUROOT)include/Makefile.include
BENCHDBS = bench.bdb/ bench.tokudb ptest*.dir/ x.dir/ xfast.dir/
ifdef BDBDIR
BDB_CPPFLAGS = -I$(BDBDIR)/include
BDB_LDFLAGS = -L$(BDBDIR)/lib -ldb -Wl,-rpath,$(BDBDIR)/lib -lpthread
BDB_CPPFLAGS = -D_GNU_SOURCE -I$(BDBDIR)/include -I../include -I../linux
BDB_LDFLAGS = -L$(BDBDIR)/lib -ldb -Wl,-rpath,$(BDBDIR)/lib $(LIBPORTABILITY) -lpthread
else
BDB_CPPFLAGS =
BDB_LDFLAGS = -ldb
......@@ -32,12 +32,14 @@ TOKUDB=libtokudb.$(SOEXT)
TDB_DLINK_FILES = $(TOKUROOT)lib/$(TOKUDB)
TARGET_BDB = db-benchmark-test-bdb$(BINSUF)
SCANSCAN_BDB = scanscan-bdb$(BINSUF)
TARGET_TDB = db-benchmark-test-tokudb$(BINSUF)
SCANSCAN_TDB = scanscan-tokudb$(BINSUF)
TARGETS = $(TARGET_BDB) $(TARGET_TDB) $(SCANSCAN_TDB)
TARGETS = $(TARGET_BDB) $(SCANSCAN_BDB) $(TARGET_TDB) $(SCANSCAN_TDB)
default: build
build: $(TARGETS)
build.bdb: $(TARGET_BDB) $(SCANSCAN_BDB)
build.tdb: $(TARGET_TDB) $(SCANSCAN_TDB)
check: check-default check-xfast check-x
......@@ -97,7 +99,9 @@ $(SCANSCAN_TDB): scanscan.c
endif
$(TARGET_BDB): db-benchmark-test.c
$(CC) $(CFLAGS) $(BDB_CPPFLAGS) $(BDB_LDFLAGS) $< -o $@ -DDIRSUF=bdb
$(MAYBEATSIGN)$(CC) $(CFLAGS) $(BDB_CPPFLAGS) $< -o $@ -DDIRSUF=bdb $(BDB_LDFLAGS)
$(SCANSCAN_BDB): scanscan.c
$(MAYBEATSIGN)$(CC) $(CFLAGS) $(BDB_CPPFLAGS) $< -o $@ -DDIRSUF=bdb $(BDB_LDFLAGS)
PARGS =
......
......@@ -2,7 +2,6 @@
#ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved."
/* Insert a bunch of stuff */
#include <toku_portability.h>
#include <assert.h>
#include <errno.h>
......@@ -55,6 +54,8 @@ static void do_prelock(DB* db, DB_TXN* txn) {
#if !defined(NO_DB_PRELOCKED)
int r = db->pre_acquire_table_lock(db, txn);
assert(r==0);
#else
db = db; txn = txn;
#endif
}
}
......
......@@ -6,8 +6,6 @@
#include <errno.h>
#include <stdlib.h>
#include <string.h>
//#include <sys/resource.h>
//#include <sys/time.h>
#include <fcntl.h>
#include <unistd.h>
......@@ -34,8 +32,10 @@ static void parse_args (int argc, const char *argv[]) {
if (specified_run_mode && run_mode!=RUN_VERIFY) goto two_modes;
run_mode = RUN_HWC;
} else if (strcmp(*argv, "--prelock")==0) prelock=1;
#ifdef TOKUDB
else if (strcmp(*argv, "--prelockflag")==0) { prelockflag=1; lock_flag = DB_PRELOCKED; }
else if (strcmp(*argv, "--prelockwriteflag")==0) { prelockflag=1; lock_flag = DB_PRELOCKED_WRITE; }
#endif
else if (strcmp(*argv, "--nox")==0) { do_txns=0; }
else if (strcmp(*argv, "--count")==0) {
char *end;
......@@ -86,6 +86,7 @@ static void scanscan_setup (void) {
r = env->txn_begin(env, 0, &tid, 0); assert(r==0);
}
r = db->open(db, tid, dbfilename, NULL, DB_BTREE, 0, S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH); assert(r==0);
#ifdef TOKUDB
if (prelock) {
r = db->pre_acquire_read_lock(db,
tid,
......@@ -93,6 +94,7 @@ static void scanscan_setup (void) {
db->dbt_pos_infty(), db->dbt_pos_infty());
assert(r==0);
}
#endif
}
static void scanscan_shutdown (void) {
......@@ -146,6 +148,8 @@ static void scanscan_hwc (void) {
}
}
#ifdef TOKUDB
struct extra_count {
long long totalbytes;
int rowcounter;
......@@ -234,6 +238,7 @@ static void scanscan_verify (void) {
}
}
#endif
int main (int argc, const char *argv[]) {
......@@ -241,12 +246,14 @@ int main (int argc, const char *argv[]) {
scanscan_setup();
switch (run_mode) {
case RUN_HWC: scanscan_hwc(); goto ok;
case RUN_LWC: scanscan_lwc(); goto ok;
case RUN_VERIFY: scanscan_verify(); goto ok;
case RUN_HWC: scanscan_hwc(); break;
#ifdef TOKUDB
case RUN_LWC: scanscan_lwc(); break;
case RUN_VERIFY: scanscan_verify(); break;
#else
default: assert(0); break;
#endif
}
assert(0);
ok:
scanscan_shutdown();
#if 0 && defined TOKUDB
......
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