Commit 9f99c41d authored by Rich Prohaska's avatar Rich Prohaska Committed by Yoni Fogel

#3535 remove DB_YESOVERWRITE on main. merge tokudb.3535 to main refs[t:3535]

git-svn-id: file:///svn/toku/tokudb@31293 c7de825b-a66e-492c-adef-691d508d4ae1
parent 1e8071a6
......@@ -219,8 +219,7 @@ typedef enum {
#define DB_KEYLAST 17
#define DB_NOOVERWRITE 23
#define DB_NODUPDATA 22
#define DB_YESOVERWRITE 1
#define DB_NOOVERWRITE_NO_ERROR 2
#define DB_NOOVERWRITE_NO_ERROR 1
#define DB_OPFLAGS_MASK 255
#define DB_AUTO_COMMIT 8388608
#define DB_INIT_LOCK 4096
......
......@@ -219,8 +219,7 @@ typedef enum {
#define DB_KEYLAST 16
#define DB_NOOVERWRITE 22
#define DB_NODUPDATA 21
#define DB_YESOVERWRITE 1
#define DB_NOOVERWRITE_NO_ERROR 2
#define DB_NOOVERWRITE_NO_ERROR 1
#define DB_OPFLAGS_MASK 255
#define DB_AUTO_COMMIT 16777216
#define DB_INIT_LOCK 8192
......
......@@ -219,8 +219,7 @@ typedef enum {
#define DB_KEYLAST 16
#define DB_NOOVERWRITE 22
#define DB_NODUPDATA 21
#define DB_YESOVERWRITE 1
#define DB_NOOVERWRITE_NO_ERROR 2
#define DB_NOOVERWRITE_NO_ERROR 1
#define DB_OPFLAGS_MASK 255
#define DB_AUTO_COMMIT 16777216
#define DB_INIT_LOCK 16384
......
......@@ -219,8 +219,7 @@ typedef enum {
#define DB_KEYLAST 14
#define DB_NOOVERWRITE 20
#define DB_NODUPDATA 19
#define DB_YESOVERWRITE 1
#define DB_NOOVERWRITE_NO_ERROR 2
#define DB_NOOVERWRITE_NO_ERROR 1
#define DB_OPFLAGS_MASK 255
#define DB_AUTO_COMMIT 33554432
#define DB_INIT_LOCK 32768
......
......@@ -219,8 +219,7 @@ typedef enum {
#define DB_KEYLAST 14
#define DB_NOOVERWRITE 20
#define DB_NODUPDATA 19
#define DB_YESOVERWRITE 1
#define DB_NOOVERWRITE_NO_ERROR 2
#define DB_NOOVERWRITE_NO_ERROR 1
#define DB_OPFLAGS_MASK 255
#define DB_AUTO_COMMIT 33554432
#define DB_INIT_LOCK 131072
......
......@@ -110,7 +110,6 @@ static void print_defines (void) {
static uint8_t insert_flags[256];
dodefine_track_enum(insert_flags, DB_NOOVERWRITE);
dodefine_track_enum(insert_flags, DB_NODUPDATA);
dodefine_from_track_enum(insert_flags, DB_YESOVERWRITE);
dodefine_from_track_enum(insert_flags, DB_NOOVERWRITE_NO_ERROR);
}
dodefine(DB_OPFLAGS_MASK);
......
......@@ -219,8 +219,7 @@ typedef enum {
#define DB_KEYLAST 14
#define DB_NOOVERWRITE 20
#define DB_NODUPDATA 19
#define DB_YESOVERWRITE 1
#define DB_NOOVERWRITE_NO_ERROR 2
#define DB_NOOVERWRITE_NO_ERROR 1
#define DB_OPFLAGS_MASK 255
#define DB_AUTO_COMMIT 33554432
#define DB_INIT_LOCK 131072
......
#include <assert.h>
#include <db_cxx.h>
#ifndef DB_YESOVERWRITE
#define DB_YESOVERWRITE 0
#endif
char *data_dir, *env_dir=NULL;
static int dbcreate(char *dbfile, char *dbname, int dbflags, int argc, char *argv[]) {
......@@ -32,7 +28,7 @@ static int dbcreate(char *dbfile, char *dbname, int dbflags, int argc, char *arg
if (i < argc) {
char *v = argv[i++];
Dbt key(k, strlen(k)); Dbt val(v, strlen(v));
r = db->put(0, &key, &val, DB_YESOVERWRITE); assert(r == 0);
r = db->put(0, &key, &val, 0); assert(r == 0);
}
}
......
......@@ -11,13 +11,6 @@ int verbose;
#define FNAME __FILE__ ".tdb"
#ifndef DB_YESOVERWRITE
#define BDB 1
#define DB_YESOVERWRITE 0
#else
#define TDB 1
#endif
int keyeq(Dbt *a, Dbt *b) {
if (a->get_size() != b->get_size()) return 0;
return memcmp(a->get_data(), b->get_data(), a->get_size()) == 0;
......@@ -135,7 +128,7 @@ void load(Db *db, int n) {
Dbt key(&k, sizeof k);
int v = i;
Dbt val(&v, sizeof v);
int r = db->put(0, &key, &val, DB_YESOVERWRITE); assert(r == 0);
int r = db->put(0, &key, &val, 0); assert(r == 0);
}
for (i=0; i<n; i++) {
......@@ -143,7 +136,7 @@ void load(Db *db, int n) {
int v = i;
Dbt key(&k, sizeof k);
Dbt val(&v, sizeof v);
int r = db->put(0, &key, &val, DB_YESOVERWRITE); assert(r == 0);
int r = db->put(0, &key, &val, 0); assert(r == 0);
}
}
......
......@@ -86,7 +86,7 @@ void test_reverse_compare(int n) {
Dbt key(&k, sizeof k);
v = htonl(i);
Dbt val(&v, sizeof v);
r = db->put(null_txn, &key, &val, DB_YESOVERWRITE);
r = db->put(null_txn, &key, &val, 0);
assert(r == 0);
}
......@@ -109,7 +109,7 @@ void test_reverse_compare(int n) {
Dbt key(&k, sizeof k);
v = htonl(i);
Dbt val(&v, sizeof v);
r = db->put(null_txn, &key, &val, DB_YESOVERWRITE);
r = db->put(null_txn, &key, &val, 0);
assert(r == 0);
}
......
......@@ -16,10 +16,6 @@
#include "trace_mem.h"
#endif
#if !defined(DB_YESOVERWRITE)
#define DB_YESOVERWRITE 0
#endif
#if !defined(DB_PRELOCKED_WRITE)
#define NO_DB_PRELOCKED
#define DB_PRELOCKED_WRITE 0
......@@ -62,7 +58,7 @@ int if_transactions_do_logging = DB_INIT_LOG; // set this to zero if we want no
int do_abort = 0;
int n_insertions_since_txn_began=0;
int env_open_flags = DB_CREATE|DB_PRIVATE|DB_INIT_MPOOL;
u_int32_t put_flags = DB_YESOVERWRITE;
u_int32_t put_flags = 0;
double compressibility = -1; // -1 means make it very compressible. 1 means use random bits everywhere. 2 means half the bits are random.
int do_append = 0;
int do_checkpoint_period = 0;
......@@ -672,7 +668,7 @@ static int test_main (int argc, char *const argv[]) {
if (unique_checks)
put_flags = DB_NOOVERWRITE;
else
put_flags = DB_YESOVERWRITE;
put_flags = 0;
} else if (strcmp(arg, "--log_dir") == 0) {
if (i+1 >= argc) return print_usage(argv[0]);
log_dir = argv[++i];
......
......@@ -79,7 +79,7 @@ static int inserter(struct keygen *keygen, DB_ENV *env, DB *db) {
uint64_t kk = bswap_64(k);
DBT key = { .data = &kk, .size = sizeof kk };
DBT val = { .data = &k, .size = sizeof k };
r = db->put(db, txn, &key, &val, DB_YESOVERWRITE);
r = db->put(db, txn, &key, &val, 0);
assert(r == 0);
r = txn->commit(txn, commit_flag);
......
......@@ -219,8 +219,7 @@ typedef enum {
#define DB_KEYLAST 14
#define DB_NOOVERWRITE 20
#define DB_NODUPDATA 19
#define DB_YESOVERWRITE 1
#define DB_NOOVERWRITE_NO_ERROR 2
#define DB_NOOVERWRITE_NO_ERROR 1
#define DB_OPFLAGS_MASK 255
#define DB_AUTO_COMMIT 33554432
#define DB_INIT_LOCK 131072
......
......@@ -56,7 +56,7 @@ static void table_init(struct table *t, int ndbs, DB **dbs, size_t key_length, s
table_init_dbt(&t->mult_vals[i], val_length);
t->mult_flags = calloc(ndbs, sizeof (uint32_t));
for (i = 0; i < ndbs; i++)
t->mult_flags[i] = DB_YESOVERWRITE;
t->mult_flags[i] = 0;
#endif
}
......@@ -73,10 +73,6 @@ static void table_destroy(struct table *t) {
#endif
}
#if defined(BDB)
#define DB_YESOVERWRITE 0
#endif
static int verbose = 0;
static long random64(void) {
......
......@@ -26,10 +26,6 @@ static inline float toku_tdiff (struct timeval *a, struct timeval *b) {
return (a->tv_sec - b->tv_sec) +1e-6*(a->tv_usec - b->tv_usec);
}
#if !defined(DB_YESOVERWRITE)
#define DB_YESOVERWRITE 0
#endif
#if !defined(DB_PRELOCKED_WRITE)
#define NO_DB_PRELOCKED
#define DB_PRELOCKED_WRITE 0
......@@ -69,7 +65,7 @@ int if_transactions_do_logging = DB_INIT_LOG; // set this to zero if we want no
int do_abort = 0;
int n_insertions_since_txn_began=0;
int env_open_flags = DB_CREATE|DB_PRIVATE|DB_INIT_MPOOL;
u_int32_t put_flags = DB_YESOVERWRITE;
u_int32_t put_flags = 0;
double compressibility = -1; // -1 means make it very compressible. 1 means use random bits everywhere. 2 means half the bits are random.
int do_append = 0;
int do_checkpoint_period = 0;
......@@ -472,7 +468,7 @@ int main (int argc, const char *argv[]) {
if (unique_checks)
put_flags = DB_NOOVERWRITE;
else
put_flags = DB_YESOVERWRITE;
put_flags = 0;
} else {
return print_usage(argv[0]);
}
......
......@@ -14,10 +14,6 @@
#include <arpa/inet.h>
#include "db.h"
#if defined(BDB)
#define DB_YESOVERWRITE 0
#endif
static int verbose = 0;
static int get_int(void *p) {
......@@ -83,9 +79,9 @@ static void insert_and_update(DB_ENV *db_env, DB *db, DB_TXN *txn, int a, int b,
int oldc = get_int(oldvalue.data);
newc = htonl(oldc + c); // newc = oldc + newc
memcpy(val_buffer, &newc, sizeof newc);
r = db->put(db, txn, &key, &value, DB_YESOVERWRITE);
r = db->put(db, txn, &key, &value, 0);
} else if (r == DB_NOTFOUND) {
r = db->put(db, txn, &key, &value, DB_YESOVERWRITE);
r = db->put(db, txn, &key, &value, 0);
}
assert(r == 0);
}
......
......@@ -28,7 +28,7 @@ static void insert (int i, int j) {
int r = db->put(db, xchild,
dbt_init(&key, hello, strlen(hello)+1),
dbt_init(&data, there, strlen(there)+1),
DB_YESOVERWRITE);
0);
CKERR(r);
}
......
......@@ -28,7 +28,7 @@ static void insert (int i, int j) {
int r = db->put(db, xchild,
dbt_init(&key, hello, strlen(hello)+1),
dbt_init(&data, there, strlen(there)+1),
DB_YESOVERWRITE);
0);
CKERR(r);
}
......
......@@ -28,7 +28,7 @@ static void insert (int i) {
int r = db->put(db, xchild,
dbt_init(&key, hello, strlen(hello)+1),
dbt_init(&data, there, strlen(there)+1),
DB_YESOVERWRITE);
0);
CKERR(r);
}
......
......@@ -26,7 +26,7 @@ static void insert (int i) {
int r = db->put(db, xchild,
dbt_init(&key, hello, strlen(hello)+1),
dbt_init(&data, there, strlen(there)+1),
DB_YESOVERWRITE);
0);
CKERR(r);
}
......
......@@ -19,7 +19,7 @@ insert(int i)
int r=db->put(db, txn,
dbt_init(&key, hello, strlen(hello)+1),
dbt_init(&val, there, strlen(there)+1),
DB_YESOVERWRITE);
0);
CKERR(r);
}
......
......@@ -299,11 +299,11 @@ insert_random(DB *db1, DB *db2, DB_TXN *txn) {
dbt_init(&val, &v, sizeof(v));
if (db1) {
r = db1->put(db1, txn, &key, &val, DB_YESOVERWRITE);
r = db1->put(db1, txn, &key, &val, 0);
CKERR(r);
}
if (db2) {
r = db2->put(db2, txn, &key, &val, DB_YESOVERWRITE);
r = db2->put(db2, txn, &key, &val, 0);
CKERR(r);
}
}
......@@ -375,11 +375,11 @@ insert_n(DB *db1, DB *db2, DB_TXN *txn, int firstkey, int n, int offset) {
dbt_init(&key, &k, sizeof(k));
dbt_init(&val, &v, sizeof(v));
if (db1) {
r = db1->put(db1, txn, &key, &val, DB_YESOVERWRITE);
r = db1->put(db1, txn, &key, &val, 0);
CKERR(r);
}
if (db2) {
r = db2->put(db2, txn, &key, &val, DB_YESOVERWRITE);
r = db2->put(db2, txn, &key, &val, 0);
CKERR(r);
}
}
......
......@@ -56,7 +56,7 @@ doit (BOOL committed_provdels) {
r=env->txn_begin(env, 0, &txn, 0); CKERR(r);
for (i = 0; i < num_insert; i++) {
j = (i<<1) + 37;
r=db->put(db, txn, dbt_init(&key, &i, sizeof(i)), dbt_init(&data, &j, sizeof(j)), DB_YESOVERWRITE);
r=db->put(db, txn, dbt_init(&key, &i, sizeof(i)), dbt_init(&data, &j, sizeof(j)), 0);
}
r=txn->commit(txn, 0); CKERR(r);
r=env->txn_begin(env, 0, &txn, 0); CKERR(r);
......@@ -81,9 +81,9 @@ doit (BOOL committed_provdels) {
jlast=(ilast<<1)+37;
ifirst=-1*num_insert;
jfirst=(ifirst<<1)+37;
r=db->put(db, txn, dbt_init(&key, &ifirst, sizeof(ifirst)), dbt_init(&data, &jfirst, sizeof(jfirst)), DB_YESOVERWRITE);
r=db->put(db, txn, dbt_init(&key, &ifirst, sizeof(ifirst)), dbt_init(&data, &jfirst, sizeof(jfirst)), 0);
CKERR(r);
r=db->put(db, txn, dbt_init(&key, &ilast, sizeof(ilast)), dbt_init(&data, &jlast, sizeof(jlast)), DB_YESOVERWRITE);
r=db->put(db, txn, dbt_init(&key, &ilast, sizeof(ilast)), dbt_init(&data, &jlast, sizeof(jlast)), 0);
CKERR(r);
r = dbc->c_get(dbc, dbt_init(&key, NULL, 0), dbt_init(&data, NULL, 0), DB_FIRST); CKERR(r);
......
......@@ -37,9 +37,9 @@ doit (void) {
DBT key,data;
int r;
r=env->txn_begin(env, 0, &txn, 0); assert(r==0);
r=db->put(db, txn, dbt_init(&key, "a", 2), dbt_init(&data, "a", 2), DB_YESOVERWRITE);
r=db->put(db, txn, dbt_init(&key, "b", 2), dbt_init(&data, "b", 2), DB_YESOVERWRITE);
r=db->put(db, txn, dbt_init(&key, "c", 2), dbt_init(&data, "c", 2), DB_YESOVERWRITE);
r=db->put(db, txn, dbt_init(&key, "a", 2), dbt_init(&data, "a", 2), 0);
r=db->put(db, txn, dbt_init(&key, "b", 2), dbt_init(&data, "b", 2), 0);
r=db->put(db, txn, dbt_init(&key, "c", 2), dbt_init(&data, "c", 2), 0);
r=txn->commit(txn, 0); assert(r==0);
r=env->txn_begin(env, 0, &txn, 0); assert(r==0);
......
......@@ -102,7 +102,7 @@ populate_primary(DB_ENV *env, DB *db, int ndbs, int nrows) {
int v[max(ndbs, 1024)]; memset(v, 0, sizeof v); get_data(v, i, ndbs);
DBT key; dbt_init(&key, &k, sizeof k);
DBT val; dbt_init(&val, &v[0], sizeof v);
r = db->put(db, txn, &key, &val, DB_YESOVERWRITE); assert_zero(r);
r = db->put(db, txn, &key, &val, 0); assert_zero(r);
}
r = txn->commit(txn, 0); assert_zero(r);
......@@ -119,7 +119,7 @@ populate_secondary(DB_ENV *env, DB *db, int dbnum, int nrows) {
int k = get_key(i, dbnum);
DBT key; dbt_init(&key, &k, sizeof k);
DBT val; dbt_init(&val, NULL, 0);
r = db->put(db, txn, &key, &val, DB_YESOVERWRITE); assert_zero(r);
r = db->put(db, txn, &key, &val, 0); assert_zero(r);
}
r = txn->commit(txn, 0); assert_zero(r);
......
......@@ -97,7 +97,7 @@ populate_primary(DB_ENV *env, DB *db, int ndbs, int nrows) {
int v[ndbs]; get_data(v, i, ndbs);
DBT key; dbt_init(&key, &k, sizeof k);
DBT val; dbt_init(&val, &v[0], sizeof v);
r = db->put(db, txn, &key, &val, DB_YESOVERWRITE); assert_zero(r);
r = db->put(db, txn, &key, &val, 0); assert_zero(r);
}
r = txn->commit(txn, 0); assert_zero(r);
......@@ -114,7 +114,7 @@ populate_secondary(DB_ENV *env, DB *db, int dbnum, int nrows) {
int k = get_key(i, dbnum);
DBT key; dbt_init(&key, &k, sizeof k);
DBT val; dbt_init(&val, NULL, 0);
r = db->put(db, txn, &key, &val, DB_YESOVERWRITE); assert_zero(r);
r = db->put(db, txn, &key, &val, 0); assert_zero(r);
}
r = txn->commit(txn, 0); assert_zero(r);
......
......@@ -98,7 +98,7 @@ populate_primary(DB_ENV *env, DB *db, int ndbs, int nrows) {
int v[ndbs]; get_data(v, i, ndbs);
DBT key; dbt_init(&key, &k, sizeof k);
DBT val; dbt_init(&val, &v[0], sizeof v);
r = db->put(db, txn, &key, &val, DB_YESOVERWRITE); assert_zero(r);
r = db->put(db, txn, &key, &val, 0); assert_zero(r);
}
r = txn->commit(txn, 0); assert_zero(r);
......@@ -115,7 +115,7 @@ populate_secondary(DB_ENV *env, DB *db, int dbnum, int nrows) {
int k = get_key(i, dbnum);
DBT key; dbt_init(&key, &k, sizeof k);
DBT val; dbt_init(&val, NULL, 0);
r = db->put(db, txn, &key, &val, DB_YESOVERWRITE); assert_zero(r);
r = db->put(db, txn, &key, &val, 0); assert_zero(r);
}
r = txn->commit(txn, 0); assert_zero(r);
......
......@@ -70,7 +70,7 @@ test_del(int nrows) {
int v = i;
DBT key; dbt_init(&key, &k, sizeof k);
DBT val; dbt_init(&val, &v, sizeof v);
r = db->put(db, txn, &key, &val, DB_YESOVERWRITE); assert_zero(r);
r = db->put(db, txn, &key, &val, 0); assert_zero(r);
}
r = txn->commit(txn, 0); assert_zero(r);
......
......@@ -28,7 +28,7 @@ static int update_fun(DB *UU(db),
static void verify_shared_ops_fail(DB_ENV* env, DB* db) {
int r;
DB_TXN* txn = NULL;
u_int32_t flags = DB_YESOVERWRITE;
u_int32_t flags = 0;
DBC* c = NULL;
DBT key,val;
DBT in_key,in_val;
......@@ -111,7 +111,7 @@ static void verify_shared_ops_fail(DB_ENV* env, DB* db) {
CKERR2(r, DB_LOCK_NOTGRANTED);
r = txn->commit(txn,0); CKERR(r);
flags = DB_YESOVERWRITE;
flags = 0;
r = env->txn_begin(env, NULL, &txn, 0); CKERR(r);
r = env->update_multiple(
......@@ -338,7 +338,7 @@ int test_main (int argc, char * const argv[]) {
u_int32_t flags = DB_YESOVERWRITE;
u_int32_t flags = 0;
r = env->txn_begin(env, NULL, &txna, 0); CKERR(r);
......@@ -382,7 +382,7 @@ int test_main (int argc, char * const argv[]) {
r = txna->abort(txna); CKERR(r);
r = txnb->abort(txnb); CKERR(r);
flags = DB_YESOVERWRITE;
flags = 0;
DBT in_keys[2];
memset(&in_keys, 0, sizeof(in_keys));
r = env->txn_begin(env, NULL, &txna, 0); CKERR(r);
......
......@@ -109,9 +109,9 @@ static void run_test (void) {
r = txn->commit(txn, 0);
}
{
//Insert again with DB_YESOVERWRITE, expect it to work.
//Insert again with 0, expect it to work.
for (which = 0; which < num_dbs; which++) {
flags[which] = DB_YESOVERWRITE;
flags[which] = 0;
}
DB_TXN *txn;
r = env->txn_begin(env, NULL, &txn, 0);
......@@ -158,9 +158,9 @@ static void run_test (void) {
{
//Different number
magic = 0xFEEDADAD;
//Insert again with DB_YESOVERWRITE, using 2 transactions, expect it to fail (unless 0 dbs).
//Insert again with 0, using 2 transactions, expect it to fail (unless 0 dbs).
for (which = 0; which < num_dbs; which++) {
flags[which] = DB_YESOVERWRITE;
flags[which] = 0;
}
DB_TXN *txna;
r = env->txn_begin(env, NULL, &txna, 0);
......
......@@ -86,7 +86,7 @@ insert_n (u_int32_t ah, int datasize) {
// if (verbose) printf("insert an = %0X (ah = %0X)\n", an, ah);
DBT key = {.size = 4, .data=&an };
DBT val = {.size = sizeof(vdata), .data=vdata};
int r = db->put(db, NULL, &key, &val, DB_YESOVERWRITE);
int r = db->put(db, NULL, &key, &val, 0);
CKERR(r);
ninsert++;
}
......
......@@ -247,7 +247,7 @@ static void test_indexer(DB *src, DB **dbs)
if ( verbose ) printf("test_indexer\n");
for(int i=0;i<NUM_DBS;i++) {
db_flags[i] = DB_YESOVERWRITE;
db_flags[i] = 0;
}
clients_init(dbs, db_flags);
......
......@@ -252,7 +252,7 @@ static void test_indexer(DB *src, DB **dbs)
if ( verbose ) printf("test_indexer\n");
for(int i=0;i<NUM_DBS;i++) {
db_flags[i] = DB_YESOVERWRITE;
db_flags[i] = 0;
}
clients_init(dbs, db_flags);
......
......@@ -97,7 +97,7 @@ static void test_indexer(DB *src, DB **dbs)
if ( verbose ) printf("test_indexer\n");
for(int i=0;i<NUM_DBS;i++) {
db_flags[i] = DB_YESOVERWRITE;
db_flags[i] = 0;
}
client_init();
......
......@@ -64,7 +64,7 @@ insert_n (u_int32_t ah) {
u_int32_t an = htonl(ah);
DBT key = {.size = 4, .data=&an };
DBT val = {.size = sizeof(vdata), .data=vdata};
int r = db->put(db, NULL, &key, &val, DB_YESOVERWRITE);
int r = db->put(db, NULL, &key, &val, 0);
CKERR(r);
}
......
......@@ -64,7 +64,7 @@ insert_n (u_int32_t ah) {
u_int32_t an = htonl(ah);
DBT key = {.size = 4, .data=&an };
DBT val = {.size = sizeof(vdata), .data=vdata};
int r = db->put(db, NULL, &key, &val, DB_YESOVERWRITE);
int r = db->put(db, NULL, &key, &val, 0);
CKERR(r);
}
......
......@@ -114,7 +114,7 @@ int main(int argc, char *argv[]) {
r = db_init(env, "db0", &db);
assert(r == 0);
r = inserter(env, db, maxk, DB_YESOVERWRITE, 0);
r = inserter(env, db, maxk, 0, 0);
assert(r == 0);
r = inserter(env, db, maxk, DB_NOOVERWRITE, DB_KEYEXIST);
......
......@@ -48,7 +48,7 @@ static void test (void) {
snprintf(key, 100, "%08llu", (unsigned long long)2*ri+1);
snprintf(val, 100, "%08llu", (unsigned long long)2*ri+1);
DBT k,v;
r = db->put(db, txn, dbt_init(&k, key, 1+strlen(key)), dbt_init(&v,val, 1+strlen(val)), DB_YESOVERWRITE);
r = db->put(db, txn, dbt_init(&k, key, 1+strlen(key)), dbt_init(&v,val, 1+strlen(val)), 0);
assert(r == 0);
}
r=txn->commit(txn, 0); assert(r==0);
......
......@@ -34,7 +34,7 @@ static void test (void) {
snprintf(key, 100, "%08llu", (unsigned long long)2*i+1);
snprintf(val, 100, "%08llu", (unsigned long long)2*i+1);
DBT k,v;
r = db->put(db, txn, dbt_init(&k, key, 1+strlen(key)), dbt_init(&v,val, 1+strlen(val)), DB_YESOVERWRITE);
r = db->put(db, txn, dbt_init(&k, key, 1+strlen(key)), dbt_init(&v,val, 1+strlen(val)), 0);
assert(r == 0);
}
r=txn->commit(txn, 0); assert(r==0);
......
......@@ -389,7 +389,7 @@ static void test_loader(DB **dbs)
uint32_t db_flags[MAX_DBS];
uint32_t dbt_flags[MAX_DBS];
uint32_t flags = DB_NOOVERWRITE;
if ( (USE_PUTS == 1) && (ALLOW_DUPS == 1) ) flags = DB_YESOVERWRITE;
if ( (USE_PUTS == 1) && (ALLOW_DUPS == 1) ) flags = 0;
for(int i=0;i<MAX_DBS;i++) {
db_flags[i] = flags;
dbt_flags[i] = 0;
......
......@@ -350,7 +350,7 @@ static void test_loader(DB **dbs)
uint32_t db_flags[MAX_DBS];
uint32_t dbt_flags[MAX_DBS];
uint32_t flags = DB_NOOVERWRITE;
if ( (USE_PUTS == 1) && (ALLOW_DUPS == 1) ) flags = DB_YESOVERWRITE;
if ( (USE_PUTS == 1) && (ALLOW_DUPS == 1) ) flags = 0;
for(int i=0;i<MAX_DBS;i++) {
db_flags[i] = flags;
dbt_flags[i] = 0;
......
......@@ -65,7 +65,7 @@ doit (void) {
dbt_init(&key, str, 1+strlen(str));
dbt_init(&data, str, 1+strlen(str));
for (i=0; i<NFILES; i++) {
r = dbs[i]->put(dbs[i], txn, &key, &data, DB_YESOVERWRITE);
r = dbs[i]->put(dbs[i], txn, &key, &data, 0);
CKERR(r);
}
}
......
......@@ -26,7 +26,7 @@ static void insert (int i) {
int r = db->put(db, xchild,
dbt_init(&key, hello, strlen(hello)+1),
dbt_init(&data, there, strlen(there)+1),
DB_YESOVERWRITE);
0);
CKERR(r);
}
......
......@@ -67,14 +67,14 @@ static void do_write (void) {
for (long N=0; 1; N++) {
DB_TXN *txn = 0;
r = env->txn_begin(env, 0, &txn, 0); CKERR(r);
put(dbs[0], txn, N, N, DB_YESOVERWRITE);
put(dbs[0], txn, N, N, 0);
int sum=0;
for (int i=1; i+1<N_DBS; i++) {
int rval = (random()%2048)-1024;
sum+=rval;
put(dbs[i], txn, shuffle(N, i), rval, (i%2==0) ? DB_YESOVERWRITE : 0); // even numbered databases are overwritten
put(dbs[i], txn, shuffle(N, i), rval, (i%2==0) ? 0 : 0); // even numbered databases are overwritten
}
put(dbs[N_DBS-1],txn, N, sum, DB_YESOVERWRITE);
put(dbs[N_DBS-1],txn, N, sum, 0);
r = txn->commit(txn, 0); CKERR(r);
printf("%ld\n", N);
}
......
......@@ -132,7 +132,7 @@ static void preload_dbs(DB **dbs)
uint32_t db_flags[MAX_DBS];
uint32_t dbt_flags[MAX_DBS];
uint32_t flags = DB_NOOVERWRITE;
flags = DB_YESOVERWRITE;
flags = 0;
for(int i=0;i<MAX_DBS;i++) {
db_flags[i] = flags;
dbt_flags[i] = 0;
......
......@@ -41,7 +41,7 @@ static void preload_dbs(DB **dbs)
uint32_t db_flags[MAX_DBS];
uint32_t dbt_flags[MAX_DBS];
uint32_t flags = DB_NOOVERWRITE;
flags = DB_YESOVERWRITE;
flags = 0;
for(int i=0;i<MAX_DBS;i++) {
db_flags[i] = flags;
dbt_flags[i] = 0;
......
......@@ -277,7 +277,7 @@ insert(void) {
int r=db->put(db, txn,
&key,
&val,
DB_YESOVERWRITE);
0);
CKERR(r);
}
......
......@@ -54,7 +54,7 @@ run_test(void) {
r = env->txn_begin(env, NULL, &txn, 0); CKERR(r);
DBT k={.data="a", .size=2};
DBT v={.data="a", .size=2};
r = db->put(db, txn, &k, &v, DB_YESOVERWRITE); CKERR(r);
r = db->put(db, txn, &k, &v, 0); CKERR(r);
r = txn->commit(txn, 0); CKERR(r);
}
......@@ -66,7 +66,7 @@ run_test(void) {
r = env->txn_begin(env, NULL, &txn, 0); CKERR(r);
DBT k={.data="b", .size=2};
DBT v={.data="b", .size=2};
r = db->put(db, txn, &k, &v, DB_YESOVERWRITE); CKERR(r);
r = db->put(db, txn, &k, &v, 0); CKERR(r);
}
// cause crash at next checkpoint, after xstillopen written, before checkpoint_end is written
......
......@@ -31,8 +31,8 @@ static void run_test (BOOL do_commit, BOOL do_abort) {
{
DBT a={.data="a", .size=2};
DBT b={.data="b", .size=2};
r = dba->put(dba, txn, &a, &b, DB_YESOVERWRITE); CKERR(r);
r = dbb->put(dbb, txn, &b, &a, DB_YESOVERWRITE); CKERR(r);
r = dba->put(dba, txn, &a, &b, 0); CKERR(r);
r = dbb->put(dbb, txn, &b, &a, 0); CKERR(r);
}
//printf("opened\n");
if (do_commit) {
......
......@@ -31,8 +31,8 @@ static void run_test (BOOL do_commit, BOOL do_abort) {
{
DBT a={.data="a", .size=2};
DBT b={.data="b", .size=2};
r = dba->put(dba, txn, &a, &b, DB_YESOVERWRITE); CKERR(r);
r = dbb->put(dbb, txn, &b, &a, DB_YESOVERWRITE); CKERR(r);
r = dba->put(dba, txn, &a, &b, 0); CKERR(r);
r = dbb->put(dbb, txn, &b, &a, 0); CKERR(r);
}
//printf("opened\n");
if (do_commit) {
......
......@@ -32,8 +32,8 @@ static void run_test (BOOL do_commit, BOOL do_abort) {
{
DBT a={.data="a", .size=2};
DBT b={.data="b", .size=2};
r = dba->put(dba, txn, &a, &b, DB_YESOVERWRITE); CKERR(r);
r = dbb->put(dbb, txn, &b, &a, DB_YESOVERWRITE); CKERR(r);
r = dba->put(dba, txn, &a, &b, 0); CKERR(r);
r = dbb->put(dbb, txn, &b, &a, 0); CKERR(r);
}
//printf("opened\n");
if (do_commit) {
......
......@@ -32,8 +32,8 @@ static void run_test (BOOL do_commit, BOOL do_abort) {
{
DBT a={.data="a", .size=2};
DBT b={.data="b", .size=2};
r = dba->put(dba, txn, &a, &b, DB_YESOVERWRITE); CKERR(r);
r = dbb->put(dbb, txn, &b, &a, DB_YESOVERWRITE); CKERR(r);
r = dba->put(dba, txn, &a, &b, 0); CKERR(r);
r = dbb->put(dbb, txn, &b, &a, 0); CKERR(r);
}
//printf("opened\n");
if (do_commit) {
......
......@@ -30,9 +30,9 @@ static void run_test (void) {
{
DBT a={.data="a", .size=2};
DBT b={.data="b", .size=2};
r = dba->put(dba, txn, &a, &b, DB_YESOVERWRITE); CKERR(r);
r = dba->put(dba, txn, &a, &b, 0); CKERR(r);
r = env->txn_checkpoint(env, 0, 0, 0); CKERR(r);
r = dbb->put(dbb, txn, &b, &a, DB_YESOVERWRITE); CKERR(r);
r = dbb->put(dbb, txn, &b, &a, 0); CKERR(r);
}
r = txn->commit(txn, 0); CKERR(r);
......
......@@ -30,9 +30,9 @@ static void run_test (void) {
{
DBT a={.data="a", .size=2};
DBT b={.data="b", .size=2};
r = dba->put(dba, txn, &a, &b, DB_YESOVERWRITE); CKERR(r);
r = dba->put(dba, txn, &a, &b, 0); CKERR(r);
r = env->txn_checkpoint(env, 0, 0, 0); CKERR(r);
r = dbb->put(dbb, txn, &b, &a, DB_YESOVERWRITE); CKERR(r);
r = dbb->put(dbb, txn, &b, &a, 0); CKERR(r);
}
r = txn->commit(txn, 0); CKERR(r);
......
......@@ -15,7 +15,7 @@ static void put_something(DB_ENV *env, DB *db, char *k, char *v) {
DBT val={.data=v, .size=strlen(v)};
DB_TXN *txn;
r = env->txn_begin(env, 0, &txn, 0); CKERR(r);
r = db->put(db, txn, &key, &val, DB_YESOVERWRITE); CKERR(r);
r = db->put(db, txn, &key, &val, 0); CKERR(r);
r = txn->commit(txn, 0); CKERR(r);
}
......
......@@ -75,7 +75,7 @@ static void run_test (void) {
CHK(dbb->change_descriptor(dbb, txn_desc, &descriptor, 0));
});
DB *dbs[num_dbs] = {dba, dbb};
uint32_t flags[num_dbs] = {DB_YESOVERWRITE, DB_YESOVERWRITE};
uint32_t flags[num_dbs] = {0, 0};
// txn_begin; insert <a,a>; txn_abort
{
DB_TXN *txn;
......
......@@ -36,7 +36,7 @@ static void run_test (void) {
r = env->txn_begin(env, NULL, &txn, 0); CKERR(r);
DBT k={.data="a", .size=2};
DBT v={.data="a", .size=2};
r = db->put(db, txn, &k, &v, DB_YESOVERWRITE); CKERR(r);
r = db->put(db, txn, &k, &v, 0); CKERR(r);
r = txn->abort(txn); CKERR(r);
}
......@@ -46,7 +46,7 @@ static void run_test (void) {
r = env->txn_begin(env, NULL, &txn, 0); CKERR(r);
DBT k={.data="a", .size=2};
DBT v={.data="b", .size=2};
r = db->put(db, txn, &k, &v, DB_YESOVERWRITE); CKERR(r);
r = db->put(db, txn, &k, &v, 0); CKERR(r);
}
// checkpoint
......
......@@ -40,7 +40,7 @@ static void run_test (void) {
{
DBT a={.data="a", .size=2};
DBT b={.data="b", .size=2};
r = dba->put(dba, txn, &a, &b, DB_YESOVERWRITE); CKERR(r);
r = dba->put(dba, txn, &a, &b, 0); CKERR(r);
}
r = txn->commit(txn, 0); CKERR(r);
......
......@@ -45,7 +45,7 @@ static void run_test (void) {
{
DBT a={.data="a", .size=2};
DBT b={.data="b", .size=2};
r = dba->put(dba, txn, &a, &b, DB_YESOVERWRITE); CKERR(r);
r = dba->put(dba, txn, &a, &b, 0); CKERR(r);
}
r = txn->commit(txn, 0); CKERR(r);
......
......@@ -72,7 +72,7 @@ static void run_test (void) {
});
DB *dbs[num_dbs] = {dba, dbb};
uint32_t flags[num_dbs] = {DB_YESOVERWRITE, DB_YESOVERWRITE};
uint32_t flags[num_dbs] = {0, 0};
// txn_begin; insert <a,a>; txn_abort
{
DB_TXN *txn;
......
......@@ -76,7 +76,7 @@ static void run_test (void) {
});
DB *dbs[num_dbs] = {dba, dbb};
uint32_t flags[num_dbs] = {DB_YESOVERWRITE, DB_YESOVERWRITE};
uint32_t flags[num_dbs] = {0, 0};
// txn_begin; insert <a,a>; txn_abort
{
DB_TXN *txn;
......
......@@ -74,7 +74,7 @@ static void run_test (void) {
r = env->txn_checkpoint(env, 0, 0, 0); CKERR(r);
DB *dbs[num_dbs] = {dba, dbb};
uint32_t flags[num_dbs] = {DB_YESOVERWRITE, DB_YESOVERWRITE};
uint32_t flags[num_dbs] = {0, 0};
// txn_begin; insert <a,a>; txn_abort
{
DB_TXN *txn;
......
......@@ -35,7 +35,7 @@ static void run_test (void) {
DBT k={.data="a", .size=2};
DBT v={.data="a", .size=2};
r = db->put(db, btxn, &k, &v, DB_YESOVERWRITE); CKERR(r);
r = db->put(db, btxn, &k, &v, 0); CKERR(r);
r = btxn->commit(btxn, 0); CKERR(r);
r = atxn->abort(atxn); CKERR(r);
......
......@@ -128,7 +128,7 @@ populate_primary(DB_ENV *env, DB *db, int ndbs, int nrows) {
int v[ndbs]; get_data(v, i, ndbs);
DBT key; dbt_init(&key, &k, sizeof k);
DBT val; dbt_init(&val, &v[0], sizeof v);
r = db->put(db, txn, &key, &val, DB_YESOVERWRITE); assert_zero(r);
r = db->put(db, txn, &key, &val, 0); assert_zero(r);
}
r = txn->commit(txn, 0); assert_zero(r);
......@@ -145,7 +145,7 @@ populate_secondary(DB_ENV *env, DB *db, int dbnum, int nrows) {
int k = get_key(i, dbnum);
DBT key; dbt_init(&key, &k, sizeof k);
DBT val; dbt_init(&val, NULL, 0);
r = db->put(db, txn, &key, &val, DB_YESOVERWRITE); assert_zero(r);
r = db->put(db, txn, &key, &val, 0); assert_zero(r);
}
r = txn->commit(txn, 0); assert_zero(r);
......
......@@ -128,7 +128,7 @@ populate_primary(DB_ENV *env, DB *db, int ndbs, int nrows) {
int v[ndbs]; get_data(v, i, ndbs);
DBT key; dbt_init(&key, &k, sizeof k);
DBT val; dbt_init(&val, &v[0], sizeof v);
r = db->put(db, txn, &key, &val, DB_YESOVERWRITE); assert_zero(r);
r = db->put(db, txn, &key, &val, 0); assert_zero(r);
}
r = txn->commit(txn, 0); assert_zero(r);
......@@ -145,7 +145,7 @@ populate_secondary(DB_ENV *env, DB *db, int dbnum, int nrows) {
int k = get_key(i, dbnum);
DBT key; dbt_init(&key, &k, sizeof k);
DBT val; dbt_init(&val, NULL, 0);
r = db->put(db, txn, &key, &val, DB_YESOVERWRITE); assert_zero(r);
r = db->put(db, txn, &key, &val, 0); assert_zero(r);
}
r = txn->commit(txn, 0); assert_zero(r);
......
......@@ -472,7 +472,7 @@ static void insert_n(DB *db, DB_TXN *txn, int firstkey, int n) {
v = generate_val(k);
dbt_init(&key, &k, sizeof(k));
dbt_init(&val, &v, sizeof(v));
r = db->put(db, txn, &key, &val, DB_YESOVERWRITE);
r = db->put(db, txn, &key, &val, 0);
CKERR(r);
}
}
......
......@@ -285,23 +285,23 @@ fcreate(void) {
DBT key, val;
dbt_init(&key, choices, sizeof(choices));
dbt_init(&val, NULL, 0);
r = db->put(db, txn, &key, &val, DB_YESOVERWRITE);
r = db->put(db, txn, &key, &val, 0);
CKERR(r);
dbt_init(&key, "name", sizeof("name"));
dbt_init(&val, (void*)oldname, strlen(oldname)+1);
r = db->put(db, txn, &key, &val, DB_YESOVERWRITE);
r = db->put(db, txn, &key, &val, 0);
CKERR(r);
dbt_init(&key, "to_delete", sizeof("to_delete"));
dbt_init(&val, "delete_me", sizeof("delete_me"));
r = db->put(db, txn, &key, &val, DB_YESOVERWRITE);
r = db->put(db, txn, &key, &val, 0);
CKERR(r);
r = db->del(db, txn, &key, DB_DELETE_ANY);
CKERR(r);
dbt_init(&key, "to_delete2", sizeof("to_delete2"));
dbt_init(&val, "delete_me2", sizeof("delete_me2"));
r = db->put(db, txn, &key, &val, DB_YESOVERWRITE);
r = db->put(db, txn, &key, &val, 0);
CKERR(r);
r = db->del(db, txn, &key, 0);
CKERR(r);
......@@ -328,7 +328,7 @@ frename(void) {
CKERR(r);
dbt_init(&key, "name", sizeof("name"));
dbt_init(&val, (void*)newname, strlen(newname)+1);
r = db->put(db, txn, &key, &val, DB_YESOVERWRITE);
r = db->put(db, txn, &key, &val, 0);
CKERR(r);
r = db->close(db, 0);
CKERR(r);
......@@ -529,7 +529,7 @@ verify_file_exists(const char *name, int should_exist) {
DBT key, val;
dbt_init(&key, choices, sizeof(choices));
dbt_init(&val, NULL, 0);
r = db->get(db, txn, &key, &val, DB_YESOVERWRITE);
r = db->get(db, txn, &key, &val, 0);
r = db->getf_set(db, txn, 0, &key, getf_do_nothing, NULL);
CKERR(r);
dbt_init(&key, "name", sizeof("name"));
......
......@@ -158,7 +158,7 @@ insert(int idx, int64_t i) {
int r=db->put(db, txn,
&key,
&val,
DB_YESOVERWRITE);
0);
CKERR(r);
}
......
......@@ -37,8 +37,8 @@ insert_row(DB_ENV *env UU(), DB_TXN *txn, DB *db, uint64_t rowi) {
DBT key = { .data = key_buffer, .size = sizeof key_buffer };
DBT value = { .data = val_buffer, .size = sizeof val_buffer };
//uint32_t put_flags = DB_YESOVERWRITE | (txn ? (DB_PRELOCKED_FILE_READ | DB_PRELOCKED_WRITE) : 0);
uint32_t put_flags = DB_YESOVERWRITE;
//uint32_t put_flags = 0 | (txn ? (DB_PRELOCKED_FILE_READ | DB_PRELOCKED_WRITE) : 0);
uint32_t put_flags = 0;
r = db->put(db, txn, &key, &value, put_flags); assert_zero(r);
}
......
......@@ -50,7 +50,7 @@ test_stat64 (unsigned int N) {
r=db->put(db, txn,
dbt_init(&key, hello, strlen(hello)+1),
dbt_init(&val, there, strlen(there)+1),
DB_YESOVERWRITE);
0);
dsize += strlen(hello)+1 + strlen(there)+1;
CKERR(r);
}
......
......@@ -29,9 +29,6 @@ extern "C" {
#endif
#define DB_KEYEMPTY DB_NOTFOUND
#endif
#ifndef DB_YESOVERWRITE
#define DB_YESOVERWRITE 0
#endif
#ifndef DB_DELETE_ANY
#define DB_DELETE_ANY 0
#endif
......
......@@ -63,7 +63,7 @@ do_insert_delete_fifo (void)
u_int32_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), DB_YESOVERWRITE); CKERR(r);
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.
......
......@@ -50,7 +50,7 @@ four_billion_subtransactions (int do_something_in_children, int use_big_incremen
r=db->put(db, xchild,
dbt_init(&key, hello, strlen(hello)+1),
dbt_init(&val, there, strlen(there)+1),
DB_YESOVERWRITE);
0);
CKERR(r);
}
r=xchild->commit(xchild, 0); CKERR(r);
......
......@@ -99,13 +99,13 @@ test_txn_abort (u_int32_t dup_mode) {
int v2 = 1;
u_int8_t extra_1 = 1;
u_int8_t extra_2 = 2;
r = db->put(db, txn, dbt_init(&key, &k, sizeof k), dbt_init_length(&val, v1, extra_1, value1), DB_YESOVERWRITE);
r = db->put(db, txn, dbt_init(&key, &k, sizeof k), dbt_init_length(&val, v1, extra_1, value1), 0);
CKERR(r);
r = txn->commit(txn, DB_TXN_NOSYNC);
txn = NULL;
r = env->txn_begin(env, 0, &txn, 0); CKERR(r);
r = db->put(db, txn, dbt_init(&key, &k, sizeof k), dbt_init_length(&val, v2, extra_2, value2), DB_YESOVERWRITE);
r = db->put(db, txn, dbt_init(&key, &k, sizeof k), dbt_init_length(&val, v2, extra_2, value2), 0);
CKERR(r);
r = db->del(db, txn, dbt_init(&key, &k, sizeof k), DB_DELETE_ANY);
CKERR(r);
......
......@@ -61,7 +61,7 @@ static void create_db (u_int64_t N) {
snprintf(data, sizeof(data), "%08lx%08lx%66s", random(), random()%16, "");
DBT keyd, datad;
{
int r = db->put(db, txn, dbt_init(&keyd, key, strlen(key)+1), dbt_init(&datad, data, strlen(data)+1), DB_YESOVERWRITE);
int r = db->put(db, txn, dbt_init(&keyd, key, strlen(key)+1), dbt_init(&datad, data, strlen(data)+1), 0);
CKERR(r);
}
}
......
......@@ -27,7 +27,7 @@ insert(int i, DB_TXN *txn)
int r=db->put(db, txn,
dbt_init(&key, hello, strlen(hello)+1),
dbt_init(&val, there, strlen(there)+1),
DB_YESOVERWRITE);
0);
CKERR(r);
}
......
......@@ -37,7 +37,7 @@ insert(int i, DB_TXN *txn)
int r=db->put(db, txn,
dbt_init(&key, hello, strlen(hello)+1),
dbt_init(&val, there, strlen(there)+1),
DB_YESOVERWRITE);
0);
CKERR(r);
}
......
......@@ -50,7 +50,7 @@ run (int choice) {
char key[2]={25,v[i]};
char val=v[i];
//printf("put %d %d\n", key, val);
r=db->put(db, txn, dbt_init(&kdbt, &key, 2), dbt_init(&vdbt, &val, 1), DB_YESOVERWRITE); CKERR(r);
r=db->put(db, txn, dbt_init(&kdbt, &key, 2), dbt_init(&vdbt, &val, 1), 0); CKERR(r);
}
r=txn->commit(txn, DB_TXN_NOSYNC); CKERR(r);
}
......
......@@ -18,11 +18,11 @@ run (void) {
r=env->txn_begin(env, 0, &txn, 0); CKERR(r);
DBT k,v;
int i;
r=db->put(db, txn, dbt_init(&k, &v1, 1), dbt_init(&v, &v101, 1), DB_YESOVERWRITE); CKERR(r);
r=db->put(db, txn, dbt_init(&k, &v2, 1), dbt_init(&v, &v102, 1), DB_YESOVERWRITE); CKERR(r);
r=db->put(db, txn, dbt_init(&k, &v1, 1), dbt_init(&v, &v101, 1), 0); CKERR(r);
r=db->put(db, txn, dbt_init(&k, &v2, 1), dbt_init(&v, &v102, 1), 0); CKERR(r);
for (i=0; i<N; i++) {
int iv = htonl(i);
r=db->put(db, txn, dbt_init(&k, &vN, 1), dbt_init(&v, &iv, 4), DB_YESOVERWRITE); CKERR(r);
r=db->put(db, txn, dbt_init(&k, &vN, 1), dbt_init(&v, &iv, 4), 0); CKERR(r);
}
r=txn->commit(txn, 0); CKERR(r);
}
......
......@@ -26,7 +26,7 @@ run (void) {
r=env->txn_begin(env, 0, &txn, 0); CKERR(r);
char kk[2] = {v2, v102};
DBT k,v;
r=db->put(db, txn, dbt_init(&k, &kk, 2), dbt_init(&v, &v102, 1), DB_YESOVERWRITE); CKERR(r);
r=db->put(db, txn, dbt_init(&k, &kk, 2), dbt_init(&v, &v102, 1), 0); CKERR(r);
r=txn->commit(txn, 0); CKERR(r);
}
......@@ -37,7 +37,7 @@ run (void) {
DBT k,v;
{
char kk[2] = {v1, v101};
r=db->put(db, txn, dbt_init(&k, &kk, 2), dbt_init(&v, &v101, 1), DB_YESOVERWRITE); CKERR(r);
r=db->put(db, txn, dbt_init(&k, &kk, 2), dbt_init(&v, &v101, 1), 0); CKERR(r);
}
DBC *c2;
......
......@@ -12,10 +12,6 @@ static DB_ENV *env;
static DB *db;
static DB_TXN *txn;
#ifndef TOKUDB
#define DB_YESOVERWRITE 0
#endif
static void insert (int i, int j) {
char hello[30], there[30];
DBT key,data;
......@@ -25,7 +21,7 @@ static void insert (int i, int j) {
int r = db->put(db, txn,
dbt_init(&key, hello, strlen(hello)+1),
dbt_init(&data, there, strlen(there)+1),
DB_YESOVERWRITE);
0);
CKERR(r);
}
......
......@@ -55,10 +55,6 @@ abort_txn(void) {
txn = NULL;
}
#ifndef DB_YESOVERWRITE
#define DB_YESOVERWRITE 0
#endif
static void
put(u_int32_t k, u_int32_t v) {
int r;
......@@ -66,7 +62,7 @@ put(u_int32_t k, u_int32_t v) {
dbt_init(&key, &k, sizeof(k));
dbt_init(&val, &v, sizeof(v));
r = db->put(db, txn, &key, &val, DB_YESOVERWRITE); CKERR(r);
r = db->put(db, txn, &key, &val, 0); CKERR(r);
}
static void
......
......@@ -87,10 +87,6 @@ abort_txn(int type) {
txn = NULL;
}
#ifndef DB_YESOVERWRITE
#define DB_YESOVERWRITE 0
#endif
static void
put(u_int32_t k, u_int32_t v) {
int r;
......@@ -102,7 +98,7 @@ put(u_int32_t k, u_int32_t v) {
vvec[0] = v;
dbt_init(&key, &kvec[0], sizeof(kvec));
dbt_init(&val, &vvec[0], sizeof(vvec));
r = db->put(db, childtxn ? childtxn : txn, &key, &val, DB_YESOVERWRITE); CKERR(r);
r = db->put(db, childtxn ? childtxn : txn, &key, &val, 0); CKERR(r);
}
static void
......
......@@ -71,14 +71,10 @@ static void close_cursor(void) {
cursor = NULL;
}
#ifdef USE_BDB
#define DB_YESOVERWRITE 0
#endif
static void insert(char k, char d) {
DBT key;
DBT data;
r = db->put(db, null_txn, dbt_init(&key, &k, sizeof(k)), dbt_init(&data, &d, sizeof(d)), DB_YESOVERWRITE);
r = db->put(db, null_txn, dbt_init(&key, &k, sizeof(k)), dbt_init(&data, &d, sizeof(d)), 0);
CKERR(r);
}
......
......@@ -71,7 +71,7 @@ test_cursor_delete (int dup_mode) {
int k = htonl(i);
int v = htonl(i);
DBT key, val;
r = db->put(db, null_txn, dbt_init(&key, &k, sizeof k), dbt_init(&val, &v, sizeof v), DB_YESOVERWRITE); assert(r == 0);
r = db->put(db, null_txn, dbt_init(&key, &k, sizeof k), dbt_init(&val, &v, sizeof v), 0); assert(r == 0);
}
/* verify the sort order with a cursor */
......
......@@ -30,7 +30,7 @@ test_cursor_delete2 (void) {
r = txn->commit(txn, 0); CKERR(r);
r = dbenv->txn_begin(dbenv, 0, &txn, 0); CKERR(r);
r = db->put(db, txn, dbt_init(&key, "a", 2), dbt_init(&val, "b", 2), DB_YESOVERWRITE); CKERR(r);
r = db->put(db, txn, dbt_init(&key, "a", 2), dbt_init(&val, "b", 2), 0); CKERR(r);
r = txn->commit(txn, 0); CKERR(r);
r = dbenv->txn_begin(dbenv, 0, &txn, 0); CKERR(r);
......@@ -42,12 +42,12 @@ test_cursor_delete2 (void) {
r = txn->commit(txn, 0); CKERR(r);
r = dbenv->txn_begin(dbenv, 0, &txn, 0); CKERR(r);
r = db->put(db, txn, dbt_init(&key, "a", 2), dbt_init(&val, "c", 2), DB_YESOVERWRITE); CKERR(r);
r = db->put(db, txn, dbt_init(&key, "a", 2), dbt_init(&val, "c", 2), 0); CKERR(r);
r = db->del(db, txn, dbt_init(&key, "a", 2), 0); CKERR(r);
r = txn->commit(txn, 0); CKERR(r);
r = dbenv->txn_begin(dbenv, 0, &txn, 0); CKERR(r);
r = db->put(db, txn, dbt_init(&key, "a", 2), dbt_init(&val, "c", 2), DB_YESOVERWRITE); CKERR(r);
r = db->put(db, txn, dbt_init(&key, "a", 2), dbt_init(&val, "c", 2), 0); CKERR(r);
r = txn->commit(txn, 0); CKERR(r);
r = dbenv->txn_begin(dbenv, 0, &txn, 0); CKERR(r);
......
......@@ -31,7 +31,7 @@ test_cursor_delete2 (void) {
r = txn->commit(txn, 0); CKERR(r);
r = dbenv->txn_begin(dbenv, 0, &txn, 0); CKERR(r);
r = db->put(db, txn, dbt_init(&key, "a", 2), dbt_init(&val, "b", 2), DB_YESOVERWRITE); CKERR(r);
r = db->put(db, txn, dbt_init(&key, "a", 2), dbt_init(&val, "b", 2), 0); CKERR(r);
r = txn->commit(txn, 0); CKERR(r);
r = dbenv->txn_begin(dbenv, 0, &txn, 0); CKERR(r);
......@@ -39,7 +39,7 @@ test_cursor_delete2 (void) {
r = txn->commit(txn, 0); CKERR(r);
r = dbenv->txn_begin(dbenv, 0, &txn, 0); CKERR(r);
r = db->put(db, txn, dbt_init(&key, "a", 2), dbt_init(&val, "c", 2), DB_YESOVERWRITE); CKERR(r);
r = db->put(db, txn, dbt_init(&key, "a", 2), dbt_init(&val, "c", 2), 0); CKERR(r);
cursor=cursor;
......
......@@ -35,7 +35,7 @@ test_cursor_delete_2119 (u_int32_t c_del_flags, u_int32_t txn_isolation_flags) {
r = txn->commit(txn, 0); CKERR(r);
r = dbenv->txn_begin(dbenv, 0, &txn, txn_isolation_flags); CKERR(r);
r = db->put(db, txn, dbt_init(&key, "a", 2), dbt_init(&val, "b", 2), DB_YESOVERWRITE); CKERR(r);
r = db->put(db, txn, dbt_init(&key, "a", 2), dbt_init(&val, "b", 2), 0); CKERR(r);
r = txn->commit(txn, 0); CKERR(r);
r = dbenv->txn_begin(dbenv, 0, &txn, txn_isolation_flags); CKERR(r);
......@@ -43,7 +43,7 @@ test_cursor_delete_2119 (u_int32_t c_del_flags, u_int32_t txn_isolation_flags) {
r = txn->commit(txn, 0); CKERR(r);
r = dbenv->txn_begin(dbenv, 0, &txn, txn_isolation_flags); CKERR(r);
r = db->put(db, txn, dbt_init(&key, "a", 2), dbt_init(&val, "c", 2), DB_YESOVERWRITE); CKERR(r);
r = db->put(db, txn, dbt_init(&key, "a", 2), dbt_init(&val, "c", 2), 0); CKERR(r);
cursor=cursor;
......
......@@ -51,11 +51,11 @@ insert (void) {
dbt_init(&key, "key", sizeof("key"));
dbt_init(&value, "value1", sizeof("value1"));
r = db->put(db, null_txn, &key, &value, DB_YESOVERWRITE); CKERR(r);
r = db->put(db, null_txn, &key, &value, 0); CKERR(r);
dbt_init(&key, "key2", sizeof("key2"));
dbt_init(&value, "value2", sizeof("value2"));
r = db->put(db, null_txn, &key, &value, DB_YESOVERWRITE); CKERR(r);
r = db->put(db, null_txn, &key, &value, 0); CKERR(r);
}
static void
......
......@@ -32,7 +32,7 @@ put (int _key, int _data) {
data.size = 0;
}
r = db->put(db, null_txn, &key, &data, DB_YESOVERWRITE);
r = db->put(db, null_txn, &key, &data, 0);
CKERR(r);
}
......
......@@ -213,7 +213,7 @@ test_insert (int n, int which) {
int k = last++;
DBT key, val;
u_int64_t called = num_called;
int r = db->put(db, txn, dbt_init(&key, &k, sizeof k), dbt_init(&val, &i, sizeof i), DB_YESOVERWRITE);
int r = db->put(db, txn, dbt_init(&key, &k, sizeof k), dbt_init(&val, &i, sizeof i), 0);
if (i>0) assert(num_called > called);
CKERR(r);
}
......
......@@ -99,14 +99,13 @@ get_bad_flags (DB* db, u_int32_t flags, int r_expect, int keyint, int dataint) {
#ifdef USE_TDB
#define EINVAL_FOR_TDB_OK_FOR_BDB EINVAL
#else
#define DB_YESOVERWRITE 0 //This is just so test numbers stay the same.
#define EINVAL_FOR_TDB_OK_FOR_BDB 0
#endif
PUT_TEST put_tests[] = {
{0, DB_NODUPDATA, EINVAL, 0, 0}, //r_expect must change to 0, once implemented.
{0, DB_YESOVERWRITE, 0, 0, 0},
{0, 0, 0, 0, 0},
{0, DB_NOOVERWRITE, 0, 0, 0},
{0, 0, 0, 0, 0},
};
......@@ -115,9 +114,9 @@ const int num_put = sizeof(put_tests) / sizeof(put_tests[0]);
GET_TEST get_tests[] = {
{{0, 0, 0, 0, 0}, 0 , 0, 0, 0},
{{0, 0, 0, 0, 0}, 0 , 0, 0, 0},
{{0, DB_YESOVERWRITE, 0, 0, 0}, 0 , 0, 0, 0},
{{0, DB_YESOVERWRITE, 0, 0, 0}, 0 , 0, 0, 0},
{{0, DB_YESOVERWRITE, 0, 0, 0}, DB_RMW, EINVAL, 0, 0},
{{0, 0, 0, 0, 0}, 0 , 0, 0, 0},
{{0, 0, 0, 0, 0}, 0 , 0, 0, 0},
{{0, 0, 0, 0, 0}, DB_RMW, EINVAL, 0, 0},
{{0, 0, 0, 0, 0}, DB_RMW, EINVAL, 0, 0},
};
const int num_get = sizeof(get_tests) / sizeof(get_tests[0]);
......
......@@ -29,7 +29,7 @@ put(BOOL success, char txn, int _key, int _data) {
r = db->put(db, txns[(int)txn],
dbt_init(&key, &_key, sizeof(int)),
dbt_init(&data, &_data, sizeof(int)),
DB_YESOVERWRITE);
0);
if (success) CKERR(r);
else CKERR2s(r, DB_LOCK_DEADLOCK, DB_LOCK_NOTGRANTED);
......
......@@ -27,7 +27,7 @@ put(BOOL success, char txn, int _key, int _data) {
r = db->put(db, txns[(int)txn],
dbt_init(&key, &_key, sizeof(int)),
dbt_init(&data, &_data, sizeof(int)),
DB_YESOVERWRITE);
0);
if (success) CKERR(r);
else CKERR2s(r, DB_LOCK_DEADLOCK, DB_LOCK_NOTGRANTED);
......
......@@ -25,7 +25,7 @@ test_get (void) {
r = db_create (&db, env, 0); assert(r == 0);
r = db->open(db, null_txn, fname, "main", DB_BTREE, DB_CREATE, 0666); assert(r == 0);
dbt_init(&key, "a", 2);
r = db->put(db, null_txn, &key, dbt_init(&data, "b", 2), DB_YESOVERWRITE); assert(r==0);
r = db->put(db, null_txn, &key, dbt_init(&data, "b", 2), 0); assert(r==0);
memset(&data, 0, sizeof(data));
r = db->get(db, null_txn, &key, &data, 0); assert(r == 0);
assert(strcmp(data.data, "b")==0);
......
......@@ -10,15 +10,10 @@
#include <sys/stat.h>
#include <db.h>
#ifdef USE_BDB
#define DB_YESOVERWRITE 0
#endif
static int
db_put (DB *db, DB_TXN *txn, int k, int v) {
DBT key, val;
int r = db->put(db, txn, dbt_init(&key, &k, sizeof k), dbt_init(&val, &v, sizeof v), DB_YESOVERWRITE);
int r = db->put(db, txn, dbt_init(&key, &k, sizeof k), dbt_init(&val, &v, sizeof v), 0);
return r;
}
......
......@@ -38,7 +38,7 @@ test_insert_delete_insert (void) {
int k = htonl(1), v = 2;
DBT key, val;
r = db->put(db, null_txn, dbt_init(&key, &k, sizeof k), dbt_init(&val, &v, sizeof v), DB_YESOVERWRITE);
r = db->put(db, null_txn, dbt_init(&key, &k, sizeof k), dbt_init(&val, &v, sizeof v), 0);
assert(r == 0);
r = cursor->c_get(cursor, dbt_init(&key, &k, sizeof k), dbt_init_malloc(&val), DB_SET);
......@@ -53,7 +53,7 @@ test_insert_delete_insert (void) {
if (key.data) toku_free(key.data);
if (val.data) toku_free(val.data);
r = db->put(db, null_txn, dbt_init(&key, &k, sizeof k), dbt_init(&val, &v, sizeof v), DB_YESOVERWRITE);
r = db->put(db, null_txn, dbt_init(&key, &k, sizeof k), dbt_init(&val, &v, sizeof v), 0);
assert(r == 0);
r = cursor->c_get(cursor, dbt_init_malloc(&key), dbt_init_malloc(&val), DB_CURRENT);
......
......@@ -56,7 +56,7 @@ static void test_key_size_limit (void) {
memset(v, 0, vs);
memcpy(v, &vs, sizeof vs);
DBT key, val;
r = db->put(db, null_txn, dbt_init(&key, k, ks), dbt_init(&val, v, vs), DB_YESOVERWRITE);
r = db->put(db, null_txn, dbt_init(&key, k, ks), dbt_init(&val, v, vs), 0);
if (r == 0) {
bigest = mi;
lo = mi+1;
......@@ -115,7 +115,7 @@ static void test_data_size_limit (void) {
memset(v, 0, vs);
memcpy(v, &vs, sizeof vs);
DBT key, val;
r = db->put(db, null_txn, dbt_init(&key, k, ks), dbt_init(&val, v, vs), DB_YESOVERWRITE);
r = db->put(db, null_txn, dbt_init(&key, k, ks), dbt_init(&val, v, vs), 0);
if (r == 0) {
bigest = mi;
lo = mi+1;
......
......@@ -95,7 +95,7 @@ test_reverse_compare (int n) {
dbt_init(&key, &k, sizeof k);
v = htonl(i);
dbt_init(&val, &v, sizeof v);
r = db->put(db, null_txn, &key, &val, DB_YESOVERWRITE);
r = db->put(db, null_txn, &key, &val, 0);
CKERR(r);
}
......@@ -121,7 +121,7 @@ test_reverse_compare (int n) {
dbt_init(&key, &k, sizeof k);
v = htonl(i);
dbt_init(&val, &v, sizeof v);
r = db->put(db, null_txn, &key, &val, DB_YESOVERWRITE);
r = db->put(db, null_txn, &key, &val, 0);
CKERR(r);
}
......
......@@ -26,7 +26,7 @@ struct db_inserter {
static int
db_put (DB *db, my_t k, my_t v) {
DBT key, val;
int r = db->put(db, 0, dbt_init(&key, &k, sizeof k), dbt_init(&val, &v, sizeof v), DB_YESOVERWRITE);
int r = db->put(db, 0, dbt_init(&key, &k, sizeof k), dbt_init(&val, &v, sizeof v), 0);
return r;
}
......
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.
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