Commit 0a747782 authored by John Esmet's avatar John Esmet

fixes #199 Remove BDB-related cmake logic, ydb tests (some code, mostly conditional

compilations).
parent 2b6b6a7d
...@@ -631,7 +631,6 @@ int main (int argc, char *const argv[] __attribute__((__unused__))) { ...@@ -631,7 +631,6 @@ int main (int argc, char *const argv[] __attribute__((__unused__))) {
//printf("#include <inttypes.h>\n"); //printf("#include <inttypes.h>\n");
printf("#if defined(__cplusplus) || defined(__cilkplusplus)\nextern \"C\" {\n#endif\n"); printf("#if defined(__cplusplus) || defined(__cilkplusplus)\nextern \"C\" {\n#endif\n");
printf("#define TOKUDB 1\n");
printf("#define DB_VERSION_MAJOR %d\n", DB_VERSION_MAJOR); printf("#define DB_VERSION_MAJOR %d\n", DB_VERSION_MAJOR);
printf("#define DB_VERSION_MINOR %d\n", DB_VERSION_MINOR); printf("#define DB_VERSION_MINOR %d\n", DB_VERSION_MINOR);
printf("/* As of r40364 (post TokuDB 5.2.7), the patch version number is 100+ the BDB header patch version number.*/\n"); printf("/* As of r40364 (post TokuDB 5.2.7), the patch version number is 100+ the BDB header patch version number.*/\n");
......
...@@ -93,8 +93,6 @@ if (BUILD_TESTING OR BUILD_FT_TESTS OR BUILD_SRC_TESTS) ...@@ -93,8 +93,6 @@ if (BUILD_TESTING OR BUILD_FT_TESTS OR BUILD_SRC_TESTS)
## set up full valgrind suppressions file (concatenate the suppressions files) ## set up full valgrind suppressions file (concatenate the suppressions files)
file(READ ft/valgrind.suppressions valgrind_suppressions) file(READ ft/valgrind.suppressions valgrind_suppressions)
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/valgrind.suppressions" "${valgrind_suppressions}") file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/valgrind.suppressions" "${valgrind_suppressions}")
file(READ src/tests/bdb.suppressions bdb_suppressions)
file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/valgrind.suppressions" "${bdb_suppressions}")
file(READ bash.suppressions bash_suppressions) file(READ bash.suppressions bash_suppressions)
file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/valgrind.suppressions" "${bash_suppressions}") file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/valgrind.suppressions" "${bash_suppressions}")
......
This diff is collapsed.
This diff is collapsed.
/* -*- mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
// vim: ft=cpp:expandtab:ts=8:sw=4:softtabstop=4:
#ident "$Id$"
/*
COPYING CONDITIONS NOTICE:
This program is free software; you can redistribute it and/or modify
it under the terms of version 2 of the GNU General Public License as
published by the Free Software Foundation, and provided that the
following conditions are met:
* Redistributions of source code must retain this COPYING
CONDITIONS NOTICE, the COPYRIGHT NOTICE (below), the
DISCLAIMER (below), the UNIVERSITY PATENT NOTICE (below), the
PATENT MARKING NOTICE (below), and the PATENT RIGHTS
GRANT (below).
* Redistributions in binary form must reproduce this COPYING
CONDITIONS NOTICE, the COPYRIGHT NOTICE (below), the
DISCLAIMER (below), the UNIVERSITY PATENT NOTICE (below), the
PATENT MARKING NOTICE (below), and the PATENT RIGHTS
GRANT (below) in the documentation and/or other materials
provided with the distribution.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
COPYRIGHT NOTICE:
TokuDB, Tokutek Fractal Tree Indexing Library.
Copyright (C) 2007-2013 Tokutek, Inc.
DISCLAIMER:
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
UNIVERSITY PATENT NOTICE:
The technology is licensed by the Massachusetts Institute of
Technology, Rutgers State University of New Jersey, and the Research
Foundation of State University of New York at Stony Brook under
United States of America Serial No. 11/760379 and to the patents
and/or patent applications resulting from it.
PATENT MARKING NOTICE:
This software is covered by US Patent No. 8,185,551.
This software is covered by US Patent No. 8,489,638.
PATENT RIGHTS GRANT:
"THIS IMPLEMENTATION" means the copyrightable works distributed by
Tokutek as part of the Fractal Tree project.
"PATENT CLAIMS" means the claims of patents that are owned or
licensable by Tokutek, both currently or in the future; and that in
the absence of this license would be infringed by THIS
IMPLEMENTATION or by using or running THIS IMPLEMENTATION.
"PATENT CHALLENGE" shall mean a challenge to the validity,
patentability, enforceability and/or non-infringement of any of the
PATENT CLAIMS or otherwise opposing any of the PATENT CLAIMS.
Tokutek hereby grants to you, for the term and geographical scope of
the PATENT CLAIMS, a non-exclusive, no-charge, royalty-free,
irrevocable (except as stated in this section) patent license to
make, have made, use, offer to sell, sell, import, transfer, and
otherwise run, modify, and propagate the contents of THIS
IMPLEMENTATION, where such license applies only to the PATENT
CLAIMS. This grant does not include claims that would be infringed
only as a consequence of further modifications of THIS
IMPLEMENTATION. If you or your agent or licensee institute or order
or agree to the institution of patent litigation against any entity
(including a cross-claim or counterclaim in a lawsuit) alleging that
THIS IMPLEMENTATION constitutes direct or contributory patent
infringement, or inducement of patent infringement, then any rights
granted to you under this License shall terminate as of the date
such litigation is filed. If you or your agent or exclusive
licensee institute or order or agree to the institution of a PATENT
CHALLENGE, then Tokutek may terminate any rights granted to you
under this License.
*/
#ident "Copyright (c) 2007-2013 Tokutek Inc. All rights reserved."
#ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it."
// verify that a simle write lock deadlock is detected by the BDB locker
// A write locks L
// B write locks M
// A tries to write lock M, gets DB_LOCK_NOTGRANTED
// B tries to write lock L, gets DB_LOCK_NOTGRANTED
#include "test.h"
static void simple_deadlock(DB_ENV *db_env) {
int r;
uint32_t locker_a;
r = db_env->lock_id(db_env, &locker_a); assert(r == 0);
uint32_t locker_b;
r = db_env->lock_id(db_env, &locker_b); assert(r == 0);
DBT object_l = { .data = (char *) "L", .size = 1 };
DBT object_m = { .data = (char *) "M", .size = 1 };
DB_LOCK lock_a_l;
r = db_env->lock_get(db_env, locker_a, DB_LOCK_NOWAIT, &object_l, DB_LOCK_WRITE, &lock_a_l); assert(r == 0);
DB_LOCK lock_b_m;
r = db_env->lock_get(db_env, locker_b, DB_LOCK_NOWAIT, &object_m, DB_LOCK_WRITE, &lock_b_m); assert(r == 0);
DB_LOCK lock_a_m;
r = db_env->lock_get(db_env, locker_a, DB_LOCK_NOWAIT, &object_m, DB_LOCK_WRITE, &lock_a_m); assert(r == DB_LOCK_NOTGRANTED);
DB_LOCK lock_b_l;
r = db_env->lock_get(db_env, locker_b, DB_LOCK_NOWAIT, &object_l, DB_LOCK_WRITE, &lock_b_l); assert(r == DB_LOCK_NOTGRANTED);
r = db_env->lock_put(db_env, &lock_a_l); assert(r == 0);
r = db_env->lock_put(db_env, &lock_b_m); assert(r == 0);
r = db_env->lock_id_free(db_env, locker_a); assert(r == 0);
r = db_env->lock_id_free(db_env, locker_b); assert(r == 0);
}
int test_main(int argc, char * const argv[]) {
uint64_t cachesize = 0;
int do_txn = 1;
const char *db_env_dir = TOKU_TEST_FILENAME;
int db_env_open_flags = DB_CREATE | DB_PRIVATE | DB_INIT_MPOOL | DB_INIT_TXN | DB_INIT_LOCK | DB_INIT_LOG | DB_THREAD;
// parse_args(argc, argv);
for (int i = 1; i < argc; i++) {
if (strcmp(argv[i], "-v") == 0 || strcmp(argv[i], "--verbose") == 0) {
verbose++;
continue;
}
if (strcmp(argv[i], "-q") == 0 || strcmp(argv[i], "--quiet") == 0) {
if (verbose > 0)
verbose--;
continue;
}
assert(0);
}
// setup env
int r;
char rm_cmd[strlen(db_env_dir) + strlen("rm -rf ") + 1];
snprintf(rm_cmd, sizeof(rm_cmd), "rm -rf %s", db_env_dir);
r = system(rm_cmd); assert(r == 0);
r = toku_os_mkdir(db_env_dir, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH); assert(r == 0);
DB_ENV *db_env = NULL;
r = db_env_create(&db_env, 0); assert(r == 0);
if (cachesize) {
const uint64_t gig = 1 << 30;
r = db_env->set_cachesize(db_env, cachesize / gig, cachesize % gig, 1); assert(r == 0);
}
if (!do_txn)
db_env_open_flags &= ~(DB_INIT_TXN | DB_INIT_LOG);
r = db_env->open(db_env, db_env_dir, db_env_open_flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0);
#if 0 && defined(USE_BDB)
r = db_env->set_lk_detect(db_env, DB_LOCK_YOUNGEST); assert(r == 0);
#endif
// run test
simple_deadlock(db_env);
// close env
r = db_env->close(db_env, 0); assert(r == 0); db_env = NULL;
return 0;
}
This diff is collapsed.
{
bdb_writes_undefined_data_to_disk
Memcheck:Param
pwrite64(buf)
fun:pwrite64
fun:__os_io
obj:/lib/libdb-4.3.so
fun:__memp_bhwrite
fun:__memp_sync_int
fun:__memp_fsync
fun:__db_sync
fun:__db_refresh
fun:__db_close
fun:__fop_subdb_setup
fun:__db_open
fun:__db_open_pp
}
{
bdb_leaks_db_home_strdup
Memcheck:Leak
fun:_vgrZU_libcZdsoZa_malloc
fun:__os_malloc
fun:__os_strdup
fun:__db_open_pp
fun:main
}
{
bdb_leaks_in_db_create
Memcheck:Leak
fun:_vgrZU_libcZdsoZa_malloc
fun:__os_malloc
fun:__os_calloc
fun:__bam_db_create
fun:db_create
fun:main
}
{
bdb_leaks_if_you_open_twice
Memcheck:Leak
fun:_vgrZU_libcZdsoZa_malloc
fun:__os_malloc
fun:__os_strdup
fun:__db_open_pp
}
{
bdb_leaks_again
Memcheck:Leak
fun:_vgrZU_libcZdsoZa_malloc
fun:__os_malloc
fun:__os_strdup
fun:__db_home
obj:/lib/libdb-4.3.so
fun:__dbenv_open
}
{
<bdb_leaks>
Memcheck:Leak
fun:_vgrZU_libcZdsoZa_malloc
fun:__os_malloc
fun:__os_calloc
fun:__bam_db_create
fun:db_create
}
{
<bdb_leaks>
Memcheck:Leak
fun:_vgrZU_libcZdsoZa_malloc
fun:__os_malloc
fun:__os_calloc
fun:__bam_db_create
fun:db_create
}
{
<bdb_leaks>
Memcheck:Leak
fun:_vgrZU_libcZdsoZa_malloc
fun:__os_malloc
fun:__os_calloc
fun:db_create
}
...@@ -175,11 +175,7 @@ setup (void) { ...@@ -175,11 +175,7 @@ setup (void) {
r=db_env_create(&env, 0); CKERR(r); r=db_env_create(&env, 0); CKERR(r);
#ifndef TOKUDB
r=env->set_lk_max_objects(env, N); CKERR(r);
#else
r=env->set_redzone(env, 0); CKERR(r); r=env->set_redzone(env, 0); CKERR(r);
#endif
env->set_errfile(env, stderr); env->set_errfile(env, stderr);
r=env->open(env, TOKU_TEST_FILENAME, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); r=env->open(env, TOKU_TEST_FILENAME, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r=db_create(&db, env, 0); CKERR(r); r=db_create(&db, env, 0); CKERR(r);
......
...@@ -174,9 +174,6 @@ setup (void) { ...@@ -174,9 +174,6 @@ setup (void) {
r=db_env_create(&env, 0); CKERR(r); r=db_env_create(&env, 0); CKERR(r);
#ifndef TOKUDB
r=env->set_lk_max_objects(env, N); CKERR(r);
#endif
env->set_errfile(env, stderr); env->set_errfile(env, stderr);
r=env->open(env, TOKU_TEST_FILENAME, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); r=env->open(env, TOKU_TEST_FILENAME, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r=db_create(&db, env, 0); CKERR(r); r=db_create(&db, env, 0); CKERR(r);
......
...@@ -169,9 +169,6 @@ setup (void) { ...@@ -169,9 +169,6 @@ setup (void) {
r=db_env_create(&env, 0); CKERR(r); r=db_env_create(&env, 0); CKERR(r);
#ifndef TOKUDB
r=env->set_lk_max_objects(env, N); CKERR(r);
#endif
env->set_errfile(env, stderr); env->set_errfile(env, stderr);
r=env->open(env, TOKU_TEST_FILENAME, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); r=env->open(env, TOKU_TEST_FILENAME, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r=db_create(&db, env, 0); CKERR(r); r=db_create(&db, env, 0); CKERR(r);
......
...@@ -168,13 +168,8 @@ setup (void) { ...@@ -168,13 +168,8 @@ setup (void) {
r=toku_os_mkdir(TOKU_TEST_FILENAME, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); r=toku_os_mkdir(TOKU_TEST_FILENAME, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r=db_env_create(&env, 0); CKERR(r); r=db_env_create(&env, 0); CKERR(r);
#ifdef TOKUDB
r=env->set_redzone(env, 0); CKERR(r); r=env->set_redzone(env, 0); CKERR(r);
#endif
#ifndef TOKUDB
r=env->set_lk_max_objects(env, N); CKERR(r);
#endif
env->set_errfile(env, stderr); env->set_errfile(env, stderr);
r=env->open(env, TOKU_TEST_FILENAME, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); r=env->open(env, TOKU_TEST_FILENAME, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r=db_create(&db, env, 0); CKERR(r); r=db_create(&db, env, 0); CKERR(r);
......
...@@ -98,7 +98,6 @@ struct my_callback_context { ...@@ -98,7 +98,6 @@ struct my_callback_context {
DBT val; DBT val;
}; };
#if TOKUDB
static int blocking_first_callback(DBT const *a UU(), DBT const *b UU(), void *e UU()) { static int blocking_first_callback(DBT const *a UU(), DBT const *b UU(), void *e UU()) {
DBT const *found_key = a; DBT const *found_key = a;
DBT const *found_val = b; DBT const *found_val = b;
...@@ -107,7 +106,6 @@ static int blocking_first_callback(DBT const *a UU(), DBT const *b UU(), void *e ...@@ -107,7 +106,6 @@ static int blocking_first_callback(DBT const *a UU(), DBT const *b UU(), void *e
copy_dbt(&context->val, found_val); copy_dbt(&context->val, found_val);
return 0; return 0;
} }
#endif
static void blocking_first(DB_ENV *db_env, DB *db, uint64_t nrows, long sleeptime) { static void blocking_first(DB_ENV *db_env, DB *db, uint64_t nrows, long sleeptime) {
int r; int r;
...@@ -122,11 +120,7 @@ static void blocking_first(DB_ENV *db_env, DB *db, uint64_t nrows, long sleeptim ...@@ -122,11 +120,7 @@ static void blocking_first(DB_ENV *db_env, DB *db, uint64_t nrows, long sleeptim
DBC *cursor = NULL; DBC *cursor = NULL;
r = db->cursor(db, txn, &cursor, 0); assert(r == 0); // get a write lock on -inf +inf r = db->cursor(db, txn, &cursor, 0); assert(r == 0); // get a write lock on -inf +inf
#if TOKUDB
r = cursor->c_getf_first(cursor, DB_RMW, blocking_first_callback, &context); assert(r == DB_NOTFOUND); r = cursor->c_getf_first(cursor, DB_RMW, blocking_first_callback, &context); assert(r == DB_NOTFOUND);
#else
r = cursor->c_get(cursor, &context.key, &context.val, DB_FIRST + DB_RMW); assert(r == DB_NOTFOUND);
#endif
usleep(sleeptime); usleep(sleeptime);
...@@ -219,9 +213,7 @@ int test_main(int argc, char * const argv[]) { ...@@ -219,9 +213,7 @@ int test_main(int argc, char * const argv[]) {
r = db_env->set_cachesize(db_env, cachesize / gig, cachesize % gig, 1); assert(r == 0); r = db_env->set_cachesize(db_env, cachesize / gig, cachesize % gig, 1); assert(r == 0);
} }
r = db_env->open(db_env, db_env_dir, db_env_open_flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0); r = db_env->open(db_env, db_env_dir, db_env_open_flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0);
#if TOKUDB
r = db_env->set_lock_timeout(db_env, 30 * 1000, nullptr); assert(r == 0); r = db_env->set_lock_timeout(db_env, 30 * 1000, nullptr); assert(r == 0);
#endif
// create the db // create the db
DB *db = NULL; DB *db = NULL;
......
...@@ -116,7 +116,6 @@ struct my_callback_context { ...@@ -116,7 +116,6 @@ struct my_callback_context {
DBT val; DBT val;
}; };
#if TOKUDB
static int blocking_first_callback(DBT const *a UU(), DBT const *b UU(), void *e UU()) { static int blocking_first_callback(DBT const *a UU(), DBT const *b UU(), void *e UU()) {
DBT const *found_key = a; DBT const *found_key = a;
DBT const *found_val = b; DBT const *found_val = b;
...@@ -125,7 +124,6 @@ static int blocking_first_callback(DBT const *a UU(), DBT const *b UU(), void *e ...@@ -125,7 +124,6 @@ static int blocking_first_callback(DBT const *a UU(), DBT const *b UU(), void *e
copy_dbt(&context->val, found_val); copy_dbt(&context->val, found_val);
return 0; return 0;
} }
#endif
static void blocking_first(DB_ENV *db_env, DB *db, uint64_t nrows, long sleeptime) { static void blocking_first(DB_ENV *db_env, DB *db, uint64_t nrows, long sleeptime) {
int r; int r;
...@@ -140,11 +138,7 @@ static void blocking_first(DB_ENV *db_env, DB *db, uint64_t nrows, long sleeptim ...@@ -140,11 +138,7 @@ static void blocking_first(DB_ENV *db_env, DB *db, uint64_t nrows, long sleeptim
DBC *cursor = NULL; DBC *cursor = NULL;
r = db->cursor(db, txn, &cursor, 0); assert(r == 0); // get a write lock on -inf ... 0 r = db->cursor(db, txn, &cursor, 0); assert(r == 0); // get a write lock on -inf ... 0
#if TOKUDB
r = cursor->c_getf_first(cursor, DB_RMW, blocking_first_callback, &context); assert(r == 0); r = cursor->c_getf_first(cursor, DB_RMW, blocking_first_callback, &context); assert(r == 0);
#else
r = cursor->c_get(cursor, &context.key, &context.val, DB_FIRST + DB_RMW); assert(r == 0);
#endif
usleep(sleeptime); usleep(sleeptime);
r = cursor->c_close(cursor); assert(r == 0); r = cursor->c_close(cursor); assert(r == 0);
...@@ -236,9 +230,7 @@ int test_main(int argc, char * const argv[]) { ...@@ -236,9 +230,7 @@ int test_main(int argc, char * const argv[]) {
r = db_env->set_cachesize(db_env, cachesize / gig, cachesize % gig, 1); assert(r == 0); r = db_env->set_cachesize(db_env, cachesize / gig, cachesize % gig, 1); assert(r == 0);
} }
r = db_env->open(db_env, db_env_dir, db_env_open_flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0); r = db_env->open(db_env, db_env_dir, db_env_open_flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0);
#if TOKUDB
r = db_env->set_lock_timeout(db_env, 30 * 1000, nullptr); assert(r == 0); r = db_env->set_lock_timeout(db_env, 30 * 1000, nullptr); assert(r == 0);
#endif
// create the db // create the db
DB *db = NULL; DB *db = NULL;
......
...@@ -116,7 +116,6 @@ struct my_callback_context { ...@@ -116,7 +116,6 @@ struct my_callback_context {
DBT val; DBT val;
}; };
#if TOKUDB
static int blocking_last_callback(DBT const *a UU(), DBT const *b UU(), void *e UU()) { static int blocking_last_callback(DBT const *a UU(), DBT const *b UU(), void *e UU()) {
DBT const *found_key = a; DBT const *found_key = a;
DBT const *found_val = b; DBT const *found_val = b;
...@@ -125,7 +124,6 @@ static int blocking_last_callback(DBT const *a UU(), DBT const *b UU(), void *e ...@@ -125,7 +124,6 @@ static int blocking_last_callback(DBT const *a UU(), DBT const *b UU(), void *e
copy_dbt(&context->val, found_val); copy_dbt(&context->val, found_val);
return 0; return 0;
} }
#endif
static void blocking_last(DB_ENV *db_env, DB *db, uint64_t nrows, long sleeptime) { static void blocking_last(DB_ENV *db_env, DB *db, uint64_t nrows, long sleeptime) {
int r; int r;
...@@ -140,11 +138,7 @@ static void blocking_last(DB_ENV *db_env, DB *db, uint64_t nrows, long sleeptime ...@@ -140,11 +138,7 @@ static void blocking_last(DB_ENV *db_env, DB *db, uint64_t nrows, long sleeptime
DBC *cursor = NULL; DBC *cursor = NULL;
r = db->cursor(db, txn, &cursor, 0); assert(r == 0); // get a write lock on -inf ... 0 r = db->cursor(db, txn, &cursor, 0); assert(r == 0); // get a write lock on -inf ... 0
#if TOKUDB
r = cursor->c_getf_last(cursor, DB_RMW, blocking_last_callback, &context); assert(r == 0); r = cursor->c_getf_last(cursor, DB_RMW, blocking_last_callback, &context); assert(r == 0);
#else
r = cursor->c_get(cursor, &context.key, &context.val, DB_LAST + DB_RMW); assert(r == 0);
#endif
usleep(sleeptime); usleep(sleeptime);
r = cursor->c_close(cursor); assert(r == 0); r = cursor->c_close(cursor); assert(r == 0);
...@@ -236,9 +230,7 @@ int test_main(int argc, char * const argv[]) { ...@@ -236,9 +230,7 @@ int test_main(int argc, char * const argv[]) {
r = db_env->set_cachesize(db_env, cachesize / gig, cachesize % gig, 1); assert(r == 0); r = db_env->set_cachesize(db_env, cachesize / gig, cachesize % gig, 1); assert(r == 0);
} }
r = db_env->open(db_env, db_env_dir, db_env_open_flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0); r = db_env->open(db_env, db_env_dir, db_env_open_flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0);
#if TOKUDB
r = db_env->set_lock_timeout(db_env, 30 * 1000, nullptr); assert(r == 0); r = db_env->set_lock_timeout(db_env, 30 * 1000, nullptr); assert(r == 0);
#endif
// create the db // create the db
DB *db = NULL; DB *db = NULL;
......
...@@ -124,7 +124,6 @@ struct my_callback_context { ...@@ -124,7 +124,6 @@ struct my_callback_context {
DBT val; DBT val;
}; };
#if TOKUDB
static int blocking_next_callback(DBT const *a UU(), DBT const *b UU(), void *e UU()) { static int blocking_next_callback(DBT const *a UU(), DBT const *b UU(), void *e UU()) {
DBT const *found_key = a; DBT const *found_key = a;
DBT const *found_val = b; DBT const *found_val = b;
...@@ -133,7 +132,6 @@ static int blocking_next_callback(DBT const *a UU(), DBT const *b UU(), void *e ...@@ -133,7 +132,6 @@ static int blocking_next_callback(DBT const *a UU(), DBT const *b UU(), void *e
copy_dbt(&context->val, found_val); copy_dbt(&context->val, found_val);
return 0; return 0;
} }
#endif
static void blocking_next(DB_ENV *db_env, DB *db, uint64_t nrows UU(), long sleeptime) { static void blocking_next(DB_ENV *db_env, DB *db, uint64_t nrows UU(), long sleeptime) {
int r; int r;
...@@ -150,11 +148,7 @@ static void blocking_next(DB_ENV *db_env, DB *db, uint64_t nrows UU(), long slee ...@@ -150,11 +148,7 @@ static void blocking_next(DB_ENV *db_env, DB *db, uint64_t nrows UU(), long slee
uint64_t i; uint64_t i;
for (i = 0; ; i++) { for (i = 0; ; i++) {
#if TOKUDB
r = cursor->c_getf_next(cursor, DB_RMW, blocking_next_callback, &context); r = cursor->c_getf_next(cursor, DB_RMW, blocking_next_callback, &context);
#else
r = cursor->c_get(cursor, &context.key, &context.val, DB_NEXT + DB_RMW);
#endif
if (r != 0) if (r != 0)
break; break;
if (verbose) if (verbose)
...@@ -196,11 +190,7 @@ static void blocking_prev(DB_ENV *db_env, DB *db, uint64_t nrows UU(), long slee ...@@ -196,11 +190,7 @@ static void blocking_prev(DB_ENV *db_env, DB *db, uint64_t nrows UU(), long slee
uint64_t i; uint64_t i;
for (i = 0; ; i++) { for (i = 0; ; i++) {
#if TOKUDB
r = cursor->c_getf_prev(cursor, DB_RMW, blocking_next_callback, &context); r = cursor->c_getf_prev(cursor, DB_RMW, blocking_next_callback, &context);
#else
r = cursor->c_get(cursor, &context.key, &context.val, DB_PREV + DB_RMW);
#endif
if (r != 0) if (r != 0)
break; break;
if (verbose) if (verbose)
...@@ -305,11 +295,7 @@ int test_main(int argc, char * const argv[]) { ...@@ -305,11 +295,7 @@ int test_main(int argc, char * const argv[]) {
r = db_env->set_cachesize(db_env, cachesize / gig, cachesize % gig, 1); assert(r == 0); r = db_env->set_cachesize(db_env, cachesize / gig, cachesize % gig, 1); assert(r == 0);
} }
r = db_env->open(db_env, db_env_dir, db_env_open_flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0); r = db_env->open(db_env, db_env_dir, db_env_open_flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0);
#if TOKUDB
r = db_env->set_lock_timeout(db_env, 30 * 1000, nullptr); assert(r == 0); r = db_env->set_lock_timeout(db_env, 30 * 1000, nullptr); assert(r == 0);
#else
r = db_env->set_lk_detect(db_env, DB_LOCK_YOUNGEST); assert(r == 0);
#endif
// create the db // create the db
DB *db = NULL; DB *db = NULL;
......
...@@ -123,7 +123,6 @@ struct my_callback_context { ...@@ -123,7 +123,6 @@ struct my_callback_context {
DBT val; DBT val;
}; };
#if TOKUDB
static int blocking_next_callback(DBT const *a UU(), DBT const *b UU(), void *e UU()) { static int blocking_next_callback(DBT const *a UU(), DBT const *b UU(), void *e UU()) {
DBT const *found_key = a; DBT const *found_key = a;
DBT const *found_val = b; DBT const *found_val = b;
...@@ -132,7 +131,6 @@ static int blocking_next_callback(DBT const *a UU(), DBT const *b UU(), void *e ...@@ -132,7 +131,6 @@ static int blocking_next_callback(DBT const *a UU(), DBT const *b UU(), void *e
copy_dbt(&context->val, found_val); copy_dbt(&context->val, found_val);
return 0; return 0;
} }
#endif
static void blocking_next(DB_ENV *db_env, DB *db, uint64_t nrows UU(), long sleeptime) { static void blocking_next(DB_ENV *db_env, DB *db, uint64_t nrows UU(), long sleeptime) {
int r; int r;
...@@ -149,11 +147,7 @@ static void blocking_next(DB_ENV *db_env, DB *db, uint64_t nrows UU(), long slee ...@@ -149,11 +147,7 @@ static void blocking_next(DB_ENV *db_env, DB *db, uint64_t nrows UU(), long slee
uint64_t i; uint64_t i;
for (i = 0; ; i++) { for (i = 0; ; i++) {
#if TOKUDB
r = cursor->c_getf_next(cursor, 0, blocking_next_callback, &context); r = cursor->c_getf_next(cursor, 0, blocking_next_callback, &context);
#else
r = cursor->c_get(cursor, &context.key, &context.val, DB_NEXT);
#endif
if (r != 0) if (r != 0)
break; break;
if (verbose) if (verbose)
...@@ -199,11 +193,7 @@ static void blocking_prev(DB_ENV *db_env, DB *db, uint64_t nrows UU(), long slee ...@@ -199,11 +193,7 @@ static void blocking_prev(DB_ENV *db_env, DB *db, uint64_t nrows UU(), long slee
uint64_t i; uint64_t i;
for (i = 0; ; i++) { for (i = 0; ; i++) {
#if TOKUDB
r = cursor->c_getf_prev(cursor, 0, blocking_next_callback, &context); r = cursor->c_getf_prev(cursor, 0, blocking_next_callback, &context);
#else
r = cursor->c_get(cursor, &context.key, &context.val, DB_PREV);
#endif
if (r != 0) if (r != 0)
break; break;
if (verbose) if (verbose)
......
...@@ -181,9 +181,7 @@ int test_main(int argc, char * const argv[]) { ...@@ -181,9 +181,7 @@ int test_main(int argc, char * const argv[]) {
r = db_env->set_cachesize(db_env, cachesize / gig, cachesize % gig, 1); assert(r == 0); r = db_env->set_cachesize(db_env, cachesize / gig, cachesize % gig, 1); assert(r == 0);
} }
r = db_env->open(db_env, db_env_dir, db_env_open_flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0); r = db_env->open(db_env, db_env_dir, db_env_open_flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0);
#if TOKUDB
r = db_env->set_lock_timeout(db_env, 30 * 1000, nullptr); assert(r == 0); r = db_env->set_lock_timeout(db_env, 30 * 1000, nullptr); assert(r == 0);
#endif
// create the db // create the db
DB *db = NULL; DB *db = NULL;
......
...@@ -156,11 +156,7 @@ static void t_b(DB_ENV *db_env, DB *db, struct test_seq *seq) { ...@@ -156,11 +156,7 @@ static void t_b(DB_ENV *db_env, DB *db, struct test_seq *seq) {
DBT key = { .data = &k, .size = sizeof k }; DBT key = { .data = &k, .size = sizeof k };
DBT val = { .data = &k, .size = sizeof k }; DBT val = { .data = &k, .size = sizeof k };
r = db->put(db, txn_b, &key, &val, 0); r = db->put(db, txn_b, &key, &val, 0);
#if USE_BDB
assert(r == DB_LOCK_DEADLOCK);
#else
assert(r == DB_LOCK_NOTGRANTED); assert(r == DB_LOCK_NOTGRANTED);
#endif
r = txn_b->abort(txn_b); assert(r == 0); r = txn_b->abort(txn_b); assert(r == 0);
} }
...@@ -212,31 +208,12 @@ int test_main(int argc, char * const argv[]) { ...@@ -212,31 +208,12 @@ int test_main(int argc, char * const argv[]) {
r = db_env->set_cachesize(db_env, cachesize / gig, cachesize % gig, 1); assert(r == 0); r = db_env->set_cachesize(db_env, cachesize / gig, cachesize % gig, 1); assert(r == 0);
} }
r = db_env->open(db_env, db_env_dir, db_env_open_flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0); r = db_env->open(db_env, db_env_dir, db_env_open_flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0);
#if USE_BDB
db_timeout_t t;
r = db_env->get_timeout(db_env, &t, DB_SET_LOCK_TIMEOUT); assert(r == 0);
if (verbose) printf("lock %d\n", t);
r = db_env->get_timeout(db_env, &t, DB_SET_TXN_TIMEOUT); assert(r == 0);
if (verbose) printf("txn %d\n", t);
r = db_env->set_timeout(db_env, 5000000, DB_SET_LOCK_TIMEOUT); assert(r == 0);
r = db_env->set_timeout(db_env, 5000000, DB_SET_TXN_TIMEOUT); assert(r == 0);
r = db_env->get_timeout(db_env, &t, DB_SET_LOCK_TIMEOUT); assert(r == 0);
if (verbose) printf("lock %d\n", t);
r = db_env->get_timeout(db_env, &t, DB_SET_TXN_TIMEOUT); assert(r == 0);
if (verbose) printf("txn %d\n", t);
r = db_env->set_lk_detect(db_env, DB_LOCK_EXPIRE); assert(r == 0);
#endif
#if USE_TDB
uint64_t lock_timeout_msec; uint64_t lock_timeout_msec;
r = db_env->get_lock_timeout(db_env, &lock_timeout_msec); assert(r == 0); r = db_env->get_lock_timeout(db_env, &lock_timeout_msec); assert(r == 0);
if (verbose) printf("lock timeout: %" PRIu64 "\n", lock_timeout_msec); if (verbose) printf("lock timeout: %" PRIu64 "\n", lock_timeout_msec);
r = db_env->set_lock_timeout(db_env, 5000, nullptr); assert(r == 0); r = db_env->set_lock_timeout(db_env, 5000, nullptr); assert(r == 0);
r = db_env->get_lock_timeout(db_env, &lock_timeout_msec); assert(r == 0); r = db_env->get_lock_timeout(db_env, &lock_timeout_msec); assert(r == 0);
if (verbose) printf("lock timeout: %" PRIu64 "\n", lock_timeout_msec); if (verbose) printf("lock timeout: %" PRIu64 "\n", lock_timeout_msec);
#endif
// create the db // create the db
DB *db = NULL; DB *db = NULL;
......
...@@ -208,9 +208,7 @@ int test_main(int argc, char * const argv[]) { ...@@ -208,9 +208,7 @@ int test_main(int argc, char * const argv[]) {
r = db_env->set_cachesize(db_env, cachesize / gig, cachesize % gig, 1); assert(r == 0); r = db_env->set_cachesize(db_env, cachesize / gig, cachesize % gig, 1); assert(r == 0);
} }
r = db_env->open(db_env, db_env_dir, db_env_open_flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0); r = db_env->open(db_env, db_env_dir, db_env_open_flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0);
#if TOKUDB
r = db_env->set_lock_timeout(db_env, 30 * 1000, nullptr); assert(r == 0); r = db_env->set_lock_timeout(db_env, 30 * 1000, nullptr); assert(r == 0);
#endif
// create the db // create the db
DB *db = NULL; DB *db = NULL;
......
...@@ -180,9 +180,7 @@ int test_main(int argc, char * const argv[]) { ...@@ -180,9 +180,7 @@ int test_main(int argc, char * const argv[]) {
r = db_env->set_cachesize(db_env, cachesize / gig, cachesize % gig, 1); assert(r == 0); r = db_env->set_cachesize(db_env, cachesize / gig, cachesize % gig, 1); assert(r == 0);
} }
r = db_env->open(db_env, db_env_dir, db_env_open_flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0); r = db_env->open(db_env, db_env_dir, db_env_open_flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0);
#if TOKUDB
r = db_env->set_lock_timeout(db_env, 30 * 1000, nullptr); assert(r == 0); r = db_env->set_lock_timeout(db_env, 30 * 1000, nullptr); assert(r == 0);
#endif
// create the db // create the db
DB *db = NULL; DB *db = NULL;
......
...@@ -117,7 +117,6 @@ struct my_callback_context { ...@@ -117,7 +117,6 @@ struct my_callback_context {
DBT val; DBT val;
}; };
#if TOKUDB
static int blocking_set_range_callback(DBT const *a UU(), DBT const *b UU(), void *e UU()) { static int blocking_set_range_callback(DBT const *a UU(), DBT const *b UU(), void *e UU()) {
DBT const *found_key = a; DBT const *found_key = a;
DBT const *found_val = b; DBT const *found_val = b;
...@@ -126,7 +125,6 @@ static int blocking_set_range_callback(DBT const *a UU(), DBT const *b UU(), voi ...@@ -126,7 +125,6 @@ static int blocking_set_range_callback(DBT const *a UU(), DBT const *b UU(), voi
copy_dbt(&context->val, found_val); copy_dbt(&context->val, found_val);
return 0; return 0;
} }
#endif
static void blocking_set_range(DB_ENV *db_env, DB *db, uint64_t nrows, long sleeptime, uint64_t the_key) { static void blocking_set_range(DB_ENV *db_env, DB *db, uint64_t nrows, long sleeptime, uint64_t the_key) {
int r; int r;
...@@ -144,11 +142,7 @@ static void blocking_set_range(DB_ENV *db_env, DB *db, uint64_t nrows, long slee ...@@ -144,11 +142,7 @@ static void blocking_set_range(DB_ENV *db_env, DB *db, uint64_t nrows, long slee
uint64_t k = htonl(the_key); uint64_t k = htonl(the_key);
DBT key = { .data = &k, .size = sizeof k }; DBT key = { .data = &k, .size = sizeof k };
#if TOKUDB
r = cursor->c_getf_set_range(cursor, DB_RMW, &key, blocking_set_range_callback, &context); assert(r == 0); r = cursor->c_getf_set_range(cursor, DB_RMW, &key, blocking_set_range_callback, &context); assert(r == 0);
#else
r = cursor->c_get(cursor, &key, &context.val, DB_SET_RANGE + DB_RMW); assert(r == 0);
#endif
uint64_t v; uint64_t v;
assert(context.val.size == sizeof v); assert(context.val.size == sizeof v);
memcpy(&v, context.val.data, context.val.size); memcpy(&v, context.val.data, context.val.size);
...@@ -246,9 +240,7 @@ int test_main(int argc, char * const argv[]) { ...@@ -246,9 +240,7 @@ int test_main(int argc, char * const argv[]) {
r = db_env->set_cachesize(db_env, cachesize / gig, cachesize % gig, 1); assert(r == 0); r = db_env->set_cachesize(db_env, cachesize / gig, cachesize % gig, 1); assert(r == 0);
} }
r = db_env->open(db_env, db_env_dir, db_env_open_flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0); r = db_env->open(db_env, db_env_dir, db_env_open_flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0);
#if TOKUDB
r = db_env->set_lock_timeout(db_env, 30 * 1000, nullptr); assert(r == 0); r = db_env->set_lock_timeout(db_env, 30 * 1000, nullptr); assert(r == 0);
#endif
// create the db // create the db
DB *db = NULL; DB *db = NULL;
......
...@@ -117,7 +117,6 @@ struct my_callback_context { ...@@ -117,7 +117,6 @@ struct my_callback_context {
DBT val; DBT val;
}; };
#if TOKUDB
static int blocking_set_range_callback(DBT const *a UU(), DBT const *b UU(), void *e UU()) { static int blocking_set_range_callback(DBT const *a UU(), DBT const *b UU(), void *e UU()) {
DBT const *found_key = a; DBT const *found_key = a;
DBT const *found_val = b; DBT const *found_val = b;
...@@ -126,7 +125,6 @@ static int blocking_set_range_callback(DBT const *a UU(), DBT const *b UU(), voi ...@@ -126,7 +125,6 @@ static int blocking_set_range_callback(DBT const *a UU(), DBT const *b UU(), voi
copy_dbt(&context->val, found_val); copy_dbt(&context->val, found_val);
return 0; return 0;
} }
#endif
static void blocking_set_range(DB_ENV *db_env, DB *db, uint64_t nrows, long sleeptime, uint64_t the_key) { static void blocking_set_range(DB_ENV *db_env, DB *db, uint64_t nrows, long sleeptime, uint64_t the_key) {
int r; int r;
...@@ -144,11 +142,7 @@ static void blocking_set_range(DB_ENV *db_env, DB *db, uint64_t nrows, long slee ...@@ -144,11 +142,7 @@ static void blocking_set_range(DB_ENV *db_env, DB *db, uint64_t nrows, long slee
uint64_t k = htonl(the_key); uint64_t k = htonl(the_key);
DBT key = { .data = &k, .size = sizeof k }; DBT key = { .data = &k, .size = sizeof k };
#if TOKUDB
r = cursor->c_getf_set_range(cursor, DB_RMW, &key, blocking_set_range_callback, &context); assert(r == DB_NOTFOUND); r = cursor->c_getf_set_range(cursor, DB_RMW, &key, blocking_set_range_callback, &context); assert(r == DB_NOTFOUND);
#else
r = cursor->c_get(cursor, &key, &context.val, DB_SET_RANGE + DB_RMW); assert(r == DB_NOTFOUND);
#endif
usleep(sleeptime); usleep(sleeptime);
r = cursor->c_close(cursor); assert(r == 0); r = cursor->c_close(cursor); assert(r == 0);
...@@ -241,9 +235,7 @@ int test_main(int argc, char * const argv[]) { ...@@ -241,9 +235,7 @@ int test_main(int argc, char * const argv[]) {
r = db_env->set_cachesize(db_env, cachesize / gig, cachesize % gig, 1); assert(r == 0); r = db_env->set_cachesize(db_env, cachesize / gig, cachesize % gig, 1); assert(r == 0);
} }
r = db_env->open(db_env, db_env_dir, db_env_open_flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0); r = db_env->open(db_env, db_env_dir, db_env_open_flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0);
#if TOKUDB
r = db_env->set_lock_timeout(db_env, 30 * 1000, nullptr); assert(r == 0); r = db_env->set_lock_timeout(db_env, 30 * 1000, nullptr); assert(r == 0);
#endif
// create the db // create the db
DB *db = NULL; DB *db = NULL;
......
...@@ -142,11 +142,7 @@ static void blocking_set_range(DB_ENV *db_env, DB *db, uint64_t nrows, long slee ...@@ -142,11 +142,7 @@ static void blocking_set_range(DB_ENV *db_env, DB *db, uint64_t nrows, long slee
uint64_t k = htonl(the_key); uint64_t k = htonl(the_key);
DBT key = { .data = &k, .size = sizeof k }; DBT key = { .data = &k, .size = sizeof k };
#if TOKUDB
r = cursor->c_getf_set_range_reverse(cursor, 0, &key, blocking_set_range_callback, &context); assert(r == 0); r = cursor->c_getf_set_range_reverse(cursor, 0, &key, blocking_set_range_callback, &context); assert(r == 0);
#else
r = cursor->c_get(cursor, &key, &context.val, DB_SET_RANGE_REVERSE); assert(r == 0);
#endif
uint64_t v; uint64_t v;
assert(context.val.size == sizeof v); assert(context.val.size == sizeof v);
memcpy(&v, context.val.data, context.val.size); memcpy(&v, context.val.data, context.val.size);
...@@ -244,9 +240,7 @@ int test_main(int argc, char * const argv[]) { ...@@ -244,9 +240,7 @@ int test_main(int argc, char * const argv[]) {
r = db_env->set_cachesize(db_env, cachesize / gig, cachesize % gig, 1); assert(r == 0); r = db_env->set_cachesize(db_env, cachesize / gig, cachesize % gig, 1); assert(r == 0);
} }
r = db_env->open(db_env, db_env_dir, db_env_open_flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0); r = db_env->open(db_env, db_env_dir, db_env_open_flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0);
#if TOKUDB
r = db_env->set_lock_timeout(db_env, 30 * 1000, nullptr); assert(r == 0); r = db_env->set_lock_timeout(db_env, 30 * 1000, nullptr); assert(r == 0);
#endif
// create the db // create the db
DB *db = NULL; DB *db = NULL;
......
...@@ -112,7 +112,6 @@ static void populate(DB_ENV *db_env, DB *db, uint64_t nrows) { ...@@ -112,7 +112,6 @@ static void populate(DB_ENV *db_env, DB *db, uint64_t nrows) {
r = txn->commit(txn, 0); assert(r == 0); r = txn->commit(txn, 0); assert(r == 0);
} }
#if TOKUDB
static int blocking_set_callback(DBT const *a UU(), DBT const *b UU(), void *e UU()) { static int blocking_set_callback(DBT const *a UU(), DBT const *b UU(), void *e UU()) {
// DBT const *found_key = a; // DBT const *found_key = a;
DBT const *found_val = b; DBT const *found_val = b;
...@@ -123,7 +122,6 @@ static int blocking_set_callback(DBT const *a UU(), DBT const *b UU(), void *e U ...@@ -123,7 +122,6 @@ static int blocking_set_callback(DBT const *a UU(), DBT const *b UU(), void *e U
memcpy(my_val->data, found_val->data, found_val->size); memcpy(my_val->data, found_val->data, found_val->size);
return 0; return 0;
} }
#endif
static void blocking_set(DB_ENV *db_env, DB *db, uint64_t nrows, long sleeptime) { static void blocking_set(DB_ENV *db_env, DB *db, uint64_t nrows, long sleeptime) {
int r; int r;
...@@ -140,11 +138,7 @@ static void blocking_set(DB_ENV *db_env, DB *db, uint64_t nrows, long sleeptime) ...@@ -140,11 +138,7 @@ static void blocking_set(DB_ENV *db_env, DB *db, uint64_t nrows, long sleeptime)
uint64_t k = htonl(0); // set to key 0 uint64_t k = htonl(0); // set to key 0
DBT key = { .data = &k, .size = sizeof k }; DBT key = { .data = &k, .size = sizeof k };
#if TOKUDB
r = cursor->c_getf_set(cursor, DB_RMW, &key, blocking_set_callback, &val); assert(r == 0); r = cursor->c_getf_set(cursor, DB_RMW, &key, blocking_set_callback, &val); assert(r == 0);
#else
r = cursor->c_get(cursor, &key, &val, DB_SET + DB_RMW); assert(r == 0);
#endif
uint64_t v; uint64_t v;
assert(val.size == sizeof v); assert(val.size == sizeof v);
memcpy(&v, val.data, val.size); memcpy(&v, val.data, val.size);
...@@ -226,9 +220,7 @@ int test_main(int argc, char * const argv[]) { ...@@ -226,9 +220,7 @@ int test_main(int argc, char * const argv[]) {
r = db_env->set_cachesize(db_env, cachesize / gig, cachesize % gig, 1); assert(r == 0); r = db_env->set_cachesize(db_env, cachesize / gig, cachesize % gig, 1); assert(r == 0);
} }
r = db_env->open(db_env, db_env_dir, db_env_open_flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0); r = db_env->open(db_env, db_env_dir, db_env_open_flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0);
#if TOKUDB
r = db_env->set_lock_timeout(db_env, 30 * 1000, nullptr); assert(r == 0); r = db_env->set_lock_timeout(db_env, 30 * 1000, nullptr); assert(r == 0);
#endif
// create the db // create the db
DB *db = NULL; DB *db = NULL;
......
...@@ -174,9 +174,7 @@ int test_main(int argc, char * const argv[]) { ...@@ -174,9 +174,7 @@ int test_main(int argc, char * const argv[]) {
r = db_env->set_cachesize(db_env, cachesize / gig, cachesize % gig, 1); assert(r == 0); r = db_env->set_cachesize(db_env, cachesize / gig, cachesize % gig, 1); assert(r == 0);
} }
r = db_env->open(db_env, db_env_dir, db_env_open_flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0); r = db_env->open(db_env, db_env_dir, db_env_open_flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0);
#if TOKUDB
r = db_env->set_lock_timeout(db_env, 30 * 1000, nullptr); assert(r == 0); r = db_env->set_lock_timeout(db_env, 30 * 1000, nullptr); assert(r == 0);
#endif
// create the db // create the db
DB *db = NULL; DB *db = NULL;
......
...@@ -118,9 +118,7 @@ checkpoint1 (void) ...@@ -118,9 +118,7 @@ checkpoint1 (void)
toku_os_mkdir(TOKU_TEST_FILENAME, S_IRWXU+S_IRWXG+S_IRWXO); toku_os_mkdir(TOKU_TEST_FILENAME, S_IRWXU+S_IRWXG+S_IRWXO);
r = db_env_create(&env, 0); CKERR(r); r = db_env_create(&env, 0); CKERR(r);
#ifdef TOKUDB
r = env->set_redzone(env, 0); CKERR(r); r = env->set_redzone(env, 0); CKERR(r);
#endif
r = env->open(env, TOKU_TEST_FILENAME, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); r = env->open(env, TOKU_TEST_FILENAME, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r = db_create(&db, env, 0); CKERR(r); r = db_create(&db, env, 0); CKERR(r);
......
...@@ -147,9 +147,7 @@ int test_main(int argc, char * const argv[]) { ...@@ -147,9 +147,7 @@ int test_main(int argc, char * const argv[]) {
// try to starve the checkpoint // try to starve the checkpoint
{ int chk_r = db_env_create(&env, 0); CKERR(chk_r); } { int chk_r = db_env_create(&env, 0); CKERR(chk_r); }
#ifdef USE_TDB
{ int chk_r = env->set_redzone(env, 0); CKERR(chk_r); } { int chk_r = env->set_redzone(env, 0); CKERR(chk_r); }
#endif
{ {
const int size = 10+strlen(env_dir); const int size = 10+strlen(env_dir);
char cmd[size]; char cmd[size];
......
...@@ -272,10 +272,7 @@ random_acts(void * d) { ...@@ -272,10 +272,7 @@ random_acts(void * d) {
} }
} }
#if IS_TDB && !TOKU_WINDOWS
return intothevoid; return intothevoid;
#endif
} }
uint64_t max_windows_cachesize = 256 << 20; uint64_t max_windows_cachesize = 256 << 20;
......
...@@ -114,13 +114,9 @@ static void run_test (void) { ...@@ -114,13 +114,9 @@ static void run_test (void) {
r = db_create(&db, env, 0); CKERR(r); r = db_create(&db, env, 0); CKERR(r);
r = db->open(db, NULL, "bdir/b.db", NULL, DB_BTREE, DB_AUTO_COMMIT|DB_CREATE, 0666); r = db->open(db, NULL, "bdir/b.db", NULL, DB_BTREE, DB_AUTO_COMMIT|DB_CREATE, 0666);
#if USE_TDB
CKERR(r); //Success, so need a new handle CKERR(r); //Success, so need a new handle
r = db->close(db, 0); CKERR(r); r = db->close(db, 0); CKERR(r);
r = db_create(&db, env, 0); CKERR(r); r = db_create(&db, env, 0); CKERR(r);
#else
assert(r != 0);
#endif
char path[TOKU_PATH_MAX+1]; char path[TOKU_PATH_MAX+1];
r = toku_os_mkdir(toku_path_join(path, 2, TOKU_TEST_FILENAME, "bdir"), 0777); assert(r == 0); r = toku_os_mkdir(toku_path_join(path, 2, TOKU_TEST_FILENAME, "bdir"), 0777); assert(r == 0);
r = db->open(db, NULL, "bdir/b.db", NULL, DB_BTREE, DB_AUTO_COMMIT|DB_CREATE, 0666); CKERR(r); r = db->open(db, NULL, "bdir/b.db", NULL, DB_BTREE, DB_AUTO_COMMIT|DB_CREATE, 0666); CKERR(r);
...@@ -137,13 +133,6 @@ static void run_test (void) { ...@@ -137,13 +133,6 @@ static void run_test (void) {
r = db->open(db, NULL, "c.db", NULL, DB_BTREE, DB_AUTO_COMMIT|DB_CREATE, 0666); CKERR(r); r = db->open(db, NULL, "c.db", NULL, DB_BTREE, DB_AUTO_COMMIT|DB_CREATE, 0666); CKERR(r);
r = db->close(db, 0); CKERR(r); r = db->close(db, 0); CKERR(r);
#if 0
// test fname with absolute path
r = db_create(&db, env, 0); CKERR(r);
r = db->open(db, NULL, "/tmp/d.db", NULL, DB_BTREE, DB_AUTO_COMMIT|DB_CREATE, 0666); CKERR(r);
r = db->close(db, 0); CKERR(r);
#endif
r = env->close(env, 0); CKERR(r); r = env->close(env, 0); CKERR(r);
} }
......
...@@ -104,22 +104,14 @@ setup (void) { ...@@ -104,22 +104,14 @@ setup (void) {
r=toku_os_mkdir(TOKU_TEST_FILENAME, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); r=toku_os_mkdir(TOKU_TEST_FILENAME, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r=db_env_create(&env, 0); CKERR(r); r=db_env_create(&env, 0); CKERR(r);
#ifdef TOKUDB
r=env->set_redzone(env, 0); CKERR(r); r=env->set_redzone(env, 0); CKERR(r);
r=env->set_default_bt_compare(env, int_dbt_cmp); CKERR(r); r=env->set_default_bt_compare(env, int_dbt_cmp); CKERR(r);
#endif
env->set_errfile(env, stderr); env->set_errfile(env, stderr);
#ifdef USE_BDB
r=env->set_lk_max_objects(env, 2*num_insert); CKERR(r);
#endif
r=env->open(env, TOKU_TEST_FILENAME, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); r=env->open(env, TOKU_TEST_FILENAME, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r=db_create(&db, env, 0); CKERR(r); r=db_create(&db, env, 0); CKERR(r);
r=env->txn_begin(env, 0, &txn, 0); assert(r==0); r=env->txn_begin(env, 0, &txn, 0); assert(r==0);
#ifdef USE_BDB
r=db->set_bt_compare(db, int_dbt_cmp); CKERR(r);
#endif
r=db->open(db, txn, "foo.db", 0, DB_BTREE, DB_CREATE, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); r=db->open(db, txn, "foo.db", 0, DB_BTREE, DB_CREATE, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r=txn->commit(txn, 0); assert(r==0); r=txn->commit(txn, 0); assert(r==0);
} }
......
...@@ -184,9 +184,6 @@ static void simple_deadlock(DB_ENV *db_env, DB *db, int do_txn, int n) { ...@@ -184,9 +184,6 @@ static void simple_deadlock(DB_ENV *db_env, DB *db, int do_txn, int n) {
} }
uint32_t txn_flags = 0; uint32_t txn_flags = 0;
#if USE_BDB
txn_flags = DB_TXN_NOWAIT; // force no wait for BDB to avoid a bug described below
#endif
DB_TXN *txn_a = NULL; DB_TXN *txn_a = NULL;
if (do_txn) { if (do_txn) {
...@@ -209,7 +206,6 @@ static void simple_deadlock(DB_ENV *db_env, DB *db, int do_txn, int n) { ...@@ -209,7 +206,6 @@ static void simple_deadlock(DB_ENV *db_env, DB *db, int do_txn, int n) {
test_seq_next_state(&test_seq); test_seq_next_state(&test_seq);
test_seq_sleep(&test_seq, 2); test_seq_sleep(&test_seq, 2);
// BDB does not time out this lock request, so the test hangs. it looks like a bug in bdb's __lock_get_internal.
insert_row(db, txn_a, htonl(n-1), n-1, DB_LOCK_NOTGRANTED); insert_row(db, txn_a, htonl(n-1), n-1, DB_LOCK_NOTGRANTED);
test_seq_next_state(&test_seq); test_seq_next_state(&test_seq);
...@@ -268,16 +264,8 @@ int test_main(int argc, char * const argv[]) { ...@@ -268,16 +264,8 @@ int test_main(int argc, char * const argv[]) {
} }
if (!do_txn) if (!do_txn)
db_env_open_flags &= ~(DB_INIT_TXN | DB_INIT_LOG); db_env_open_flags &= ~(DB_INIT_TXN | DB_INIT_LOG);
#if USE_BDB
r = db_env->set_flags(db_env, DB_TIME_NOTGRANTED, 1); assert(r == 0); // force DB_LOCK_DEADLOCK to DB_LOCK_NOTGRANTED
#endif
r = db_env->open(db_env, db_env_dir, db_env_open_flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0); r = db_env->open(db_env, db_env_dir, db_env_open_flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0);
#if defined(USE_TDB)
r = db_env->set_lock_timeout(db_env, 0, nullptr); assert(r == 0); // no wait r = db_env->set_lock_timeout(db_env, 0, nullptr); assert(r == 0); // no wait
#elif defined(USE_BDB)
r = db_env->set_lk_detect(db_env, DB_LOCK_YOUNGEST); assert(r == 0);
r = db_env->set_timeout(db_env, 10000, DB_SET_LOCK_TIMEOUT); assert(r == 0);
#endif
// create the db // create the db
DB *db = NULL; DB *db = NULL;
......
...@@ -88,7 +88,7 @@ PATENT RIGHTS GRANT: ...@@ -88,7 +88,7 @@ PATENT RIGHTS GRANT:
#ident "Copyright (c) 2007-2013 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007-2013 Tokutek Inc. All rights reserved."
#ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it." #ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it."
// this test demonstrates that a simple deadlock with 2 transactions on a single thread works with tokudb, hangs with bdb // this test demonstrates that a simple deadlock with 2 transactions on a single thread works with tokudb
#include "test.h" #include "test.h"
...@@ -115,9 +115,6 @@ static void simple_deadlock(DB_ENV *db_env, DB *db, int do_txn, int n) { ...@@ -115,9 +115,6 @@ static void simple_deadlock(DB_ENV *db_env, DB *db, int do_txn, int n) {
} }
uint32_t txn_flags = 0; uint32_t txn_flags = 0;
#if USE_BDB
txn_flags = DB_TXN_NOWAIT; // force no wait for BDB to avoid a bug described below
#endif
DB_TXN *txn_a = NULL; DB_TXN *txn_a = NULL;
if (do_txn) { if (do_txn) {
...@@ -133,7 +130,6 @@ static void simple_deadlock(DB_ENV *db_env, DB *db, int do_txn, int n) { ...@@ -133,7 +130,6 @@ static void simple_deadlock(DB_ENV *db_env, DB *db, int do_txn, int n) {
insert_row(db, txn_b, htonl(n-1), n-1, 0); insert_row(db, txn_b, htonl(n-1), n-1, 0);
// if the txn_flags is 0, then BDB does not time out this lock request, so the test hangs. it looks like a bug in bdb's __lock_get_internal.
insert_row(db, txn_a, htonl(n-1), n-1, DB_LOCK_NOTGRANTED); insert_row(db, txn_a, htonl(n-1), n-1, DB_LOCK_NOTGRANTED);
insert_row(db, txn_b, htonl(0), 0, DB_LOCK_NOTGRANTED); insert_row(db, txn_b, htonl(0), 0, DB_LOCK_NOTGRANTED);
...@@ -148,7 +144,7 @@ int test_main(int argc, char * const argv[]) { ...@@ -148,7 +144,7 @@ int test_main(int argc, char * const argv[]) {
uint64_t cachesize = 0; uint64_t cachesize = 0;
uint32_t pagesize = 0; uint32_t pagesize = 0;
int do_txn = 1; int do_txn = 1;
int nrows = 1000; // for BDB, insert enough rows to create a tree with more than one page in it. this avoids a page locking conflict. int nrows = 1000;
const char *db_env_dir = TOKU_TEST_FILENAME; const char *db_env_dir = TOKU_TEST_FILENAME;
const char *db_filename = "simple_deadlock"; const char *db_filename = "simple_deadlock";
int db_env_open_flags = DB_CREATE | DB_PRIVATE | DB_INIT_MPOOL | DB_INIT_TXN | DB_INIT_LOCK | DB_INIT_LOG | DB_THREAD; int db_env_open_flags = DB_CREATE | DB_PRIVATE | DB_INIT_MPOOL | DB_INIT_TXN | DB_INIT_LOCK | DB_INIT_LOG | DB_THREAD;
...@@ -187,14 +183,7 @@ int test_main(int argc, char * const argv[]) { ...@@ -187,14 +183,7 @@ int test_main(int argc, char * const argv[]) {
} }
if (!do_txn) if (!do_txn)
db_env_open_flags &= ~(DB_INIT_TXN | DB_INIT_LOG); db_env_open_flags &= ~(DB_INIT_TXN | DB_INIT_LOG);
#if USE_BDB
r = db_env->set_flags(db_env, DB_TIME_NOTGRANTED, 1); assert(r == 0); // force DB_LOCK_DEADLOCK to DB_LOCK_NOTGRANTED
#endif
r = db_env->open(db_env, db_env_dir, db_env_open_flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0); r = db_env->open(db_env, db_env_dir, db_env_open_flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0);
#if defined(USE_BDB)
r = db_env->set_lk_detect(db_env, DB_LOCK_YOUNGEST); assert(r == 0);
r = db_env->set_timeout(db_env, 1000, DB_SET_LOCK_TIMEOUT); assert(r == 0);
#endif
// create the db // create the db
DB *db = NULL; DB *db = NULL;
r = db_create(&db, db_env, 0); assert(r == 0); r = db_create(&db, db_env, 0); assert(r == 0);
......
...@@ -213,11 +213,7 @@ int test_main(int argc, char * const argv[]) { ...@@ -213,11 +213,7 @@ int test_main(int argc, char * const argv[]) {
if (!do_txn) if (!do_txn)
db_env_open_flags &= ~(DB_INIT_TXN | DB_INIT_LOG); db_env_open_flags &= ~(DB_INIT_TXN | DB_INIT_LOG);
r = db_env->open(db_env, db_env_dir, db_env_open_flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0); r = db_env->open(db_env, db_env_dir, db_env_open_flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0);
#if TOKUDB
r = db_env->set_lock_timeout(db_env, 30 * 1000, nullptr); assert(r == 0); r = db_env->set_lock_timeout(db_env, 30 * 1000, nullptr); assert(r == 0);
#else
r = db_env->set_lk_detect(db_env, DB_LOCK_YOUNGEST); assert(r == 0);
#endif
// create the db // create the db
DB *db = NULL; DB *db = NULL;
......
...@@ -91,7 +91,6 @@ PATENT RIGHTS GRANT: ...@@ -91,7 +91,6 @@ PATENT RIGHTS GRANT:
// for all i: T(i) reads 0, gets a read lock on 0 // for all i: T(i) reads 0, gets a read lock on 0
// for all i: T(i) writes 0, enters a deadlock // for all i: T(i) writes 0, enters a deadlock
// tokudb detects deadlock on the fly // tokudb detects deadlock on the fly
// bdb detects deadlock on the fly or uses a deadlock detector
// --poll runs the deadlock detector until all the txns are resolved // --poll runs the deadlock detector until all the txns are resolved
#include "test.h" #include "test.h"
...@@ -201,18 +200,6 @@ static void update_deadlock(DB_ENV *db_env, DB *db, int do_txn, int nrows, int n ...@@ -201,18 +200,6 @@ static void update_deadlock(DB_ENV *db_env, DB *db, int do_txn, int nrows, int n
} }
#endif #endif
#if defined(USE_BDB)
// check for deadlocks
if (poll_deadlock) {
while (n_txns > 0) {
sleep(10);
int rejected = 0;
r = db_env->lock_detect(db_env, 0, DB_LOCK_YOUNGEST, &rejected); assert(r == 0);
printf("%s rejected %d\n", __FUNCTION__, rejected);
}
}
#endif
// cleanup // cleanup
for (int i = 0; i < ntxns; i++) { for (int i = 0; i < ntxns; i++) {
void *ret = NULL; void *ret = NULL;
...@@ -274,14 +261,7 @@ int test_main(int argc, char * const argv[]) { ...@@ -274,14 +261,7 @@ int test_main(int argc, char * const argv[]) {
if (!do_txn) if (!do_txn)
db_env_open_flags &= ~(DB_INIT_TXN | DB_INIT_LOG); db_env_open_flags &= ~(DB_INIT_TXN | DB_INIT_LOG);
r = db_env->open(db_env, db_env_dir, db_env_open_flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0); r = db_env->open(db_env, db_env_dir, db_env_open_flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert(r == 0);
#if defined(TOKUDB)
r = db_env->set_lock_timeout(db_env, 30 * 1000, nullptr); assert(r == 0); r = db_env->set_lock_timeout(db_env, 30 * 1000, nullptr); assert(r == 0);
#endif
#if defined(USE_BDB)
if (!poll_deadlock) {
r = db_env->set_lk_detect(db_env, DB_LOCK_YOUNGEST); assert(r == 0);
}
#endif
// create the db // create the db
DB *db = NULL; DB *db = NULL;
......
...@@ -106,22 +106,14 @@ setup (void) { ...@@ -106,22 +106,14 @@ setup (void) {
} }
r=db_env_create(&env, 0); CKERR(r); r=db_env_create(&env, 0); CKERR(r);
#ifdef TOKUDB
r=env->set_redzone(env, 0); CKERR(r); r=env->set_redzone(env, 0); CKERR(r);
r=env->set_default_bt_compare(env, int_dbt_cmp); CKERR(r); r=env->set_default_bt_compare(env, int_dbt_cmp); CKERR(r);
#endif
env->set_errfile(env, stderr); env->set_errfile(env, stderr);
#ifdef USE_BDB
r=env->set_lk_max_objects(env, 2*num_insert); CKERR(r);
#endif
r=env->open(env, TOKU_TEST_FILENAME, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); r=env->open(env, TOKU_TEST_FILENAME, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r=db_create(&db, env, 0); CKERR(r); r=db_create(&db, env, 0); CKERR(r);
r=env->txn_begin(env, 0, &txn, 0); assert(r==0); r=env->txn_begin(env, 0, &txn, 0); assert(r==0);
#ifdef USE_BDB
r=db->set_bt_compare(db, int_dbt_cmp); CKERR(r);
#endif
r=db->open(db, txn, "foo.db", 0, DB_BTREE, DB_CREATE, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); r=db->open(db, txn, "foo.db", 0, DB_BTREE, DB_CREATE, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r=txn->commit(txn, 0); assert(r==0); r=txn->commit(txn, 0); assert(r==0);
} }
......
...@@ -196,11 +196,7 @@ delete_n (uint32_t ah) ...@@ -196,11 +196,7 @@ delete_n (uint32_t ah)
ndelete_notfound++; ndelete_notfound++;
else else
ndelete_failed++; ndelete_failed++;
#ifdef USE_BDB
assert(r==0 || r==DB_NOTFOUND);
#else
CKERR(r); CKERR(r);
#endif
} }
static void static void
......
...@@ -165,11 +165,7 @@ delete_n (uint32_t ah) ...@@ -165,11 +165,7 @@ delete_n (uint32_t ah)
DBT key; DBT key;
dbt_init(&key, &an, 4); dbt_init(&key, &an, 4);
int r = db->del(db, NULL, &key, DB_DELETE_ANY); int r = db->del(db, NULL, &key, DB_DELETE_ANY);
#ifdef USE_BDB
assert(r==0 || r==DB_NOTFOUND);
#else
CKERR(r); CKERR(r);
#endif
} }
static void static void
......
...@@ -179,11 +179,7 @@ delete_n_now (uint32_t ah) ...@@ -179,11 +179,7 @@ delete_n_now (uint32_t ah)
DBT key; DBT key;
dbt_init(&key, &an, 4); dbt_init(&key, &an, 4);
int r = db->del(db, NULL, &key, DB_DELETE_ANY); int r = db->del(db, NULL, &key, DB_DELETE_ANY);
#ifdef USE_BDB
assert(r==0 || r==DB_NOTFOUND);
#else
CKERR(r); CKERR(r);
#endif
get_n(ah, DB_NOTFOUND); get_n(ah, DB_NOTFOUND);
} }
......
// verify that the loader can deal with blobs larger than the node size
#include "test.h"
static int my_bt_compare(DB *db, const DBT *a, const DBT *b) {
db = db;
assert(a->size == 8 && b->size == 8);
return memcmp(a->data, b->data, 8);
}
static int my_row_generate(DB *dest_db, DB *src_db, DBT *dest_key, DBT *dest_val, const DBT *src_key, const DBT *src_val) {
dest_db = dest_db; src_db = src_db; dest_key = dest_key; dest_val = dest_val; src_key = src_key; src_val = src_val;
assert(dest_key->flags == DB_DBT_REALLOC);
dest_key->data = toku_realloc(dest_key->data, src_key->size);
memcpy(dest_key->data, src_key->data, src_key->size);
dest_key->size = src_key->size;
assert(dest_val->flags == DB_DBT_REALLOC);
dest_val->data = toku_realloc(dest_val->data, src_val->size);
memcpy(dest_val->data, src_val->data, src_val->size);
dest_val->size = src_val->size;
return 0;
}
static void insert(DB_LOADER *loader, int k, int val_size) {
int r;
// generate the key
char key_buffer[8];
memset(key_buffer, 0, sizeof key_buffer);
int newa = htonl(k);
memcpy(key_buffer, &newa, sizeof newa);
// generate the value
char *val_buffer = toku_malloc(val_size); assert(val_buffer);
memset(val_buffer, 0, val_size);
DBT key = { .data = key_buffer, .size = sizeof key_buffer };
DBT value = { .data = val_buffer, .size = val_size };
r = loader->put(loader, &key, &value);
if (DISALLOW_PUTS) {
assert(r == EINVAL);
}
else {
assert_zero(r);
}
toku_free(val_buffer);
}
int test_main(int argc, char * const argv[]) {
uint32_t loader_flags = 0;
#if defined(TOKUDB)
char *db_env_dir = "blobs.leafsplit.env.tokudb";
#else
char *db_env_dir = "blobs.leafsplit.env.bdb";
#endif
int db_env_open_flags = DB_CREATE | DB_PRIVATE | DB_INIT_MPOOL | DB_INIT_TXN | DB_INIT_LOCK | DB_INIT_LOG;
char *db_filename = "blobs.db";
int do_txn = 1;
u_int64_t cachesize = 0;
u_int32_t pagesize = 0;
int i;
for (i = 1; i < argc; i++) {
char *arg = argv[i];
if (strcmp(arg, "-v") == 0 || strcmp(arg, "--verbose") == 0) {
verbose++;
continue;
}
if (strcmp(arg, "-q") == 0) {
if (verbose > 0) verbose--;
continue;
}
if (strcmp(arg, "-z") == 0) {
loader_flags |= LOADER_COMPRESS_INTERMEDIATES;
continue;
}
if (strcmp(arg, "-p") == 0) {
loader_flags |= LOADER_DISALLOW_PUTS;
continue;
}
if (strcmp(arg, "--txn") == 0 && i+1 < argc) {
do_txn = atoi(argv[++i]);
continue;
}
if (strcmp(arg, "--pagesize") == 0 && i+1 < argc) {
pagesize = atoi(argv[++i]);
continue;
}
if (strcmp(arg, "--cachesize") == 0 && i+1 < argc) {
cachesize = atol(argv[++i]);
continue;
}
assert(0);
}
int r;
char rm_cmd[strlen(db_env_dir) + strlen("rm -rf ") + 1];
snprintf(rm_cmd, sizeof(rm_cmd), "rm -rf %s", db_env_dir);
r = system(rm_cmd); assert_zero(r);
r = toku_os_mkdir(db_env_dir, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH); assert_zero(r);
// create and open the env
DB_ENV *db_env = NULL;
r = db_env_create(&db_env, 0); assert_zero(r);
if (cachesize) {
const u_int64_t gig = 1 << 30;
r = db_env->set_cachesize(db_env, cachesize / gig, cachesize % gig, 1); assert_zero(r);
}
r = db_env->set_generate_row_callback_for_put(db_env, my_row_generate); assert_zero(r);
r = db_env->set_default_bt_compare(db_env, my_bt_compare); assert_zero(r);
if (!do_txn)
db_env_open_flags &= ~(DB_INIT_TXN | DB_INIT_LOG);
r = db_env->open(db_env, db_env_dir, db_env_open_flags, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert_zero(r);
// create the db
DB *db = NULL;
r = db_create(&db, db_env, 0); assert_zero(r);
DB_TXN *create_txn = NULL;
if (do_txn) {
r = db_env->txn_begin(db_env, NULL, &create_txn, 0); assert_zero(r);
}
if (pagesize) {
r = db->set_pagesize(db, pagesize); assert_zero(r);
}
r = db->open(db, create_txn, db_filename, NULL, DB_BTREE, DB_CREATE, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); assert_zero(r);
DB_LOADER *loader = NULL;
uint32_t db_flags = 0;
uint32_t dbt_flags = 0;
r = db_env->create_loader(db_env, create_txn, &loader, db, 1, &db, &db_flags, &dbt_flags, loader_flags); assert_zero(r);
insert(loader, 1, 8000000);
insert(loader, 2, 1);
r = loader->close(loader); assert_zero(r);
if (do_txn) {
r = create_txn->commit(create_txn, 0); assert_zero(r);
}
// shutdown
r = db->close(db, 0); assert_zero(r); db = NULL;
r = db_env->close(db_env, 0); assert_zero(r); db_env = NULL;
return 0;
}
...@@ -177,9 +177,6 @@ test_setup (void) { ...@@ -177,9 +177,6 @@ test_setup (void) {
r=toku_os_mkdir(TOKU_TEST_FILENAME, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); r=toku_os_mkdir(TOKU_TEST_FILENAME, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r=db_env_create(&env, 0); CKERR(r); r=db_env_create(&env, 0); CKERR(r);
#ifndef TOKUDB
r=env->set_lk_max_objects(env, N); CKERR(r);
#endif
env->set_errfile(env, stderr); env->set_errfile(env, stderr);
r=env->open(env, TOKU_TEST_FILENAME, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); r=env->open(env, TOKU_TEST_FILENAME, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r=db_create(&db, env, 0); CKERR(r); r=db_create(&db, env, 0); CKERR(r);
......
...@@ -100,8 +100,6 @@ const int envflags = DB_INIT_MPOOL|DB_CREATE|DB_THREAD |DB_INIT_LOCK|DB_INIT_LOG ...@@ -100,8 +100,6 @@ const int envflags = DB_INIT_MPOOL|DB_CREATE|DB_THREAD |DB_INIT_LOCK|DB_INIT_LOG
const char *namea="a.db"; const char *namea="a.db";
const char *nameb="b.db"; const char *nameb="b.db";
#if USE_TDB
static int my_compare(DB *UU(db), const DBT *a, const DBT *b) { static int my_compare(DB *UU(db), const DBT *a, const DBT *b) {
assert(db); assert(db);
assert(db->cmp_descriptor); assert(db->cmp_descriptor);
...@@ -112,17 +110,13 @@ static int my_compare(DB *UU(db), const DBT *a, const DBT *b) { ...@@ -112,17 +110,13 @@ static int my_compare(DB *UU(db), const DBT *a, const DBT *b) {
return memcmp(a->data, b->data, a->size); return memcmp(a->data, b->data, a->size);
} }
#endif
static void static void
change_descriptor(DB_ENV* env, DB* db) { change_descriptor(DB_ENV* env, DB* db) {
#if USE_TDB
DBT descriptor; DBT descriptor;
dbt_init(&descriptor, descriptor_contents, sizeof(descriptor_contents)); dbt_init(&descriptor, descriptor_contents, sizeof(descriptor_contents));
IN_TXN_COMMIT(env, NULL, txn_desc, 0, { IN_TXN_COMMIT(env, NULL, txn_desc, 0, {
{ int chk_r = db->change_descriptor(db, txn_desc, &descriptor, DB_UPDATE_CMP_DESCRIPTOR); CKERR(chk_r); } { int chk_r = db->change_descriptor(db, txn_desc, &descriptor, DB_UPDATE_CMP_DESCRIPTOR); CKERR(chk_r); }
}); });
#endif
} }
static void static void
...@@ -136,9 +130,7 @@ do_x1_shutdown (bool do_commit, bool do_abort) { ...@@ -136,9 +130,7 @@ do_x1_shutdown (bool do_commit, bool do_abort) {
DB *dba, *dbb; DB *dba, *dbb;
r = db_env_create(&env, 0); CKERR(r); r = db_env_create(&env, 0); CKERR(r);
r = env->set_data_dir(env, "data"); CKERR(r); r = env->set_data_dir(env, "data"); CKERR(r);
#if USE_TDB
r = env->set_default_bt_compare(env, my_compare); CKERR(r); r = env->set_default_bt_compare(env, my_compare); CKERR(r);
#endif
r = env->open(env, TOKU_TEST_FILENAME, envflags, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); r = env->open(env, TOKU_TEST_FILENAME, envflags, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r = db_create(&dba, env, 0); CKERR(r); r = db_create(&dba, env, 0); CKERR(r);
r = dba->open(dba, NULL, namea, NULL, DB_BTREE, DB_AUTO_COMMIT|DB_CREATE, 0666); CKERR(r); r = dba->open(dba, NULL, namea, NULL, DB_BTREE, DB_AUTO_COMMIT|DB_CREATE, 0666); CKERR(r);
...@@ -181,9 +173,7 @@ do_x1_recover (bool did_commit) { ...@@ -181,9 +173,7 @@ do_x1_recover (bool did_commit) {
r = toku_os_mkdir(datadir, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); r = toku_os_mkdir(datadir, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r = db_env_create(&env, 0); CKERR(r); r = db_env_create(&env, 0); CKERR(r);
r = env->set_data_dir(env, "data"); CKERR(r); r = env->set_data_dir(env, "data"); CKERR(r);
#if USE_TDB
r = env->set_default_bt_compare(env, my_compare); CKERR(r); r = env->set_default_bt_compare(env, my_compare); CKERR(r);
#endif
r = env->open(env, TOKU_TEST_FILENAME, envflags|DB_RECOVER, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); r = env->open(env, TOKU_TEST_FILENAME, envflags|DB_RECOVER, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r = db_create(&dba, env, 0); CKERR(r); r = db_create(&dba, env, 0); CKERR(r);
r = dba->open(dba, NULL, namea, NULL, DB_BTREE, DB_AUTO_COMMIT|DB_CREATE, 0666); CKERR(r); r = dba->open(dba, NULL, namea, NULL, DB_BTREE, DB_AUTO_COMMIT|DB_CREATE, 0666); CKERR(r);
......
...@@ -98,16 +98,12 @@ const int envflags = DB_INIT_MPOOL|DB_CREATE|DB_THREAD |DB_INIT_LOCK|DB_INIT_LOG ...@@ -98,16 +98,12 @@ const int envflags = DB_INIT_MPOOL|DB_CREATE|DB_THREAD |DB_INIT_LOCK|DB_INIT_LOG
const char *namea="a.db"; const char *namea="a.db";
const char *nameb="b.db"; const char *nameb="b.db";
#if USE_TDB
static int my_compare(DB *UU(db), const DBT *a, const DBT *b) { static int my_compare(DB *UU(db), const DBT *a, const DBT *b) {
assert(db); assert(db);
assert(a->size == b->size); assert(a->size == b->size);
return memcmp(a->data, b->data, a->size); return memcmp(a->data, b->data, a->size);
} }
#endif
static void static void
do_x1_shutdown (bool do_commit, bool do_abort) { do_x1_shutdown (bool do_commit, bool do_abort) {
int r; int r;
...@@ -116,9 +112,7 @@ do_x1_shutdown (bool do_commit, bool do_abort) { ...@@ -116,9 +112,7 @@ do_x1_shutdown (bool do_commit, bool do_abort) {
DB_ENV *env; DB_ENV *env;
DB *dba, *dbb; DB *dba, *dbb;
r = db_env_create(&env, 0); CKERR(r); r = db_env_create(&env, 0); CKERR(r);
#if USE_TDB
r = env->set_default_bt_compare(env, my_compare); CKERR(r); r = env->set_default_bt_compare(env, my_compare); CKERR(r);
#endif
r = env->open(env, TOKU_TEST_FILENAME, envflags, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); r = env->open(env, TOKU_TEST_FILENAME, envflags, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r = db_create(&dba, env, 0); CKERR(r); r = db_create(&dba, env, 0); CKERR(r);
r = dba->open(dba, NULL, namea, NULL, DB_BTREE, DB_AUTO_COMMIT|DB_CREATE, 0666); CKERR(r); r = dba->open(dba, NULL, namea, NULL, DB_BTREE, DB_AUTO_COMMIT|DB_CREATE, 0666); CKERR(r);
...@@ -155,9 +149,7 @@ do_x1_recover (bool did_commit) { ...@@ -155,9 +149,7 @@ do_x1_recover (bool did_commit) {
DB *dba, *dbb; DB *dba, *dbb;
int r; int r;
r = db_env_create(&env, 0); CKERR(r); r = db_env_create(&env, 0); CKERR(r);
#if USE_TDB
r = env->set_default_bt_compare(env, my_compare); CKERR(r); r = env->set_default_bt_compare(env, my_compare); CKERR(r);
#endif
r = env->open(env, TOKU_TEST_FILENAME, envflags|DB_RECOVER, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); r = env->open(env, TOKU_TEST_FILENAME, envflags|DB_RECOVER, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r = db_create(&dba, env, 0); CKERR(r); r = db_create(&dba, env, 0); CKERR(r);
r = dba->open(dba, NULL, namea, NULL, DB_BTREE, DB_AUTO_COMMIT|DB_CREATE, 0666); CKERR(r); r = dba->open(dba, NULL, namea, NULL, DB_BTREE, DB_AUTO_COMMIT|DB_CREATE, 0666); CKERR(r);
......
...@@ -99,7 +99,6 @@ static const char *namea="a.db"; uint32_t nodesizea = 0; ...@@ -99,7 +99,6 @@ static const char *namea="a.db"; uint32_t nodesizea = 0;
static const char *nameb="b.db"; uint32_t nodesizeb = 32*1024; static const char *nameb="b.db"; uint32_t nodesizeb = 32*1024;
static void do_remove(DB_ENV *env, const char *filename) { static void do_remove(DB_ENV *env, const char *filename) {
#if TOKUDB
int r; int r;
DBT dname; DBT dname;
DBT iname; DBT iname;
...@@ -112,12 +111,6 @@ static void do_remove(DB_ENV *env, const char *filename) { ...@@ -112,12 +111,6 @@ static void do_remove(DB_ENV *env, const char *filename) {
toku_path_join(rmpath, 2, TOKU_TEST_FILENAME, iname.data); toku_path_join(rmpath, 2, TOKU_TEST_FILENAME, iname.data);
toku_os_recursive_delete(rmpath); toku_os_recursive_delete(rmpath);
toku_free(iname.data); toku_free(iname.data);
#else
(void) env;
char rmpath[TOKU_PATH_MAX+1];
toku_path_join(rmpath, 2, TOKU_TEST_FILENAME, filename);
toku_os_recursive_delete(rmpath);
#endif
} }
static void run_test (void) { static void run_test (void) {
......
...@@ -100,7 +100,6 @@ static const char *namea="a.db"; uint32_t nodesizea = 0; ...@@ -100,7 +100,6 @@ static const char *namea="a.db"; uint32_t nodesizea = 0;
static const char *nameb="b.db"; uint32_t nodesizeb = 64*1024; static const char *nameb="b.db"; uint32_t nodesizeb = 64*1024;
static void do_remove(DB_ENV *env, const char *filename) { static void do_remove(DB_ENV *env, const char *filename) {
#if TOKUDB
int r; int r;
DBT dname; DBT dname;
DBT iname; DBT iname;
...@@ -113,12 +112,6 @@ static void do_remove(DB_ENV *env, const char *filename) { ...@@ -113,12 +112,6 @@ static void do_remove(DB_ENV *env, const char *filename) {
toku_path_join(rmpath, 2, TOKU_TEST_FILENAME, iname.data); toku_path_join(rmpath, 2, TOKU_TEST_FILENAME, iname.data);
toku_os_recursive_delete(rmpath); toku_os_recursive_delete(rmpath);
toku_free(iname.data); toku_free(iname.data);
#else
(void) env;
char rmpath[TOKU_PATH_MAX+1];
toku_path_join(rmpath, 2, TOKU_TEST_FILENAME, filename);
toku_os_recursive_delete(rmpath);
#endif
} }
static void run_test (void) { static void run_test (void) {
......
...@@ -109,9 +109,7 @@ static void run_test (void) { ...@@ -109,9 +109,7 @@ static void run_test (void) {
DB_ENV *env; DB_ENV *env;
r = db_env_create(&env, 0); CKERR(r); r = db_env_create(&env, 0); CKERR(r);
#if IS_TDB
db_env_enable_engine_status(0); // disable engine status on crash because test is expected to fail db_env_enable_engine_status(0); // disable engine status on crash because test is expected to fail
#endif
r = env->open(env, TOKU_TEST_FILENAME, envflags, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); r = env->open(env, TOKU_TEST_FILENAME, envflags, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
DB *dba; DB *dba;
...@@ -160,9 +158,7 @@ static void run_recover (void) { ...@@ -160,9 +158,7 @@ static void run_recover (void) {
CKERR(r); CKERR(r);
r = db_env_create(&env, 0); CKERR(r); r = db_env_create(&env, 0); CKERR(r);
#if IS_TDB
db_env_enable_engine_status(0); // disable engine status on crash because test is expected to fail db_env_enable_engine_status(0); // disable engine status on crash because test is expected to fail
#endif
r = env->open(env, TOKU_TEST_FILENAME, envflags + DB_RECOVER, S_IRWXU+S_IRWXG+S_IRWXO); r = env->open(env, TOKU_TEST_FILENAME, envflags + DB_RECOVER, S_IRWXU+S_IRWXG+S_IRWXO);
assert(r == DB_RUNRECOVERY); assert(r == DB_RUNRECOVERY);
...@@ -184,9 +180,7 @@ static void run_no_recover (void) { ...@@ -184,9 +180,7 @@ static void run_no_recover (void) {
int r; int r;
r = db_env_create(&env, 0); CKERR(r); r = db_env_create(&env, 0); CKERR(r);
#if IS_TDB
db_env_enable_engine_status(0); // disable engine status on crash because test is expected to fail db_env_enable_engine_status(0); // disable engine status on crash because test is expected to fail
#endif
r = env->open(env, TOKU_TEST_FILENAME, envflags & ~DB_RECOVER, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); r = env->open(env, TOKU_TEST_FILENAME, envflags & ~DB_RECOVER, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r = env->close(env, 0); CKERR(r); r = env->close(env, 0); CKERR(r);
exit(0); exit(0);
......
...@@ -109,9 +109,7 @@ static void run_test (void) { ...@@ -109,9 +109,7 @@ static void run_test (void) {
DB *dba; DB *dba;
r = db_env_create(&env, 0); CKERR(r); r = db_env_create(&env, 0); CKERR(r);
#if IS_TDB
db_env_enable_engine_status(0); // disable engine status on crash because test is expected to fail db_env_enable_engine_status(0); // disable engine status on crash because test is expected to fail
#endif
r = env->open(env, TOKU_TEST_FILENAME, envflags, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); r = env->open(env, TOKU_TEST_FILENAME, envflags, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r = db_create(&dba, env, 0); CKERR(r); r = db_create(&dba, env, 0); CKERR(r);
...@@ -151,9 +149,7 @@ static void run_recover (void) { ...@@ -151,9 +149,7 @@ static void run_recover (void) {
CKERR(r); CKERR(r);
r = db_env_create(&env, 0); CKERR(r); r = db_env_create(&env, 0); CKERR(r);
#if IS_TDB
db_env_enable_engine_status(0); // disable engine status on crash because test is expected to fail db_env_enable_engine_status(0); // disable engine status on crash because test is expected to fail
#endif
r = env->open(env, TOKU_TEST_FILENAME, envflags + DB_RECOVER, S_IRWXU+S_IRWXG+S_IRWXO); r = env->open(env, TOKU_TEST_FILENAME, envflags + DB_RECOVER, S_IRWXU+S_IRWXG+S_IRWXO);
CKERR2(r, DB_RUNRECOVERY); CKERR2(r, DB_RUNRECOVERY);
...@@ -175,9 +171,7 @@ static void run_no_recover (void) { ...@@ -175,9 +171,7 @@ static void run_no_recover (void) {
int r; int r;
r = db_env_create(&env, 0); CKERR(r); r = db_env_create(&env, 0); CKERR(r);
#if IS_TDB
db_env_enable_engine_status(0); // disable engine status on crash because test is expected to fail db_env_enable_engine_status(0); // disable engine status on crash because test is expected to fail
#endif
r = env->open(env, TOKU_TEST_FILENAME, envflags & ~DB_RECOVER, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); r = env->open(env, TOKU_TEST_FILENAME, envflags & ~DB_RECOVER, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r = env->close(env, 0); CKERR(r); r = env->close(env, 0); CKERR(r);
exit(0); exit(0);
......
...@@ -105,8 +105,6 @@ const char *namea="a.db"; ...@@ -105,8 +105,6 @@ const char *namea="a.db";
int verified = 0; int verified = 0;
uint32_t forced_version = 2; uint32_t forced_version = 2;
#if USE_TDB
static int my_compare(DB *UU(db), const DBT *a, const DBT *b) { static int my_compare(DB *UU(db), const DBT *a, const DBT *b) {
assert(db); assert(db);
assert(db->cmp_descriptor); assert(db->cmp_descriptor);
...@@ -121,18 +119,14 @@ static int my_compare(DB *UU(db), const DBT *a, const DBT *b) { ...@@ -121,18 +119,14 @@ static int my_compare(DB *UU(db), const DBT *a, const DBT *b) {
return memcmp(a->data, b->data, a->size); return memcmp(a->data, b->data, a->size);
} }
#endif
static void static void
change_descriptor(DB* db, int which, DB_ENV* env) { change_descriptor(DB* db, int which, DB_ENV* env) {
#if USE_TDB
DBT descriptor; DBT descriptor;
size_t len = strlen(descriptor_contents[which])+1; size_t len = strlen(descriptor_contents[which])+1;
dbt_init(&descriptor, descriptor_contents[which], len); dbt_init(&descriptor, descriptor_contents[which], len);
IN_TXN_COMMIT(env, NULL, txn_desc, 0, { IN_TXN_COMMIT(env, NULL, txn_desc, 0, {
{ int chk_r = db->change_descriptor(db, txn_desc, &descriptor, DB_UPDATE_CMP_DESCRIPTOR); CKERR(chk_r); } { int chk_r = db->change_descriptor(db, txn_desc, &descriptor, DB_UPDATE_CMP_DESCRIPTOR); CKERR(chk_r); }
}); });
#endif
} }
static void static void
...@@ -146,9 +140,7 @@ do_x1_shutdown (bool do_commit, bool do_abort) { ...@@ -146,9 +140,7 @@ do_x1_shutdown (bool do_commit, bool do_abort) {
DB *dba, *dbb; DB *dba, *dbb;
r = db_env_create(&env, 0); CKERR(r); r = db_env_create(&env, 0); CKERR(r);
r = env->set_data_dir(env, "data"); CKERR(r); r = env->set_data_dir(env, "data"); CKERR(r);
#if USE_TDB
r = env->set_default_bt_compare(env, my_compare); CKERR(r); r = env->set_default_bt_compare(env, my_compare); CKERR(r);
#endif
r = env->open(env, TOKU_TEST_FILENAME, envflags, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); r = env->open(env, TOKU_TEST_FILENAME, envflags, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r = db_create(&dba, env, 0); CKERR(r); r = db_create(&dba, env, 0); CKERR(r);
...@@ -194,9 +186,7 @@ do_x1_recover (bool did_commit) { ...@@ -194,9 +186,7 @@ do_x1_recover (bool did_commit) {
r = toku_os_mkdir(datadir, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); r = toku_os_mkdir(datadir, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r = db_env_create(&env, 0); CKERR(r); r = db_env_create(&env, 0); CKERR(r);
r = env->set_data_dir(env, "data"); CKERR(r); r = env->set_data_dir(env, "data"); CKERR(r);
#if USE_TDB
r = env->set_default_bt_compare(env, my_compare); CKERR(r); r = env->set_default_bt_compare(env, my_compare); CKERR(r);
#endif
r = env->open(env, TOKU_TEST_FILENAME, envflags|DB_RECOVER, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); r = env->open(env, TOKU_TEST_FILENAME, envflags|DB_RECOVER, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r = db_create(&dba, env, 0); CKERR(r); r = db_create(&dba, env, 0); CKERR(r);
r = dba->open(dba, NULL, namea, NULL, DB_BTREE, DB_AUTO_COMMIT|DB_CREATE, 0666); CKERR(r); r = dba->open(dba, NULL, namea, NULL, DB_BTREE, DB_AUTO_COMMIT|DB_CREATE, 0666); CKERR(r);
......
...@@ -105,8 +105,6 @@ const char *namea="a.db"; ...@@ -105,8 +105,6 @@ const char *namea="a.db";
int verified = 0; int verified = 0;
uint32_t forced_version = 2; uint32_t forced_version = 2;
#if USE_TDB
static int my_compare(DB *UU(db), const DBT *a, const DBT *b) { static int my_compare(DB *UU(db), const DBT *a, const DBT *b) {
assert(db); assert(db);
assert(db->cmp_descriptor); assert(db->cmp_descriptor);
...@@ -121,18 +119,14 @@ static int my_compare(DB *UU(db), const DBT *a, const DBT *b) { ...@@ -121,18 +119,14 @@ static int my_compare(DB *UU(db), const DBT *a, const DBT *b) {
return memcmp(a->data, b->data, a->size); return memcmp(a->data, b->data, a->size);
} }
#endif
static void static void
change_descriptor(DB* db, int which, DB_ENV* env) { change_descriptor(DB* db, int which, DB_ENV* env) {
#if USE_TDB
DBT descriptor; DBT descriptor;
size_t len = strlen(descriptor_contents[which])+1; size_t len = strlen(descriptor_contents[which])+1;
dbt_init(&descriptor, descriptor_contents[which], len); dbt_init(&descriptor, descriptor_contents[which], len);
IN_TXN_COMMIT(env, NULL, txn_desc, 0, { IN_TXN_COMMIT(env, NULL, txn_desc, 0, {
{ int chk_r = db->change_descriptor(db, txn_desc, &descriptor, DB_UPDATE_CMP_DESCRIPTOR); CKERR(chk_r); } { int chk_r = db->change_descriptor(db, txn_desc, &descriptor, DB_UPDATE_CMP_DESCRIPTOR); CKERR(chk_r); }
}); });
#endif
} }
static void static void
...@@ -146,9 +140,7 @@ do_x1_shutdown (bool do_commit, bool do_abort) { ...@@ -146,9 +140,7 @@ do_x1_shutdown (bool do_commit, bool do_abort) {
DB *dba; DB *dba;
r = db_env_create(&env, 0); CKERR(r); r = db_env_create(&env, 0); CKERR(r);
r = env->set_data_dir(env, "data"); CKERR(r); r = env->set_data_dir(env, "data"); CKERR(r);
#if USE_TDB
r = env->set_default_bt_compare(env, my_compare); CKERR(r); r = env->set_default_bt_compare(env, my_compare); CKERR(r);
#endif
r = env->open(env, TOKU_TEST_FILENAME, envflags, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); r = env->open(env, TOKU_TEST_FILENAME, envflags, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r = db_create(&dba, env, 0); CKERR(r); r = db_create(&dba, env, 0); CKERR(r);
...@@ -197,9 +189,7 @@ do_x1_recover (bool did_commit) { ...@@ -197,9 +189,7 @@ do_x1_recover (bool did_commit) {
r = toku_os_mkdir(datadir, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); r = toku_os_mkdir(datadir, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r = db_env_create(&env, 0); CKERR(r); r = db_env_create(&env, 0); CKERR(r);
r = env->set_data_dir(env, "data"); CKERR(r); r = env->set_data_dir(env, "data"); CKERR(r);
#if USE_TDB
r = env->set_default_bt_compare(env, my_compare); CKERR(r); r = env->set_default_bt_compare(env, my_compare); CKERR(r);
#endif
r = env->open(env, TOKU_TEST_FILENAME, envflags|DB_RECOVER, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); r = env->open(env, TOKU_TEST_FILENAME, envflags|DB_RECOVER, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r = db_create(&dba, env, 0); CKERR(r); r = db_create(&dba, env, 0); CKERR(r);
r = dba->open(dba, NULL, namea, NULL, DB_BTREE, DB_AUTO_COMMIT|DB_CREATE, 0666); CKERR(r); r = dba->open(dba, NULL, namea, NULL, DB_BTREE, DB_AUTO_COMMIT|DB_CREATE, 0666); CKERR(r);
......
...@@ -184,11 +184,7 @@ static void root_fifo_2(int n, int create_outside) { ...@@ -184,11 +184,7 @@ static void root_fifo_2(int n, int create_outside) {
// cleanup // cleanup
r = env->close(env, 0); r = env->close(env, 0);
#if TOKUDB
assert(r == 0); env = null_env; assert(r == 0); env = null_env;
#else
printf("%s:%d env close r=%d\n", __FUNCTION__, __LINE__, r);
#endif
} }
int test_main(int argc, char *const argv[]) { int test_main(int argc, char *const argv[]) {
......
...@@ -102,9 +102,7 @@ static void setup_env (void) { ...@@ -102,9 +102,7 @@ static void setup_env (void) {
{int r = toku_os_mkdir(envdir, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); } {int r = toku_os_mkdir(envdir, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); }
{int r = db_env_create(&env, 0); CKERR(r); } {int r = db_env_create(&env, 0); CKERR(r); }
//env->set_errfile(env, stderr); //env->set_errfile(env, stderr);
#ifdef TOKUDB
CKERR(env->set_redzone(env, 0)); CKERR(env->set_redzone(env, 0));
#endif
{ int r = env->open(env, envdir, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); } { int r = env->open(env, envdir, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); }
{ int r = db_create(&db, env, 0); CKERR(r); } { int r = db_create(&db, env, 0); CKERR(r); }
{ int r = db->open(db, NULL, "foo.db", 0, DB_BTREE, DB_CREATE | DB_AUTO_COMMIT, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); } { int r = db->open(db, NULL, "foo.db", 0, DB_BTREE, DB_CREATE | DB_AUTO_COMMIT, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); }
...@@ -119,14 +117,11 @@ static void put (const char *keystring, int size, bool should_work) { ...@@ -119,14 +117,11 @@ static void put (const char *keystring, int size, bool should_work) {
DBT k, v; DBT k, v;
dbt_init(&k, keystring, 1+strlen(keystring)); dbt_init(&k, keystring, 1+strlen(keystring));
dbt_init(&v, toku_xcalloc(size, 1), size); dbt_init(&v, toku_xcalloc(size, 1), size);
#ifdef USE_BDB
#define DB_YES_OVERWRITE 0
#endif
static DB_TXN *txn = NULL; static DB_TXN *txn = NULL;
{ int r = env->txn_begin(env, 0, &txn, 0); CKERR(r); } { int r = env->txn_begin(env, 0, &txn, 0); CKERR(r); }
{ {
int r = db->put(db, NULL, &k, &v, 0); int r = db->put(db, NULL, &k, &v, 0);
if (!IS_TDB || should_work) { if (should_work) {
CKERR(r); CKERR(r);
} else { } else {
assert(r!=0); assert(r!=0);
......
...@@ -136,9 +136,7 @@ test_main (int argc, char * const argv[]) { ...@@ -136,9 +136,7 @@ test_main (int argc, char * const argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
setup(FLAGS_LOG); setup(FLAGS_LOG);
env->txn_checkpoint(env, 0, 0, 0); env->txn_checkpoint(env, 0, 0, 0);
#ifdef USE_TDB
print_engine_status(env); print_engine_status(env);
#endif
test_shutdown(); test_shutdown();
return 0; return 0;
} }
...@@ -103,9 +103,7 @@ static void clean_env (const char *envdir) { ...@@ -103,9 +103,7 @@ static void clean_env (const char *envdir) {
static void setup_env (DB_ENV **envp, const char *envdir) { static void setup_env (DB_ENV **envp, const char *envdir) {
{ int chk_r = db_env_create(envp, 0); CKERR(chk_r); } { int chk_r = db_env_create(envp, 0); CKERR(chk_r); }
(*envp)->set_errfile(*envp, stderr); (*envp)->set_errfile(*envp, stderr);
#ifdef TOKUDB
{ int chk_r = (*envp)->set_redzone(*envp, 0); CKERR(chk_r); } { int chk_r = (*envp)->set_redzone(*envp, 0); CKERR(chk_r); }
#endif
{ int chk_r = (*envp)->open(*envp, envdir, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE|DB_RECOVER, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(chk_r); } { int chk_r = (*envp)->open(*envp, envdir, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE|DB_RECOVER, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(chk_r); }
} }
......
...@@ -105,9 +105,7 @@ static void clean_env (const char *envdir) { ...@@ -105,9 +105,7 @@ static void clean_env (const char *envdir) {
static void setup_env (DB_ENV **envp, const char *envdir) { static void setup_env (DB_ENV **envp, const char *envdir) {
{ int chk_r = db_env_create(envp, 0); CKERR(chk_r); } { int chk_r = db_env_create(envp, 0); CKERR(chk_r); }
(*envp)->set_errfile(*envp, stderr); (*envp)->set_errfile(*envp, stderr);
#ifdef TOKUDB
{ int chk_r = (*envp)->set_redzone(*envp, 0); CKERR(chk_r); } { int chk_r = (*envp)->set_redzone(*envp, 0); CKERR(chk_r); }
#endif
{ int chk_r = (*envp)->open(*envp, envdir, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE|DB_RECOVER, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(chk_r); } { int chk_r = (*envp)->open(*envp, envdir, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE|DB_RECOVER, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(chk_r); }
} }
......
...@@ -105,9 +105,7 @@ static void clean_env (const char *envdir) { ...@@ -105,9 +105,7 @@ static void clean_env (const char *envdir) {
static void setup_env (DB_ENV **envp, const char *envdir) { static void setup_env (DB_ENV **envp, const char *envdir) {
{ int chk_r = db_env_create(envp, 0); CKERR(chk_r); } { int chk_r = db_env_create(envp, 0); CKERR(chk_r); }
(*envp)->set_errfile(*envp, stderr); (*envp)->set_errfile(*envp, stderr);
#ifdef TOKUDB
{ int chk_r = (*envp)->set_redzone(*envp, 0); CKERR(chk_r); } { int chk_r = (*envp)->set_redzone(*envp, 0); CKERR(chk_r); }
#endif
{ int chk_r = (*envp)->open(*envp, envdir, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE|DB_RECOVER, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(chk_r); } { int chk_r = (*envp)->open(*envp, envdir, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE|DB_RECOVER, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(chk_r); }
} }
......
...@@ -103,9 +103,7 @@ static void clean_env (const char *envdir) { ...@@ -103,9 +103,7 @@ static void clean_env (const char *envdir) {
static void setup_env (DB_ENV **envp, const char *envdir) { static void setup_env (DB_ENV **envp, const char *envdir) {
{ int chk_r = db_env_create(envp, 0); CKERR(chk_r); } { int chk_r = db_env_create(envp, 0); CKERR(chk_r); }
(*envp)->set_errfile(*envp, stderr); (*envp)->set_errfile(*envp, stderr);
#ifdef TOKUDB
{ int chk_r = (*envp)->set_redzone(*envp, 0); CKERR(chk_r); } { int chk_r = (*envp)->set_redzone(*envp, 0); CKERR(chk_r); }
#endif
{ int chk_r = (*envp)->open(*envp, envdir, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE|DB_RECOVER, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(chk_r); } { int chk_r = (*envp)->open(*envp, envdir, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE|DB_RECOVER, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(chk_r); }
} }
......
...@@ -107,17 +107,13 @@ PATENT RIGHTS GRANT: ...@@ -107,17 +107,13 @@ PATENT RIGHTS GRANT:
#include "toku_assert.h" #include "toku_assert.h"
#include <signal.h> #include <signal.h>
#include <time.h> #include <time.h>
#if defined(USE_TDB)
#include "ydb.h" #include "ydb.h"
//TDB uses DB_NOTFOUND for c_del and DB_CURRENT errors. //TDB uses DB_NOTFOUND for c_del and DB_CURRENT errors.
#ifdef DB_KEYEMPTY #ifdef DB_KEYEMPTY
#error #error
#endif #endif
#define DB_KEYEMPTY DB_NOTFOUND #define DB_KEYEMPTY DB_NOTFOUND
#endif
#ifndef DB_DELETE_ANY
#define DB_DELETE_ANY 0
#endif
// Certain tests fail when row locks taken for read are not shared. // Certain tests fail when row locks taken for read are not shared.
// This switch prevents them from failing so long as read locks are not shared. // This switch prevents them from failing so long as read locks are not shared.
...@@ -144,13 +140,6 @@ int verbose=0; ...@@ -144,13 +140,6 @@ int verbose=0;
fflush(stderr); \ fflush(stderr); \
} while (0) } while (0)
// If the error code depends on BDB vs TDB use this
#ifdef USE_TDB
#define CKERR_depending(r,tdbexpect,bdbexpect) CKERR2(r,tdbexpect)
#else
#define CKERR_depending(r,tdbexpect,bdbexpect) CKERR2(r,bdbexpect)
#endif
static __attribute__((__unused__)) void static __attribute__((__unused__)) void
parse_args (int argc, char * const argv[]) { parse_args (int argc, char * const argv[]) {
const char *argv0=argv[0]; const char *argv0=argv[0];
...@@ -174,7 +163,6 @@ parse_args (int argc, char * const argv[]) { ...@@ -174,7 +163,6 @@ parse_args (int argc, char * const argv[]) {
} }
} }
#ifdef USE_TDB
static __attribute__((__unused__)) void static __attribute__((__unused__)) void
print_engine_status(DB_ENV * UU(env)) { print_engine_status(DB_ENV * UU(env)) {
if (verbose) { // verbose declared statically in this file if (verbose) { // verbose declared statically in this file
...@@ -187,9 +175,7 @@ print_engine_status(DB_ENV * UU(env)) { ...@@ -187,9 +175,7 @@ print_engine_status(DB_ENV * UU(env)) {
printf("%s", buff); printf("%s", buff);
} }
} }
#endif
#ifdef USE_TDB
static __attribute__((__unused__)) uint64_t static __attribute__((__unused__)) uint64_t
get_engine_status_val(DB_ENV * UU(env), const char * keyname) { get_engine_status_val(DB_ENV * UU(env), const char * keyname) {
uint64_t rval = 0; uint64_t rval = 0;
...@@ -213,7 +199,6 @@ get_engine_status_val(DB_ENV * UU(env), const char * keyname) { ...@@ -213,7 +199,6 @@ get_engine_status_val(DB_ENV * UU(env), const char * keyname) {
CKERR2(found, 1); CKERR2(found, 1);
return rval; return rval;
} }
#endif
static __attribute__((__unused__)) DBT * static __attribute__((__unused__)) DBT *
dbt_init(DBT *dbt, const void *data, uint32_t size) { dbt_init(DBT *dbt, const void *data, uint32_t size) {
...@@ -293,13 +278,8 @@ uint_dbt_cmp (DB *db, const DBT *a, const DBT *b) { ...@@ -293,13 +278,8 @@ uint_dbt_cmp (DB *db, const DBT *a, const DBT *b) {
return 0; return 0;
} }
#ifdef USE_TDB
#define SET_TRACE_FILE(x) toku_set_trace_file(x) #define SET_TRACE_FILE(x) toku_set_trace_file(x)
#define CLOSE_TRACE_FILE(x) toku_close_trace_file() #define CLOSE_TRACE_FILE(x) toku_close_trace_file()
#else
#define SET_TRACE_FILE(x) ((void)0)
#define CLOSE_TRACE_FILE(x) ((void)0)
#endif
#include <memory.h> #include <memory.h>
...@@ -361,19 +341,11 @@ void print_time_now(void) { ...@@ -361,19 +341,11 @@ void print_time_now(void) {
static void UU() static void UU()
multiply_locks_for_n_dbs(DB_ENV *env, int num_dbs) { multiply_locks_for_n_dbs(DB_ENV *env, int num_dbs) {
#ifdef USE_TDB
uint64_t current_max_lock_memory; uint64_t current_max_lock_memory;
int r = env->get_lk_max_memory(env, &current_max_lock_memory); int r = env->get_lk_max_memory(env, &current_max_lock_memory);
CKERR(r); CKERR(r);
r = env->set_lk_max_memory(env, current_max_lock_memory * num_dbs); r = env->set_lk_max_memory(env, current_max_lock_memory * num_dbs);
CKERR(r); CKERR(r);
#else
uint32_t current_max_locks;
int r = env->get_lk_max_locks(env, &current_max_locks);
CKERR(r);
r = env->set_lk_max_locks(env, current_max_locks * num_dbs);
CKERR(r);
#endif
} }
static inline void static inline void
...@@ -402,7 +374,6 @@ static void copy_dbt(DBT *dest, const DBT *src) { ...@@ -402,7 +374,6 @@ static void copy_dbt(DBT *dest, const DBT *src) {
} }
// DBT_ARRAY is a toku-specific type // DBT_ARRAY is a toku-specific type
#ifdef USE_TDB
UU() UU()
static int static int
env_update_multiple_test_no_array( env_update_multiple_test_no_array(
...@@ -507,7 +478,6 @@ static int env_del_multiple_test_no_array( ...@@ -507,7 +478,6 @@ static int env_del_multiple_test_no_array(
} }
return r; return r;
} }
#endif
/* Some macros for evaluating blocks or functions within the scope of a /* Some macros for evaluating blocks or functions within the scope of a
* transaction. */ * transaction. */
...@@ -535,20 +505,8 @@ main(int argc, char * const argv[]) ...@@ -535,20 +505,8 @@ main(int argc, char * const argv[])
#endif #endif
{ {
int r; int r;
#if IS_TDB && TOKU_WINDOWS
int rinit = toku_ydb_init();
CKERR(rinit);
#endif
#if !IS_TDB && DB_VERSION_MINOR==4 && DB_VERSION_MINOR == 7
db_env_set_func_malloc(toku_malloc);
db_env_set_func_free(toku_free);
db_env_set_func_realloc(toku_realloc);
#endif
toku_os_initialize_settings(1); toku_os_initialize_settings(1);
r = test_main(argc, argv); r = test_main(argc, argv);
#if IS_TDB && TOKU_WINDOWS
toku_ydb_destroy();
#endif
return r; return r;
} }
......
/* -*- mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
// vim: ft=cpp:expandtab:ts=8:sw=4:softtabstop=4:
#ident "$Id$"
/*
COPYING CONDITIONS NOTICE:
This program is free software; you can redistribute it and/or modify
it under the terms of version 2 of the GNU General Public License as
published by the Free Software Foundation, and provided that the
following conditions are met:
* Redistributions of source code must retain this COPYING
CONDITIONS NOTICE, the COPYRIGHT NOTICE (below), the
DISCLAIMER (below), the UNIVERSITY PATENT NOTICE (below), the
PATENT MARKING NOTICE (below), and the PATENT RIGHTS
GRANT (below).
* Redistributions in binary form must reproduce this COPYING
CONDITIONS NOTICE, the COPYRIGHT NOTICE (below), the
DISCLAIMER (below), the UNIVERSITY PATENT NOTICE (below), the
PATENT MARKING NOTICE (below), and the PATENT RIGHTS
GRANT (below) in the documentation and/or other materials
provided with the distribution.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
COPYRIGHT NOTICE:
TokuDB, Tokutek Fractal Tree Indexing Library.
Copyright (C) 2007-2013 Tokutek, Inc.
DISCLAIMER:
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
UNIVERSITY PATENT NOTICE:
The technology is licensed by the Massachusetts Institute of
Technology, Rutgers State University of New Jersey, and the Research
Foundation of State University of New York at Stony Brook under
United States of America Serial No. 11/760379 and to the patents
and/or patent applications resulting from it.
PATENT MARKING NOTICE:
This software is covered by US Patent No. 8,185,551.
This software is covered by US Patent No. 8,489,638.
PATENT RIGHTS GRANT:
"THIS IMPLEMENTATION" means the copyrightable works distributed by
Tokutek as part of the Fractal Tree project.
"PATENT CLAIMS" means the claims of patents that are owned or
licensable by Tokutek, both currently or in the future; and that in
the absence of this license would be infringed by THIS
IMPLEMENTATION or by using or running THIS IMPLEMENTATION.
"PATENT CHALLENGE" shall mean a challenge to the validity,
patentability, enforceability and/or non-infringement of any of the
PATENT CLAIMS or otherwise opposing any of the PATENT CLAIMS.
Tokutek hereby grants to you, for the term and geographical scope of
the PATENT CLAIMS, a non-exclusive, no-charge, royalty-free,
irrevocable (except as stated in this section) patent license to
make, have made, use, offer to sell, sell, import, transfer, and
otherwise run, modify, and propagate the contents of THIS
IMPLEMENTATION, where such license applies only to the PATENT
CLAIMS. This grant does not include claims that would be infringed
only as a consequence of further modifications of THIS
IMPLEMENTATION. If you or your agent or licensee institute or order
or agree to the institution of patent litigation against any entity
(including a cross-claim or counterclaim in a lawsuit) alleging that
THIS IMPLEMENTATION constitutes direct or contributory patent
infringement, or inducement of patent infringement, then any rights
granted to you under this License shall terminate as of the date
such litigation is filed. If you or your agent or exclusive
licensee institute or order or agree to the institution of a PATENT
CHALLENGE, then Tokutek may terminate any rights granted to you
under this License.
*/
#ident "Copyright (c) 2007-2013 Tokutek Inc. All rights reserved."
#include "test.h"
/* Test for #1426. Make sure deletes and inserts in a FIFO work. */
/* This test is run using a special makefile rule that runs the TDB version and the BDB version, dumps their outputs, and compares them */
#include <db.h>
#include <memory.h>
#include <fcntl.h>
// |DB_INIT_TXN| DB_INIT_LOG | DB_RECOVER
const int envflags = DB_CREATE|DB_INIT_MPOOL|DB_INIT_LOCK |DB_THREAD |DB_PRIVATE;
DB_ENV *env;
DB *db;
DB_TXN * const null_txn = NULL;
static void
empty_cachetable (void)
// Make all the cachetable entries clean.
// Brute force it by closing and reopening everything.
{
int r;
r = db->close(db, 0); CKERR(r);
r = env->close(env, 0); CKERR(r);
r = db_env_create(&env, 0); CKERR(r);
#ifdef TOKUDB
r = env->set_cachesize(env, 0, 10000000, 1); CKERR(r);
#endif
r = env->open(env, TOKU_TEST_FILENAME, envflags, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r = db_create(&db, env, 0); CKERR(r);
r = db->open(db, null_txn, "main", 0, DB_BTREE, 0, 0666); CKERR(r);
}
static void
do_insert_delete_fifo (void)
{
int r;
toku_os_recursive_delete(TOKU_TEST_FILENAME);
toku_os_mkdir(TOKU_TEST_FILENAME, S_IRWXU+S_IRWXG+S_IRWXO);
r = db_env_create(&env, 0); CKERR(r);
#ifdef TOKUDB
r = env->set_cachesize(env, 0, 10000000, 1); CKERR(r);
#endif
r = env->open(env, TOKU_TEST_FILENAME, envflags, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r = db_create(&db, env, 0); CKERR(r);
r = db->set_pagesize(db, 4096); CKERR(r);
r = db->open(db, null_txn, "main", 0, DB_BTREE, DB_CREATE, 0666); CKERR(r);
{
uint64_t i;
uint64_t n_deleted = 0;
uint64_t N=20000; // total number to insert
uint64_t M= 5000; // size of rolling fifo
uint64_t D= 200; // number to delete at once
for (i=0; i<N; i++) {
{
char k[100],v[100];
int keylen = snprintf(k, sizeof k, "%016" PRIu64 "key", i);
uint32_t rand1 = myrandom();
uint32_t rand2 = myrandom();
uint32_t rand3 = myrandom();
int vallen = snprintf(v, sizeof v, "%016" PRIu64 "val%08x%08x%08x", i, rand1, rand2, rand3);
DBT kt, vt;
r = db->put(db, null_txn, dbt_init(&kt, k, keylen) , dbt_init(&vt, v, vallen), 0); CKERR(r);
}
if (i%D==0) {
// Once every D steps, delete everything until there are only M things left.
// Flush the data down the tree for all the values we will do
{
uint64_t peek_here = n_deleted;
while (peek_here + M < i) {
char k[100];
int keylen = snprintf(k, sizeof k, "%016" PRIu64 "key", peek_here);
DBT kt;
DBT vt;
memset(&vt, 0, sizeof(vt));
vt.flags = DB_DBT_MALLOC;
r = db->get(db, null_txn, dbt_init(&kt, k, keylen), &vt, 0); CKERR(r);
peek_here++;
toku_free(vt.data);
}
}
empty_cachetable();
while (n_deleted + M < i) {
char k[100];
int keylen = snprintf(k, sizeof k, "%016" PRIu64 "key", n_deleted);
DBT kt;
r = db->del(db, null_txn, dbt_init(&kt, k, keylen), 0);
if (r!=0) printf("error %d %s", r, db_strerror(r));
CKERR(r);
n_deleted++;
empty_cachetable();
}
}
}
}
r = db->close(db, 0); CKERR(r);
r = env->close(env, 0); CKERR(r);
}
int
test_main (int argc, char *const argv[])
{
parse_args(argc, argv);
do_insert_delete_fifo();
return 0;
}
...@@ -99,10 +99,6 @@ DB_TXN *null_txn=0; ...@@ -99,10 +99,6 @@ DB_TXN *null_txn=0;
static void do_test1753 (int do_create_on_reopen) { static void do_test1753 (int do_create_on_reopen) {
if (IS_TDB==0 && DB_VERSION_MAJOR==4 && DB_VERSION_MINOR<7 && do_create_on_reopen==0) {
return; // do_create_on_reopen==0 segfaults in 4.6
}
int r; int r;
toku_os_recursive_delete(TOKU_TEST_FILENAME); toku_os_recursive_delete(TOKU_TEST_FILENAME);
toku_os_mkdir(TOKU_TEST_FILENAME, S_IRWXU+S_IRWXG+S_IRWXO); toku_os_mkdir(TOKU_TEST_FILENAME, S_IRWXU+S_IRWXG+S_IRWXO);
......
...@@ -137,9 +137,7 @@ setup_db (uint32_t dup_mode) { ...@@ -137,9 +137,7 @@ setup_db (uint32_t dup_mode) {
toku_os_mkdir(TOKU_TEST_FILENAME, S_IRWXU+S_IRWXG+S_IRWXO); toku_os_mkdir(TOKU_TEST_FILENAME, S_IRWXU+S_IRWXG+S_IRWXO);
r = db_env_create(&env, 0); CKERR(r); r = db_env_create(&env, 0); CKERR(r);
#ifdef TOKUDB
r = env->set_default_bt_compare(env, int_dbt_cmp); CKERR(r); r = env->set_default_bt_compare(env, int_dbt_cmp); CKERR(r);
#endif
r = env->open(env, TOKU_TEST_FILENAME, DB_INIT_MPOOL | DB_INIT_LOG | DB_INIT_LOCK | DB_INIT_TXN | DB_PRIVATE | DB_CREATE, S_IRWXU+S_IRWXG+S_IRWXO); r = env->open(env, TOKU_TEST_FILENAME, DB_INIT_MPOOL | DB_INIT_LOG | DB_INIT_LOCK | DB_INIT_TXN | DB_PRIVATE | DB_CREATE, S_IRWXU+S_IRWXG+S_IRWXO);
CKERR(r); CKERR(r);
...@@ -148,9 +146,6 @@ setup_db (uint32_t dup_mode) { ...@@ -148,9 +146,6 @@ setup_db (uint32_t dup_mode) {
r = env->txn_begin(env, 0, &txn, 0); CKERR(r); r = env->txn_begin(env, 0, &txn, 0); CKERR(r);
r = db_create(&db, env, 0); CKERR(r); r = db_create(&db, env, 0); CKERR(r);
#ifndef TOKUDB
r=db->set_bt_compare(db, int_dbt_cmp); CKERR(r);
#endif
r = db->set_flags(db, dup_mode); assert(r == 0); CKERR(r); r = db->set_flags(db, dup_mode); assert(r == 0); CKERR(r);
r = db->open(db, txn, "test.db", 0, DB_BTREE, DB_CREATE, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); r = db->open(db, txn, "test.db", 0, DB_BTREE, DB_CREATE, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r = txn->commit(txn, 0); CKERR(r); r = txn->commit(txn, 0); CKERR(r);
......
...@@ -112,11 +112,7 @@ static DB_ENV *env = NULL; ...@@ -112,11 +112,7 @@ static DB_ENV *env = NULL;
static DB *db; static DB *db;
// BDB cannot handle big transactions by default (runs out of locks). // BDB cannot handle big transactions by default (runs out of locks).
#ifdef TOKUDB
#define N_PER_XACTION 10000 #define N_PER_XACTION 10000
#else
#define N_PER_XACTION 1000
#endif
static void create_db (uint64_t N) { static void create_db (uint64_t N) {
n_rows = N; n_rows = N;
...@@ -124,9 +120,7 @@ static void create_db (uint64_t N) { ...@@ -124,9 +120,7 @@ static void create_db (uint64_t N) {
toku_os_mkdir(TOKU_TEST_FILENAME, S_IRWXU+S_IRWXG+S_IRWXO); toku_os_mkdir(TOKU_TEST_FILENAME, S_IRWXU+S_IRWXG+S_IRWXO);
{ int r = db_env_create(&env, 0); CKERR(r); } { int r = db_env_create(&env, 0); CKERR(r); }
env->set_errfile(env, stderr); env->set_errfile(env, stderr);
#ifdef TOKUDB
env->set_redzone(env, 0); env->set_redzone(env, 0);
#endif
{ int r = env->set_cachesize(env, 0, 400*4096, 1); CKERR(r); } { int r = env->set_cachesize(env, 0, 400*4096, 1); CKERR(r); }
{ int r = env->open(env, TOKU_TEST_FILENAME, envflags, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); } { int r = env->open(env, TOKU_TEST_FILENAME, envflags, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); }
DB_TXN *txn; DB_TXN *txn;
......
...@@ -92,7 +92,7 @@ PATENT RIGHTS GRANT: ...@@ -92,7 +92,7 @@ PATENT RIGHTS GRANT:
const int envflags = DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE|DB_RECOVER; const int envflags = DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE|DB_RECOVER;
const int my_lg_max = IS_TDB ? 100 : (4096*2); const int my_lg_max = 100;
int test_main (int UU(argc), char UU(*const argv[])) { int test_main (int UU(argc), char UU(*const argv[])) {
int r; int r;
......
...@@ -103,9 +103,7 @@ static void clean_env (const char *envdir) { ...@@ -103,9 +103,7 @@ static void clean_env (const char *envdir) {
static void setup_env (DB_ENV **envp, const char *envdir) { static void setup_env (DB_ENV **envp, const char *envdir) {
{ int chk_r = db_env_create(envp, 0); CKERR(chk_r); } { int chk_r = db_env_create(envp, 0); CKERR(chk_r); }
(*envp)->set_errfile(*envp, stderr); (*envp)->set_errfile(*envp, stderr);
#ifdef TOKUDB
{ int chk_r = (*envp)->set_redzone(*envp, 0); CKERR(chk_r); } { int chk_r = (*envp)->set_redzone(*envp, 0); CKERR(chk_r); }
#endif
{ int chk_r = (*envp)->open(*envp, envdir, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE|DB_RECOVER, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(chk_r); } { int chk_r = (*envp)->open(*envp, envdir, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE|DB_RECOVER, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(chk_r); }
} }
......
...@@ -215,9 +215,7 @@ test_main(int argc, char *const argv[]) { ...@@ -215,9 +215,7 @@ test_main(int argc, char *const argv[]) {
DB_TXN *txn; DB_TXN *txn;
{ {
r = db_env_create(&env, 0); CKERR(r); r = db_env_create(&env, 0); CKERR(r);
#ifdef TOKUDB
r = env->set_redzone(env, 0); CKERR(r); r = env->set_redzone(env, 0); CKERR(r);
#endif
r=env->open(env, TOKU_TEST_FILENAME, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); r=env->open(env, TOKU_TEST_FILENAME, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
env->set_errfile(env, stderr); env->set_errfile(env, stderr);
r=env->txn_begin(env, 0, &txn, 0); CKERR(r); r=env->txn_begin(env, 0, &txn, 0); CKERR(r);
......
...@@ -153,9 +153,7 @@ test_main(int argc, char *const argv[]) { ...@@ -153,9 +153,7 @@ test_main(int argc, char *const argv[]) {
DB_TXN *txn; DB_TXN *txn;
{ {
r = db_env_create(&env, 0); CKERR(r); r = db_env_create(&env, 0); CKERR(r);
#ifdef TOKUDB
r = env->set_redzone(env, 0); CKERR(r); r = env->set_redzone(env, 0); CKERR(r);
#endif
r=env->open(env, TOKU_TEST_FILENAME, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); r=env->open(env, TOKU_TEST_FILENAME, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
env->set_errfile(env, stderr); env->set_errfile(env, stderr);
r=env->txn_begin(env, 0, &txn, 0); CKERR(r); r=env->txn_begin(env, 0, &txn, 0); CKERR(r);
......
...@@ -113,20 +113,6 @@ test_db_open_aborts (void) { ...@@ -113,20 +113,6 @@ test_db_open_aborts (void) {
r=db_env_create(&env, 0); assert(r==0); r=db_env_create(&env, 0); assert(r==0);
r=env->open(env, TOKU_TEST_FILENAME, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_PRIVATE|DB_CREATE, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); r=env->open(env, TOKU_TEST_FILENAME, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_PRIVATE|DB_CREATE, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r=db_create(&db, env, 0); CKERR(r); r=db_create(&db, env, 0); CKERR(r);
#if 0
{
DB_TXN *tid;
r=env->txn_begin(env, 0, &tid, 0); assert(r==0);
r=db->open(db, tid, "foo.db", 0, DB_BTREE, DB_CREATE, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r=tid->abort(tid); assert(r==0);
}
{
toku_struct_stat buf;
r=toku_stat(ENVDIR "/foo.db", &buf);
assert(r!=0);
assert(errno==ENOENT);
}
#endif
{ {
DB_TXN *tid; DB_TXN *tid;
r=env->txn_begin(env, 0, &tid, 0); assert(r==0); r=env->txn_begin(env, 0, &tid, 0); assert(r==0);
...@@ -142,7 +128,6 @@ test_db_open_aborts (void) { ...@@ -142,7 +128,6 @@ test_db_open_aborts (void) {
r=tid->abort(tid); assert(r==0); r=tid->abort(tid); assert(r==0);
} }
{ {
#if USE_TDB
{ {
DBT dname; DBT dname;
DBT iname; DBT iname;
...@@ -152,7 +137,6 @@ test_db_open_aborts (void) { ...@@ -152,7 +137,6 @@ test_db_open_aborts (void) {
r = env->get_iname(env, &dname, &iname); r = env->get_iname(env, &dname, &iname);
CKERR2(r, DB_NOTFOUND); CKERR2(r, DB_NOTFOUND);
} }
#endif
toku_struct_stat statbuf; toku_struct_stat statbuf;
char filename[TOKU_PATH_MAX+1]; char filename[TOKU_PATH_MAX+1];
r = toku_stat(toku_path_join(filename, 2, TOKU_TEST_FILENAME, "foo.db"), &statbuf); r = toku_stat(toku_path_join(filename, 2, TOKU_TEST_FILENAME, "foo.db"), &statbuf);
...@@ -209,7 +193,6 @@ test_db_put_aborts (void) { ...@@ -209,7 +193,6 @@ test_db_put_aborts (void) {
// The database should exist // The database should exist
{ {
char *filename; char *filename;
#if USE_TDB
{ {
DBT dname; DBT dname;
DBT iname; DBT iname;
...@@ -221,9 +204,6 @@ test_db_put_aborts (void) { ...@@ -221,9 +204,6 @@ test_db_put_aborts (void) {
CAST_FROM_VOIDP(filename, iname.data); CAST_FROM_VOIDP(filename, iname.data);
assert(filename); assert(filename);
} }
#else
filename = toku_xstrdup("foo.db");
#endif
toku_struct_stat statbuf; toku_struct_stat statbuf;
char fullfile[TOKU_PATH_MAX+1]; char fullfile[TOKU_PATH_MAX+1];
r = toku_stat(toku_path_join(fullfile, 2, TOKU_TEST_FILENAME, filename), &statbuf); r = toku_stat(toku_path_join(fullfile, 2, TOKU_TEST_FILENAME, filename), &statbuf);
......
...@@ -149,13 +149,6 @@ do_test_abort2 (void) { ...@@ -149,13 +149,6 @@ do_test_abort2 (void) {
r=db_create(&db, env, 0); CKERR(r); r=db_create(&db, env, 0); CKERR(r);
r=env->txn_begin(env, 0, &txn, 0); CKERR(r); r=env->txn_begin(env, 0, &txn, 0); CKERR(r);
r=db->open(db, txn, "foo.db", 0, DB_BTREE, 0, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); r=db->open(db, txn, "foo.db", 0, DB_BTREE, 0, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
#ifndef TOKUDB
{
uint32_t ps;
r=db->get_pagesize(db, &ps); CKERR(r);
assert(ps==4096);
}
#endif
r=txn->commit(txn, 0); assert(r==0); r=txn->commit(txn, 0); assert(r==0);
r=env->txn_begin(env, 0, &txn, 0); assert(r==0); r=env->txn_begin(env, 0, &txn, 0); assert(r==0);
......
...@@ -120,11 +120,7 @@ static void op_delete (int i) { ...@@ -120,11 +120,7 @@ static void op_delete (int i) {
int r = db->del(db, txn, int r = db->del(db, txn,
dbt_init(&key, hello, strlen(hello)+1), dbt_init(&key, hello, strlen(hello)+1),
DB_DELETE_ANY); DB_DELETE_ANY);
#ifdef TOKUDB
assert(r==0); assert(r==0);
#else
assert(r==DB_NOTFOUND || r==0);
#endif
} }
static void lookup (int i, int expect, int expectj) { static void lookup (int i, int expect, int expectj) {
......
...@@ -200,7 +200,6 @@ verify_and_tear_down(int close_first) { ...@@ -200,7 +200,6 @@ verify_and_tear_down(int close_first) {
int r; int r;
{ {
char *filename; char *filename;
#if USE_TDB
{ {
DBT dname; DBT dname;
DBT iname; DBT iname;
...@@ -212,9 +211,6 @@ verify_and_tear_down(int close_first) { ...@@ -212,9 +211,6 @@ verify_and_tear_down(int close_first) {
CAST_FROM_VOIDP(filename, iname.data); CAST_FROM_VOIDP(filename, iname.data);
assert(filename); assert(filename);
} }
#else
filename = toku_xstrdup("foo.db");
#endif
toku_struct_stat statbuf; toku_struct_stat statbuf;
char fullfile[TOKU_PATH_MAX+1]; char fullfile[TOKU_PATH_MAX+1];
r = toku_stat(toku_path_join(fullfile, 2, TOKU_TEST_FILENAME, filename), &statbuf); r = toku_stat(toku_path_join(fullfile, 2, TOKU_TEST_FILENAME, filename), &statbuf);
......
...@@ -231,7 +231,6 @@ verify_and_tear_down(int close_first) { ...@@ -231,7 +231,6 @@ verify_and_tear_down(int close_first) {
int r; int r;
{ {
char *filename; char *filename;
#if USE_TDB
{ {
DBT dname; DBT dname;
DBT iname; DBT iname;
...@@ -243,9 +242,6 @@ verify_and_tear_down(int close_first) { ...@@ -243,9 +242,6 @@ verify_and_tear_down(int close_first) {
CAST_FROM_VOIDP(filename, iname.data); CAST_FROM_VOIDP(filename, iname.data);
assert(filename); assert(filename);
} }
#else
filename = toku_xstrdup("foo.db");
#endif
toku_struct_stat statbuf; toku_struct_stat statbuf;
char fullfile[TOKU_PATH_MAX+1]; char fullfile[TOKU_PATH_MAX+1];
r = toku_stat(toku_path_join(fullfile, 2, TOKU_TEST_FILENAME, filename), &statbuf); r = toku_stat(toku_path_join(fullfile, 2, TOKU_TEST_FILENAME, filename), &statbuf);
......
...@@ -205,13 +205,12 @@ do_abort_delete_first_or_last(int N, ...@@ -205,13 +205,12 @@ do_abort_delete_first_or_last(int N,
r=db->close(db, 0); CKERR(r); r=db->close(db, 0); CKERR(r);
r=env->close(env, 0); CKERR(r); r=env->close(env, 0); CKERR(r);
#if defined(TOKUDB) && defined(__unix__)
// Oh man, this is gross. // Oh man, this is gross.
char cmd[sizeof("../../tools/tokudb_dump -h foo.db >") + 2 * TOKU_PATH_MAX]; char cmd[sizeof("../../tools/tokudb_dump -h foo.db >") + 2 * TOKU_PATH_MAX];
snprintf(cmd, sizeof(cmd), "../../tools/tokudb_dump -h %s foo.db > %s", TOKU_TEST_FILENAME, DEV_NULL_FILE); snprintf(cmd, sizeof(cmd), "../../tools/tokudb_dump -h %s foo.db > %s", TOKU_TEST_FILENAME, DEV_NULL_FILE);
r=system(cmd); r=system(cmd);
CKERR(r); CKERR(r);
#endif
} }
int int
......
...@@ -135,14 +135,7 @@ test_main (int argc, char *const argv[]) { ...@@ -135,14 +135,7 @@ test_main (int argc, char *const argv[]) {
CKERR(r); CKERR(r);
//this test no longer produces a list with any entries for TDB //this test no longer produces a list with any entries for TDB
// - txn_checkpoint trims unused logfiles // - txn_checkpoint trims unused logfiles
#if IS_TDB
assert(list == 0); assert(list == 0);
#else
assert(list);
assert(list[0]);
if (verbose) printf("file[0]=%s\n", list[0]);
toku_free(list);
#endif
} }
r=db->close(db, 0); CKERR(r); r=db->close(db, 0); CKERR(r);
......
...@@ -112,11 +112,7 @@ static void insert(DB *db, DB_TXN *txn, int k, int val_size) { ...@@ -112,11 +112,7 @@ static void insert(DB *db, DB_TXN *txn, int k, int val_size) {
} }
int test_main(int argc, char * const argv[]) { int test_main(int argc, char * const argv[]) {
#if defined(TOKUDB)
const char *db_env_dir = "dir.blobs.leafsplit.env.tdb"; const char *db_env_dir = "dir.blobs.leafsplit.env.tdb";
#else
const char *db_env_dir = "dir.blobs.leafsplit.env.bdb";
#endif
int db_env_open_flags = DB_CREATE | DB_PRIVATE | DB_INIT_MPOOL | DB_INIT_TXN | DB_INIT_LOCK | DB_INIT_LOG; int db_env_open_flags = DB_CREATE | DB_PRIVATE | DB_INIT_MPOOL | DB_INIT_TXN | DB_INIT_LOCK | DB_INIT_LOG;
const char *db_filename = "blobs.db"; const char *db_filename = "blobs.db";
int do_txn = 1; int do_txn = 1;
......
...@@ -101,10 +101,6 @@ PATENT RIGHTS GRANT: ...@@ -101,10 +101,6 @@ PATENT RIGHTS GRANT:
static uint64_t static uint64_t
size_from (uint32_t gbytes, uint32_t bytes) { size_from (uint32_t gbytes, uint32_t bytes) {
#ifdef USE_BDB
if (sizeof (intptr_t) == 4 && gbytes == 4 && bytes == 0)
return 0xffffffff;
#endif
return ((uint64_t)gbytes << 30) + bytes; return ((uint64_t)gbytes << 30) + bytes;
} }
...@@ -119,11 +115,6 @@ expect_le (uint64_t a, uint32_t gbytes, uint32_t bytes) { ...@@ -119,11 +115,6 @@ expect_le (uint64_t a, uint32_t gbytes, uint32_t bytes) {
uint64_t b = size_from(gbytes, bytes); uint64_t b = size_from(gbytes, bytes);
if (a != b && verbose) if (a != b && verbose)
printf("WARNING: expect %" PRIu64 " got %" PRIu64 "\n", a, b); printf("WARNING: expect %" PRIu64 " got %" PRIu64 "\n", a, b);
#ifdef USE_BDB
if (a > b) {
assert(a == 4ULL<<30 && b == a-1); return;
}
#endif
assert(a <= b); assert(a <= b);
} }
......
...@@ -125,7 +125,7 @@ test_cursor_delete2 (void) { ...@@ -125,7 +125,7 @@ test_cursor_delete2 (void) {
r = txn->commit(txn, 0); CKERR(r); r = txn->commit(txn, 0); CKERR(r);
r = dbenv->txn_begin(dbenv, 0, &txn, 0); CKERR(r); r = dbenv->txn_begin(dbenv, 0, &txn, 0); CKERR(r);
r = db->del(db, txn, dbt_init(&key, "a", 2), DB_DELETE_ANY); CKERR_depending(r,0,DB_NOTFOUND); r = db->del(db, txn, dbt_init(&key, "a", 2), DB_DELETE_ANY); CKERR(r);
r = txn->commit(txn, 0); CKERR(r); r = txn->commit(txn, 0); CKERR(r);
r = dbenv->txn_begin(dbenv, 0, &txn, 0); CKERR(r); r = dbenv->txn_begin(dbenv, 0, &txn, 0); CKERR(r);
...@@ -139,7 +139,7 @@ test_cursor_delete2 (void) { ...@@ -139,7 +139,7 @@ test_cursor_delete2 (void) {
r = dbenv->txn_begin(dbenv, 0, &txn, 0); CKERR(r); r = dbenv->txn_begin(dbenv, 0, &txn, 0); CKERR(r);
r = db->del(db, txn, dbt_init(&key, "a", 2), 0); CKERR(r); r = db->del(db, txn, dbt_init(&key, "a", 2), 0); CKERR(r);
r = db->del(db, txn, dbt_init(&key, "a", 2), DB_DELETE_ANY); CKERR_depending(r,0,DB_NOTFOUND); r = db->del(db, txn, dbt_init(&key, "a", 2), DB_DELETE_ANY); CKERR(r);
r = txn->commit(txn, 0); CKERR(r); r = txn->commit(txn, 0); CKERR(r);
r = db->close(db, 0); CKERR(r); r = db->close(db, 0); CKERR(r);
......
...@@ -223,14 +223,12 @@ test_main(int argc, char *const argv[]) { ...@@ -223,14 +223,12 @@ test_main(int argc, char *const argv[]) {
assert(!was_truncated); assert(!was_truncated);
bool ulen_should_change = false; bool ulen_should_change = false;
#if defined(USE_TDB)
if (flags[j] == DB_DBT_REALLOC) { if (flags[j] == DB_DBT_REALLOC) {
ulen_should_change = (bool)(old_ulen < sizeof(DATA)); ulen_should_change = (bool)(old_ulen < sizeof(DATA));
} }
else if (flags[j] == DB_DBT_MALLOC) { else if (flags[j] == DB_DBT_MALLOC) {
ulen_should_change = (bool)(old_ulen != sizeof(DATA)*2); ulen_should_change = (bool)(old_ulen != sizeof(DATA)*2);
} }
#endif
assert(ulen_should_change == (bool)ulen_changed); assert(ulen_should_change == (bool)ulen_changed);
assert(size_full); assert(size_full);
assert(doclone == !small_buffer); assert(doclone == !small_buffer);
......
...@@ -136,9 +136,7 @@ test_db_delete (int n, int dup_mode) { ...@@ -136,9 +136,7 @@ test_db_delete (int n, int dup_mode) {
/* create the dup database file */ /* create the dup database file */
DB_ENV *env; DB_ENV *env;
r = db_env_create(&env, 0); assert(r == 0); r = db_env_create(&env, 0); assert(r == 0);
#ifdef TOKUDB
r = env->set_redzone(env, 0); assert(r == 0); r = env->set_redzone(env, 0); assert(r == 0);
#endif
r = env->open(env, TOKU_TEST_FILENAME, DB_CREATE+DB_PRIVATE+DB_INIT_MPOOL, 0); assert(r == 0); r = env->open(env, TOKU_TEST_FILENAME, DB_CREATE+DB_PRIVATE+DB_INIT_MPOOL, 0); assert(r == 0);
DB *db; DB *db;
...@@ -179,16 +177,7 @@ test_db_delete (int n, int dup_mode) { ...@@ -179,16 +177,7 @@ test_db_delete (int n, int dup_mode) {
} }
expect_db_del(db, htonl(n), 0, DB_NOTFOUND); expect_db_del(db, htonl(n), 0, DB_NOTFOUND);
#if defined(USE_TDB)
expect_db_del(db, htonl(n), DB_DELETE_ANY, 0); expect_db_del(db, htonl(n), DB_DELETE_ANY, 0);
#endif
#if defined(USE_BDB) && defined(DB_DELETE_ANY)
#if DB_DELETE_ANY == 0
expect_db_del(db, htonl(n), DB_DELETE_ANY, DB_NOTFOUND);
#else
expect_db_del(db, htonl(n), DB_DELETE_ANY, EINVAL);
#endif
#endif
r = db->close(db, 0); assert(r == 0); r = db->close(db, 0); assert(r == 0);
r = env->close(env, 0); assert(r == 0); r = env->close(env, 0); assert(r == 0);
...@@ -208,9 +197,7 @@ test_db_get_datasize0 (void) { ...@@ -208,9 +197,7 @@ test_db_get_datasize0 (void) {
/* create the dup database file */ /* create the dup database file */
DB_ENV *env; DB_ENV *env;
r = db_env_create(&env, 0); assert(r == 0); r = db_env_create(&env, 0); assert(r == 0);
#ifdef TOKUDB
r = env->set_redzone(env, 0); assert(r == 0); r = env->set_redzone(env, 0); assert(r == 0);
#endif
r = env->open(env, TOKU_TEST_FILENAME, DB_CREATE+DB_PRIVATE+DB_INIT_MPOOL, 0); assert(r == 0); r = env->open(env, TOKU_TEST_FILENAME, DB_CREATE+DB_PRIVATE+DB_INIT_MPOOL, 0); assert(r == 0);
DB *db; DB *db;
......
...@@ -117,11 +117,7 @@ test_main(int argc, char *const argv[]) { ...@@ -117,11 +117,7 @@ test_main(int argc, char *const argv[]) {
int do_private; int do_private;
for (do_private=0; do_private<2; do_private++) { for (do_private=0; do_private<2; do_private++) {
#ifdef USE_TDB
if (do_private==0) continue; // See #208. if (do_private==0) continue; // See #208.
#else
if (do_private==1) continue; // See #530. BDB 4.6.21 segfaults if DB_PRIVATE is passed when no environment previously exists.
#endif
int private_flags = do_private ? (DB_CREATE|DB_PRIVATE) : 0; int private_flags = do_private ? (DB_CREATE|DB_PRIVATE) : 0;
toku_os_recursive_delete(TOKU_TEST_FILENAME); toku_os_recursive_delete(TOKU_TEST_FILENAME);
...@@ -136,37 +132,12 @@ test_main(int argc, char *const argv[]) { ...@@ -136,37 +132,12 @@ test_main(int argc, char *const argv[]) {
r = db_env_create(&dbenv, 0); r = db_env_create(&dbenv, 0);
CKERR(r); CKERR(r);
r = dbenv->open(dbenv, TOKU_TEST_FILENAME, private_flags|DB_INIT_MPOOL, 0); r = dbenv->open(dbenv, TOKU_TEST_FILENAME, private_flags|DB_INIT_MPOOL, 0);
#ifdef USE_TDB
// TokuDB has no trouble opening an environment if the directory exists. // TokuDB has no trouble opening an environment if the directory exists.
CKERR(r); CKERR(r);
assert(r==0); assert(r==0);
#else
if (r!=ENOENT) printf("%s:%d %d: %s\n", __FILE__, __LINE__, r,db_strerror(r));
assert(r==ENOENT);
#endif
dbenv->close(dbenv,0); // free memory dbenv->close(dbenv,0); // free memory
} }
#ifndef USE_TDB
// Now make sure that if we have a non-private DB that we can tell if it opened or not.
DB *db;
toku_os_recursive_delete(TOKU_TEST_FILENAME);
toku_os_mkdir(TOKU_TEST_FILENAME, S_IRWXU+S_IRWXG+S_IRWXO);
r = db_env_create(&dbenv, 0);
CKERR(r);
r = dbenv->open(dbenv, TOKU_TEST_FILENAME, DB_CREATE|DB_INIT_MPOOL, 0);
CKERR(r);
r=db_create(&db, dbenv, 0);
CKERR(r);
db->close(db, 0);
dbenv->close(dbenv,0); // free memory
r = db_env_create(&dbenv, 0);
CKERR(r);
r = dbenv->open(dbenv, TOKU_TEST_FILENAME, DB_INIT_MPOOL, 0);
CKERR(r);
dbenv->close(dbenv,0); // free memory
#endif
return 0; return 0;
} }
...@@ -117,18 +117,7 @@ test_main(int argc, char*const* argv) { ...@@ -117,18 +117,7 @@ test_main(int argc, char*const* argv) {
r = dbenv->open(dbenv, TOKU_TEST_FILENAME, DB_CREATE|DB_INIT_MPOOL|DB_PRIVATE, 0666); r = dbenv->open(dbenv, TOKU_TEST_FILENAME, DB_CREATE|DB_INIT_MPOOL|DB_PRIVATE, 0666);
if (verbose) printf("r=%d\n", r); if (verbose) printf("r=%d\n", r);
#ifdef USE_TDB
assert(r == EINVAL); assert(r == EINVAL);
#elif USE_BDB
#if DB_VERSION_MAJOR >= 5
assert(r == EINVAL);
#else
if (verbose) printf("test_db_env_open_open_close.bdb skipped. (BDB apparently does not follow the spec).\n");
assert(r == 0);
#endif
#else
#error
#endif
r = dbenv->close(dbenv, 0); r = dbenv->close(dbenv, 0);
assert(r == 0); assert(r == 0);
......
...@@ -121,13 +121,8 @@ test_main(int argc, char *const argv[]) { ...@@ -121,13 +121,8 @@ test_main(int argc, char *const argv[]) {
r = dbenv->open(dbenv, TOKU_TEST_FILENAME, DB_INIT_TXN|DB_INIT_LOG|DB_CREATE|DB_PRIVATE|DB_INIT_MPOOL, 0); r = dbenv->open(dbenv, TOKU_TEST_FILENAME, DB_INIT_TXN|DB_INIT_LOG|DB_CREATE|DB_PRIVATE|DB_INIT_MPOOL, 0);
CKERR(r); CKERR(r);
#ifdef USE_TDB
// According to the BDB man page, you may not call set_lg_dir after doing the open.
// Some versions of BDB don't actually check this or complain
r = dbenv->set_lg_dir(dbenv, "."); r = dbenv->set_lg_dir(dbenv, ".");
assert(r == EINVAL); assert(r == EINVAL);
#endif
r = dbenv->close(dbenv, 0); r = dbenv->close(dbenv, 0);
assert(r == 0); assert(r == 0);
......
...@@ -121,13 +121,8 @@ test_main(int argc, char *const argv[]) { ...@@ -121,13 +121,8 @@ test_main(int argc, char *const argv[]) {
r = dbenv->open(dbenv, TOKU_TEST_FILENAME, DB_CREATE|DB_PRIVATE|DB_INIT_MPOOL, 0); r = dbenv->open(dbenv, TOKU_TEST_FILENAME, DB_CREATE|DB_PRIVATE|DB_INIT_MPOOL, 0);
CKERR(r); CKERR(r);
#ifdef USE_TDB
// According to the BDB man page, you may not call set_tmp_dir after doing the open.
// Some versions of BDB don't actually check this or complain
r = dbenv->set_tmp_dir(dbenv, "."); r = dbenv->set_tmp_dir(dbenv, ".");
assert(r == EINVAL); assert(r == EINVAL);
#endif
r = dbenv->close(dbenv, 0); r = dbenv->close(dbenv, 0);
assert(r == 0); assert(r == 0);
......
...@@ -108,13 +108,10 @@ test_main (int UU(argc), char UU(*const argv[])) { ...@@ -108,13 +108,10 @@ test_main (int UU(argc), char UU(*const argv[])) {
toku_os_recursive_delete(TOKU_TEST_FILENAME); toku_os_recursive_delete(TOKU_TEST_FILENAME);
r=toku_os_mkdir(TOKU_TEST_FILENAME, S_IRWXU+S_IRWXG+S_IRWXO); assert(r==0); r=toku_os_mkdir(TOKU_TEST_FILENAME, S_IRWXU+S_IRWXG+S_IRWXO); assert(r==0);
r=db_env_create(&env, 0); assert(r==0); r=db_env_create(&env, 0); assert(r==0);
// None of this stuff works with BDB. TDB does more error checking.
#ifdef USE_TDB
r=env->set_data_dir(env, NULL); assert(r==EINVAL); r=env->set_data_dir(env, NULL); assert(r==EINVAL);
r=env->open(env, TOKU_TEST_FILENAME, DB_CREATE|DB_PRIVATE, S_IRWXU+S_IRWXG+S_IRWXO); assert(r==0); r=env->open(env, TOKU_TEST_FILENAME, DB_CREATE|DB_PRIVATE, S_IRWXU+S_IRWXG+S_IRWXO); assert(r==0);
env->set_errpfx(env, NULL); assert(1); //Did not crash. env->set_errpfx(env, NULL); assert(1); //Did not crash.
r=env->set_tmp_dir(env, NULL); assert(r==EINVAL); r=env->set_tmp_dir(env, NULL); assert(r==EINVAL);
#endif
r=env->close(env, 0); assert(r==0); r=env->close(env, 0); assert(r==0);
return 0; return 0;
} }
......
...@@ -136,9 +136,7 @@ setup (uint32_t flags) { ...@@ -136,9 +136,7 @@ setup (uint32_t flags) {
toku_os_mkdir(TOKU_TEST_FILENAME, S_IRWXU+S_IRWXG+S_IRWXO); toku_os_mkdir(TOKU_TEST_FILENAME, S_IRWXU+S_IRWXG+S_IRWXO);
/* Open/create primary */ /* Open/create primary */
r = db_env_create(&dbenv, 0); assert(r == 0); r = db_env_create(&dbenv, 0); assert(r == 0);
#ifdef USE_TDB
r = dbenv->set_redzone(dbenv, 0); CKERR(r); r = dbenv->set_redzone(dbenv, 0); CKERR(r);
#endif
r = dbenv->open(dbenv, TOKU_TEST_FILENAME, DB_CREATE+DB_PRIVATE+DB_INIT_MPOOL, 0); assert(r == 0); r = dbenv->open(dbenv, TOKU_TEST_FILENAME, DB_CREATE+DB_PRIVATE+DB_INIT_MPOOL, 0); assert(r == 0);
r = db_create(&dbp, dbenv, 0); CKERR(r); r = db_create(&dbp, dbenv, 0); CKERR(r);
dbp->set_errfile(dbp,0); // Turn off those annoying errors dbp->set_errfile(dbp,0); // Turn off those annoying errors
...@@ -182,13 +180,6 @@ get_bad_flags (DB* db, uint32_t flags, int r_expect, int keyint, int dataint) { ...@@ -182,13 +180,6 @@ get_bad_flags (DB* db, uint32_t flags, int r_expect, int keyint, int dataint) {
assert(*(int*)data.data == dataint); assert(*(int*)data.data == dataint);
} }
#ifdef USE_TDB
#define EINVAL_FOR_TDB_OK_FOR_BDB EINVAL
#else
#define EINVAL_FOR_TDB_OK_FOR_BDB 0
#endif
PUT_TEST put_tests[] = { PUT_TEST put_tests[] = {
{0, DB_NODUPDATA, EINVAL, 0, 0}, //r_expect must change to 0, once implemented. {0, DB_NODUPDATA, EINVAL, 0, 0}, //r_expect must change to 0, once implemented.
{0, 0, 0, 0, 0}, {0, 0, 0, 0, 0},
......
...@@ -114,11 +114,7 @@ static void test_db_remove (void) { ...@@ -114,11 +114,7 @@ static void test_db_remove (void) {
// Now remove it, while it is open. // Now remove it, while it is open.
r = env->dbremove(env, NULL, fname, 0, 0); r = env->dbremove(env, NULL, fname, 0, 0);
#ifdef USE_TDB
assert(r!=0); assert(r!=0);
#else
assert(r==0);
#endif
r = db1->close(db1, 0); assert(r==0); r = db1->close(db1, 0); assert(r==0);
r = env->close(env, 0); assert(r == 0); r = env->close(env, 0); assert(r == 0);
......
...@@ -236,10 +236,8 @@ setup_dbs (void) { ...@@ -236,10 +236,8 @@ setup_dbs (void) {
/* Open/create primary */ /* Open/create primary */
r = db_env_create(&dbenv, 0); r = db_env_create(&dbenv, 0);
CKERR(r); CKERR(r);
#ifdef TOKUDB
r = dbenv->set_default_bt_compare(dbenv, int_dbt_cmp); r = dbenv->set_default_bt_compare(dbenv, int_dbt_cmp);
CKERR(r); CKERR(r);
#endif
uint32_t env_txn_flags = DB_INIT_TXN | DB_INIT_LOCK; uint32_t env_txn_flags = DB_INIT_TXN | DB_INIT_LOCK;
uint32_t env_open_flags = DB_CREATE | DB_PRIVATE | DB_INIT_MPOOL; uint32_t env_open_flags = DB_CREATE | DB_PRIVATE | DB_INIT_MPOOL;
r = dbenv->open(dbenv, TOKU_TEST_FILENAME, env_open_flags | env_txn_flags, 0600); r = dbenv->open(dbenv, TOKU_TEST_FILENAME, env_open_flags | env_txn_flags, 0600);
...@@ -247,10 +245,6 @@ setup_dbs (void) { ...@@ -247,10 +245,6 @@ setup_dbs (void) {
r = db_create(&db, dbenv, 0); r = db_create(&db, dbenv, 0);
CKERR(r); CKERR(r);
#ifndef TOKUDB
r = db->set_bt_compare( db, int_dbt_cmp);
CKERR(r);
#endif
char a; char a;
for (a = 'a'; a <= 'z'; a++) init_txn(a); for (a = 'a'; a <= 'z'; a++) init_txn(a);
...@@ -665,16 +659,6 @@ test (void) { ...@@ -665,16 +659,6 @@ test (void) {
int int
test_main(int argc, char *const argv[]) { test_main(int argc, char *const argv[]) {
parse_args(argc, argv); parse_args(argc, argv);
if (!IS_TDB) { test();
if (verbose) {
printf("Warning: " __FILE__" does not work in BDB.\n");
}
} else {
test();
/*
test_abort(0);
test_abort(DB_DUP | DB_DUPSORT);
*/
}
return 0; return 0;
} }
...@@ -178,10 +178,8 @@ setup_dbs (void) { ...@@ -178,10 +178,8 @@ setup_dbs (void) {
/* Open/create primary */ /* Open/create primary */
r = db_env_create(&dbenv, 0); r = db_env_create(&dbenv, 0);
CKERR(r); CKERR(r);
#ifdef TOKUDB
r = dbenv->set_default_bt_compare(dbenv, int_dbt_cmp); r = dbenv->set_default_bt_compare(dbenv, int_dbt_cmp);
CKERR(r); CKERR(r);
#endif
uint32_t env_txn_flags = DB_INIT_TXN | DB_INIT_LOCK; uint32_t env_txn_flags = DB_INIT_TXN | DB_INIT_LOCK;
uint32_t env_open_flags = DB_CREATE | DB_PRIVATE | DB_INIT_MPOOL; uint32_t env_open_flags = DB_CREATE | DB_PRIVATE | DB_INIT_MPOOL;
r = dbenv->open(dbenv, TOKU_TEST_FILENAME, env_open_flags | env_txn_flags, 0600); r = dbenv->open(dbenv, TOKU_TEST_FILENAME, env_open_flags | env_txn_flags, 0600);
...@@ -189,10 +187,6 @@ setup_dbs (void) { ...@@ -189,10 +187,6 @@ setup_dbs (void) {
r = db_create(&db, dbenv, 0); r = db_create(&db, dbenv, 0);
CKERR(r); CKERR(r);
#ifndef TOKUDB
r = db->set_bt_compare( db, int_dbt_cmp);
CKERR(r);
#endif
char a; char a;
for (a = 'a'; a <= 'z'; a++) init_txn(a, 0); for (a = 'a'; a <= 'z'; a++) init_txn(a, 0);
...@@ -256,28 +250,9 @@ table_scan(char txn, bool success) { ...@@ -256,28 +250,9 @@ table_scan(char txn, bool success) {
static void static void
table_prelock(char txn, bool success) { table_prelock(char txn, bool success) {
int r; int r;
#if defined USE_TDB && USE_TDB
r = db->pre_acquire_table_lock(db, txns[(int)txn]); r = db->pre_acquire_table_lock(db, txns[(int)txn]);
if (success) CKERR(r); if (success) CKERR(r);
else CKERR2s(r, DB_LOCK_NOTGRANTED, DB_LOCK_DEADLOCK); else CKERR2s(r, DB_LOCK_NOTGRANTED, DB_LOCK_DEADLOCK);
#else
DBT key;
DBT data;
assert(txns[(int)txn] && cursors[(int)txn]);
r = cursors[(int)txn]->c_get(cursors[(int)txn],
dbt_init(&key, 0, 0),
dbt_init(&data, 0, 0),
DB_FIRST | DB_RMW);
while (r==0) {
r = cursors[(int)txn]->c_get(cursors[(int)txn],
dbt_init(&key, 0, 0),
dbt_init(&data, 0, 0),
DB_NEXT | DB_RMW);
}
if (success) CKERR2(r, DB_NOTFOUND);
else CKERR2s(r, DB_LOCK_NOTGRANTED, DB_LOCK_DEADLOCK);
#endif
} }
static void static void
......
...@@ -114,12 +114,7 @@ test_main (int argc __attribute__((__unused__)), char *const argv[] __attribute ...@@ -114,12 +114,7 @@ test_main (int argc __attribute__((__unused__)), char *const argv[] __attribute
r=db_env_create(&env, 0); assert(r==0); r=db_env_create(&env, 0); assert(r==0);
env->set_errfile(env,0); // Turn off those annoying errors env->set_errfile(env,0); // Turn off those annoying errors
r=env->close (env, 1); r=env->close (env, 1);
//BDB does not check this in some versions
#if defined(USE_TDB) || (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 3)
assert(r==EINVAL); assert(r==EINVAL);
#else
assert(r==0);
#endif
toku_os_recursive_delete(TOKU_TEST_FILENAME); toku_os_recursive_delete(TOKU_TEST_FILENAME);
r=toku_os_mkdir(TOKU_TEST_FILENAME, S_IRWXU+S_IRWXG+S_IRWXO); assert(r==0); r=toku_os_mkdir(TOKU_TEST_FILENAME, S_IRWXU+S_IRWXG+S_IRWXO); assert(r==0);
...@@ -135,11 +130,6 @@ test_main (int argc __attribute__((__unused__)), char *const argv[] __attribute ...@@ -135,11 +130,6 @@ test_main (int argc __attribute__((__unused__)), char *const argv[] __attribute
env->set_errfile(env,0); // Turn off those annoying errors env->set_errfile(env,0); // Turn off those annoying errors
r=env->open(env, TOKU_TEST_FILENAME, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_PRIVATE|DB_CREATE, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); r=env->open(env, TOKU_TEST_FILENAME, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_PRIVATE|DB_CREATE, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r=env->close (env, 1); r=env->close (env, 1);
//BDB does not check this.
#if defined(USE_TDB) || (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 3)
assert(r==EINVAL); assert(r==EINVAL);
#else
assert(r==0);
#endif
return 0; return 0;
} }
...@@ -104,13 +104,7 @@ test_main (int UU(argc), char UU(*const argv[])) { ...@@ -104,13 +104,7 @@ test_main (int UU(argc), char UU(*const argv[])) {
r = db_env_create(&env, 0); r = db_env_create(&env, 0);
assert(r == 0); assert(r == 0);
r = db_create(&db, env, 0); r = db_create(&db, env, 0);
// BDB doesnt' actually barf on this case.
#ifdef USE_TDB
assert(r != 0); assert(r != 0);
#else
r = db->close(db, 0);
assert(r == 0);
#endif
r = env->close(env, 0); r = env->close(env, 0);
assert(r == 0); assert(r == 0);
return 0; return 0;
......
...@@ -125,25 +125,19 @@ test_main(int argc, char *const argv[]) { ...@@ -125,25 +125,19 @@ test_main(int argc, char *const argv[]) {
toku_os_recursive_delete(TOKU_TEST_FILENAME); toku_os_recursive_delete(TOKU_TEST_FILENAME);
toku_os_mkdir(TOKU_TEST_FILENAME, S_IRWXU+S_IRWXG+S_IRWXO); toku_os_mkdir(TOKU_TEST_FILENAME, S_IRWXU+S_IRWXG+S_IRWXO);
#ifdef USE_TDB
char tracefile[TOKU_PATH_MAX+1]; char tracefile[TOKU_PATH_MAX+1];
toku_set_trace_file(toku_path_join(tracefile, 2, TOKU_TEST_FILENAME, "trace.tktrace")); toku_set_trace_file(toku_path_join(tracefile, 2, TOKU_TEST_FILENAME, "trace.tktrace"));
#endif
/* test flags */ /* test flags */
test_env_open_flags(0, ENOENT); test_env_open_flags(0, ENOENT);
#ifdef TOKUDB
// This one segfaults in BDB 4.6.21 // This one segfaults in BDB 4.6.21
test_env_open_flags(DB_PRIVATE, ENOENT); test_env_open_flags(DB_PRIVATE, ENOENT);
#endif
test_env_open_flags(DB_PRIVATE+DB_CREATE, 0); test_env_open_flags(DB_PRIVATE+DB_CREATE, 0);
test_env_open_flags(DB_PRIVATE+DB_CREATE+DB_INIT_MPOOL, 0); test_env_open_flags(DB_PRIVATE+DB_CREATE+DB_INIT_MPOOL, 0);
test_env_open_flags(DB_PRIVATE+DB_RECOVER, EINVAL); test_env_open_flags(DB_PRIVATE+DB_RECOVER, EINVAL);
test_env_open_flags(DB_PRIVATE+DB_CREATE+DB_INIT_MPOOL+DB_RECOVER, EINVAL); test_env_open_flags(DB_PRIVATE+DB_CREATE+DB_INIT_MPOOL+DB_RECOVER, EINVAL);
#ifdef USE_TDB
toku_close_trace_file(); toku_close_trace_file();
#endif
return 0; return 0;
} }
...@@ -101,12 +101,7 @@ DB_ENV *env; ...@@ -101,12 +101,7 @@ DB_ENV *env;
DB *db; DB *db;
int do_sync=1; int do_sync=1;
#ifdef TOKUDB
#define NITER 100 #define NITER 100
#else
// BDB is slow. Reduce the work.
#define NITER 25
#endif
static void *start_a_thread (void *i_p) { static void *start_a_thread (void *i_p) {
int *CAST_FROM_VOIDP(which_thread_p, i_p); int *CAST_FROM_VOIDP(which_thread_p, i_p);
...@@ -214,12 +209,7 @@ do_test (int N) { ...@@ -214,12 +209,7 @@ do_test (int N) {
} }
} }
#ifdef TOKUDB
int log_max_n_threads_over_10 = 3; int log_max_n_threads_over_10 = 3;
#else
// BDB is slow. Reduce the work.
int log_max_n_threads_over_10 = 2;
#endif
static void static void
my_parse_args (int argc, char *const argv[]) { my_parse_args (int argc, char *const argv[]) {
...@@ -267,9 +257,7 @@ test_main (int argc, char *const argv[]) { ...@@ -267,9 +257,7 @@ test_main (int argc, char *const argv[]) {
prev_count=0; prev_count=0;
db_env_set_func_fsync(do_fsync); db_env_set_func_fsync(do_fsync);
#if TOKUDB
db_env_set_num_bucket_mutexes(32); db_env_set_num_bucket_mutexes(32);
#endif
toku_os_recursive_delete(env_path); toku_os_recursive_delete(env_path);
{ int r=toku_os_mkdir(env_path, S_IRWXU+S_IRWXG+S_IRWXO); assert(r==0); } { int r=toku_os_mkdir(env_path, S_IRWXU+S_IRWXG+S_IRWXO); assert(r==0); }
......
...@@ -123,7 +123,6 @@ static void make_db (bool close_env) { ...@@ -123,7 +123,6 @@ static void make_db (bool close_env) {
CKERR(r); CKERR(r);
} }
char *filename; char *filename;
#if USE_TDB
{ {
DBT dname; DBT dname;
DBT iname; DBT iname;
...@@ -135,10 +134,6 @@ static void make_db (bool close_env) { ...@@ -135,10 +134,6 @@ static void make_db (bool close_env) {
CAST_FROM_VOIDP(filename, iname.data); CAST_FROM_VOIDP(filename, iname.data);
assert(filename); assert(filename);
} }
#else
filename = toku_xstrdup("foo.db");
#endif
r=tid->commit(tid, 0); assert(r==0); r=tid->commit(tid, 0); assert(r==0);
r=db->close(db, 0); assert(r==0); r=db->close(db, 0); assert(r==0);
......
...@@ -120,9 +120,7 @@ static void insert_some (int outeri, bool close_env) { ...@@ -120,9 +120,7 @@ static void insert_some (int outeri, bool close_env) {
DB *db; DB *db;
DB_TXN *tid; DB_TXN *tid;
r=db_env_create(&env, 0); assert(r==0); r=db_env_create(&env, 0); assert(r==0);
#if IS_TDB
db_env_enable_engine_status(0); // disable engine status on crash because test is expected to fail db_env_enable_engine_status(0); // disable engine status on crash because test is expected to fail
#endif
r=env->open(env, TOKU_TEST_FILENAME, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE|create_flag, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); r=env->open(env, TOKU_TEST_FILENAME, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE|create_flag, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r=db_create(&db, env, 0); CKERR(r); r=db_create(&db, env, 0); CKERR(r);
...@@ -148,13 +146,6 @@ static void insert_some (int outeri, bool close_env) { ...@@ -148,13 +146,6 @@ static void insert_some (int outeri, bool close_env) {
key.data = hello; key.size=strlen(hello)+1; key.data = hello; key.size=strlen(hello)+1;
data.data = there; data.size=strlen(there)+1; data.data = there; data.size=strlen(there)+1;
r=db->put(db, tid, &key, &data, 0); CKERR(r); r=db->put(db, tid, &key, &data, 0); CKERR(r);
#ifndef TOKUDB
// BDB cannot handle such a big txn.
if (i%1000==999) {
r=tid->commit(tid, 0); assert(r==0);
r=env->txn_begin(env, 0, &tid, 0); assert(r==0);
}
#endif
} }
r=tid->commit(tid, 0); assert(r==0); r=tid->commit(tid, 0); assert(r==0);
r=db->close(db, 0); assert(r==0); r=db->close(db, 0); assert(r==0);
...@@ -173,9 +164,7 @@ static void make_db (bool close_env) { ...@@ -173,9 +164,7 @@ static void make_db (bool close_env) {
toku_os_recursive_delete(TOKU_TEST_FILENAME); toku_os_recursive_delete(TOKU_TEST_FILENAME);
r=toku_os_mkdir(TOKU_TEST_FILENAME, S_IRWXU+S_IRWXG+S_IRWXO); assert(r==0); r=toku_os_mkdir(TOKU_TEST_FILENAME, S_IRWXU+S_IRWXG+S_IRWXO); assert(r==0);
r=db_env_create(&env, 0); assert(r==0); r=db_env_create(&env, 0); assert(r==0);
#if IS_TDB
db_env_enable_engine_status(0); // disable engine status on crash because test is expected to fail db_env_enable_engine_status(0); // disable engine status on crash because test is expected to fail
#endif
r=env->open(env, TOKU_TEST_FILENAME, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); r=env->open(env, TOKU_TEST_FILENAME, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r=db_create(&db, env, 0); CKERR(r); r=db_create(&db, env, 0); CKERR(r);
......
...@@ -129,15 +129,7 @@ test_main (int UU(argc), char UU(*const argv[])) { ...@@ -129,15 +129,7 @@ test_main (int UU(argc), char UU(*const argv[])) {
r=tid->abort(tid); r=tid->abort(tid);
assert(r==0); assert(r==0);
r=env->close(env, 0); r=env->close(env, 0);
#ifdef USE_BDB
#if DB_VERSION_MAJOR >= 5
assert(r==0); assert(r==0);
#else
assert(r==ENOENT);
#endif
#else
assert(r==0);
#endif
{ {
toku_struct_stat statbuf; toku_struct_stat statbuf;
char filename[TOKU_PATH_MAX+1]; char filename[TOKU_PATH_MAX+1];
......
...@@ -122,9 +122,6 @@ static void make_db (bool close_env) { ...@@ -122,9 +122,6 @@ static void make_db (bool close_env) {
toku_os_recursive_delete(TOKU_TEST_FILENAME); toku_os_recursive_delete(TOKU_TEST_FILENAME);
r=toku_os_mkdir(TOKU_TEST_FILENAME, S_IRWXU+S_IRWXG+S_IRWXO); assert(r==0); r=toku_os_mkdir(TOKU_TEST_FILENAME, S_IRWXU+S_IRWXG+S_IRWXO); assert(r==0);
r=db_env_create(&env, 0); assert(r==0); r=db_env_create(&env, 0); assert(r==0);
#ifdef TOKUDB
#endif
r=env->open(env, TOKU_TEST_FILENAME, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); r=env->open(env, TOKU_TEST_FILENAME, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r=db_create(&db, env, 0); CKERR(r); r=db_create(&db, env, 0); CKERR(r);
r=env->txn_begin(env, 0, &tid, 0); assert(r==0); r=env->txn_begin(env, 0, &tid, 0); assert(r==0);
...@@ -147,13 +144,11 @@ static void make_db (bool close_env) { ...@@ -147,13 +144,11 @@ static void make_db (bool close_env) {
key.data = hello; key.size=strlen(hello)+1; key.data = hello; key.size=strlen(hello)+1;
data.data = there; data.size=strlen(there)+1; data.data = there; data.size=strlen(there)+1;
r=db->put(db, tid, &key, &data, 0); assert(r==0); r=db->put(db, tid, &key, &data, 0); assert(r==0);
#ifndef TOKUDB
// BDB cannot handle this huge transaction even with a lot of locks. // BDB cannot handle this huge transaction even with a lot of locks.
if (i%1000==599) { if (i%1000==599) {
r=tid->commit(tid, 0); assert(r==0); r=tid->commit(tid, 0); assert(r==0);
r=env->txn_begin(env, 0, &tid, 0); assert(r==0); r=env->txn_begin(env, 0, &tid, 0); assert(r==0);
} }
#endif
} }
r=tid->commit(tid, 0); assert(r==0); r=tid->commit(tid, 0); assert(r==0);
r=db->close(db, 0); assert(r==0); r=db->close(db, 0); assert(r==0);
......
...@@ -119,9 +119,7 @@ static void insert_some (int outeri, bool close_env) { ...@@ -119,9 +119,7 @@ static void insert_some (int outeri, bool close_env) {
DB *db; DB *db;
DB_TXN *tid; DB_TXN *tid;
r=db_env_create(&env, 0); assert(r==0); r=db_env_create(&env, 0); assert(r==0);
#if IS_TDB
db_env_enable_engine_status(0); // disable engine status on crash because test is expected to fail db_env_enable_engine_status(0); // disable engine status on crash because test is expected to fail
#endif
r=env->open(env, TOKU_TEST_FILENAME, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE|create_flag, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); r=env->open(env, TOKU_TEST_FILENAME, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE|create_flag, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
...@@ -166,9 +164,7 @@ static void make_db (bool close_env) { ...@@ -166,9 +164,7 @@ static void make_db (bool close_env) {
toku_os_recursive_delete(TOKU_TEST_FILENAME); toku_os_recursive_delete(TOKU_TEST_FILENAME);
r=toku_os_mkdir(TOKU_TEST_FILENAME, S_IRWXU+S_IRWXG+S_IRWXO); assert(r==0); r=toku_os_mkdir(TOKU_TEST_FILENAME, S_IRWXU+S_IRWXG+S_IRWXO); assert(r==0);
r=db_env_create(&env, 0); assert(r==0); r=db_env_create(&env, 0); assert(r==0);
#if IS_TDB
db_env_enable_engine_status(0); // disable engine status on crash because test is expected to fail db_env_enable_engine_status(0); // disable engine status on crash because test is expected to fail
#endif
r=env->open(env, TOKU_TEST_FILENAME, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); r=env->open(env, TOKU_TEST_FILENAME, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r=db_create(&db, env, 0); CKERR(r); r=db_create(&db, env, 0); CKERR(r);
......
...@@ -119,9 +119,7 @@ static void insert_some (int outeri, bool close_env) { ...@@ -119,9 +119,7 @@ static void insert_some (int outeri, bool close_env) {
DB *db; DB *db;
DB_TXN *tid; DB_TXN *tid;
r=db_env_create(&env, 0); assert(r==0); r=db_env_create(&env, 0); assert(r==0);
#if IS_TDB
db_env_enable_engine_status(0); // disable engine status on crash because test is expected to fail db_env_enable_engine_status(0); // disable engine status on crash because test is expected to fail
#endif
r=env->open(env, TOKU_TEST_FILENAME, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE|create_flag, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); r=env->open(env, TOKU_TEST_FILENAME, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE|create_flag, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r=db_create(&db, env, 0); CKERR(r); r=db_create(&db, env, 0); CKERR(r);
...@@ -165,9 +163,7 @@ static void make_db (bool close_env) { ...@@ -165,9 +163,7 @@ static void make_db (bool close_env) {
toku_os_recursive_delete(TOKU_TEST_FILENAME); toku_os_recursive_delete(TOKU_TEST_FILENAME);
r=toku_os_mkdir(TOKU_TEST_FILENAME, S_IRWXU+S_IRWXG+S_IRWXO); assert(r==0); r=toku_os_mkdir(TOKU_TEST_FILENAME, S_IRWXU+S_IRWXG+S_IRWXO); assert(r==0);
r=db_env_create(&env, 0); assert(r==0); r=db_env_create(&env, 0); assert(r==0);
#if IS_TDB
db_env_enable_engine_status(0); // disable engine status on crash because test is expected to fail db_env_enable_engine_status(0); // disable engine status on crash because test is expected to fail
#endif
r=env->open(env, TOKU_TEST_FILENAME, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r); r=env->open(env, TOKU_TEST_FILENAME, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r=db_create(&db, env, 0); CKERR(r); r=db_create(&db, env, 0); CKERR(r);
......
...@@ -96,11 +96,7 @@ PATENT RIGHTS GRANT: ...@@ -96,11 +96,7 @@ PATENT RIGHTS GRANT:
// Return the offset // Return the offset
static int static int
grep_for_in_logs (const char *str) { grep_for_in_logs (const char *str) {
#ifdef TOKUDB
#define lfname "log000000000000.tokulog[0-9]*" #define lfname "log000000000000.tokulog[0-9]*"
#else
#define lfname "log.0000000001"
#endif
#define COMMAND "grep -F -q" #define COMMAND "grep -F -q"
char lname[TOKU_PATH_MAX+1]; char lname[TOKU_PATH_MAX+1];
toku_path_join(lname, 2, TOKU_TEST_FILENAME, lfname); toku_path_join(lname, 2, TOKU_TEST_FILENAME, lfname);
......
...@@ -152,11 +152,7 @@ test_logmax (int logmax) { ...@@ -152,11 +152,7 @@ test_logmax (int logmax) {
int effective_max; int effective_max;
if (logmax>0) effective_max = logmax; if (logmax>0) effective_max = logmax;
else { else {
#ifdef TOKUDB
effective_max = 100<<20; effective_max = 100<<20;
#else
effective_max = 10<<20;
#endif
} }
r=env->txn_begin(env, 0, &tid, 0); CKERR(r); r=env->txn_begin(env, 0, &tid, 0); CKERR(r);
......
...@@ -155,10 +155,8 @@ test_reverse_compare (int n) { ...@@ -155,10 +155,8 @@ test_reverse_compare (int n) {
/* create the dup database file */ /* create the dup database file */
DB_ENV *env; DB_ENV *env;
r = db_env_create(&env, 0); assert(r == 0); r = db_env_create(&env, 0); assert(r == 0);
#ifdef TOKUDB
r = env->set_default_bt_compare(env, reverse_compare); r = env->set_default_bt_compare(env, reverse_compare);
CKERR(r); CKERR(r);
#endif
r = env->open(env, TOKU_TEST_FILENAME, DB_CREATE+DB_PRIVATE+DB_INIT_MPOOL, 0); assert(r == 0); r = env->open(env, TOKU_TEST_FILENAME, DB_CREATE+DB_PRIVATE+DB_INIT_MPOOL, 0); assert(r == 0);
DB *db; DB *db;
...@@ -166,10 +164,6 @@ test_reverse_compare (int n) { ...@@ -166,10 +164,6 @@ test_reverse_compare (int n) {
CKERR(r); CKERR(r);
r = db->set_pagesize(db, 4096); r = db->set_pagesize(db, 4096);
CKERR(r); CKERR(r);
#ifndef TOKUDB
r = db->set_bt_compare(db, reverse_compare);
CKERR(r);
#endif
r = db->open(db, null_txn, fname, "main", DB_BTREE, DB_CREATE, 0666); r = db->open(db, null_txn, fname, "main", DB_BTREE, DB_CREATE, 0666);
CKERR(r); CKERR(r);
...@@ -192,10 +186,6 @@ test_reverse_compare (int n) { ...@@ -192,10 +186,6 @@ test_reverse_compare (int n) {
CKERR(r); CKERR(r);
r = db->set_pagesize(db, 4096); r = db->set_pagesize(db, 4096);
CKERR(r); CKERR(r);
#ifndef TOKUDB
r = db->set_bt_compare(db, reverse_compare);
CKERR(r);
#endif
r = db->open(db, null_txn, fname, "main", DB_BTREE, 0, 0666); r = db->open(db, null_txn, fname, "main", DB_BTREE, 0, 0666);
CKERR(r); CKERR(r);
......
...@@ -153,7 +153,6 @@ test1 (void) ...@@ -153,7 +153,6 @@ test1 (void)
db_env_set_func_realloc(brealloc); db_env_set_func_realloc(brealloc);
db_env_set_func_free(bfree); db_env_set_func_free(bfree);
#ifdef USE_TDB
// toku_malloc isn't affected by calling the BDB set_fun_malloc calls. // toku_malloc isn't affected by calling the BDB set_fun_malloc calls.
malloc_counter = realloc_counter = free_counter = 0; malloc_counter = realloc_counter = free_counter = 0;
...@@ -166,8 +165,6 @@ test1 (void) ...@@ -166,8 +165,6 @@ test1 (void)
db_env_set_func_malloc(NULL); db_env_set_func_malloc(NULL);
db_env_set_func_realloc(NULL); db_env_set_func_realloc(NULL);
db_env_set_func_free(NULL); db_env_set_func_free(NULL);
#endif
} }
int int
......
...@@ -119,7 +119,6 @@ test_abort_create (void) { ...@@ -119,7 +119,6 @@ test_abort_create (void) {
{ {
char *filename; char *filename;
#if USE_TDB
{ {
DBT dname; DBT dname;
DBT iname; DBT iname;
...@@ -131,9 +130,6 @@ test_abort_create (void) { ...@@ -131,9 +130,6 @@ test_abort_create (void) {
CAST_FROM_VOIDP(filename, iname.data); CAST_FROM_VOIDP(filename, iname.data);
assert(filename); assert(filename);
} }
#else
filename = toku_xstrdup("test.db");
#endif
toku_struct_stat statbuf; toku_struct_stat statbuf;
char fullfile[TOKU_PATH_MAX+1]; char fullfile[TOKU_PATH_MAX+1];
r = toku_stat(toku_path_join(fullfile, 2, TOKU_TEST_FILENAME, filename), &statbuf); r = toku_stat(toku_path_join(fullfile, 2, TOKU_TEST_FILENAME, filename), &statbuf);
...@@ -145,7 +141,6 @@ test_abort_create (void) { ...@@ -145,7 +141,6 @@ test_abort_create (void) {
r = txn->abort(txn); assert(r == 0); r = txn->abort(txn); assert(r == 0);
{ {
#if USE_TDB
{ {
DBT dname; DBT dname;
DBT iname; DBT iname;
...@@ -155,7 +150,6 @@ test_abort_create (void) { ...@@ -155,7 +150,6 @@ test_abort_create (void) {
r = env->get_iname(env, &dname, &iname); r = env->get_iname(env, &dname, &iname);
CKERR2(r, DB_NOTFOUND); CKERR2(r, DB_NOTFOUND);
} }
#endif
toku_struct_stat statbuf; toku_struct_stat statbuf;
char fullfile[TOKU_PATH_MAX+1]; char fullfile[TOKU_PATH_MAX+1];
r = toku_stat(toku_path_join(fullfile, 2, TOKU_TEST_FILENAME, "test.db"), &statbuf); r = toku_stat(toku_path_join(fullfile, 2, TOKU_TEST_FILENAME, "test.db"), &statbuf);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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