diff options
author | Keith Bostic <keith@wiredtiger.com> | 2014-08-07 07:24:17 -0400 |
---|---|---|
committer | Keith Bostic <keith@wiredtiger.com> | 2014-08-07 07:24:17 -0400 |
commit | 2ba9ac1963cffd53d9b0f3b6287572107564b81c (patch) | |
tree | 02edabe2b40fde5ef8a6fc973cbf2f862d5b173e /bench | |
parent | 2b0508fe2907f109721425dca86a6c7ac7280787 (diff) | |
download | mongo-2ba9ac1963cffd53d9b0f3b6287572107564b81c.tar.gz |
Remove tcbench, it makes clang's static analyzer unhappy and we're not
doing to fix it.
Diffstat (limited to 'bench')
-rw-r--r-- | bench/tcbench/Makefile.am | 9 | ||||
-rw-r--r-- | bench/tcbench/README | 66 | ||||
-rw-r--r-- | bench/tcbench/tokyocabinet-test.patch | 193 | ||||
-rw-r--r-- | bench/tcbench/wttest.c | 608 |
4 files changed, 0 insertions, 876 deletions
diff --git a/bench/tcbench/Makefile.am b/bench/tcbench/Makefile.am deleted file mode 100644 index d56892f8b8c..00000000000 --- a/bench/tcbench/Makefile.am +++ /dev/null @@ -1,9 +0,0 @@ -AM_CPPFLAGS = -I$(top_builddir) -LDADD = $(top_builddir)/libwiredtiger.la - -noinst_PROGRAMS = wttest -wttest_SOURCES = wttest.c - -clean-local: - rm -rf WiredTiger* *.core casket.wt - diff --git a/bench/tcbench/README b/bench/tcbench/README deleted file mode 100644 index 855135f590a..00000000000 --- a/bench/tcbench/README +++ /dev/null @@ -1,66 +0,0 @@ -================================================================ - Comparison of key/value stores -================================================================ - -In the wiredtiger/bench/tcbench directory is a simple test of WiredTiger -that inserts, then reads, some records in a single file. It's designed -to match the functionality of the Tokyo Cabinet "bros" tests, so results -can be compared across various key/value stores. - -To run the test, first build WiredTiger in the top-level "build_posix" -directory. Building WiredTiger also builds the application "wttest" in -the wiredtiger/build_posix/bench/tcbench directory. - -To run wttest as a standalone read test: - - $ cd wiredtiger/build_posix/bench/tcbench - $ ./wttest read file:casket.wt 1000000 - -To run wttest as a standalone write test: - - $ cd wiredtiger/build_posix/bench/tcbench - $ ./wttest write file:casket.wt 1000000 - -================================================================ -To compare the results from WiredTiger with various other stores: - -1. Download, configure and build Tokyo Cabinet, using GNU make: - - $ cd tokyocabinet - $ ./configure - $ gmake - -2. Apply the tokyocabinet-test.patch in the bros subdirectory of the - TokyoCabinet distribution; this patch updates the bros Makefile to - build wttest and to build a local version of Berkeley DB, updates the - "reporter" script to run wttest, as well as fixing bugs in the - reporter script. - - NOTE: This patch was created for the TokyoCabinet 1.4.47 release - distribution, if you are building with a different distribution, the - patch may not work. - - $ cd tokyocabinet/bros - $ patch < path-to-WiredTiger/bench/tcbench/tokyocabinet-test.patch - -3. Set the environment variable WT_HOME to the path of the top-level - WiredTiger directory and the BDB_HOME environment variable to path - of the top-level Berkeley DB directory, and then build the test - programs: - - $ env \ - WT_HOME=path-to-WiredTiger \ - BDB_HOME=path-to-BerkeleyDB \ - gmake bdbtest tctest wttest - -4. Run "reporter": - - $ ./reporter - -5. The output concludes with CSV output for the various runs: the columns - are as follows: - - column 1: key/value store identifier, - column 2: elapsed time for writing 1M records, - column 3: elapsed time for reading 1M records, - column 4: file size. diff --git a/bench/tcbench/tokyocabinet-test.patch b/bench/tcbench/tokyocabinet-test.patch deleted file mode 100644 index fe1a260fd33..00000000000 --- a/bench/tcbench/tokyocabinet-test.patch +++ /dev/null @@ -1,193 +0,0 @@ -*** Makefile.orig Mon Jan 26 02:44:10 2009 ---- Makefile Tue Sep 13 15:17:04 2011 -*************** -*** 12,18 **** - - # Targets - MYBINS = tctest qdbmtest ndbmtest sdbmtest gdbmtest tdbtest cdbtest bdbtest \ -! maptest sqltest cmpsqltctest - - - ---- 12,18 ---- - - # Targets - MYBINS = tctest qdbmtest ndbmtest sdbmtest gdbmtest tdbtest cdbtest bdbtest \ -! maptest sqltest cmpsqltctest wttest - - - -*************** -*** 98,106 **** - - - bdbtest : bdbtest.c -! gcc -I/usr/local/bdb/include -D_GNU_SOURCE=1 \ - -Wall -O3 -o $@ bdbtest.c \ -! -static -L/usr/local/bdb/lib -ldb -lpthread -lc - - - maptest : maptest.cc ---- 98,112 ---- - - - bdbtest : bdbtest.c -! gcc -I$(BDB_HOME)/build_unix -D_GNU_SOURCE=1 \ - -Wall -O3 -o $@ bdbtest.c \ -! -static $(BDB_HOME)/build_unix/libdb.a -lpthread -lc -! -! -! wttest : $(WT_HOME)/bench/tcbench/wttest.c -! gcc -I$(WT_HOME)/build_posix -D_GNU_SOURCE=1 \ -! -Wall -O3 -o $@ $(WT_HOME)/bench/tcbench/wttest.c \ -! -static $(WT_HOME)/build_posix/.libs/libwiredtiger.a -lpthread -lc - - - maptest : maptest.cc ---- reporter.orig 2008-07-27 22:30:39.000000000 +1000 -+++ reporter 2011-08-05 17:20:26.500784436 +1000 -@@ -11,9 +11,9 @@ - - use constant { - RECNUM => 1000000, -- TESTCOUNT => 20, -+ TESTCOUNT => 7, - REMOVETOP => 2, -- REMOVEBOTTOM => 8, -+ REMOVEBOTTOM => 2, - }; - - my @commands = ( -@@ -47,6 +47,27 @@ - './bdbtest btread -rnd casket.bdbb_r ' . RECNUM, - './tctest flwrite casket.tcf ' . RECNUM, - './tctest flread casket.tcf ' . RECNUM, -+ -+ './wttest write -bulk file:casket.wt_b ' . RECNUM, -+ './wttest read file:casket.wt_b ' . RECNUM, -+ './wttest write file:casket.wt_a ' . RECNUM, -+ './wttest read file:casket.wt_a ' . RECNUM, -+ './wttest write -rnd file:casket.wt_r ' . RECNUM, -+ './wttest read -rnd file:casket.wt_r ' . RECNUM, -+ -+ './wttest vlcswrite -bulk file:casket.vlwt_b ' . RECNUM, -+ './wttest vlcsread file:casket.vlwt_b ' . RECNUM, -+ './wttest vlcswrite file:casket.vlwt_a ' . RECNUM, -+ './wttest vlcsread file:casket.vlwt_a ' . RECNUM, -+ './wttest vlcswrite -rnd file:casket.vlwt_r ' . RECNUM, -+ './wttest vlcsread -rnd file:casket.vlwt_r ' . RECNUM, -+ -+ './wttest flcswrite -bulk file:casket.flwt_b ' . RECNUM, -+ './wttest flcsread file:casket.flwt_b ' . RECNUM, -+ './wttest flcswrite file:casket.flwt_a ' . RECNUM, -+ './wttest flcsread file:casket.flwt_a ' . RECNUM, -+ './wttest flcswrite -rnd file:casket.flwt_r ' . RECNUM, -+ './wttest flcsread -rnd file:casket.flwt_r ' . RECNUM, - ); - - my @names = ( -@@ -65,6 +86,15 @@ - 'casket.bdbb', - 'casket.bdbb_r', - 'casket.tcf', -+ 'casket.wt_b', -+ 'casket.wt_a', -+ 'casket.wt_r', -+ 'casket.vlwt_b', -+ 'casket.vlwt_a', -+ 'casket.vlwt_r', -+ 'casket.flwt_b', -+ 'casket.flwt_a', -+ 'casket.flwt_r', - ); - - foreach my $name (@names){ -@@ -120,22 +150,36 @@ - } - printf("\n"); - --printf("%s,%.5f,%.5f,%d\n", "TC", $table[0][1], $table[1][1], $sizes[0]); --printf("%s,%.5f,%.5f,%d\n", "QDBM", $table[2][1], $table[3][1], $sizes[1]); --printf("%s,%.5f,%.5f,%d\n", "NDBM", $table[4][1], $table[5][1], $sizes[2]); --printf("%s,%.5f,%.5f,%d\n", "SDBM", $table[6][1], $table[7][1], $sizes[3]); --printf("%s,%.5f,%.5f,%d\n", "GDBM", $table[8][1], $table[9][1], $sizes[4]); --printf("%s,%.5f,%.5f,%d\n", "TDB", $table[10][1], $table[11][1], $sizes[5]); --printf("%s,%.5f,%.5f,%d\n", "CDB", $table[12][1], $table[13][1], $sizes[6]); --printf("%s,%.5f,%.5f,%d\n", "BDB", $table[14][1], $table[15][1], $sizes[7]); -+printf("%s,%.5f,%.5f,%d\n", "TC-HASH", $table[0][1], $table[1][1], $sizes[0]); -+printf("%s,%.5f,%.5f,%d\n", "QDBM-HASH", $table[2][1], $table[3][1], $sizes[1]); -+#printf("%s,%.5f,%.5f,%d\n", "NDBM", $table[4][1], $table[5][1], $sizes[2]); -+#printf("%s,%.5f,%.5f,%d\n", "SDBM", $table[6][1], $table[7][1], $sizes[3]); -+#printf("%s,%.5f,%.5f,%d\n", "GDBM", $table[8][1], $table[9][1], $sizes[4]); -+#printf("%s,%.5f,%.5f,%d\n", "TDB", $table[10][1], $table[11][1], $sizes[5]); -+#printf("%s,%.5f,%.5f,%d\n", "CDB", $table[12][1], $table[13][1], $sizes[6]); -+printf("%s,%.5f,%.5f,%d\n", "BDB-HASH", $table[14][1], $table[15][1], $sizes[7]); -+ -+# Ordered trees, in-order writes - printf("%s,%.5f,%.5f,%d\n", "TC-BT-ASC", $table[16][1], $table[17][1], $sizes[8]); --printf("%s,%.5f,%.5f,%d\n", "TC-BT-RND", $table[18][1], $table[19][1], $sizes[9]); - printf("%s,%.5f,%.5f,%d\n", "QDBM-BT-ASC", $table[20][1], $table[21][1], $sizes[10]); --printf("%s,%.5f,%.5f,%d\n", "QDBM-BT-RND", $table[22][1], $table[23][1], $sizes[11]); - printf("%s,%.5f,%.5f,%d\n", "BDB-BT-ASC", $table[24][1], $table[25][1], $sizes[12]); --printf("%s,%.5f,%.5f,%d\n", "BDB-BT-RND", $table[26][1], $table[27][1], $sizes[13]); --printf("%s,%.5f,%.5f,%d\n", "TC-FIXED", $table[28][1], $table[29][1], $sizes[14]); -+printf("%s,%.5f,%.5f,%d\n", "WT-BT-BULK", $table[30][1], $table[31][1], $sizes[15]); -+printf("%s,%.5f,%.5f,%d\n", "WT-BT-ASC", $table[32][1], $table[33][1], $sizes[16]); - -+# Ordered trees, random writes -+printf("%s,%.5f,%.5f,%d\n", "TC-BT-RND", $table[18][1], $table[19][1], $sizes[9]); -+printf("%s,%.5f,%.5f,%d\n", "QDBM-BT-RND", $table[22][1], $table[23][1], $sizes[11]); -+printf("%s,%.5f,%.5f,%d\n", "BDB-BT-RND", $table[26][1], $table[27][1], $sizes[13]); -+printf("%s,%.5f,%.5f,%d\n", "WT-BT-RND", $table[34][1], $table[35][1], $sizes[17]); - -+# Fixed-size / column stores -+printf("%s,%.5f,%.5f,%d\n", "TC-FIXED", $table[28][1], $table[29][1], $sizes[14]); -+printf("%s,%.5f,%.5f,%d\n", "WT-VAR-BULK", $table[36][1], $table[37][1], $sizes[18]); -+printf("%s,%.5f,%.5f,%d\n", "WT-VAR", $table[38][1], $table[39][1], $sizes[19]); -+printf("%s,%.5f,%.5f,%d\n", "WT-VAR-RND", $table[40][1], $table[41][1], $sizes[20]); -+ -+printf("%s,%.5f,%.5f,%d\n", "WT-FIX-BULK", $table[42][1], $table[43][1], $sizes[21]); -+printf("%s,%.5f,%.5f,%d\n", "WT-FIX", $table[44][1], $table[45][1], $sizes[22]); -+printf("%s,%.5f,%.5f,%d\n", "WT-FIX-RND", $table[46][1], $table[47][1], $sizes[23]); - - # END OF FILE ---- reporter.orig 2011-08-05 17:20:26.500784436 +1000 -+++ reporter 2011-09-14 06:19:44.702015434 +1000 -@@ -33,16 +33,16 @@ - './cdbtest read casket.cdbh ' . RECNUM, - './bdbtest write casket.bdbh ' . RECNUM, - './bdbtest read casket.bdbh ' . RECNUM, -- './tctest btwrite casket.tcb ' . RECNUM, -- './tctest btread casket.tcb ' . RECNUM, -+ './tctest btwrite casket.tcb_a ' . RECNUM, -+ './tctest btread casket.tcb_a ' . RECNUM, - './tctest btwrite -rnd casket.tcb_r ' . RECNUM, - './tctest btread -rnd casket.tcb_r ' . RECNUM, -- './qdbmtest btwrite casket.qdbb ' . RECNUM, -- './qdbmtest btread casket.qdbb ' . RECNUM, -+ './qdbmtest btwrite casket.qdbb_a ' . RECNUM, -+ './qdbmtest btread casket.qdbb_a ' . RECNUM, - './qdbmtest btwrite -rnd casket.qdbb_r ' . RECNUM, - './qdbmtest btread -rnd casket.qdbb_r ' . RECNUM, -- './bdbtest btwrite casket.bdbb ' . RECNUM, -- './bdbtest btread casket.bdbb ' . RECNUM, -+ './bdbtest btwrite casket.bdbb_a ' . RECNUM, -+ './bdbtest btread casket.bdbb_a ' . RECNUM, - './bdbtest btwrite -rnd casket.bdbb_r ' . RECNUM, - './bdbtest btread -rnd casket.bdbb_r ' . RECNUM, - './tctest flwrite casket.tcf ' . RECNUM, -@@ -79,11 +79,11 @@ - 'casket.tdbh', - 'casket.cdbh', - 'casket.bdbh', -- 'casket.tcb', -+ 'casket.tcb_a', - 'casket.tcb_r', -- 'casket.qdbb', -+ 'casket.qdbb_a', - 'casket.qdbb_r', -- 'casket.bdbb', -+ 'casket.bdbb_a', - 'casket.bdbb_r', - 'casket.tcf', - 'casket.wt_b', diff --git a/bench/tcbench/wttest.c b/bench/tcbench/wttest.c deleted file mode 100644 index 9cb0ce8d804..00000000000 --- a/bench/tcbench/wttest.c +++ /dev/null @@ -1,608 +0,0 @@ -/************************************************************************************************* - * Microbenchmark of WiredTiger - * Designed to be comparable with the TokyoCabinet "bros" tests. - *************************************************************************************************/ - - -#include <stdbool.h> -#include <stdint.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <wiredtiger.h> - -#undef TRUE -#define TRUE 1 /* boolean true */ -#undef FALSE -#define FALSE 0 /* boolean false */ - -#define RECBUFSIZ 32 /* buffer for records */ - - -/* global variables */ -const char *progname; /* program name */ -int showprgr; /* whether to show progression */ - - -/* function prototypes */ -int main(int argc, char **argv); -void usage(void); -int setup(char *name, const char *kf, const char *vf, const char *cconfig, WT_CURSOR **cursor); -int teardown(void); -int runwrite(int argc, char **argv); -int runread(int argc, char **argv); -int runvlcswrite(int argc, char **argv); -int runvlcsread(int argc, char **argv); -int runflcswrite(int argc, char **argv); -int runflcsread(int argc, char **argv); -int myrand(void); -int dowrite(char *name, int rnum, int bulk, int rnd); -int doread(char *name, int rnum, int rnd); -int dovlcswrite(char *name, int rnum, int bulk, int rnd); -int dovlcsread(char *name, int rnum, int rnd); -int doflcswrite(char *name, int rnum, int bulk, int rnd); -int doflcsread(char *name, int rnum, int rnd); - - -/* main routine */ -int main(int argc, char **argv){ - int rv; - progname = argv[0]; - showprgr = TRUE; - if(getenv("HIDEPRGR")) - showprgr = FALSE; - srand48(1978); - if(argc < 2) - usage(); - rv = 0; - if(!strcmp(argv[1], "write")){ - rv = runwrite(argc, argv); - } else if(!strcmp(argv[1], "read")){ - rv = runread(argc, argv); - } else if(!strcmp(argv[1], "vlcswrite")){ - rv = runvlcswrite(argc, argv); - } else if(!strcmp(argv[1], "vlcsread")){ - rv = runvlcsread(argc, argv); - } else if(!strcmp(argv[1], "flcswrite")){ - rv = runflcswrite(argc, argv); - } else if(!strcmp(argv[1], "flcsread")){ - rv = runflcsread(argc, argv); - } else { - usage(); - } - return rv; -} - - -/* print the usage and exit */ -void usage(void){ - fprintf(stderr, "%s: test cases for WiredTiger\n", progname); - fprintf(stderr, "\n"); - fprintf(stderr, "usage:\n"); - fprintf(stderr, " %s write [-bulk|-rnd] name rnum\n", progname); - fprintf(stderr, " %s read [-rnd] name rnum\n", progname); - fprintf(stderr, " %s vlcswrite [-bulk|-rnd] name rnum\n", progname); - fprintf(stderr, " %s vlcsread [-rnd] name rnum\n", progname); - fprintf(stderr, " %s flcswrite [-bulk|-rnd] name rnum\n", progname); - fprintf(stderr, " %s flcsread [-rnd] name rnum\n", progname); - fprintf(stderr, "\n"); - exit(1); -} - - -/* parse arguments of write command */ -int runwrite(int argc, char **argv){ - char *name, *rstr; - int bulk, i, rnd, rnum, rv; - name = NULL; - rstr = NULL; - bulk = rnd = FALSE; - rnum = 0; - for(i = 2; i < argc; i++){ - if(!name && argv[i][0] == '-'){ - if(!name && !strcmp(argv[i], "-bulk")) - bulk = TRUE; - else if(!name && !strcmp(argv[i], "-rnd")) - rnd = TRUE; - else - usage(); - } else if(!name){ - name = argv[i]; - } else if(!rstr){ - rstr = argv[i]; - } else { - usage(); - } - } - if(!name || !rstr) - usage(); - rnum = atoi(rstr); - if(rnum < 1) - usage(); - rv = dowrite(name, rnum, bulk, rnd); - return rv; -} - - -/* parse arguments of read command */ -int runread(int argc, char **argv){ - char *name, *rstr; - int i, rnd, rnum, rv; - name = NULL; - rstr = NULL; - rnd = FALSE; - rnum = 0; - for(i = 2; i < argc; i++){ - if(!name && argv[i][0] == '-'){ - if(!name && !strcmp(argv[i], "-rnd")) - rnd = TRUE; - else - usage(); - } else if(!name){ - name = argv[i]; - } else if(!rstr){ - rstr = argv[i]; - } else { - usage(); - } - } - if(!name || !rstr) - usage(); - rnum = atoi(rstr); - if(rnum < 1) - usage(); - rv = doread(name, rnum, rnd); - return rv; -} - - -/* parse arguments of write command */ -int runvlcswrite(int argc, char **argv){ - char *name, *rstr; - int bulk, i, rnd, rnum, rv; - name = NULL; - rstr = NULL; - rnum = 0; - bulk = rnd = FALSE; - for(i = 2; i < argc; i++){ - if(!name && argv[i][0] == '-'){ - if(!name && !strcmp(argv[i], "-bulk")) - bulk = TRUE; - else if(!name && !strcmp(argv[i], "-rnd")) - rnd = TRUE; - else - usage(); - } else if(!name){ - name = argv[i]; - } else if(!rstr){ - rstr = argv[i]; - } else { - usage(); - } - } - if(!name || !rstr) - usage(); - rnum = atoi(rstr); - if(rnum < 1) - usage(); - rv = dovlcswrite(name, rnum, bulk, rnd); - return rv; -} - - -/* parse arguments of read command */ -int runvlcsread(int argc, char **argv){ - char *name, *rstr; - int i, rnd, rnum, rv; - name = NULL; - rstr = NULL; - rnum = 0; - rnd = FALSE; - for(i = 2; i < argc; i++){ - if(!name && argv[i][0] == '-'){ - if(!name && !strcmp(argv[i], "-rnd")) - rnd = TRUE; - else - usage(); - } else if(!name){ - name = argv[i]; - } else if(!rstr){ - rstr = argv[i]; - } else { - usage(); - } - } - if(!name || !rstr) - usage(); - rnum = atoi(rstr); - if(rnum < 1) - usage(); - rv = dovlcsread(name, rnum, rnd); - return rv; -} - - -/* parse arguments of write command */ -int runflcswrite(int argc, char **argv){ - char *name, *rstr; - int bulk, i, rnd, rnum, rv; - name = NULL; - rstr = NULL; - rnum = 0; - bulk = rnd = FALSE; - for(i = 2; i < argc; i++){ - if(!name && argv[i][0] == '-'){ - if(!name && !strcmp(argv[i], "-bulk")) - bulk = TRUE; - else if(!name && !strcmp(argv[i], "-rnd")) - rnd = TRUE; - else - usage(); - } else if(!name){ - name = argv[i]; - } else if(!rstr){ - rstr = argv[i]; - } else { - usage(); - } - } - if(!name || !rstr) - usage(); - rnum = atoi(rstr); - if(rnum < 1) - usage(); - rv = doflcswrite(name, rnum, bulk, rnd); - return rv; -} - - -/* parse arguments of read command */ -int runflcsread(int argc, char **argv){ - char *name, *rstr; - int i, rnd, rnum, rv; - name = NULL; - rstr = NULL; - rnum = 0; - rnd = FALSE; - for(i = 2; i < argc; i++){ - if(!name && argv[i][0] == '-'){ - if(!name && !strcmp(argv[i], "-rnd")) - rnd = TRUE; - else - usage(); - } else if(!name){ - name = argv[i]; - } else if(!rstr){ - rstr = argv[i]; - } else { - usage(); - } - } - if(!name || !rstr) - usage(); - rnum = atoi(rstr); - if(rnum < 1) - usage(); - rv = doflcsread(name, rnum, rnd); - return rv; -} - - -/* pseudo random number generator */ -int myrand(void){ - static int cnt = 0; - return (int)((lrand48() + cnt++) & 0x7FFFFFFF); -} - -WT_CONNECTION *conn; - -int setup(char *name, const char *kf, const char *vf, const char *cconfig, WT_CURSOR **cursor){ - WT_SESSION *session; - int creating, ret; - char tconfig[64]; - - creating = (kf != NULL); - - if((ret = wiredtiger_open(NULL, NULL, "create", &conn) != 0) || - (ret = conn->open_session(conn, NULL, NULL, &session)) != 0) - return ret; - - /* If we get a configuration, create the table. */ - if(creating) { - (void)session->drop(session, name, "force"); - snprintf(tconfig, sizeof(tconfig), "key_format=%s,value_format=%s", kf, vf); - if ((ret = session->create(session, name, tconfig)) != 0) - return ret; - } - - return session->open_cursor(session, name, NULL, cconfig, cursor); -} - -int teardown(void){ - int ret = 0; - if (conn != NULL) { - ret = conn->close(conn, NULL); - conn = NULL; - } - return ret; -} - -/* perform write command */ -int dowrite(char *name, int rnum, int bulk, int rnd){ - WT_CURSOR *c; - WT_ITEM key, value; - int i, err; - char buf[RECBUFSIZ]; - if(showprgr) - printf("<Write Test of Row Store>\n name=%s rnum=%d\n\n", name, rnum); - /* open a database */ - if(setup(name, "u", "u", bulk ? "bulk" : NULL, &c) != 0) { - fprintf(stderr, "create failed\n"); - (void)teardown(); - return 1; - } - err = FALSE; - key.data = value.data = buf; - key.size = value.size = 8; - /* loop for each record */ - for(i = 1; i <= rnum; i++){ - /* store a record */ - sprintf(buf, "%08d", rnd ? myrand() % rnum + 1 : i); - c->set_key(c, &key); - c->set_value(c, &value); - if((err = c->insert(c)) != 0 && err != WT_DUPLICATE_KEY) { - fprintf(stderr, "insert failed\n"); - break; - } - /* print progression */ - if(showprgr && rnum > 250 && i % (rnum / 250) == 0){ - putchar('.'); - fflush(stdout); - if(i == rnum || i % (rnum / 10) == 0){ - printf(" (%08d)\n", i); - fflush(stdout); - } - } - } - /* close the database */ - if(teardown() != 0) { - fprintf(stderr, "close failed\n"); - return 1; - } - if(showprgr && !err) - printf("ok\n\n"); - return err ? 1 : 0; -} - - -/* perform read command */ -int doread(char *name, int rnum, int rnd){ - WT_CURSOR *c; - WT_ITEM key, value; - int i, err; - char buf[RECBUFSIZ]; - if(showprgr) - printf("<Read Test of Row Store>\n name=%s rnum=%d\n\n", name, rnum); - /* open a database */ - if(setup(name, NULL, NULL, NULL, &c) != 0){ - fprintf(stderr, "open failed\n"); - return 1; - } - err = FALSE; - key.data = value.data = buf; - key.size = value.size = 8; - /* loop for each record */ - for(i = 1; i <= rnum; i++){ - /* store a record */ - sprintf(buf, "%08d", rnd ? myrand() % rnum + 1 : i); - c->set_key(c, &key); - if(c->search(c) != 0){ - fprintf(stderr, "search failed\n"); - err = TRUE; - break; - } - /* Include the cost of getting the value. */ - c->get_value(c, &value); - /* print progression */ - if(showprgr && rnum > 250 && i % (rnum / 250) == 0){ - putchar('.'); - fflush(stdout); - if(i == rnum || i % (rnum / 10) == 0){ - printf(" (%08d)\n", i); - fflush(stdout); - } - } - } - /* close the database */ - if(teardown() != 0) { - fprintf(stderr, "close failed\n"); - return 1; - } - if(showprgr && !err) - printf("ok\n\n"); - return err ? 1 : 0; -} - -/* perform write command */ -int dovlcswrite(char *name, int rnum, int bulk, int rnd){ - WT_CURSOR *c; - WT_ITEM value; - int i, err; - char buf[RECBUFSIZ]; - if(showprgr) - printf("<Write Test of var-length Column Store>\n name=%s rnum=%d\n\n", name, rnum); - /* open a database */ - if(setup(name, "r", "u", bulk ? "bulk" : NULL, &c) != 0) { - fprintf(stderr, "create failed\n"); - (void)teardown(); - return 1; - } - err = FALSE; - value.data = buf; - value.size = 8; - /* loop for each record */ - for(i = 1; i <= rnum; i++){ - /* store a record */ - sprintf(buf, "%08d", i); - c->set_key(c, (uint64_t)(rnd ? myrand() % rnum + 1 : i)); - c->set_value(c, &value); - if((err = c->insert(c)) != 0 && err != WT_DUPLICATE_KEY) { - fprintf(stderr, "insert failed\n"); - break; - } - /* print progression */ - if(showprgr && rnum > 250 && i % (rnum / 250) == 0){ - putchar('.'); - fflush(stdout); - if(i == rnum || i % (rnum / 10) == 0){ - printf(" (%08d)\n", i); - fflush(stdout); - } - } - } - /* close the database */ - if(teardown() != 0) { - fprintf(stderr, "close failed\n"); - return 1; - } - if(showprgr && !err) - printf("ok\n\n"); - return err ? 1 : 0; -} - - -/* perform read command */ -int dovlcsread(char *name, int rnum, int rnd){ - WT_CURSOR *c; - int i, err; - WT_ITEM value; - if(showprgr) - printf("<Read Test of var-length Column Store>\n name=%s rnum=%d\n\n", name, rnum); - /* open a database */ - if(setup(name, NULL, NULL, NULL, &c) != 0){ - fprintf(stderr, "open failed\n"); - return 1; - } - err = FALSE; - /* loop for each record */ - for(i = 1; i <= rnum; i++){ - c->set_key(c, (uint64_t)(rnd ? myrand() % rnum + 1 : i)); - if(c->search(c) != 0){ - fprintf(stderr, "search failed\n"); - err = TRUE; - break; - } - /* Include the cost of getting the value. */ - c->get_value(c, &value); - /* print progression */ - if(showprgr && rnum > 250 && i % (rnum / 250) == 0){ - putchar('.'); - fflush(stdout); - if(i == rnum || i % (rnum / 10) == 0){ - printf(" (%08d)\n", i); - fflush(stdout); - } - } - } - /* close the database */ - if(teardown() != 0) { - fprintf(stderr, "close failed\n"); - return 1; - } - if(showprgr && !err) - printf("ok\n\n"); - return err ? 1 : 0; -} - - -/* perform write command */ -int doflcswrite(char *name, int rnum, int bulk, int rnd){ - WT_CURSOR *c; - uint8_t value; - int i, err; - char buf[RECBUFSIZ]; - if(showprgr) - printf("<Write Test of var-length Column Store>\n name=%s rnum=%d\n\n", name, rnum); - /* open a database */ - if(setup(name, "r", "8t", bulk ? "bulk" : NULL, &c) != 0) { - fprintf(stderr, "create failed\n"); - (void)teardown(); - return 1; - } - err = FALSE; - value = 42; - /* loop for each record */ - for(i = 1; i <= rnum; i++){ - /* store a record */ - sprintf(buf, "%08d", i); - c->set_key(c, (uint64_t)(rnd ? myrand() % rnum + 1 : i)); - c->set_value(c, value); - if((err = c->insert(c)) != 0 && err != WT_DUPLICATE_KEY) { - fprintf(stderr, "insert failed\n"); - break; - } - /* print progression */ - if(showprgr && rnum > 250 && i % (rnum / 250) == 0){ - putchar('.'); - fflush(stdout); - if(i == rnum || i % (rnum / 10) == 0){ - printf(" (%08d)\n", i); - fflush(stdout); - } - } - } - /* close the database */ - if(teardown() != 0) { - fprintf(stderr, "close failed\n"); - return 1; - } - if(showprgr && !err) - printf("ok\n\n"); - return err ? 1 : 0; -} - - -/* perform read command */ -int doflcsread(char *name, int rnum, int rnd){ - WT_CURSOR *c; - uint8_t value; - int i, err; - if(showprgr) - printf("<Read Test of var-length Column Store>\n name=%s rnum=%d\n\n", name, rnum); - /* open a database */ - if(setup(name, NULL, NULL, NULL, &c) != 0){ - fprintf(stderr, "open failed\n"); - return 1; - } - err = FALSE; - /* loop for each record */ - for(i = 1; i <= rnum; i++){ - c->set_key(c, (uint64_t)(rnd ? myrand() % rnum + 1 : i)); - if(c->search(c) != 0){ - fprintf(stderr, "search failed\n"); - err = TRUE; - break; - } - /* Include the cost of getting the value. */ - c->get_value(c, &value); - /* print progression */ - if(showprgr && rnum > 250 && i % (rnum / 250) == 0){ - putchar('.'); - fflush(stdout); - if(i == rnum || i % (rnum / 10) == 0){ - printf(" (%08d)\n", i); - fflush(stdout); - } - } - } - /* close the database */ - if(teardown() != 0) { - fprintf(stderr, "close failed\n"); - return 1; - } - if(showprgr && !err) - printf("ok\n\n"); - return err ? 1 : 0; -} - -/* END OF FILE */ |