Commit 25cb6d4b authored by Bradley C. Kuszmaul's avatar Bradley C. Kuszmaul

Break out test4 from brt-test. brt-test runs in 13 seconds, brt-test4 in 9...

Break out test4 from brt-test.   brt-test runs in 13 seconds, brt-test4 in 9 seconds, brt-test-cursor in 4 seconds, so we have halved the critical path.  Fixes #475.

git-svn-id: file:///svn/tokudb@2581 c7de825b-a66e-492c-adef-691d508d4ae1
parent 771c48e9
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
# make VERBOSE=2 # make VERBOSE=2
# GCOV_FLAGS = -fprofile-arcs -ftest-coverage # GCOV_FLAGS = -fprofile-arcs -ftest-coverage
PROF_FLAGS = -pg # PROF_FLAGS = -pg
OPTFLAGS = -O2 OPTFLAGS = -O2
ifeq ($(VERBOSE),2) ifeq ($(VERBOSE),2)
...@@ -54,6 +54,7 @@ REGRESSION_TESTS = \ ...@@ -54,6 +54,7 @@ REGRESSION_TESTS = \
fifo-test \ fifo-test \
test-brt-delete-both \ test-brt-delete-both \
brt-test \ brt-test \
brt-test4 \
brt-test-cursor \ brt-test-cursor \
test_oexcl \ test_oexcl \
test-assert \ test-assert \
...@@ -98,6 +99,7 @@ CHECKS = \ ...@@ -98,6 +99,7 @@ CHECKS = \
test-brt-delete-both \ test-brt-delete-both \
brt-test \ brt-test \
brt-test-cursor \ brt-test-cursor \
brt-test4 \
fifo-test \ fifo-test \
test_toku_malloc_plain_free \ test_toku_malloc_plain_free \
test-primes \ test-primes \
...@@ -128,7 +130,7 @@ check-fanout: ...@@ -128,7 +130,7 @@ check-fanout:
let BRT_FANOUT=BRT_FANOUT+1; \ let BRT_FANOUT=BRT_FANOUT+1; \
done done
pma-test benchmark-test brt-test brt-test-cursor test-brt-delete-both brt-serialize-test brtdump test-inc-split test-del-inorder: LDFLAGS+=-lz pma-test benchmark-test brt-test brt-test4 brt-test-cursor test-brt-delete-both brt-serialize-test brtdump test-inc-split test-del-inorder: LDFLAGS+=-lz
# pma: PROF_FLAGS=-fprofile-arcs -ftest-coverage # pma: PROF_FLAGS=-fprofile-arcs -ftest-coverage
BRT_INTERNAL_H_INCLUDES = brt-internal.h cachetable.h fifo.h pma.h brt.h brttypes.h yerror.h ybt.h log.h ../include/db.h kv-pair.h memory.h crc.h BRT_INTERNAL_H_INCLUDES = brt-internal.h cachetable.h fifo.h pma.h brt.h brttypes.h yerror.h ybt.h log.h ../include/db.h kv-pair.h memory.h crc.h
...@@ -144,10 +146,10 @@ ybt.o: ybt.h brttypes.h ../include/db.h ...@@ -144,10 +146,10 @@ 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: cachetable.h hashfun.h memory.h cachetable.o: cachetable.h hashfun.h memory.h
brt-test-cursor brt-test: ybt.o brt.o fifo.o pma.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-test4 brt-test-cursor brt-test: ybt.o brt.o fifo.o pma.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
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-test-cursor.o brt-test.o brt.o: brt.h ../include/db.h fifo.h pma.h brttypes.h cachetable.h memory.h brt-test4.o brt-test-cursor.o brt-test.o brt.o: brt.h ../include/db.h fifo.h pma.h brttypes.h cachetable.h memory.h
brt-serialize-test.o: $(BRT_INTERNAL_H_INCLUDES) brt-serialize-test.o: $(BRT_INTERNAL_H_INCLUDES)
brt.o: $(BRT_INTERNAL_H_INCLUDES) key.h log_header.h brt.o: $(BRT_INTERNAL_H_INCLUDES) key.h log_header.h
fifo.o: fifo.h brttypes.h fifo.o: fifo.h brttypes.h
......
...@@ -139,37 +139,6 @@ static void test3 (int nodesize, int count, int memcheck) { ...@@ -139,37 +139,6 @@ static void test3 (int nodesize, int count, int memcheck) {
} }
} }
static void test4 (int nodesize, int count, int memcheck) {
BRT t;
int r;
struct timeval t0,t1;
int i;
CACHETABLE ct;
char fname[]="testbrt.brt";
gettimeofday(&t0, 0);
unlink(fname);
toku_memory_check=memcheck;
toku_memory_check_all_free();
r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0);
r = toku_open_brt(fname, 0, 1, &t, nodesize, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0);
for (i=0; i<count; i++) {
char key[100],val[100];
int rv = random();
DBT k,v;
snprintf(key,100,"hello%d",rv);
snprintf(val,100,"there%d",i);
toku_brt_insert(t, toku_fill_dbt(&k, key, 1+strlen(key)), toku_fill_dbt(&v, val, 1+strlen(val)), null_txn);
}
r = toku_close_brt(t); assert(r==0);
r = toku_cachetable_close(&ct); assert(r==0);
toku_memory_check_all_free();
gettimeofday(&t1, 0);
{
double tdiff = (t1.tv_sec-t0.tv_sec)+1e-6*(t1.tv_usec-t0.tv_usec);
if (verbose) printf("random insertions: blocksize=%d %d insertions in %.3f seconds, %.2f insertions/second\n", nodesize, count, tdiff, count/tdiff);
}
}
static void test5 (void) { static void test5 (void) {
int r; int r;
BRT t; BRT t;
...@@ -1723,21 +1692,14 @@ static void brt_blackbox_test (void) { ...@@ -1723,21 +1692,14 @@ static void brt_blackbox_test (void) {
if (verbose) printf("test3 slow\n"); if (verbose) printf("test3 slow\n");
toku_memory_check=0; toku_memory_check=0;
test3(2048, 1<<15, 1); test3(2048, 1<<15, 1);
if (verbose) printf("test4 slow\n");
test4(2048, 1<<15, 1);
if (verbose) printf("test3 fast\n"); if (verbose) printf("test3 fast\n");
if (verbose) toku_pma_show_stats(); if (verbose) toku_pma_show_stats();
test3(1<<15, 1024, 1); test3(1<<15, 1024, 1);
test4(1<<15, 1024, 1);
if (verbose) printf("test3 fast\n"); if (verbose) printf("test3 fast\n");
test3(1<<18, 1<<20, 0); test3(1<<18, 1<<20, 0);
test4(1<<18, 1<<20, 0);
// Once upon a time srandom(8) caused this test to fail.
srandom(8); test4(2048, 1<<15, 1);
toku_memory_check = 1; toku_memory_check = 1;
...@@ -1753,16 +1715,12 @@ static void brt_blackbox_test (void) { ...@@ -1753,16 +1715,12 @@ static void brt_blackbox_test (void) {
toku_brt_do_push_cmd = old_brt_do_push_cmd; toku_brt_do_push_cmd = old_brt_do_push_cmd;
// test3(1<<19, 1<<20, 0); // test3(1<<19, 1<<20, 0);
// test4(1<<19, 1<<20, 0);
// test3(1<<20, 1<<20, 0); // test3(1<<20, 1<<20, 0);
// test4(1<<20, 1<<20, 0);
// test3(1<<20, 1<<21, 0); // test3(1<<20, 1<<21, 0);
// test4(1<<20, 1<<21, 0);
// test3(1<<20, 1<<22, 0); // test3(1<<20, 1<<22, 0);
// test4(1<<20, 1<<22, 0);
} }
......
/* -*- mode: C; c-basic-offset: 4 -*- */
#ident "Copyright (c) 2007, 2008 Tokutek Inc. All rights reserved."
#include "brt.h"
#include "key.h"
#include "pma.h"
#include "brt-internal.h"
#include "memory.h"
#include "toku_assert.h"
#include <fcntl.h>
#include <stdio.h>
#include <string.h>
#include <sys/time.h>
#include <stdlib.h>
#include <unistd.h>
#include <arpa/inet.h>
#include "test.h"
static const char fname[]= __FILE__ ".brt";
static TOKUTXN const null_txn = 0;
static DB * const null_db = 0;
static void test4 (int nodesize, int count, int memcheck) {
BRT t;
int r;
struct timeval t0,t1;
int i;
CACHETABLE ct;
gettimeofday(&t0, 0);
unlink(fname);
toku_memory_check=memcheck;
toku_memory_check_all_free();
r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0);
r = toku_open_brt(fname, 0, 1, &t, nodesize, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0);
for (i=0; i<count; i++) {
char key[100],val[100];
int rv = random();
DBT k,v;
snprintf(key,100,"hello%d",rv);
snprintf(val,100,"there%d",i);
toku_brt_insert(t, toku_fill_dbt(&k, key, 1+strlen(key)), toku_fill_dbt(&v, val, 1+strlen(val)), null_txn);
}
r = toku_close_brt(t); assert(r==0);
r = toku_cachetable_close(&ct); assert(r==0);
toku_memory_check_all_free();
gettimeofday(&t1, 0);
{
double tdiff = (t1.tv_sec-t0.tv_sec)+1e-6*(t1.tv_usec-t0.tv_usec);
if (verbose) printf("random insertions: blocksize=%d %d insertions in %.3f seconds, %.2f insertions/second\n", nodesize, count, tdiff, count/tdiff);
}
}
static void brt_blackbox_test (void) {
if (verbose) printf("test4 slow\n");
test4(2048, 1<<15, 1);
if (verbose) toku_pma_show_stats();
test4(1<<15, 1024, 1);
test4(1<<18, 1<<20, 0);
// Once upon a time srandom(8) caused this test to fail.
srandom(8); test4(2048, 1<<15, 1);
}
int main (int argc , const char *argv[]) {
default_parse_args(argc, argv);
brt_blackbox_test();
toku_malloc_cleanup();
if (verbose) printf("test ok\n");
return 0;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment