Commit d60e9115 authored by Bradley C. Kuszmaul's avatar Bradley C. Kuszmaul

A test for #627. This test doesn't show anything wrong. Addresses #627.

git-svn-id: file:///svn/tokudb@3219 c7de825b-a66e-492c-adef-691d508d4ae1
parent a0c89ed5
/* See #627. */
#include "test.h"
#include <sys/stat.h>
void do_627 (void) {
int r;
DB_ENV *env;
DB *db;
system("rm -rf " ENVDIR);
r=mkdir(ENVDIR, 0777); assert(r==0);
r=db_env_create(&env, 0); assert(r==0);
env->set_errfile(env, stderr);
r=env->open(env, ENVDIR, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE, 0777); CKERR(r);
r=db_create(&db, env, 0); CKERR(r);
DB_TXN *t1, *t2;
DBT a,b;
r=env->txn_begin(env, 0, &t1, 0); assert(r==0);
r=db->open(db, t1, "foo.db", 0, DB_BTREE, DB_CREATE, 0777); CKERR(r);
r=db->put(db, t1, dbt_init(&a, "a", 2), dbt_init(&b, "b", 2), 0);
r=t1->commit(t1, 0); assert(r==0);
r=env->txn_begin(env, 0, &t1, 0); assert(r==0);
r=env->txn_begin(env, 0, &t2, 0); assert(r==0);
DBC *c1,*c2;
r=db->cursor(db, t1, &c1, 0); CKERR(r);
r=db->cursor(db, t2, &c2, 0); CKERR(r);
r=c1->c_get(c1, dbt_init(&a, "a", 2), dbt_init_malloc(&b), DB_SET); CKERR(r);
free(b.data);
r=c2->c_get(c2, dbt_init(&a, "a", 2), dbt_init_malloc(&b), DB_SET); CKERR(r);
free(b.data);
r=c1->c_del(c1, 0); assert(r==DB_LOCK_NOTGRANTED);
r=c1->c_close(c1); CKERR(r);
r=t1->commit(t1, 0); assert(r==0);
r=c2->c_del(c2, 0); CKERR(r);
r=c2->c_close(c2); CKERR(r);
r=t2->commit(t2, 0); assert(r==0);
r=db->close(db, 0); CKERR(r);
r=env->close(env, 0); CKERR(r);
}
int main (int argc, const char *argv[]) {
parse_args(argc, argv);
do_627();
return 0;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment