Commit 580f5caa authored by Yoni Fogel's avatar Yoni Fogel

Addresses #2037 refs[t:2037] Merged #2037 back into main

git-svn-id: file:///svn/toku/tokudb@15562 c7de825b-a66e-492c-adef-691d508d4ae1
parent 805eef87
......@@ -6,7 +6,13 @@ TOKUROOT=./
include $(TOKUROOT)toku_include/Makefile.include
default: build
SRCDIRS = $(OS_CHOICE) newbrt src/range_tree src/lock_tree src cxx utils db-benchmark-test db-benchmark-test-cxx
ifeq ($(TOKU_SKIP_CXX),1)
SRCDIRS_CXX =
else
SRCDIRS_CXX = cxx db-benchmark-test-cxx
endif
SRCDIRS = $(OS_CHOICE) newbrt src/range_tree src/lock_tree src utils db-benchmark-test $(SRCDIRS_CXX)
BUILDDIRS = $(SRCDIRS) man/texi
newbrt.dir: $(OS_CHOICE).dir
......
......@@ -114,8 +114,6 @@ typedef enum {
#define DB_INIT_MPOOL 16384
#define DB_CLOSE_DONT_TRIM_LOG 1048576
#define DB_INIT_TXN 32768
#define DB_USE_ENVIRON 512
#define DB_USE_ENVIRON_ROOT 1024
#define DB_KEYEXIST -30997
#define DB_LOCK_DEADLOCK -30996
#define DB_LOCK_NOTGRANTED -30995
......@@ -173,47 +171,49 @@ struct __toku_db_env {
int (*set_default_dup_compare) (DB_ENV*,int (*bt_compare) (DB *, const DBT *, const DBT *)) /* Set default (val) comparison function for all DBs in this environment. Required for RECOVERY since you cannot open the DBs manually. */;
void *app_private; /* 32-bit offset=36 size=4, 64=bit offset=72 size=8 */
int (*get_engine_status) (DB_ENV*, ENGINE_STATUS*) /* Fill in status struct */;
void* __toku_dummy0[26];
int (*get_iname) (DB_ENV* env, DBT* dname_dbt, DBT* iname_dbt) /* lookup existing iname */;
void* __toku_dummy0[25];
char __toku_dummy1[64];
void *api1_internal; /* 32-bit offset=212 size=4, 64=bit offset=360 size=8 */
void* __toku_dummy2[7];
int (*close) (DB_ENV *, u_int32_t); /* 32-bit offset=244 size=4, 64=bit offset=424 size=8 */
void* __toku_dummy3[2];
int (*dbremove) (DB_ENV *, DB_TXN *, const char *, const char *, u_int32_t); /* 32-bit offset=248 size=4, 64=bit offset=432 size=8 */
int (*dbrename) (DB_ENV *, DB_TXN *, const char *, const char *, const char *, u_int32_t); /* 32-bit offset=252 size=4, 64=bit offset=440 size=8 */
void (*err) (const DB_ENV *, int, const char *, ...); /* 32-bit offset=256 size=4, 64=bit offset=448 size=8 */
void* __toku_dummy4[1];
void* __toku_dummy3[1];
int (*open) (DB_ENV *, const char *, u_int32_t, int); /* 32-bit offset=264 size=4, 64=bit offset=464 size=8 */
void* __toku_dummy5[1];
void* __toku_dummy4[1];
int (*set_data_dir) (DB_ENV *, const char *); /* 32-bit offset=272 size=4, 64=bit offset=480 size=8 */
void* __toku_dummy6[3];
void* __toku_dummy5[3];
void (*set_errcall) (DB_ENV *, void (*)(const char *, char *)); /* 32-bit offset=288 size=4, 64=bit offset=512 size=8 */
void (*set_errfile) (DB_ENV *, FILE*); /* 32-bit offset=292 size=4, 64=bit offset=520 size=8 */
void (*set_errpfx) (DB_ENV *, const char *); /* 32-bit offset=296 size=4, 64=bit offset=528 size=8 */
void* __toku_dummy7[1];
void* __toku_dummy6[1];
int (*set_flags) (DB_ENV *, u_int32_t, int); /* 32-bit offset=304 size=4, 64=bit offset=544 size=8 */
void* __toku_dummy8[4];
void* __toku_dummy7[4];
int (*set_tmp_dir) (DB_ENV *, const char *); /* 32-bit offset=324 size=4, 64=bit offset=584 size=8 */
int (*set_verbose) (DB_ENV *, u_int32_t, int); /* 32-bit offset=328 size=4, 64=bit offset=592 size=8 */
void* __toku_dummy9[1];
void* __toku_dummy8[1];
int (*set_lg_bsize) (DB_ENV *, u_int32_t); /* 32-bit offset=336 size=4, 64=bit offset=608 size=8 */
int (*set_lg_dir) (DB_ENV *, const char *); /* 32-bit offset=340 size=4, 64=bit offset=616 size=8 */
int (*set_lg_max) (DB_ENV *, u_int32_t); /* 32-bit offset=344 size=4, 64=bit offset=624 size=8 */
void* __toku_dummy10[1];
void* __toku_dummy9[1];
int (*log_archive) (DB_ENV *, char **[], u_int32_t); /* 32-bit offset=352 size=4, 64=bit offset=640 size=8 */
void* __toku_dummy11[2];
void* __toku_dummy10[2];
int (*log_flush) (DB_ENV *, const DB_LSN *); /* 32-bit offset=364 size=4, 64=bit offset=664 size=8 */
void* __toku_dummy12[4];
void* __toku_dummy11[4];
int (*set_lk_detect) (DB_ENV *, u_int32_t); /* 32-bit offset=384 size=4, 64=bit offset=704 size=8 */
int (*set_lk_max) (DB_ENV *, u_int32_t); /* 32-bit offset=388 size=4, 64=bit offset=712 size=8 */
int (*set_lk_max_locks) (DB_ENV *, u_int32_t); /* 32-bit offset=392 size=4, 64=bit offset=720 size=8 */
void* __toku_dummy13[14];
void* __toku_dummy12[14];
int (*set_cachesize) (DB_ENV *, u_int32_t, u_int32_t, int); /* 32-bit offset=452 size=4, 64=bit offset=840 size=8 */
void* __toku_dummy14[21];
void* __toku_dummy13[21];
int (*txn_begin) (DB_ENV *, DB_TXN *, DB_TXN **, u_int32_t); /* 32-bit offset=540 size=4, 64=bit offset=1016 size=8 */
int (*txn_checkpoint) (DB_ENV *, u_int32_t, u_int32_t, u_int32_t); /* 32-bit offset=544 size=4, 64=bit offset=1024 size=8 */
void* __toku_dummy15[2];
void* __toku_dummy14[2];
int (*txn_stat) (DB_ENV *, DB_TXN_STAT **, u_int32_t); /* 32-bit offset=556 size=4, 64=bit offset=1048 size=8 */
void* __toku_dummy16[2]; /* Padding at the end */
char __toku_dummy17[8]; /* Padding at the end */
void* __toku_dummy15[2]; /* Padding at the end */
char __toku_dummy16[8]; /* Padding at the end */
};
struct __toku_db_key_range {
double less; /* 32-bit offset=0 size=8, 64=bit offset=0 size=8 */
......
......@@ -114,8 +114,6 @@ typedef enum {
#define DB_INIT_MPOOL 32768
#define DB_CLOSE_DONT_TRIM_LOG 1048576
#define DB_INIT_TXN 131072
#define DB_USE_ENVIRON 1024
#define DB_USE_ENVIRON_ROOT 2048
#define DB_KEYEXIST -30996
#define DB_LOCK_DEADLOCK -30995
#define DB_LOCK_NOTGRANTED -30994
......@@ -174,57 +172,58 @@ struct __toku_db_env {
int (*set_default_bt_compare) (DB_ENV*,int (*bt_compare) (DB *, const DBT *, const DBT *)) /* Set default (key) comparison function for all DBs in this environment. Required for RECOVERY since you cannot open the DBs manually. */;
int (*set_default_dup_compare) (DB_ENV*,int (*bt_compare) (DB *, const DBT *, const DBT *)) /* Set default (val) comparison function for all DBs in this environment. Required for RECOVERY since you cannot open the DBs manually. */;
int (*get_engine_status) (DB_ENV*, ENGINE_STATUS*) /* Fill in status struct */;
void* __toku_dummy0[1];
int (*get_iname) (DB_ENV* env, DBT* dname_dbt, DBT* iname_dbt) /* lookup existing iname */;
void *app_private; /* 32-bit offset=44 size=4, 64=bit offset=88 size=8 */
void* __toku_dummy1[25];
char __toku_dummy2[96];
void* __toku_dummy0[25];
char __toku_dummy1[96];
void *api1_internal; /* 32-bit offset=244 size=4, 64=bit offset=392 size=8 */
void* __toku_dummy3[7];
void* __toku_dummy2[7];
int (*close) (DB_ENV *, u_int32_t); /* 32-bit offset=276 size=4, 64=bit offset=456 size=8 */
void* __toku_dummy4[2];
int (*dbremove) (DB_ENV *, DB_TXN *, const char *, const char *, u_int32_t); /* 32-bit offset=280 size=4, 64=bit offset=464 size=8 */
int (*dbrename) (DB_ENV *, DB_TXN *, const char *, const char *, const char *, u_int32_t); /* 32-bit offset=284 size=4, 64=bit offset=472 size=8 */
void (*err) (const DB_ENV *, int, const char *, ...); /* 32-bit offset=288 size=4, 64=bit offset=480 size=8 */
void* __toku_dummy5[1];
void* __toku_dummy3[1];
int (*open) (DB_ENV *, const char *, u_int32_t, int); /* 32-bit offset=296 size=4, 64=bit offset=496 size=8 */
void* __toku_dummy6[9];
void* __toku_dummy4[9];
int (*set_data_dir) (DB_ENV *, const char *); /* 32-bit offset=336 size=4, 64=bit offset=576 size=8 */
void* __toku_dummy7[2];
void* __toku_dummy5[2];
void (*set_errcall) (DB_ENV *, void (*)(const DB_ENV *, const char *, const char *)); /* 32-bit offset=348 size=4, 64=bit offset=600 size=8 */
void* __toku_dummy8[1];
void* __toku_dummy6[1];
void (*set_errfile) (DB_ENV *, FILE*); /* 32-bit offset=356 size=4, 64=bit offset=616 size=8 */
void* __toku_dummy9[1];
void* __toku_dummy7[1];
void (*set_errpfx) (DB_ENV *, const char *); /* 32-bit offset=364 size=4, 64=bit offset=632 size=8 */
void* __toku_dummy10[1];
void* __toku_dummy8[1];
int (*get_flags) (DB_ENV *, u_int32_t *); /* 32-bit offset=372 size=4, 64=bit offset=648 size=8 */
int (*set_flags) (DB_ENV *, u_int32_t, int); /* 32-bit offset=376 size=4, 64=bit offset=656 size=8 */
void* __toku_dummy11[13];
void* __toku_dummy9[13];
int (*set_tmp_dir) (DB_ENV *, const char *); /* 32-bit offset=432 size=4, 64=bit offset=768 size=8 */
void* __toku_dummy12[1];
void* __toku_dummy10[1];
int (*set_verbose) (DB_ENV *, u_int32_t, int); /* 32-bit offset=440 size=4, 64=bit offset=784 size=8 */
void* __toku_dummy13[2];
void* __toku_dummy11[2];
int (*set_lg_bsize) (DB_ENV *, u_int32_t); /* 32-bit offset=452 size=4, 64=bit offset=808 size=8 */
void* __toku_dummy14[1];
void* __toku_dummy12[1];
int (*set_lg_dir) (DB_ENV *, const char *); /* 32-bit offset=460 size=4, 64=bit offset=824 size=8 */
int (*get_lg_max) (DB_ENV *, u_int32_t*); /* 32-bit offset=464 size=4, 64=bit offset=832 size=8 */
int (*set_lg_max) (DB_ENV *, u_int32_t); /* 32-bit offset=468 size=4, 64=bit offset=840 size=8 */
void* __toku_dummy15[2];
void* __toku_dummy13[2];
int (*log_archive) (DB_ENV *, char **[], u_int32_t); /* 32-bit offset=480 size=4, 64=bit offset=864 size=8 */
void* __toku_dummy16[2];
void* __toku_dummy14[2];
int (*log_flush) (DB_ENV *, const DB_LSN *); /* 32-bit offset=492 size=4, 64=bit offset=888 size=8 */
void* __toku_dummy17[7];
void* __toku_dummy15[7];
int (*set_lk_detect) (DB_ENV *, u_int32_t); /* 32-bit offset=524 size=4, 64=bit offset=952 size=8 */
int (*set_lk_max) (DB_ENV *, u_int32_t); /* 32-bit offset=528 size=4, 64=bit offset=960 size=8 */
int (*get_lk_max_locks) (DB_ENV *, u_int32_t *); /* 32-bit offset=532 size=4, 64=bit offset=968 size=8 */
int (*set_lk_max_locks) (DB_ENV *, u_int32_t); /* 32-bit offset=536 size=4, 64=bit offset=976 size=8 */
void* __toku_dummy18[13];
void* __toku_dummy16[13];
int (*get_cachesize) (DB_ENV *, u_int32_t *, u_int32_t *, int *); /* 32-bit offset=592 size=4, 64=bit offset=1088 size=8 */
int (*set_cachesize) (DB_ENV *, u_int32_t, u_int32_t, int); /* 32-bit offset=596 size=4, 64=bit offset=1096 size=8 */
void* __toku_dummy19[28];
void* __toku_dummy17[28];
int (*txn_begin) (DB_ENV *, DB_TXN *, DB_TXN **, u_int32_t); /* 32-bit offset=712 size=4, 64=bit offset=1328 size=8 */
int (*txn_checkpoint) (DB_ENV *, u_int32_t, u_int32_t, u_int32_t); /* 32-bit offset=716 size=4, 64=bit offset=1336 size=8 */
void* __toku_dummy20[1];
void* __toku_dummy18[1];
int (*txn_stat) (DB_ENV *, DB_TXN_STAT **, u_int32_t); /* 32-bit offset=724 size=4, 64=bit offset=1352 size=8 */
void* __toku_dummy21[3]; /* Padding at the end */
char __toku_dummy22[16]; /* Padding at the end */
void* __toku_dummy19[3]; /* Padding at the end */
char __toku_dummy20[16]; /* Padding at the end */
};
struct __toku_db_key_range {
double less; /* 32-bit offset=0 size=8, 64=bit offset=0 size=8 */
......
......@@ -114,8 +114,6 @@ typedef enum {
#define DB_INIT_MPOOL 65536
#define DB_CLOSE_DONT_TRIM_LOG 1048576
#define DB_INIT_TXN 262144
#define DB_USE_ENVIRON 2048
#define DB_USE_ENVIRON_ROOT 4096
#define DB_READ_UNCOMMITTED 67108864
#define DB_KEYEXIST -30996
#define DB_LOCK_DEADLOCK -30995
......@@ -175,59 +173,60 @@ struct __toku_db_env {
int (*set_default_bt_compare) (DB_ENV*,int (*bt_compare) (DB *, const DBT *, const DBT *)) /* Set default (key) comparison function for all DBs in this environment. Required for RECOVERY since you cannot open the DBs manually. */;
int (*set_default_dup_compare) (DB_ENV*,int (*bt_compare) (DB *, const DBT *, const DBT *)) /* Set default (val) comparison function for all DBs in this environment. Required for RECOVERY since you cannot open the DBs manually. */;
int (*get_engine_status) (DB_ENV*, ENGINE_STATUS*) /* Fill in status struct */;
void* __toku_dummy0[1];
int (*get_iname) (DB_ENV* env, DBT* dname_dbt, DBT* iname_dbt) /* lookup existing iname */;
void *app_private; /* 32-bit offset=44 size=4, 64=bit offset=88 size=8 */
void* __toku_dummy1[40];
char __toku_dummy2[128];
void* __toku_dummy0[40];
char __toku_dummy1[128];
void *api1_internal; /* 32-bit offset=336 size=4, 64=bit offset=544 size=8 */
void* __toku_dummy3[7];
void* __toku_dummy2[7];
int (*close) (DB_ENV *, u_int32_t); /* 32-bit offset=368 size=4, 64=bit offset=608 size=8 */
void* __toku_dummy4[2];
int (*dbremove) (DB_ENV *, DB_TXN *, const char *, const char *, u_int32_t); /* 32-bit offset=372 size=4, 64=bit offset=616 size=8 */
int (*dbrename) (DB_ENV *, DB_TXN *, const char *, const char *, const char *, u_int32_t); /* 32-bit offset=376 size=4, 64=bit offset=624 size=8 */
void (*err) (const DB_ENV *, int, const char *, ...); /* 32-bit offset=380 size=4, 64=bit offset=632 size=8 */
void* __toku_dummy5[3];
void* __toku_dummy3[3];
int (*get_cachesize) (DB_ENV *, u_int32_t *, u_int32_t *, int *); /* 32-bit offset=396 size=4, 64=bit offset=664 size=8 */
void* __toku_dummy6[4];
void* __toku_dummy4[4];
int (*get_flags) (DB_ENV *, u_int32_t *); /* 32-bit offset=416 size=4, 64=bit offset=704 size=8 */
void* __toku_dummy7[4];
void* __toku_dummy5[4];
int (*get_lg_max) (DB_ENV *, u_int32_t*); /* 32-bit offset=436 size=4, 64=bit offset=744 size=8 */
void* __toku_dummy8[4];
void* __toku_dummy6[4];
int (*get_lk_max_locks) (DB_ENV *, u_int32_t *); /* 32-bit offset=456 size=4, 64=bit offset=784 size=8 */
void* __toku_dummy9[22];
void* __toku_dummy7[22];
int (*log_archive) (DB_ENV *, char **[], u_int32_t); /* 32-bit offset=548 size=4, 64=bit offset=968 size=8 */
void* __toku_dummy10[2];
void* __toku_dummy8[2];
int (*log_flush) (DB_ENV *, const DB_LSN *); /* 32-bit offset=560 size=4, 64=bit offset=992 size=8 */
void* __toku_dummy11[25];
void* __toku_dummy9[25];
int (*open) (DB_ENV *, const char *, u_int32_t, int); /* 32-bit offset=664 size=4, 64=bit offset=1200 size=8 */
void* __toku_dummy12[12];
void* __toku_dummy10[12];
int (*set_cachesize) (DB_ENV *, u_int32_t, u_int32_t, int); /* 32-bit offset=716 size=4, 64=bit offset=1304 size=8 */
int (*set_data_dir) (DB_ENV *, const char *); /* 32-bit offset=720 size=4, 64=bit offset=1312 size=8 */
void* __toku_dummy13[1];
void* __toku_dummy11[1];
void (*set_errcall) (DB_ENV *, void (*)(const DB_ENV *, const char *, const char *)); /* 32-bit offset=728 size=4, 64=bit offset=1328 size=8 */
void (*set_errfile) (DB_ENV *, FILE*); /* 32-bit offset=732 size=4, 64=bit offset=1336 size=8 */
void (*set_errpfx) (DB_ENV *, const char *); /* 32-bit offset=736 size=4, 64=bit offset=1344 size=8 */
void* __toku_dummy14[1];
void* __toku_dummy12[1];
int (*set_flags) (DB_ENV *, u_int32_t, int); /* 32-bit offset=744 size=4, 64=bit offset=1360 size=8 */
void* __toku_dummy15[2];
void* __toku_dummy13[2];
int (*set_lg_bsize) (DB_ENV *, u_int32_t); /* 32-bit offset=756 size=4, 64=bit offset=1384 size=8 */
int (*set_lg_dir) (DB_ENV *, const char *); /* 32-bit offset=760 size=4, 64=bit offset=1392 size=8 */
void* __toku_dummy16[1];
void* __toku_dummy14[1];
int (*set_lg_max) (DB_ENV *, u_int32_t); /* 32-bit offset=768 size=4, 64=bit offset=1408 size=8 */
void* __toku_dummy17[2];
void* __toku_dummy15[2];
int (*set_lk_detect) (DB_ENV *, u_int32_t); /* 32-bit offset=780 size=4, 64=bit offset=1432 size=8 */
int (*set_lk_max) (DB_ENV *, u_int32_t); /* 32-bit offset=784 size=4, 64=bit offset=1440 size=8 */
void* __toku_dummy18[1];
void* __toku_dummy16[1];
int (*set_lk_max_locks) (DB_ENV *, u_int32_t); /* 32-bit offset=792 size=4, 64=bit offset=1456 size=8 */
void* __toku_dummy19[16];
void* __toku_dummy17[16];
int (*set_tmp_dir) (DB_ENV *, const char *); /* 32-bit offset=860 size=4, 64=bit offset=1592 size=8 */
void* __toku_dummy20[2];
void* __toku_dummy18[2];
int (*set_verbose) (DB_ENV *, u_int32_t, int); /* 32-bit offset=872 size=4, 64=bit offset=1616 size=8 */
void* __toku_dummy21[1];
void* __toku_dummy19[1];
int (*txn_begin) (DB_ENV *, DB_TXN *, DB_TXN **, u_int32_t); /* 32-bit offset=880 size=4, 64=bit offset=1632 size=8 */
int (*txn_checkpoint) (DB_ENV *, u_int32_t, u_int32_t, u_int32_t); /* 32-bit offset=884 size=4, 64=bit offset=1640 size=8 */
void* __toku_dummy22[1];
void* __toku_dummy20[1];
int (*txn_stat) (DB_ENV *, DB_TXN_STAT **, u_int32_t); /* 32-bit offset=892 size=4, 64=bit offset=1656 size=8 */
void* __toku_dummy23[2]; /* Padding at the end */
char __toku_dummy24[16]; /* Padding at the end */
void* __toku_dummy21[2]; /* Padding at the end */
char __toku_dummy22[16]; /* Padding at the end */
};
struct __toku_db_key_range {
double less; /* 32-bit offset=0 size=8, 64=bit offset=0 size=8 */
......
......@@ -114,8 +114,6 @@ typedef enum {
#define DB_INIT_MPOOL 131072
#define DB_CLOSE_DONT_TRIM_LOG 1048576
#define DB_INIT_TXN 524288
#define DB_USE_ENVIRON 4096
#define DB_USE_ENVIRON_ROOT 8192
#define DB_READ_UNCOMMITTED 134217728
#define DB_KEYEXIST -30996
#define DB_LOCK_DEADLOCK -30995
......@@ -175,58 +173,60 @@ struct __toku_db_env {
int (*set_default_bt_compare) (DB_ENV*,int (*bt_compare) (DB *, const DBT *, const DBT *)) /* Set default (key) comparison function for all DBs in this environment. Required for RECOVERY since you cannot open the DBs manually. */;
int (*set_default_dup_compare) (DB_ENV*,int (*bt_compare) (DB *, const DBT *, const DBT *)) /* Set default (val) comparison function for all DBs in this environment. Required for RECOVERY since you cannot open the DBs manually. */;
int (*get_engine_status) (DB_ENV*, ENGINE_STATUS*) /* Fill in status struct */;
void* __toku_dummy0[3];
int (*get_iname) (DB_ENV* env, DBT* dname_dbt, DBT* iname_dbt) /* lookup existing iname */;
void* __toku_dummy0[2];
void *app_private; /* 32-bit offset=52 size=4, 64=bit offset=104 size=8 */
void* __toku_dummy1[38];
char __toku_dummy2[128];
void *api1_internal; /* 32-bit offset=336 size=4, 64=bit offset=544 size=8 */
void* __toku_dummy3[8];
int (*close) (DB_ENV *, u_int32_t); /* 32-bit offset=372 size=4, 64=bit offset=616 size=8 */
void* __toku_dummy4[2];
int (*dbremove) (DB_ENV *, DB_TXN *, const char *, const char *, u_int32_t); /* 32-bit offset=376 size=4, 64=bit offset=624 size=8 */
int (*dbrename) (DB_ENV *, DB_TXN *, const char *, const char *, const char *, u_int32_t); /* 32-bit offset=380 size=4, 64=bit offset=632 size=8 */
void (*err) (const DB_ENV *, int, const char *, ...); /* 32-bit offset=384 size=4, 64=bit offset=640 size=8 */
void* __toku_dummy5[3];
void* __toku_dummy4[3];
int (*get_cachesize) (DB_ENV *, u_int32_t *, u_int32_t *, int *); /* 32-bit offset=400 size=4, 64=bit offset=672 size=8 */
void* __toku_dummy6[4];
void* __toku_dummy5[4];
int (*get_flags) (DB_ENV *, u_int32_t *); /* 32-bit offset=420 size=4, 64=bit offset=712 size=8 */
void* __toku_dummy7[4];
void* __toku_dummy6[4];
int (*get_lg_max) (DB_ENV *, u_int32_t*); /* 32-bit offset=440 size=4, 64=bit offset=752 size=8 */
void* __toku_dummy8[4];
void* __toku_dummy7[4];
int (*get_lk_max_locks) (DB_ENV *, u_int32_t *); /* 32-bit offset=460 size=4, 64=bit offset=792 size=8 */
void* __toku_dummy9[21];
void* __toku_dummy8[21];
int (*log_archive) (DB_ENV *, char **[], u_int32_t); /* 32-bit offset=548 size=4, 64=bit offset=968 size=8 */
void* __toku_dummy10[2];
void* __toku_dummy9[2];
int (*log_flush) (DB_ENV *, const DB_LSN *); /* 32-bit offset=560 size=4, 64=bit offset=992 size=8 */
void* __toku_dummy11[25];
void* __toku_dummy10[25];
int (*open) (DB_ENV *, const char *, u_int32_t, int); /* 32-bit offset=664 size=4, 64=bit offset=1200 size=8 */
void* __toku_dummy12[27];
void* __toku_dummy11[27];
int (*set_cachesize) (DB_ENV *, u_int32_t, u_int32_t, int); /* 32-bit offset=776 size=4, 64=bit offset=1424 size=8 */
int (*set_data_dir) (DB_ENV *, const char *); /* 32-bit offset=780 size=4, 64=bit offset=1432 size=8 */
void* __toku_dummy13[1];
void* __toku_dummy12[1];
void (*set_errcall) (DB_ENV *, void (*)(const DB_ENV *, const char *, const char *)); /* 32-bit offset=788 size=4, 64=bit offset=1448 size=8 */
void (*set_errfile) (DB_ENV *, FILE*); /* 32-bit offset=792 size=4, 64=bit offset=1456 size=8 */
void (*set_errpfx) (DB_ENV *, const char *); /* 32-bit offset=796 size=4, 64=bit offset=1464 size=8 */
void* __toku_dummy14[2];
void* __toku_dummy13[2];
int (*set_flags) (DB_ENV *, u_int32_t, int); /* 32-bit offset=808 size=4, 64=bit offset=1488 size=8 */
void* __toku_dummy15[2];
void* __toku_dummy14[2];
int (*set_lg_bsize) (DB_ENV *, u_int32_t); /* 32-bit offset=820 size=4, 64=bit offset=1512 size=8 */
int (*set_lg_dir) (DB_ENV *, const char *); /* 32-bit offset=824 size=4, 64=bit offset=1520 size=8 */
void* __toku_dummy16[1];
void* __toku_dummy15[1];
int (*set_lg_max) (DB_ENV *, u_int32_t); /* 32-bit offset=832 size=4, 64=bit offset=1536 size=8 */
void* __toku_dummy17[2];
void* __toku_dummy16[2];
int (*set_lk_detect) (DB_ENV *, u_int32_t); /* 32-bit offset=844 size=4, 64=bit offset=1560 size=8 */
void* __toku_dummy18[1];
void* __toku_dummy17[1];
int (*set_lk_max_locks) (DB_ENV *, u_int32_t); /* 32-bit offset=852 size=4, 64=bit offset=1576 size=8 */
void* __toku_dummy19[14];
void* __toku_dummy18[14];
int (*set_tmp_dir) (DB_ENV *, const char *); /* 32-bit offset=912 size=4, 64=bit offset=1696 size=8 */
void* __toku_dummy20[2];
void* __toku_dummy19[2];
int (*set_verbose) (DB_ENV *, u_int32_t, int); /* 32-bit offset=924 size=4, 64=bit offset=1720 size=8 */
void* __toku_dummy21[1];
void* __toku_dummy20[1];
int (*txn_begin) (DB_ENV *, DB_TXN *, DB_TXN **, u_int32_t); /* 32-bit offset=932 size=4, 64=bit offset=1736 size=8 */
int (*txn_checkpoint) (DB_ENV *, u_int32_t, u_int32_t, u_int32_t); /* 32-bit offset=936 size=4, 64=bit offset=1744 size=8 */
void* __toku_dummy22[1];
void* __toku_dummy21[1];
int (*txn_stat) (DB_ENV *, DB_TXN_STAT **, u_int32_t); /* 32-bit offset=944 size=4, 64=bit offset=1760 size=8 */
void* __toku_dummy23[2]; /* Padding at the end */
char __toku_dummy24[16]; /* Padding at the end */
void* __toku_dummy22[2]; /* Padding at the end */
char __toku_dummy23[16]; /* Padding at the end */
};
struct __toku_db_key_range {
double less; /* 32-bit offset=0 size=8, 64=bit offset=0 size=8 */
......
......@@ -114,8 +114,6 @@ typedef enum {
#define DB_INIT_MPOOL 524288
#define DB_CLOSE_DONT_TRIM_LOG 1048576
#define DB_INIT_TXN 2097152
#define DB_USE_ENVIRON 16384
#define DB_USE_ENVIRON_ROOT 32768
#define DB_READ_UNCOMMITTED 134217728
#define DB_KEYEXIST -30996
#define DB_LOCK_DEADLOCK -30995
......@@ -177,59 +175,61 @@ struct __toku_db_env {
int (*set_default_bt_compare) (DB_ENV*,int (*bt_compare) (DB *, const DBT *, const DBT *)) /* Set default (key) comparison function for all DBs in this environment. Required for RECOVERY since you cannot open the DBs manually. */;
int (*set_default_dup_compare) (DB_ENV*,int (*bt_compare) (DB *, const DBT *, const DBT *)) /* Set default (val) comparison function for all DBs in this environment. Required for RECOVERY since you cannot open the DBs manually. */;
int (*get_engine_status) (DB_ENV*, ENGINE_STATUS*) /* Fill in status struct */;
void* __toku_dummy0[3];
int (*get_iname) (DB_ENV* env, DBT* dname_dbt, DBT* iname_dbt) /* lookup existing iname */;
void* __toku_dummy0[2];
void *app_private; /* 32-bit offset=52 size=4, 64=bit offset=104 size=8 */
void* __toku_dummy1[39];
char __toku_dummy2[144];
void *api1_internal; /* 32-bit offset=356 size=4, 64=bit offset=568 size=8 */
void* __toku_dummy3[8];
int (*close) (DB_ENV *, u_int32_t); /* 32-bit offset=392 size=4, 64=bit offset=640 size=8 */
void* __toku_dummy4[2];
int (*dbremove) (DB_ENV *, DB_TXN *, const char *, const char *, u_int32_t); /* 32-bit offset=396 size=4, 64=bit offset=648 size=8 */
int (*dbrename) (DB_ENV *, DB_TXN *, const char *, const char *, const char *, u_int32_t); /* 32-bit offset=400 size=4, 64=bit offset=656 size=8 */
void (*err) (const DB_ENV *, int, const char *, ...); /* 32-bit offset=404 size=4, 64=bit offset=664 size=8 */
void* __toku_dummy5[3];
void* __toku_dummy4[3];
int (*get_cachesize) (DB_ENV *, u_int32_t *, u_int32_t *, int *); /* 32-bit offset=420 size=4, 64=bit offset=696 size=8 */
void* __toku_dummy6[5];
void* __toku_dummy5[5];
int (*get_flags) (DB_ENV *, u_int32_t *); /* 32-bit offset=444 size=4, 64=bit offset=744 size=8 */
void* __toku_dummy7[4];
void* __toku_dummy6[4];
int (*get_lg_max) (DB_ENV *, u_int32_t*); /* 32-bit offset=464 size=4, 64=bit offset=784 size=8 */
void* __toku_dummy8[4];
void* __toku_dummy7[4];
int (*get_lk_max_locks) (DB_ENV *, u_int32_t *); /* 32-bit offset=484 size=4, 64=bit offset=824 size=8 */
void* __toku_dummy9[22];
void* __toku_dummy8[22];
int (*log_archive) (DB_ENV *, char **[], u_int32_t); /* 32-bit offset=576 size=4, 64=bit offset=1008 size=8 */
void* __toku_dummy10[2];
void* __toku_dummy9[2];
int (*log_flush) (DB_ENV *, const DB_LSN *); /* 32-bit offset=588 size=4, 64=bit offset=1032 size=8 */
void* __toku_dummy11[25];
void* __toku_dummy10[25];
int (*open) (DB_ENV *, const char *, u_int32_t, int); /* 32-bit offset=692 size=4, 64=bit offset=1240 size=8 */
void* __toku_dummy12[30];
void* __toku_dummy11[30];
int (*set_cachesize) (DB_ENV *, u_int32_t, u_int32_t, int); /* 32-bit offset=816 size=4, 64=bit offset=1488 size=8 */
void* __toku_dummy13[1];
void* __toku_dummy12[1];
int (*set_data_dir) (DB_ENV *, const char *); /* 32-bit offset=824 size=4, 64=bit offset=1504 size=8 */
void* __toku_dummy14[1];
void* __toku_dummy13[1];
void (*set_errcall) (DB_ENV *, void (*)(const DB_ENV *, const char *, const char *)); /* 32-bit offset=832 size=4, 64=bit offset=1520 size=8 */
void (*set_errfile) (DB_ENV *, FILE*); /* 32-bit offset=836 size=4, 64=bit offset=1528 size=8 */
void (*set_errpfx) (DB_ENV *, const char *); /* 32-bit offset=840 size=4, 64=bit offset=1536 size=8 */
void* __toku_dummy15[2];
void* __toku_dummy14[2];
int (*set_flags) (DB_ENV *, u_int32_t, int); /* 32-bit offset=852 size=4, 64=bit offset=1560 size=8 */
void* __toku_dummy16[2];
void* __toku_dummy15[2];
int (*set_lg_bsize) (DB_ENV *, u_int32_t); /* 32-bit offset=864 size=4, 64=bit offset=1584 size=8 */
int (*set_lg_dir) (DB_ENV *, const char *); /* 32-bit offset=868 size=4, 64=bit offset=1592 size=8 */
void* __toku_dummy17[1];
void* __toku_dummy16[1];
int (*set_lg_max) (DB_ENV *, u_int32_t); /* 32-bit offset=876 size=4, 64=bit offset=1608 size=8 */
void* __toku_dummy18[2];
void* __toku_dummy17[2];
int (*set_lk_detect) (DB_ENV *, u_int32_t); /* 32-bit offset=888 size=4, 64=bit offset=1632 size=8 */
void* __toku_dummy19[1];
void* __toku_dummy18[1];
int (*set_lk_max_locks) (DB_ENV *, u_int32_t); /* 32-bit offset=896 size=4, 64=bit offset=1648 size=8 */
void* __toku_dummy20[14];
void* __toku_dummy19[14];
int (*set_tmp_dir) (DB_ENV *, const char *); /* 32-bit offset=956 size=4, 64=bit offset=1768 size=8 */
void* __toku_dummy21[2];
void* __toku_dummy20[2];
int (*set_verbose) (DB_ENV *, u_int32_t, int); /* 32-bit offset=968 size=4, 64=bit offset=1792 size=8 */
void* __toku_dummy22[1];
void* __toku_dummy21[1];
int (*txn_begin) (DB_ENV *, DB_TXN *, DB_TXN **, u_int32_t); /* 32-bit offset=976 size=4, 64=bit offset=1808 size=8 */
int (*txn_checkpoint) (DB_ENV *, u_int32_t, u_int32_t, u_int32_t); /* 32-bit offset=980 size=4, 64=bit offset=1816 size=8 */
void* __toku_dummy23[1];
void* __toku_dummy22[1];
int (*txn_stat) (DB_ENV *, DB_TXN_STAT **, u_int32_t); /* 32-bit offset=988 size=4, 64=bit offset=1832 size=8 */
void* __toku_dummy24[2]; /* Padding at the end */
char __toku_dummy25[16]; /* Padding at the end */
void* __toku_dummy23[2]; /* Padding at the end */
char __toku_dummy24[16]; /* Padding at the end */
};
struct __toku_db_key_range {
double less; /* 32-bit offset=0 size=8, 64=bit offset=0 size=8 */
......
......@@ -85,8 +85,6 @@ void print_defines (void) {
dodefine(DB_INIT_MPOOL);
printf("#define DB_CLOSE_DONT_TRIM_LOG 1048576\n"); // tokudb
dodefine(DB_INIT_TXN);
dodefine(DB_USE_ENVIRON);
dodefine(DB_USE_ENVIRON_ROOT);
#ifdef DB_READ_UNCOMMITTED
dodefine(DB_READ_UNCOMMITTED);
......@@ -407,6 +405,7 @@ int main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__un
"int (*set_default_bt_compare) (DB_ENV*,int (*bt_compare) (DB *, const DBT *, const DBT *)) /* Set default (key) comparison function for all DBs in this environment. Required for RECOVERY since you cannot open the DBs manually. */",
"int (*set_default_dup_compare) (DB_ENV*,int (*bt_compare) (DB *, const DBT *, const DBT *)) /* Set default (val) comparison function for all DBs in this environment. Required for RECOVERY since you cannot open the DBs manually. */",
"int (*get_engine_status) (DB_ENV*, ENGINE_STATUS*) /* Fill in status struct */",
"int (*get_iname) (DB_ENV* env, DBT* dname_dbt, DBT* iname_dbt) /* lookup existing iname */",
NULL};
print_struct("db_env", 1, db_env_fields32, db_env_fields64, sizeof(db_env_fields32)/sizeof(db_env_fields32[0]), extra);
}
......
......@@ -105,6 +105,8 @@ void sample_db_env_offsets (void) {
STRUCT_SETUP(DB_ENV, txn_checkpoint, "int (*%s) (DB_ENV *, u_int32_t, u_int32_t, u_int32_t)");
STRUCT_SETUP(DB_ENV, txn_stat, "int (*%s) (DB_ENV *, DB_TXN_STAT **, u_int32_t)");
STRUCT_SETUP(DB_ENV, txn_begin, "int (*%s) (DB_ENV *, DB_TXN *, DB_TXN **, u_int32_t)");
STRUCT_SETUP(DB_ENV, dbremove, "int (*%s) (DB_ENV *, DB_TXN *, const char *, const char *, u_int32_t)");
STRUCT_SETUP(DB_ENV, dbrename, "int (*%s) (DB_ENV *, DB_TXN *, const char *, const char *, const char *, u_int32_t)");
sort_and_dump_fields("db_env", sizeof(DB_ENV));
}
......
......@@ -11,6 +11,8 @@ struct fieldinfo db_env_fields32[] = {
{"void *app_private", 36, 4},
{"void *api1_internal", 212, 4},
{"int (*close) (DB_ENV *, u_int32_t)", 244, 4},
{"int (*dbremove) (DB_ENV *, DB_TXN *, const char *, const char *, u_int32_t)", 248, 4},
{"int (*dbrename) (DB_ENV *, DB_TXN *, const char *, const char *, const char *, u_int32_t)", 252, 4},
{"void (*err) (const DB_ENV *, int, const char *, ...)", 256, 4},
{"int (*open) (DB_ENV *, const char *, u_int32_t, int)", 264, 4},
{"int (*set_data_dir) (DB_ENV *, const char *)", 272, 4},
......
......@@ -11,6 +11,8 @@ struct fieldinfo db_env_fields32[] = {
{"void *app_private", 44, 4},
{"void *api1_internal", 244, 4},
{"int (*close) (DB_ENV *, u_int32_t)", 276, 4},
{"int (*dbremove) (DB_ENV *, DB_TXN *, const char *, const char *, u_int32_t)", 280, 4},
{"int (*dbrename) (DB_ENV *, DB_TXN *, const char *, const char *, const char *, u_int32_t)", 284, 4},
{"void (*err) (const DB_ENV *, int, const char *, ...)", 288, 4},
{"int (*open) (DB_ENV *, const char *, u_int32_t, int)", 296, 4},
{"int (*set_data_dir) (DB_ENV *, const char *)", 336, 4},
......
......@@ -11,6 +11,8 @@ struct fieldinfo db_env_fields32[] = {
{"void *app_private", 44, 4},
{"void *api1_internal", 336, 4},
{"int (*close) (DB_ENV *, u_int32_t)", 368, 4},
{"int (*dbremove) (DB_ENV *, DB_TXN *, const char *, const char *, u_int32_t)", 372, 4},
{"int (*dbrename) (DB_ENV *, DB_TXN *, const char *, const char *, const char *, u_int32_t)", 376, 4},
{"void (*err) (const DB_ENV *, int, const char *, ...)", 380, 4},
{"int (*get_cachesize) (DB_ENV *, u_int32_t *, u_int32_t *, int *)", 396, 4},
{"int (*get_flags) (DB_ENV *, u_int32_t *)", 416, 4},
......
......@@ -11,6 +11,8 @@ struct fieldinfo db_env_fields32[] = {
{"void *app_private", 52, 4},
{"void *api1_internal", 336, 4},
{"int (*close) (DB_ENV *, u_int32_t)", 372, 4},
{"int (*dbremove) (DB_ENV *, DB_TXN *, const char *, const char *, u_int32_t)", 376, 4},
{"int (*dbrename) (DB_ENV *, DB_TXN *, const char *, const char *, const char *, u_int32_t)", 380, 4},
{"void (*err) (const DB_ENV *, int, const char *, ...)", 384, 4},
{"int (*get_cachesize) (DB_ENV *, u_int32_t *, u_int32_t *, int *)", 400, 4},
{"int (*get_flags) (DB_ENV *, u_int32_t *)", 420, 4},
......
......@@ -11,6 +11,8 @@ struct fieldinfo db_env_fields32[] = {
{"void *app_private", 52, 4},
{"void *api1_internal", 356, 4},
{"int (*close) (DB_ENV *, u_int32_t)", 392, 4},
{"int (*dbremove) (DB_ENV *, DB_TXN *, const char *, const char *, u_int32_t)", 396, 4},
{"int (*dbrename) (DB_ENV *, DB_TXN *, const char *, const char *, const char *, u_int32_t)", 400, 4},
{"void (*err) (const DB_ENV *, int, const char *, ...)", 404, 4},
{"int (*get_cachesize) (DB_ENV *, u_int32_t *, u_int32_t *, int *)", 420, 4},
{"int (*get_flags) (DB_ENV *, u_int32_t *)", 444, 4},
......
......@@ -11,6 +11,8 @@ struct fieldinfo db_env_fields64[] = {
{"void *app_private", 72, 8},
{"void *api1_internal", 360, 8},
{"int (*close) (DB_ENV *, u_int32_t)", 424, 8},
{"int (*dbremove) (DB_ENV *, DB_TXN *, const char *, const char *, u_int32_t)", 432, 8},
{"int (*dbrename) (DB_ENV *, DB_TXN *, const char *, const char *, const char *, u_int32_t)", 440, 8},
{"void (*err) (const DB_ENV *, int, const char *, ...)", 448, 8},
{"int (*open) (DB_ENV *, const char *, u_int32_t, int)", 464, 8},
{"int (*set_data_dir) (DB_ENV *, const char *)", 480, 8},
......
......@@ -11,6 +11,8 @@ struct fieldinfo db_env_fields64[] = {
{"void *app_private", 88, 8},
{"void *api1_internal", 392, 8},
{"int (*close) (DB_ENV *, u_int32_t)", 456, 8},
{"int (*dbremove) (DB_ENV *, DB_TXN *, const char *, const char *, u_int32_t)", 464, 8},
{"int (*dbrename) (DB_ENV *, DB_TXN *, const char *, const char *, const char *, u_int32_t)", 472, 8},
{"void (*err) (const DB_ENV *, int, const char *, ...)", 480, 8},
{"int (*open) (DB_ENV *, const char *, u_int32_t, int)", 496, 8},
{"int (*set_data_dir) (DB_ENV *, const char *)", 576, 8},
......
......@@ -11,6 +11,8 @@ struct fieldinfo db_env_fields64[] = {
{"void *app_private", 88, 8},
{"void *api1_internal", 544, 8},
{"int (*close) (DB_ENV *, u_int32_t)", 608, 8},
{"int (*dbremove) (DB_ENV *, DB_TXN *, const char *, const char *, u_int32_t)", 616, 8},
{"int (*dbrename) (DB_ENV *, DB_TXN *, const char *, const char *, const char *, u_int32_t)", 624, 8},
{"void (*err) (const DB_ENV *, int, const char *, ...)", 632, 8},
{"int (*get_cachesize) (DB_ENV *, u_int32_t *, u_int32_t *, int *)", 664, 8},
{"int (*get_flags) (DB_ENV *, u_int32_t *)", 704, 8},
......
......@@ -11,6 +11,8 @@ struct fieldinfo db_env_fields64[] = {
{"void *app_private", 104, 8},
{"void *api1_internal", 544, 8},
{"int (*close) (DB_ENV *, u_int32_t)", 616, 8},
{"int (*dbremove) (DB_ENV *, DB_TXN *, const char *, const char *, u_int32_t)", 624, 8},
{"int (*dbrename) (DB_ENV *, DB_TXN *, const char *, const char *, const char *, u_int32_t)", 632, 8},
{"void (*err) (const DB_ENV *, int, const char *, ...)", 640, 8},
{"int (*get_cachesize) (DB_ENV *, u_int32_t *, u_int32_t *, int *)", 672, 8},
{"int (*get_flags) (DB_ENV *, u_int32_t *)", 712, 8},
......
......@@ -11,6 +11,8 @@ struct fieldinfo db_env_fields64[] = {
{"void *app_private", 104, 8},
{"void *api1_internal", 568, 8},
{"int (*close) (DB_ENV *, u_int32_t)", 640, 8},
{"int (*dbremove) (DB_ENV *, DB_TXN *, const char *, const char *, u_int32_t)", 648, 8},
{"int (*dbrename) (DB_ENV *, DB_TXN *, const char *, const char *, const char *, u_int32_t)", 656, 8},
{"void (*err) (const DB_ENV *, int, const char *, ...)", 664, 8},
{"int (*get_cachesize) (DB_ENV *, u_int32_t *, u_int32_t *, int *)", 696, 8},
{"int (*get_flags) (DB_ENV *, u_int32_t *)", 744, 8},
......
......@@ -114,8 +114,6 @@ typedef enum {
#define DB_INIT_MPOOL 524288
#define DB_CLOSE_DONT_TRIM_LOG 1048576
#define DB_INIT_TXN 2097152
#define DB_USE_ENVIRON 16384
#define DB_USE_ENVIRON_ROOT 32768
#define DB_READ_UNCOMMITTED 134217728
#define DB_KEYEXIST -30996
#define DB_LOCK_DEADLOCK -30995
......@@ -177,9 +175,12 @@ struct __toku_db_env {
int (*set_default_bt_compare) (DB_ENV*,int (*bt_compare) (DB *, const DBT *, const DBT *)) /* Set default (key) comparison function for all DBs in this environment. Required for RECOVERY since you cannot open the DBs manually. */;
int (*set_default_dup_compare) (DB_ENV*,int (*bt_compare) (DB *, const DBT *, const DBT *)) /* Set default (val) comparison function for all DBs in this environment. Required for RECOVERY since you cannot open the DBs manually. */;
int (*get_engine_status) (DB_ENV*, ENGINE_STATUS*) /* Fill in status struct */;
int (*get_iname) (DB_ENV* env, DBT* dname_dbt, DBT* iname_dbt) /* lookup existing iname */;
void *app_private;
void *api1_internal;
int (*close) (DB_ENV *, u_int32_t);
int (*dbremove) (DB_ENV *, DB_TXN *, const char *, const char *, u_int32_t);
int (*dbrename) (DB_ENV *, DB_TXN *, const char *, const char *, const char *, u_int32_t);
void (*err) (const DB_ENV *, int, const char *, ...);
int (*get_cachesize) (DB_ENV *, u_int32_t *, u_int32_t *, int *);
int (*get_flags) (DB_ENV *, u_int32_t *);
......
......@@ -370,9 +370,9 @@ heaviside_next(const DBT *key, const DBT *val, void *extra_h) {
struct extra_heavi *e=extra_h;
int cmp;
cmp = toku_default_compare_fun(db, key, &e->key);
cmp = toku_builtin_compare_fun(db, key, &e->key);
if (cmp != 0) return cmp;
if (val) cmp = toku_default_compare_fun(db, val, &e->val);
if (val) cmp = toku_builtin_compare_fun(db, val, &e->val);
if (cmp != 0) return cmp;
return -1; //Return negative on <=, positive on >
}
......
......@@ -114,8 +114,6 @@ typedef enum {
#define DB_INIT_MPOOL 524288
#define DB_CLOSE_DONT_TRIM_LOG 1048576
#define DB_INIT_TXN 2097152
#define DB_USE_ENVIRON 16384
#define DB_USE_ENVIRON_ROOT 32768
#define DB_READ_UNCOMMITTED 134217728
#define DB_KEYEXIST -30996
#define DB_LOCK_DEADLOCK -30995
......@@ -177,9 +175,12 @@ struct __toku_db_env {
int (*set_default_bt_compare) (DB_ENV*,int (*bt_compare) (DB *, const DBT *, const DBT *)) /* Set default (key) comparison function for all DBs in this environment. Required for RECOVERY since you cannot open the DBs manually. */;
int (*set_default_dup_compare) (DB_ENV*,int (*bt_compare) (DB *, const DBT *, const DBT *)) /* Set default (val) comparison function for all DBs in this environment. Required for RECOVERY since you cannot open the DBs manually. */;
int (*get_engine_status) (DB_ENV*, ENGINE_STATUS*) /* Fill in status struct */;
int (*get_iname) (DB_ENV* env, DBT* dname_dbt, DBT* iname_dbt) /* lookup existing iname */;
void *app_private;
void *api1_internal;
int (*close) (DB_ENV *, u_int32_t);
int (*dbremove) (DB_ENV *, DB_TXN *, const char *, const char *, u_int32_t);
int (*dbrename) (DB_ENV *, DB_TXN *, const char *, const char *, const char *, u_int32_t);
void (*err) (const DB_ENV *, int, const char *, ...);
int (*get_cachesize) (DB_ENV *, u_int32_t *, u_int32_t *, int *);
int (*get_flags) (DB_ENV *, u_int32_t *);
......
......@@ -3,6 +3,7 @@
#ident "Copyright (c) 2007 Tokutek Inc. All rights reserved."
#include "list.h"
// Included by db.h, defines some internal structures. These structures are inlined in some versions of db.h
// the types DB_TXN and so forth have been defined.
......@@ -17,6 +18,7 @@ struct __toku_db_txn_internal {
struct __toku_lth *lth; //Hash table holding list of dictionaries this txn has touched
u_int32_t flags;
DB_TXN *child;
struct list dbs_that_must_close_before_abort;
};
struct __toku_dbc_internal {
......
......@@ -633,7 +633,7 @@ deserialize_brtnode_leaf_from_rbuf_10 (BRTNODE result, bytevec magic, struct rbu
r = toku_db_badformat(); goto died_1;
}
r = toku_leaflock_borrow(&result->u.l.leaflock);
r = toku_leaflock_borrow(result->u.l.leaflock_pool, &result->u.l.leaflock);
if (r!=0) goto died_1;
rb->buf = NULL; //Buffer was used for node's mempool.
return 0;
......@@ -783,8 +783,10 @@ deserialize_brtnode_from_rbuf_10 (BLOCKNUM blocknum, u_int32_t fullhash, BRTNODE
if (result->height>0)
r = deserialize_brtnode_nonleaf_from_rbuf_10(result, magic, rb);
else
else {
result->u.l.leaflock_pool = toku_cachefile_leaflock_pool(h->cf);
r = deserialize_brtnode_leaf_from_rbuf_10(result, magic, rb);
}
if (r!=0) goto died0;
//printf("%s:%d Ok got %lld n_children=%d\n", __FILE__, __LINE__, result->thisnodename, result->n_children);
......
......@@ -116,6 +116,7 @@ struct brtnode {
struct leaf {
struct subtree_estimates leaf_stats; // actually it is exact.
OMT buffer;
LEAFLOCK_POOL leaflock_pool;
LEAFLOCK leaflock;
unsigned int n_bytes_in_buffer; /* How many bytes to represent the OMT (including the per-key overheads, but not including the overheads for the node. */
unsigned int seqinsert; /* number of sequential inserts to this leaf */
......@@ -336,4 +337,7 @@ int toku_brtheader_end_checkpoint (CACHEFILE cachefile, void *header_v);
int toku_maybe_upgrade_brt(BRT t);
int toku_db_badformat(void);
int toku_brt_remove_on_commit(TOKUTXN child, DBT* iname_dbt_p, DBT* iname_within_cwd_dbt_p);
int toku_brt_remove_now(CACHETABLE ct, DBT* iname_dbt_p, DBT* iname_within_cwd_dbt_p);
#endif
......@@ -66,6 +66,9 @@ unlock_for_pwrite (void) {
enum {FILE_CHANGE_INCREMENT = (16<<20)};
//Race condition if ydb lock is split.
//Ydb lock is held when this function is called.
//Not going to truncate and delete (redirect to devnull) at same time.
void
toku_maybe_truncate_cachefile (CACHEFILE cf, u_int64_t size_used)
// Effect: If file size >= SIZE+32MiB, reduce file size.
......@@ -796,7 +799,7 @@ deserialize_brtnode_leaf_from_rbuf (BRTNODE result, bytevec magic, struct rbuf *
r = toku_db_badformat(); goto died_1;
}
r = toku_leaflock_borrow(&result->u.l.leaflock);
r = toku_leaflock_borrow(result->u.l.leaflock_pool, &result->u.l.leaflock);
if (r!=0) goto died_1;
rb->buf = NULL; //Buffer was used for node's mempool.
return 0;
......@@ -843,8 +846,10 @@ deserialize_brtnode_from_rbuf (BLOCKNUM blocknum, u_int32_t fullhash, BRTNODE *b
if (result->height>0)
r = deserialize_brtnode_nonleaf_from_rbuf(result, magic, rb);
else
else {
result->u.l.leaflock_pool = toku_cachefile_leaflock_pool(h->cf);
r = deserialize_brtnode_leaf_from_rbuf(result, magic, rb);
}
if (r!=0) goto died0;
//printf("%s:%d Ok got %lld n_children=%d\n", __FILE__, __LINE__, result->thisnodename, result->n_children);
......
This diff is collapsed.
......@@ -30,10 +30,6 @@ typedef int(*BRT_GET_STRADDLE_CALLBACK_FUNCTION)(ITEMLEN, bytevec, ITEMLEN, byte
int toku_open_brt (const char *fname, int is_create, BRT *, int nodesize, CACHETABLE, TOKUTXN, int(*)(DB*,const DBT*,const DBT*), DB*);
struct descriptor {
u_int32_t version;
DBT dbt;
};
u_int32_t toku_serialize_descriptor_size(struct descriptor *desc);
int toku_brt_create(BRT *);
int toku_brt_set_flags(BRT, unsigned int flags);
......@@ -165,8 +161,10 @@ int toku_brt_get_fd(BRT, int *);
int toku_brt_height_of_root(BRT, int *height); // for an open brt, return the current height.
enum brt_header_flags {
TOKU_DB_DUP = 1,
TOKU_DB_DUPSORT = 2,
TOKU_DB_DUP = (1<<0),
TOKU_DB_DUPSORT = (1<<1),
TOKU_DB_KEYCMP_BUILTIN = (1<<2),
TOKU_DB_VALCMP_BUILTIN = (1<<3),
};
int toku_brt_keyrange (BRT brt, DBT *key, u_int64_t *less, u_int64_t *equal, u_int64_t *greater);
......
......@@ -18,6 +18,11 @@ typedef struct brt *BRT;
struct brt_header;
struct wbuf;
typedef struct descriptor {
u_int32_t version;
DBT dbt;
} *DESCRIPTOR, DESCRIPTOR_S;
typedef unsigned int ITEMLEN;
typedef const void *bytevec;
//typedef const void *bytevec;
......
This diff is collapsed.
......@@ -9,6 +9,7 @@
#include <fcntl.h>
#include "brttypes.h"
#include "workqueue.h"
#include "leaflock.h"
// TODO: #1398 Get rid of this entire straddle_callback hack
// Man is this ugly.
......@@ -46,6 +47,10 @@ int toku_create_cachetable(CACHETABLE */*result*/, long size_limit, LSN initial_
// During a transaction, we cannot reuse a filenum.
int toku_cachefile_of_filenum (CACHETABLE t, FILENUM filenum, CACHEFILE *cf);
// What is the cachefile that goes with a particular iname?
// During a transaction, we cannot reuse an iname.
int toku_cachefile_of_iname_and_add_reference (CACHETABLE ct, const char *iname, CACHEFILE *cf);
// TODO: #1510 Add comments on how these behave
int toku_cachetable_begin_checkpoint (CACHETABLE ct, TOKULOGGER);
int toku_cachetable_end_checkpoint(CACHETABLE ct, TOKULOGGER logger, char **error_string, void (*testcallback_f)(void*), void * testextra);
......@@ -91,7 +96,7 @@ typedef void (*CACHETABLE_FLUSH_CALLBACK)(CACHEFILE, CACHEKEY key, void *value,
// associated with the key are returned.
typedef int (*CACHETABLE_FETCH_CALLBACK)(CACHEFILE, CACHEKEY key, u_int32_t fullhash, void **value, long *sizep, void *extraargs);
void toku_cachefile_set_userdata(CACHEFILE cf, void *userdata, int (*close_userdata)(CACHEFILE, void*, char **/*error_string*/, BOOL, LSN), int (*checkpoint_userdata)(CACHEFILE, void*), int (*begin_checkpoint_userdata)(CACHEFILE, LSN, void*), int (*end_checkpoint_userdata)(CACHEFILE, void*));
void toku_cachefile_set_userdata(CACHEFILE cf, void *userdata, int (*log_fassociate_during_checkpoint)(CACHEFILE, void*), int (*close_userdata)(CACHEFILE, void*, char **/*error_string*/, BOOL, LSN), int (*checkpoint_userdata)(CACHEFILE, void*), int (*begin_checkpoint_userdata)(CACHEFILE, LSN, void*), int (*end_checkpoint_userdata)(CACHEFILE, void*));
// Effect: Store some cachefile-specific user data. When the last reference to a cachefile is closed, we call close_userdata().
// Before starting a checkpoint, we call checkpoint_prepare_userdata().
// When the cachefile needs to be checkpointed, we call checkpoint_userdata().
......@@ -259,5 +264,6 @@ typedef struct cachetable_status {
void toku_cachetable_get_status(CACHETABLE ct, CACHETABLE_STATUS s);
LEAFLOCK_POOL toku_cachefile_leaflock_pool(CACHEFILE cf);
#endif
......@@ -96,7 +96,7 @@ int toku_keycompare (bytevec key1, ITEMLEN key1len, bytevec key2, ITEMLEN key2le
#endif
int
toku_default_compare_fun (DB *db __attribute__((__unused__)), const DBT *a, const DBT*b) {
toku_builtin_compare_fun (DB *db __attribute__((__unused__)), const DBT *a, const DBT*b) {
return toku_keycompare(a->data, a->size, b->data, b->size);
}
......
......@@ -8,5 +8,5 @@
int toku_keycompare (bytevec key1, ITEMLEN key1len, bytevec key2, ITEMLEN key2len);
void toku_test_keycompare (void) ;
int toku_default_compare_fun (DB *, const DBT *, const DBT*) __attribute__((__visibility__("default")));
int toku_builtin_compare_fun (DB *, const DBT *, const DBT*) __attribute__((__visibility__("default")));
int toku_dont_call_this_compare_fun (DB *, const DBT *, const DBT*);
......@@ -49,73 +49,81 @@
//
static u_int32_t numlocks = 0; // how many locks ever created?
static u_int32_t pool_high_water_mark = 0; // max number of locks ever in pool
static u_int32_t num_in_pool = 0; // number of locks currently in pool
struct leaflock {
toku_pthread_mutex_t lock;
LEAFLOCK next;
int id;
};
static LEAFLOCK free_list;
static toku_pthread_mutex_t pool_mutex;
struct leaflock_pool {
LEAFLOCK free_list;
toku_pthread_mutex_t pool_mutex;
u_int32_t numlocks; // how many locks ever created?
u_int32_t pool_high_water_mark; // max number of locks ever in pool
u_int32_t num_in_pool; // number of locks currently in pool
};
static void
leaflock_pool_lock(void) {
int r = toku_pthread_mutex_lock(&pool_mutex); assert(r==0);
leaflock_pool_lock(LEAFLOCK_POOL pool) {
int r = toku_pthread_mutex_lock(&pool->pool_mutex); assert(r==0);
}
static void
leaflock_pool_unlock(void) {
int r = toku_pthread_mutex_unlock(&pool_mutex); assert(r==0);
leaflock_pool_unlock(LEAFLOCK_POOL pool) {
int r = toku_pthread_mutex_unlock(&pool->pool_mutex); assert(r==0);
}
int
toku_leaflock_init(void) {
int r = toku_pthread_mutex_init(&pool_mutex, NULL);
assert(r == 0);
free_list = NULL;
toku_leaflock_create(LEAFLOCK_POOL* pool) {
int r;
LEAFLOCK_POOL XCALLOC(result);
if (!result) r = ENOMEM;
else {
r = toku_pthread_mutex_init(&result->pool_mutex, NULL);
assert(r == 0);
*pool = result;
}
return r;
}
int
toku_leaflock_destroy(void) {
leaflock_pool_lock();
toku_leaflock_destroy(LEAFLOCK_POOL* pool_p) {
LEAFLOCK_POOL pool = *pool_p;
*pool_p = NULL;
leaflock_pool_lock(pool);
int r;
assert(num_in_pool==numlocks);
while (free_list) {
LEAFLOCK to_free = free_list;
free_list = free_list->next;
assert(pool->num_in_pool==pool->numlocks);
while (pool->free_list) {
LEAFLOCK to_free = pool->free_list;
pool->free_list = pool->free_list->next;
r = toku_pthread_mutex_destroy(&to_free->lock); assert(r==0);
toku_free(to_free);
}
leaflock_pool_unlock();
r = toku_pthread_mutex_destroy(&pool_mutex); assert(r == 0);
leaflock_pool_unlock(pool);
r = toku_pthread_mutex_destroy(&pool->pool_mutex); assert(r == 0);
toku_free(pool);
return r;
}
int
toku_leaflock_borrow(LEAFLOCK *leaflockp) {
leaflock_pool_lock();
toku_leaflock_borrow(LEAFLOCK_POOL pool, LEAFLOCK *leaflockp) {
leaflock_pool_lock(pool);
LEAFLOCK loaner;
int r;
if (free_list) {
assert(num_in_pool>0);
num_in_pool--;
loaner = free_list;
free_list = free_list->next;
if (pool->free_list) {
assert(pool->num_in_pool>0);
pool->num_in_pool--;
loaner = pool->free_list;
pool->free_list = pool->free_list->next;
r = 0;
}
else {
numlocks++;
pool->numlocks++;
//Create one
MALLOC(loaner);
CALLOC(loaner);
if (loaner==NULL) r = ENOMEM;
else {
memset(loaner, 0, sizeof(*loaner));
loaner->id = numlocks;
loaner->id = pool->numlocks;
r = toku_pthread_mutex_init(&loaner->lock, NULL); assert(r==0);
}
}
......@@ -123,24 +131,24 @@ toku_leaflock_borrow(LEAFLOCK *leaflockp) {
loaner->next = NULL;
*leaflockp = loaner;
}
leaflock_pool_unlock();
leaflock_pool_unlock(pool);
return r;
}
//Caller of this function must be holding the lock being returned.
void
toku_leaflock_unlock_and_return(LEAFLOCK *leaflockp) {
leaflock_pool_lock();
toku_leaflock_unlock_and_return(LEAFLOCK_POOL pool, LEAFLOCK *leaflockp) {
leaflock_pool_lock(pool);
LEAFLOCK loaner = *leaflockp;
*leaflockp = NULL; //Take away caller's reference for good hygiene.
toku_leaflock_unlock_by_leaf(loaner);
num_in_pool++;
if (num_in_pool > pool_high_water_mark)
pool_high_water_mark = num_in_pool;
assert (num_in_pool <= numlocks);
loaner->next = free_list;
free_list = loaner;
leaflock_pool_unlock();
pool->num_in_pool++;
if (pool->num_in_pool > pool->pool_high_water_mark)
pool->pool_high_water_mark = pool->num_in_pool;
assert (pool->num_in_pool <= pool->numlocks);
loaner->next = pool->free_list;
pool->free_list = loaner;
leaflock_pool_unlock(pool);
}
void
......
......@@ -6,12 +6,13 @@
#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."
typedef struct leaflock *LEAFLOCK;
typedef struct leaflock_pool *LEAFLOCK_POOL;
int toku_leaflock_init(void);
int toku_leaflock_destroy(void);
int toku_leaflock_create(LEAFLOCK_POOL* pool);
int toku_leaflock_destroy(LEAFLOCK_POOL* pool);
int toku_leaflock_borrow(LEAFLOCK *leaflockp);
void toku_leaflock_unlock_and_return(LEAFLOCK *leaflockp);
int toku_leaflock_borrow(LEAFLOCK_POOL pool, LEAFLOCK *leaflockp);
void toku_leaflock_unlock_and_return(LEAFLOCK_POOL pool, LEAFLOCK *leaflockp);
void toku_leaflock_lock_by_leaf(LEAFLOCK leaflock);
void toku_leaflock_unlock_by_leaf(LEAFLOCK leaflock);
......
......@@ -65,7 +65,7 @@ struct tokulogger {
BOOL write_log_files;
BOOL trim_log_files; // for test purposes
int panic_errno;
char *directory;
char *directory; // file system directory
int fd;
CACHETABLE ct;
int lg_max; // The size of the single file in the log. Default is 100MB in TokuDB
......@@ -87,6 +87,9 @@ struct tokulogger {
u_int32_t write_block_size; // How big should the blocks be written to various logs?
TXNID oldest_living_xid;
void (*remove_finalize_callback) (int, void*); // ydb-level callback to be called when a transaction that ...
void * remove_finalize_callback_extra; // ... deletes a file is committed or when one that creates a file is aborted.
};
int toku_logger_find_next_unused_log_file(const char *directory, long long *result);
......@@ -115,6 +118,7 @@ struct tokutxn {
u_int64_t rollentry_raw_count; // the total count of every byte in the transaction and all its children.
OMT open_brts; // a collection of the brts that we touched. Indexed by filenum.
XIDS xids; //Represents the xid list
int force_fsync_on_commit; //This transaction NEEDS an fsync once (if) it commits. (commit means root txn)
};
static inline int toku_logsizeof_u_int8_t (u_int32_t v __attribute__((__unused__))) {
......@@ -164,7 +168,7 @@ static inline int toku_logsizeof_INTPAIRARRAY (INTPAIRARRAY pa) {
static inline char *fixup_fname(BYTESTRING *f) {
assert(f->len>0);
char *fname = toku_malloc(f->len+1);
char *fname = toku_xmalloc(f->len+1);
memcpy(fname, f->data, f->len);
fname[f->len]=0;
return fname;
......
......@@ -73,6 +73,8 @@ static int lc_check_lsn(TOKULOGCURSOR lc, int dir) {
// int index = lc->cur_logfiles_index;
// fprintf(stderr, "Bad LSN: %d %s direction = %d, lsn.lsn = %"PRIu64", cur_lsn.lsn=%"PRIu64"\n",
// index, lc->logfiles[index], dir, lsn.lsn, lc->cur_lsn.lsn);
if (toku_recover_trace)
printf("DB_RUNRECOVERY: %s:%d r=%d\n", __FUNCTION__, __LINE__, 0);
return LC_LSN_ERROR;
}
lc->cur_lsn.lsn = lsn.lsn;
......
......@@ -44,9 +44,14 @@ struct logtype {
int logformat_version_number = 0;
const struct logtype rollbacks[] = {
{"fcreate", 'F', FA{{"TXNID", "txnid", 0},
{"FILENUM", "filenum", 0},
{"BYTESTRING", "fname", 0},
//TODO: #2037 Add dname
{"fdelete", 'U', FA{{"u_int8_t", "file_was_open", 0},
{"FILENUM", "filenum", 0},
{"BYTESTRING", "iname", 0},
NULLFIELD}},
//TODO: #2037 Add dname
{"fcreate", 'F', FA{{"FILENUM", "filenum", 0},
{"BYTESTRING", "iname", 0},
NULLFIELD}},
// cmdinsert is used to insert a key-value pair into a NODUP DB. For rollback we don't need the data.
{"cmdinsert", 'i', FA{
......@@ -93,28 +98,43 @@ const struct logtype logtypes[] = {
// Records produced by checkpoints
{"begin_checkpoint", 'x', FA{{"u_int64_t", "timestamp", 0}, NULLFIELD}},
{"end_checkpoint", 'X', FA{{"TXNID", "txnid", 0}, {"u_int64_t", "timestamp", 0}, NULLFIELD}}, // TXNID is LSN of begin_checkpoint
//TODO: #2037 Add dname
{"fassociate", 'f', FA{{"FILENUM", "filenum", 0},
{"BYTESTRING", "fname", 0}, // pathname of file
{"u_int32_t", "treeflags", 0},
{"BYTESTRING", "iname", 0}, // pathname of file
NULLFIELD}},
{"xstillopen", 's', FA{{"TXNID", "txnid", 0},
{"TXNID", "parent", 0},
NULLFIELD}}, // only record root transactions
// Reords produced by transactions
// Records produced by transactions
{"commit", 'C', FA{{"TXNID", "txnid", 0},NULLFIELD}},
{"xabort", 'q', FA{{"TXNID", "txnid", 0},NULLFIELD}},
{"xbegin", 'b', FA{{"TXNID", "parenttxnid", 0},NULLFIELD}},
//TODO: #2037 Add dname
{"fdelete", 'U', FA{{"TXNID", "txnid", 0},
{"u_int8_t", "file_was_open", 0},
{"FILENUM", "filenum", 0},
{"BYTESTRING", "iname", 0},
NULLFIELD}},
//TODO: #2037 Add dname
{"fcreate", 'F', FA{{"TXNID", "txnid", 0},
{"FILENUM", "filenum", 0},
{"BYTESTRING", "fname", 0},
{"BYTESTRING", "iname", 0},
{"u_int32_t", "mode", "0%o"},
{"u_int32_t", "treeflags", 0},
{"u_int32_t", "descriptor_version", 0},
{"BYTESTRING", "descriptor", 0},
NULLFIELD}},
//TODO: #2037 Add dname
{"fopen", 'O', FA{{"TXNID", "txnid", 0},
{"BYTESTRING", "fname", 0},
{"BYTESTRING", "iname", 0},
{"FILENUM", "filenum", 0},
{"u_int32_t", "treeflags", 0},
NULLFIELD}},
{"fclose", 'e', FA{{"BYTESTRING", "fname", 0},
//TODO: #2037 Add dname
{"fclose", 'e', FA{{"BYTESTRING", "iname", 0},
{"FILENUM", "filenum", 0},
{"u_int32_t", "treeflags", 0},
NULLFIELD}},
{"tablelock_on_empty_table", 'L', FA{{"FILENUM", "filenum", 0},
{"TXNID", "xid", 0},
......
......@@ -562,24 +562,39 @@ int toku_logger_restart(TOKULOGGER logger, LSN lastlsn) {
return open_logfile(logger);
}
int toku_logger_log_fcreate (TOKUTXN txn, const char *fname, FILENUM filenum, u_int32_t mode, u_int32_t treeflags) {
// fname is the iname
int toku_logger_log_fcreate (TOKUTXN txn, const char *fname, FILENUM filenum, u_int32_t mode, u_int32_t treeflags, DESCRIPTOR descriptor_p) {
if (txn==0) return 0;
if (txn->logger->is_panicked) return EINVAL;
BYTESTRING bs = { .len=strlen(fname), .data = toku_strdup_in_rollback(txn, fname) };
int r = toku_log_fcreate (txn->logger, (LSN*)0, 0, toku_txn_get_txnid(txn), filenum, bs, mode, treeflags);
if (r!=0) return r;
r = toku_logger_save_rollback_fcreate(txn, toku_txn_get_txnid(txn), filenum, bs);
BYTESTRING bs_fname = { .len=strlen(fname), .data = (char *) fname };
BYTESTRING bs_descriptor = { .len=descriptor_p->dbt.size, .data = descriptor_p->dbt.data };
// fsync log on fcreate
int r = toku_log_fcreate (txn->logger, (LSN*)0, 1, toku_txn_get_txnid(txn), filenum, bs_fname, mode, treeflags, descriptor_p->version, bs_descriptor);
return r;
}
// fname is the iname
int toku_logger_log_fdelete (TOKUTXN txn, const char *fname, FILENUM filenum, u_int8_t was_open) {
if (txn==0) return 0;
if (txn->logger->is_panicked) return EINVAL;
BYTESTRING bs = { .len=strlen(fname), .data = (char *) fname };
//No fsync.
int r = toku_log_fdelete (txn->logger, (LSN*)0, 0, toku_txn_get_txnid(txn), was_open, filenum, bs);
return r;
}
/* fopen isn't really an action. It's just for bookkeeping. We need to know the filename that goes with a filenum. */
int toku_logger_log_fopen (TOKUTXN txn, const char * fname, FILENUM filenum) {
int toku_logger_log_fopen (TOKUTXN txn, const char * fname, FILENUM filenum, uint32_t treeflags) {
if (txn==0) return 0;
if (txn->logger->is_panicked) return EINVAL;
BYTESTRING bs;
bs.len = strlen(fname);
bs.data = (char*)fname;
return toku_log_fopen (txn->logger, (LSN*)0, 0, toku_txn_get_txnid(txn), bs, filenum);
return toku_log_fopen (txn->logger, (LSN*)0, 0, toku_txn_get_txnid(txn), bs, filenum, treeflags);
}
static int toku_fread_u_int8_t_nocrclen (FILE *f, u_int8_t *v) {
......@@ -1063,3 +1078,27 @@ LSN toku_logger_get_oldest_living_lsn(TOKULOGGER logger) {
return lsn;
}
LSN
toku_logger_get_next_lsn(TOKULOGGER logger) {
return logger->lsn;
}
//////////////////////////////////////////////////////////////////////////////////////
// remove_finalize_callback is set when environment is created so that when
// a file removal is committed (or a file creation is aborted), the brt
// layer can call the ydb-layer callback to clean up the lock tree.
// called from toku_env_open()
void
toku_logger_set_remove_finalize_callback(TOKULOGGER logger, void (*funcp)(int, void *), void * extra) {
logger->remove_finalize_callback = funcp;
logger->remove_finalize_callback_extra = extra;
}
// called when a transaction that deleted a file is committed, or
// when a transaction that created a file is aborted.
void
toku_logger_call_remove_finalize_callback(TOKULOGGER logger, int fd) {
logger->remove_finalize_callback(fd, logger->remove_finalize_callback_extra);
}
......@@ -42,8 +42,9 @@ int toku_logger_restart(TOKULOGGER logger, LSN lastlsn);
// Returns: 0 if success
int toku_logger_maybe_trim_log(TOKULOGGER logger, LSN oldest_open_lsn);
int toku_logger_log_fcreate (TOKUTXN txn, const char *fname, FILENUM filenum, u_int32_t mode, u_int32_t flags);
int toku_logger_log_fopen (TOKUTXN txn, const char * fname, FILENUM filenum);
int toku_logger_log_fcreate (TOKUTXN txn, const char *fname, FILENUM filenum, u_int32_t mode, u_int32_t flags, DESCRIPTOR descriptor_p);
int toku_logger_log_fdelete (TOKUTXN txn, const char *fname, FILENUM filenum, u_int8_t was_open);
int toku_logger_log_fopen (TOKUTXN txn, const char * fname, FILENUM filenum, uint32_t treeflags);
int toku_fread_u_int8_t (FILE *f, u_int8_t *v, struct x1764 *mm, u_int32_t *len);
int toku_fread_u_int32_t_nocrclen (FILE *f, u_int32_t *v);
......@@ -88,6 +89,9 @@ void toku_logger_note_checkpoint(TOKULOGGER logger, LSN lsn);
TXNID toku_logger_get_oldest_living_xid(TOKULOGGER logger);
LSN toku_logger_get_oldest_living_lsn(TOKULOGGER logger);
LSN toku_logger_get_next_lsn(TOKULOGGER logger);
void toku_logger_set_remove_finalize_callback(TOKULOGGER logger, void (*funcp)(int, void *), void * extra);
void toku_logger_call_remove_finalize_callback(TOKULOGGER logger, int fd);
int toku_logger_make_space_in_inbuf (TOKULOGGER logger, int n_bytes_needed);
......@@ -148,3 +152,4 @@ toku_logger_maybe_fsync (TOKULOGGER logger, LSN lsn, int do_fsync);
// release the outlock
#endif
......@@ -23,6 +23,10 @@ static inline unsigned int rbuf_char (struct rbuf *r) {
return r->buf[r->ndone++];
}
static inline void rbuf_ma_u_int8_t (struct rbuf *r, MEMARENA ma __attribute__((__unused__)), u_int8_t *num) {
*num = rbuf_char(r);
}
//Read an int that MUST be in network order regardless of disk order
static unsigned int rbuf_network_int (struct rbuf *r) __attribute__((__unused__));
static unsigned int rbuf_network_int (struct rbuf *r) {
......
......@@ -7,7 +7,7 @@
#include "log_header.h"
#include "checkpoint.h"
static int toku_recover_trace = 0;
int toku_recover_trace = 0;
//#define DO_VERIFY_COUNTS
#ifdef DO_VERIFY_COUNTS
......@@ -285,14 +285,12 @@ static int internal_toku_recover_fopen_or_fcreate (RECOVER_ENV renv, int flags,
r = toku_brt_create(&brt);
assert(r == 0);
// create tree with treeflags, otherwise use the treeflags from the tree
if (flags & O_CREAT)
toku_brt_set_flags(brt, treeflags);
toku_brt_set_flags(brt, treeflags);
// set the key compare functions
if (renv->bt_compare)
if (!(treeflags & TOKU_DB_KEYCMP_BUILTIN) && renv->bt_compare)
toku_brt_set_bt_compare(brt, renv->bt_compare);
if (renv->dup_compare)
if (!(treeflags & TOKU_DB_VALCMP_BUILTIN) && renv->dup_compare)
toku_brt_set_dup_compare(brt, renv->dup_compare);
// bind to filenum when opened
......@@ -315,8 +313,8 @@ static int internal_toku_recover_fopen_or_fcreate (RECOVER_ENV renv, int flags,
}
static int toku_recover_fopen (struct logtype_fopen *l, RECOVER_ENV renv) {
char *fixedfname = fixup_fname(&l->fname);
return internal_toku_recover_fopen_or_fcreate(renv, 0, 0, fixedfname, l->filenum, 0);
char *fixedfname = fixup_fname(&l->iname);
return internal_toku_recover_fopen_or_fcreate(renv, 0, 0, fixedfname, l->filenum, l->treeflags);
}
static int toku_recover_backward_fopen (struct logtype_fopen *l, RECOVER_ENV renv) {
......@@ -338,7 +336,7 @@ static int toku_recover_backward_fopen (struct logtype_fopen *l, RECOVER_ENV ren
// fcreate is like fopen except that the file must be created. Also creates the dir if needed.
static int toku_recover_fcreate (struct logtype_fcreate *l, RECOVER_ENV renv) {
char *fixedfname = fixup_fname(&l->fname);
char *fixedfname = fixup_fname(&l->iname);
create_dir_from_file(fixedfname);
return internal_toku_recover_fopen_or_fcreate(renv, O_CREAT|O_TRUNC, l->mode, fixedfname, l->filenum, l->treeflags);
}
......@@ -348,6 +346,19 @@ static int toku_recover_backward_fcreate (struct logtype_fcreate *UU(l), RECOVER
return 0;
}
// fdelete is a transactional file delete.
static int toku_recover_fdelete (struct logtype_fdelete *UU(l), RECOVER_ENV UU(renv)) {
//TODO: #2037
//Put entry in rolltmp.
assert(FALSE);
}
static int toku_recover_backward_fdelete (struct logtype_fdelete *UU(l), RECOVER_ENV UU(renv)) {
//TODO: #2037
//Do we do anything here? Perhaps open it?
assert(FALSE);
}
static int toku_recover_enq_insert (struct logtype_enq_insert *l, RECOVER_ENV renv) {
struct file_map_tuple *tuple = NULL;
int r = file_map_find(&renv->fmap, l->filenum, &tuple);
......@@ -451,7 +462,7 @@ static int toku_recover_fclose (struct logtype_fclose *l, RECOVER_ENV UU(renv))
struct file_map_tuple *tuple = NULL;
int r = file_map_find(&renv->fmap, l->filenum, &tuple);
if (r == 0) {
char *fixedfname = fixup_fname(&l->fname);
char *fixedfname = fixup_fname(&l->iname);
assert(strcmp(tuple->fname, fixedfname) == 0);
toku_free(fixedfname);
r = toku_close_brt_lsn(tuple->brt, 0, 0, TRUE, l->lsn);
......@@ -464,8 +475,8 @@ static int toku_recover_fclose (struct logtype_fclose *l, RECOVER_ENV UU(renv))
static int toku_recover_backward_fclose (struct logtype_fclose *l, RECOVER_ENV renv) {
if (renv->bs.bs == BS_SAW_CKPT) {
// tree open
char *fixedfname = fixup_fname(&l->fname);
internal_toku_recover_fopen_or_fcreate(renv, 0, 0, fixedfname, l->filenum, 0);
char *fixedfname = fixup_fname(&l->iname);
internal_toku_recover_fopen_or_fcreate(renv, 0, 0, fixedfname, l->filenum, l->treeflags);
}
return 0;
}
......@@ -524,8 +535,8 @@ static int toku_recover_fassociate (struct logtype_fassociate *UU(l), RECOVER_EN
}
static int toku_recover_backward_fassociate (struct logtype_fassociate *l, RECOVER_ENV renv) {
char *fixedfname = fixup_fname(&l->fname);
return internal_toku_recover_fopen_or_fcreate(renv, 0, 0, fixedfname, l->filenum, 0);
char *fixedfname = fixup_fname(&l->iname);
return internal_toku_recover_fopen_or_fcreate(renv, 0, 0, fixedfname, l->filenum, l->treeflags);
}
static int toku_recover_xstillopen (struct logtype_xstillopen *UU(l), RECOVER_ENV UU(renv)) {
......@@ -714,7 +725,7 @@ static void recover_abort_live_txns(RECOVER_ENV renv) {
}
}
static int do_recovery(RECOVER_ENV renv, const char *data_dir, const char *log_dir) {
static int do_recovery(RECOVER_ENV renv, const char *env_dir, const char *log_dir) {
int r;
int rr = 0;
TOKULOGCURSOR logcursor = NULL;
......@@ -739,6 +750,8 @@ static int do_recovery(RECOVER_ENV renv, const char *data_dir, const char *log_d
r = toku_logcursor_last(logcursor, &le);
if (r != 0) {
if (toku_recover_trace)
printf("RUNRECOVERY: %s:%d r=%d\n", __FUNCTION__, __LINE__, r);
rr = DB_RUNRECOVERY; goto errorexit;
}
......@@ -749,7 +762,7 @@ static int do_recovery(RECOVER_ENV renv, const char *data_dir, const char *log_d
r = toku_logcursor_create(&logcursor, log_dir);
assert(r == 0);
r = chdir(data_dir);
r = chdir(env_dir);
if (r != 0) {
// no data directory error
rr = errno; goto errorexit;
......@@ -772,6 +785,8 @@ static int do_recovery(RECOVER_ENV renv, const char *data_dir, const char *log_d
if (toku_recover_trace)
printf("%s:%d r=%d cmd=%c\n", __FUNCTION__, __LINE__, r, le ? le->cmd : '?');
if (r != 0) {
if (toku_recover_trace)
printf("DB_RUNRECOVERY: %s:%d r=%d\n", __FUNCTION__, __LINE__, r);
rr = DB_RUNRECOVERY; goto errorexit;
}
if (renv->goforward) {
......@@ -779,6 +794,8 @@ static int do_recovery(RECOVER_ENV renv, const char *data_dir, const char *log_d
if (toku_recover_trace)
printf("%s:%d r=%d cmd=%c\n", __FUNCTION__, __LINE__, r, le ? le->cmd : '?');
if (r != 0) {
if (toku_recover_trace)
printf("DB_RUNRECOVERY: %s:%d r=%d\n", __FUNCTION__, __LINE__, r);
rr = DB_RUNRECOVERY; goto errorexit;
}
break;
......@@ -801,6 +818,8 @@ static int do_recovery(RECOVER_ENV renv, const char *data_dir, const char *log_d
if (toku_recover_trace)
printf("%s:%d r=%d cmd=%c\n", __FUNCTION__, __LINE__, r, le ? le->cmd : '?');
if (r != 0) {
if (toku_recover_trace)
printf("DB_RUNRECOVERY: %s:%d r=%d\n", __FUNCTION__, __LINE__, r);
rr = DB_RUNRECOVERY; goto errorexit;
}
}
......@@ -882,7 +901,7 @@ int tokudb_recover_delete_rolltmp_files(const char *UU(data_dir), const char *lo
return r;
}
int tokudb_recover(const char *data_dir, const char *log_dir, brt_compare_func bt_compare, brt_compare_func dup_compare) {
int tokudb_recover(const char *env_dir, const char *log_dir, brt_compare_func bt_compare, brt_compare_func dup_compare) {
int r;
int lockfd = -1;
......@@ -902,7 +921,7 @@ int tokudb_recover(const char *data_dir, const char *log_dir, brt_compare_func b
r = recover_env_init(&renv, bt_compare, dup_compare);
assert(r == 0);
rr = do_recovery(&renv, data_dir, log_dir);
rr = do_recovery(&renv, env_dir, log_dir);
recover_env_cleanup(&renv, (BOOL)(rr == 0));
}
......
......@@ -16,7 +16,7 @@
// Run tokudb recovery from the log
// Returns 0 if success
int tokudb_recover(const char *datadir, const char *logdir, brt_compare_func bt_compare, brt_compare_func dup_compare);
int tokudb_recover(const char *envdir, const char *logdir, brt_compare_func bt_compare, brt_compare_func dup_compare);
// Effect: Check the tokudb logs to determine whether or not we need to run recovery.
// If the log is empty or if there is a clean shutdown at the end of the log, then we
......@@ -28,4 +28,6 @@ int tokudb_needs_recovery(const char *logdir, BOOL ignore_empty_log);
// Ruturns 0 if success
int tokudb_recover_delete_rolltmp_files(const char *datadir, const char *logdir);
extern int toku_recover_trace;
#endif // TOKURECOVER_H
......@@ -11,8 +11,67 @@
#include "roll.h"
int
toku_commit_fcreate (TXNID UU(xid),
FILENUM UU(filenum),
toku_commit_fdelete (u_int8_t file_was_open,
FILENUM filenum, // valid if file_was_open
BYTESTRING bs_fname, // cwd/iname
TOKUTXN txn,
YIELDF UU(yield),
void *UU(yield_v),
LSN oplsn) //oplsn is the lsn of the commit
{
//TODO: #2037 verify the file is (user) closed
char *fname = fixup_fname(&bs_fname);
//Remove reference to the fd in the cachetable
CACHEFILE cf;
int r;
if (file_was_open) { // file was open when toku_brt_remove_on_commit() was called
r = toku_cachefile_of_filenum(txn->logger->ct, filenum, &cf);
assert(r == 0); // must still be open (toku_brt_remove_on_commit() incremented refcount)
{
int fd = toku_cachefile_fd(cf);
assert(!toku_cachefile_is_dev_null(cf));
toku_logger_call_remove_finalize_callback(txn->logger, fd);
}
r = toku_cachefile_redirect_nullfd(cf);
assert(r==0);
char *error_string = NULL;
r = toku_cachefile_close(&cf, txn->logger, &error_string, TRUE, oplsn);
assert(r==0);
}
r = unlink(fname); // pathname relative to cwd
assert(r==0);
toku_free(fname);
return 0;
}
int
toku_rollback_fdelete (u_int8_t UU(file_was_open),
FILENUM UU(filenum),
BYTESTRING UU(bs_fname),
TOKUTXN UU(txn),
YIELDF UU(yield),
void* UU(yield_v),
LSN oplsn) //oplsn is the lsn of the abort
{
//TODO: #2037 verify the file is (user) closed
//Rolling back an fdelete is (almost) a no-op.
//If the rollback entry is holding a reference to the cachefile, remove the reference.
int r = 0;
if (file_was_open) {
CACHEFILE cf;
r = toku_cachefile_of_filenum(txn->logger->ct, filenum, &cf);
assert(r == 0);
char *error_string = NULL;
// decrement refcount that was incremented in toku_brt_remove_on_commit()
r = toku_cachefile_close(&cf, txn->logger, &error_string, TRUE, oplsn);
assert(r==0);
}
return r;
}
int
toku_commit_fcreate (FILENUM UU(filenum),
BYTESTRING UU(bs_fname),
TOKUTXN UU(txn),
YIELDF UU(yield),
......@@ -23,32 +82,30 @@ toku_commit_fcreate (TXNID UU(xid),
}
int
toku_rollback_fcreate (TXNID UU(xid),
FILENUM filenum,
BYTESTRING bs_fname,
toku_rollback_fcreate (FILENUM filenum,
BYTESTRING bs_fname, // cwd/iname
TOKUTXN txn,
YIELDF yield,
void* yield_v,
YIELDF UU(yield),
void* UU(yield_v),
LSN UU(oplsn))
{
yield(toku_checkpoint_safe_client_lock, yield_v);
//TODO: #2037 verify the file is (user) closed
char *fname = fixup_fname(&bs_fname);
char *directory = txn->logger->directory;
int full_len=strlen(fname)+strlen(directory)+2;
char full_fname[full_len];
int l = snprintf(full_fname,full_len, "%s/%s", directory, fname);
assert(l+1 == full_len);
//Remove reference to the fd in the cachetable
CACHEFILE cf;
int r = toku_cachefile_of_filenum(txn->logger->ct, filenum, &cf);
if (r == 0) {
r = toku_cachefile_redirect_nullfd(cf);
assert(r==0);
assert(r == 0);
{
int fd = toku_cachefile_fd(cf);
assert(!toku_cachefile_is_dev_null(cf));
toku_logger_call_remove_finalize_callback(txn->logger, fd);
}
r = unlink(full_fname);
r = toku_cachefile_redirect_nullfd(cf);
assert(r==0);
r = unlink(fname); // fname is relative to cwd
assert(r==0);
toku_free(fname);
toku_checkpoint_safe_client_unlock();
return 0;
}
......@@ -67,33 +124,32 @@ static int do_insertion (enum brt_msg_type type, FILENUM filenum, BYTESTRING key
int r = toku_cachefile_of_filenum(txn->logger->ct, filenum, &cf);
assert(r==0);
OMTVALUE brtv=NULL;
r = toku_omt_find_zero(txn->open_brts, find_brt_from_filenum, &filenum, &brtv, NULL, NULL);
assert(r==0);
BRT brt = brtv;
if (!toku_cachefile_is_dev_null(cf)) {
OMTVALUE brtv=NULL;
r = toku_omt_find_zero(txn->open_brts, find_brt_from_filenum, &filenum, &brtv, NULL, NULL);
assert(r==0);
BRT brt = brtv;
LSN treelsn = toku_brt_checkpoint_lsn(brt);
if (oplsn.lsn != 0 && oplsn.lsn <= treelsn.lsn)
return 0;
LSN treelsn = toku_brt_checkpoint_lsn(brt);
if (oplsn.lsn != 0 && oplsn.lsn <= treelsn.lsn)
return 0;
DBT key_dbt,data_dbt;
XIDS xids = toku_txn_get_xids(txn);
BRT_MSG_S brtcmd = { type, xids,
.u.id={toku_fill_dbt(&key_dbt, key.data, key.len),
data
? toku_fill_dbt(&data_dbt, data->data, data->len)
: toku_init_dbt(&data_dbt) }};
DBT key_dbt,data_dbt;
XIDS xids = toku_txn_get_xids(txn);
BRT_MSG_S brtcmd = { type, xids,
.u.id={toku_fill_dbt(&key_dbt, key.data, key.len),
data
? toku_fill_dbt(&data_dbt, data->data, data->len)
: toku_init_dbt(&data_dbt) }};
r = toku_brt_root_put_cmd(brt, &brtcmd);
r = toku_brt_root_put_cmd(brt, &brtcmd);
}
return r;
}
static int do_nothing_with_filenum(TOKUTXN txn, FILENUM filenum) {
CACHEFILE cf;
int r = toku_cachefile_of_filenum(txn->logger->ct, filenum, &cf);
assert(r==0);
return r;
static int do_nothing_with_filenum(TOKUTXN UU(txn), FILENUM UU(filenum)) {
return 0;
}
......@@ -303,6 +359,7 @@ toku_rollback_tablelock_on_empty_table (FILENUM filenum,
void* yield_v,
LSN UU(oplsn))
{
//TODO: Replace truncate function with something that doesn't need to mess with checkpoints.
yield(toku_checkpoint_safe_client_lock, yield_v);
// on rollback we have to make the file be empty, since we locked an empty table, and then may have done things to it.
......
......@@ -94,6 +94,8 @@ static int note_brt_used_in_txns_parent(OMTVALUE brtv, u_int32_t UU(index), void
return r;
}
//Commit each entry in the rollback (rolltmp) log.
//If the transaction has a parent, it just promotes its information to its parent.
int toku_rollback_commit(TOKUTXN txn, YIELDF yield, void*yieldv, LSN lsn) {
int r=0;
if (txn->parent!=0) {
......@@ -150,6 +152,9 @@ int toku_rollback_commit(TOKUTXN txn, YIELDF yield, void*yieldv, LSN lsn) {
r = toku_maybe_spill_rollbacks(txn->parent);
assert(r==0);
//If this transaction needs an fsync (if it commits)
//save that in the parent. Since the commit really happens in the root txn.
txn->parent->force_fsync_on_commit |= txn->force_fsync_on_commit;
} else {
// do the commit calls and free everything
// we do the commit calls in reverse order too.
......
......@@ -31,7 +31,7 @@ static void setup (void) {
int r;
unlink(fname);
r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0);
r = toku_open_brt(fname, 1, &t, nodesize, ct, NULL_TXN, toku_default_compare_fun, (DB*)0); assert(r==0);
r = toku_open_brt(fname, 1, &t, nodesize, ct, NULL_TXN, toku_builtin_compare_fun, (DB*)0); assert(r==0);
}
static void toku_shutdown (void) {
......
......@@ -27,7 +27,7 @@ static void test_sub_block(int n) {
error = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER);
assert(error == 0);
error = toku_open_brt(fname, TRUE, &brt, nodesize, ct, null_txn, toku_default_compare_fun, null_db);
error = toku_open_brt(fname, TRUE, &brt, nodesize, ct, null_txn, toku_builtin_compare_fun, null_db);
assert(error == 0);
// insert keys 0, 1, 2, .. (n-1)
......@@ -46,7 +46,7 @@ static void test_sub_block(int n) {
assert(error == 0);
// verify the brt by walking a cursor through the rows
error = toku_open_brt(fname, FALSE, &brt, nodesize, ct, null_txn, toku_default_compare_fun, null_db);
error = toku_open_brt(fname, FALSE, &brt, nodesize, ct, null_txn, toku_builtin_compare_fun, null_db);
assert(error == 0);
BRT_CURSOR cursor;
......
......@@ -34,7 +34,7 @@ static void test_multiple_brt_cursor_dbts(int n, DB *db) {
r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER);
assert(r==0);
r = toku_open_brt(fname, 1, &brt, 1<<12, ct, null_txn, toku_default_compare_fun, db);
r = toku_open_brt(fname, 1, &brt, 1<<12, ct, null_txn, toku_builtin_compare_fun, db);
assert(r==0);
int i;
......
......@@ -17,7 +17,7 @@ static void test_dump_empty_db (void) {
r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER);
assert(r==0);
unlink(fname);
r = toku_open_brt(fname, 1, &t, 1024, ct, null_txn, toku_default_compare_fun, null_db);
r = toku_open_brt(fname, 1, &t, 1024, ct, null_txn, toku_builtin_compare_fun, null_db);
assert(r==0);
if (verbose) toku_dump_brt(stdout, t);
r = toku_close_brt(t, 0, 0); assert(r==0);
......@@ -37,8 +37,8 @@ static void test_multiple_files_of_size (int size) {
unlink(n1);
toku_memory_check_all_free();
r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0);
r = toku_open_brt(n0, 1, &t0, size, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0);
r = toku_open_brt(n1, 1, &t1, size, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0);
r = toku_open_brt(n0, 1, &t0, size, ct, null_txn, toku_builtin_compare_fun, null_db); assert(r==0);
r = toku_open_brt(n1, 1, &t1, size, ct, null_txn, toku_builtin_compare_fun, null_db); assert(r==0);
for (i=0; i<10000; i++) {
char key[100],val[100];
DBT k,v;
......@@ -61,10 +61,10 @@ static void test_multiple_files_of_size (int size) {
/* Now see if the data is all there. */
r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0);
r = toku_open_brt(n0, 0, &t0, 1<<12, ct, null_txn, toku_default_compare_fun, null_db);
r = toku_open_brt(n0, 0, &t0, 1<<12, ct, null_txn, toku_builtin_compare_fun, null_db);
if (verbose) printf("%s:%d r=%d\n", __FILE__, __LINE__,r);
assert(r==0);
r = toku_open_brt(n1, 0, &t1, 1<<12, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0);
r = toku_open_brt(n1, 0, &t1, 1<<12, ct, null_txn, toku_builtin_compare_fun, null_db); assert(r==0);
for (i=0; i<10000; i++) {
char key[100],val[100];
......@@ -97,7 +97,7 @@ static void test_multiple_brts_one_db_one_file (void) {
unlink(fname);
r = toku_brt_create_cachetable(&ct, 32, ZERO_LSN, NULL_LOGGER); assert(r==0);
for (i=0; i<MANYN; i++) {
r = toku_open_brt(fname, (i==0), &trees[i], 1<<12, ct, null_txn, toku_default_compare_fun, null_db);
r = toku_open_brt(fname, (i==0), &trees[i], 1<<12, ct, null_txn, toku_builtin_compare_fun, null_db);
assert(r==0);
}
for (i=0; i<MANYN; i++) {
......@@ -135,7 +135,7 @@ static void test_read_what_was_written (void) {
toku_memory_check_all_free();
r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0);
r = toku_open_brt(fname, 1, &brt, 1<<12, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0);
r = toku_open_brt(fname, 1, &brt, 1<<12, ct, null_txn, toku_builtin_compare_fun, null_db); assert(r==0);
r = toku_close_brt(brt, 0, 0); assert(r==0);
r = toku_cachetable_close(&ct); assert(r==0);
......@@ -143,7 +143,7 @@ static void test_read_what_was_written (void) {
/* Now see if we can read an empty tree in. */
r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0);
r = toku_open_brt(fname, 0, &brt, 1<<12, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0);
r = toku_open_brt(fname, 0, &brt, 1<<12, ct, null_txn, toku_builtin_compare_fun, null_db); assert(r==0);
/* See if we can put something in it. */
{
......@@ -158,7 +158,7 @@ static void test_read_what_was_written (void) {
/* Now see if we can read it in and get the value. */
r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0);
r = toku_open_brt(fname, 0, &brt, 1<<12, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0);
r = toku_open_brt(fname, 0, &brt, 1<<12, ct, null_txn, toku_builtin_compare_fun, null_db); assert(r==0);
brt_lookup_and_check_nodup(brt, "hello", "there");
......@@ -219,7 +219,7 @@ static void test_read_what_was_written (void) {
toku_memory_check_all_free();
r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0);
r = toku_open_brt(fname, 0, &brt, 1<<12, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0);
r = toku_open_brt(fname, 0, &brt, 1<<12, ct, null_txn, toku_builtin_compare_fun, null_db); assert(r==0);
brt_lookup_and_check_nodup(brt, "hello", "there");
{
......@@ -253,7 +253,7 @@ static void test_cursor_last_empty(void) {
//printf("%s:%d %d alloced\n", __FILE__, __LINE__, toku_get_n_items_malloced()); toku_print_malloced_items();
r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0);
//printf("%s:%d %d alloced\n", __FILE__, __LINE__, toku_get_n_items_malloced()); toku_print_malloced_items();
r = toku_open_brt(fname, 1, &brt, 1<<12, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0);
r = toku_open_brt(fname, 1, &brt, 1<<12, ct, null_txn, toku_builtin_compare_fun, null_db); assert(r==0);
//printf("%s:%d %d alloced\n", __FILE__, __LINE__, toku_get_n_items_malloced()); toku_print_malloced_items();
r = toku_brt_cursor(brt, &cursor, NULL); assert(r==0);
{
......@@ -286,7 +286,7 @@ static void test_cursor_next (void) {
toku_memory_check_all_free();
r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0);
//printf("%s:%d %d alloced\n", __FILE__, __LINE__, toku_get_n_items_malloced()); toku_print_malloced_items();
r = toku_open_brt(fname, 1, &brt, 1<<12, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0);
r = toku_open_brt(fname, 1, &brt, 1<<12, ct, null_txn, toku_builtin_compare_fun, null_db); assert(r==0);
//printf("%s:%d %d alloced\n", __FILE__, __LINE__, toku_get_n_items_malloced()); toku_print_malloced_items();
r = toku_brt_insert(brt, toku_fill_dbt(&kbt, "hello", 6), toku_fill_dbt(&vbt, "there", 6), null_txn);
r = toku_brt_insert(brt, toku_fill_dbt(&kbt, "byebye", 7), toku_fill_dbt(&vbt, "byenow", 7), null_txn);
......@@ -365,7 +365,7 @@ static void test_wrongendian_compare (int wrong_p, unsigned int N) {
//printf("%s:%d WRONG=%d\n", __FILE__, __LINE__, wrong_p);
if (0) { // ???? Why is this commented out?
r = toku_open_brt(fname, 1, &brt, 1<<20, ct, null_txn, wrong_p ? wrong_compare_fun : toku_default_compare_fun, &nonce_db); assert(r==0);
r = toku_open_brt(fname, 1, &brt, 1<<20, ct, null_txn, wrong_p ? wrong_compare_fun : toku_builtin_compare_fun, &nonce_db); assert(r==0);
for (i=1; i<257; i+=255) {
unsigned char a[4],b[4];
b[3] = a[0] = (unsigned char)(i&255);
......@@ -404,7 +404,7 @@ static void test_wrongendian_compare (int wrong_p, unsigned int N) {
{
toku_cachetable_verify(ct);
r = toku_open_brt(fname, 1, &brt, 1<<20, ct, null_txn, wrong_p ? wrong_compare_fun : toku_default_compare_fun, &nonce_db); assert(r==0);
r = toku_open_brt(fname, 1, &brt, 1<<20, ct, null_txn, wrong_p ? wrong_compare_fun : toku_builtin_compare_fun, &nonce_db); assert(r==0);
toku_cachetable_verify(ct);
for (i=0; i<N; i++) {
......@@ -459,7 +459,7 @@ static void test_large_kv(int bsize, int ksize, int vsize) {
r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER);
assert(r==0);
unlink(fname);
r = toku_open_brt(fname, 1, &t, bsize, ct, null_txn, toku_default_compare_fun, null_db);
r = toku_open_brt(fname, 1, &t, bsize, ct, null_txn, toku_builtin_compare_fun, null_db);
assert(r==0);
DBT key, val;
......@@ -505,7 +505,7 @@ static void test_brt_delete_empty(void) {
r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER);
assert(r==0);
unlink(fname);
r = toku_open_brt(fname, 1, &t, 4096, ct, null_txn, toku_default_compare_fun, null_db);
r = toku_open_brt(fname, 1, &t, 4096, ct, null_txn, toku_builtin_compare_fun, null_db);
assert(r==0);
DBT key;
......@@ -533,7 +533,7 @@ static void test_brt_delete_present(int n) {
r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER);
assert(r==0);
unlink(fname);
r = toku_open_brt(fname, 1, &t, 4096, ct, null_txn, toku_default_compare_fun, null_db);
r = toku_open_brt(fname, 1, &t, 4096, ct, null_txn, toku_builtin_compare_fun, null_db);
assert(r==0);
/* insert 0 .. n-1 */
......@@ -595,7 +595,7 @@ static void test_brt_delete_not_present(int n) {
r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER);
assert(r==0);
unlink(fname);
r = toku_open_brt(fname, 1, &t, 4096, ct, null_txn, toku_default_compare_fun, null_db);
r = toku_open_brt(fname, 1, &t, 4096, ct, null_txn, toku_builtin_compare_fun, null_db);
assert(r==0);
DBT key, val;
......@@ -641,7 +641,7 @@ static void test_brt_delete_cursor_first(int n) {
r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER);
assert(r==0);
unlink(fname);
r = toku_open_brt(fname, 1, &t, 4096, ct, null_txn, toku_default_compare_fun, null_db);
r = toku_open_brt(fname, 1, &t, 4096, ct, null_txn, toku_builtin_compare_fun, null_db);
assert(r==0);
/* insert 0 .. n-1 */
......@@ -734,7 +734,7 @@ static void test_insert_delete_lookup(int n) {
r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER);
assert(r==0);
unlink(fname);
r = toku_open_brt(fname, 1, &t, 4096, ct, null_txn, toku_default_compare_fun, null_db);
r = toku_open_brt(fname, 1, &t, 4096, ct, null_txn, toku_builtin_compare_fun, null_db);
assert(r==0);
/* insert 0 .. n-1 */
......
......@@ -19,7 +19,7 @@ static void test0 (void) {
assert(r==0);
if (verbose) printf("%s:%d test0\n", __FILE__, __LINE__);
unlink(fname);
r = toku_open_brt(fname, 1, &t, 1024, ct, null_txn, toku_default_compare_fun, null_db);
r = toku_open_brt(fname, 1, &t, 1024, ct, null_txn, toku_builtin_compare_fun, null_db);
assert(r==0);
//printf("%s:%d test0\n", __FILE__, __LINE__);
//printf("%s:%d n_items_malloced=%lld\n", __FILE__, __LINE__, n_items_malloced);
......
......@@ -18,7 +18,7 @@ static void test1 (void) {
r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER);
assert(r==0);
unlink(fname);
r = toku_open_brt(fname, 1, &t, 1024, ct, null_txn, toku_default_compare_fun, null_db);
r = toku_open_brt(fname, 1, &t, 1024, ct, null_txn, toku_builtin_compare_fun, null_db);
assert(r==0);
toku_brt_insert(t, toku_fill_dbt(&k, "hello", 6), toku_fill_dbt(&v, "there", 6), null_txn);
{
......
......@@ -18,7 +18,7 @@ static void test2 (int memcheck, int limit) {
toku_memory_check_all_free();
r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0);
unlink(fname);
r = toku_open_brt(fname, 1, &t, 1024, ct, null_txn, toku_default_compare_fun, null_db);
r = toku_open_brt(fname, 1, &t, 1024, ct, null_txn, toku_builtin_compare_fun, null_db);
if (verbose) printf("%s:%d did setup\n", __FILE__, __LINE__);
assert(r==0);
for (i=0; i<limit; i++) { // 4096
......
......@@ -21,7 +21,7 @@ static void test3 (int nodesize, int count, int memcheck) {
r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0);
gettimeofday(&t0, 0);
unlink(fname);
r = toku_open_brt(fname, 1, &t, nodesize, ct, null_txn, toku_default_compare_fun, null_db);
r = toku_open_brt(fname, 1, &t, nodesize, ct, null_txn, toku_builtin_compare_fun, null_db);
assert(r==0);
for (i=0; i<count; i++) {
char key[100],val[100];
......
......@@ -21,7 +21,7 @@ static void test4 (int nodesize, int count, int memcheck) {
toku_memory_check=memcheck;
toku_memory_check_all_free();
r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0);
r = toku_open_brt(fname, 1, &t, nodesize, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0);
r = toku_open_brt(fname, 1, &t, nodesize, ct, null_txn, toku_builtin_compare_fun, null_db); assert(r==0);
for (i=0; i<count; i++) {
char key[100],val[100];
int rv = random();
......
......@@ -20,7 +20,7 @@ static void test5 (void) {
for (i=0; i<limit; i++) values[i]=-1;
unlink(fname);
r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0);
r = toku_open_brt(fname, 1, &t, 1<<12, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0);
r = toku_open_brt(fname, 1, &t, 1<<12, ct, null_txn, toku_builtin_compare_fun, null_db); assert(r==0);
for (i=0; i<limit/2; i++) {
char key[100],val[100];
int rk = random()%limit;
......
......@@ -18,7 +18,7 @@ static void test_flat (void) {
// set the cachetable to size 1 so that things won't fit.
int r = toku_brt_create_cachetable(&ct, 1, ZERO_LSN, NULL_LOGGER); assert(r==0);
BRT t;
r = toku_open_brt(fname, 1, &t, 1<<12, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0);
r = toku_open_brt(fname, 1, &t, 1<<12, ct, null_txn, toku_builtin_compare_fun, null_db); assert(r==0);
u_int64_t i;
// permute the numbers from 0 (inclusive) to limit (exclusive)
permute[0]=0;
......
......@@ -16,7 +16,7 @@ static void test_flat (void) {
CACHETABLE ct;
int r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0);
BRT t;
r = toku_open_brt(fname, 1, &t, 1<<12, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0);
r = toku_open_brt(fname, 1, &t, 1<<12, ct, null_txn, toku_builtin_compare_fun, null_db); assert(r==0);
u_int64_t i;
for (i=0; i<limit; i++) {
char key[100],val[100];
......
......@@ -19,7 +19,7 @@ test_overflow (void) {
int r;
unlink(fname);
r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0);
r = toku_open_brt(fname, 1, &t, nodesize, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0);
r = toku_open_brt(fname, 1, &t, nodesize, ct, null_txn, toku_builtin_compare_fun, null_db); assert(r==0);
DBT k,v;
u_int32_t vsize = nodesize/8;
......
......@@ -28,7 +28,7 @@ doit (void) {
snprintf(fname, fnamelen, "%s.brt", __FILE__);
r = toku_brt_create_cachetable(&ct, 16*1024, ZERO_LSN, NULL_LOGGER); assert(r==0);
unlink(fname);
r = toku_open_brt(fname, 1, &t, NODESIZE, ct, null_txn, toku_default_compare_fun, null_db);
r = toku_open_brt(fname, 1, &t, NODESIZE, ct, null_txn, toku_builtin_compare_fun, null_db);
assert(r==0);
toku_free(fname);
......
......@@ -16,7 +16,7 @@ test_main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__u
unlink(n);
assert(f);
r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0);
r = toku_open_brt(n, 0, 1, &t, 1<<12, ct, null_txn, toku_default_compare_fun, null_db); assert(r==0);
r = toku_open_brt(n, 0, 1, &t, 1<<12, ct, null_txn, toku_builtin_compare_fun, null_db); assert(r==0);
int i;
for (i=0; i<10000; i++) {
char key[100],val[100];
......
......@@ -57,7 +57,7 @@ doit (int ksize __attribute__((__unused__))) {
snprintf(fname, fnamelen, "%s.brt", __FILE__);
r = toku_brt_create_cachetable(&ct, 16*1024, ZERO_LSN, NULL_LOGGER); assert(r==0);
unlink(fname);
r = toku_open_brt(fname, 1, &t, NODESIZE, ct, null_txn, toku_default_compare_fun, null_db);
r = toku_open_brt(fname, 1, &t, NODESIZE, ct, null_txn, toku_builtin_compare_fun, null_db);
assert(r==0);
toku_free(fname);
......
......@@ -19,6 +19,7 @@ const FILENUM fn_aname = {0};
const FILENUM fn_bname = {1};
BYTESTRING bs_aname, bs_bname;
BYTESTRING bs_a, bs_b;
BYTESTRING bs_empty;
static int create_logfiles(void);
......@@ -157,6 +158,8 @@ int create_logfiles() {
bs_bname.len = 4; bs_bname.data="b.db";
bs_a.len = 2; bs_a.data="a";
bs_b.len = 2; bs_b.data="b";
bs_empty.len = 0; bs_empty.data = NULL;
// create and open logger
r = toku_logger_create(&logger); assert(r==0);
......@@ -166,13 +169,13 @@ int create_logfiles() {
//xbegin 'b': lsn=1 parenttxnid=0 crc=00005f1f len=29
r = toku_log_xbegin(logger, &lsn, NO_FSYNC, 0); assert(r==0); txnid = lsn.lsn;
//fcreate 'F': lsn=2 txnid=1 filenum=0 fname={len=4 data="a.db"} mode=0777 treeflags=0 crc=18a3d525 len=49
r = toku_log_fcreate(logger, &lsn, NO_FSYNC, txnid, fn_aname, bs_aname, 0x0777, 0); assert(r==0);
r = toku_log_fcreate(logger, &lsn, NO_FSYNC, txnid, fn_aname, bs_aname, 0x0777, 0, 0, bs_empty); assert(r==0);
//commit 'C': lsn=3 txnid=1 crc=00001f1e len=29
r = toku_log_commit(logger, &lsn, FSYNC, txnid); assert(r==0);
//xbegin 'b': lsn=4 parenttxnid=0 crc=00000a1f len=29
r = toku_log_xbegin(logger, &lsn, NO_FSYNC, 0); assert(r==0); txnid = lsn.lsn;
//fcreate 'F': lsn=5 txnid=4 filenum=1 fname={len=4 data="b.db"} mode=0777 treeflags=0 crc=14a47925 len=49
r = toku_log_fcreate(logger, &lsn, NO_FSYNC, txnid, fn_bname, bs_bname, 0x0777, 0); assert(r==0);
r = toku_log_fcreate(logger, &lsn, NO_FSYNC, txnid, fn_bname, bs_bname, 0x0777, 0, 0, bs_empty); assert(r==0);
//commit 'C': lsn=6 txnid=4 crc=0000c11e len=29
r = toku_log_commit(logger, &lsn, FSYNC, txnid); assert(r==0);
//xbegin 'b': lsn=7 parenttxnid=0 crc=0000f91f len=29
......@@ -184,9 +187,9 @@ int create_logfiles() {
//xstillopen 's': lsn=10 txnid=7 parent=0 crc=00061816 len=37
r = toku_log_xstillopen(logger, &lsn, NO_FSYNC, txnid, 0); assert(r==0);
//fassociate 'f': lsn=11 filenum=1 fname={len=4 data="b.db"} crc=a7126035 len=33
r = toku_log_fassociate(logger, &lsn, NO_FSYNC, fn_bname, bs_bname); assert(r==0);
r = toku_log_fassociate(logger, &lsn, NO_FSYNC, fn_bname, 0, bs_bname); assert(r==0);
//fassociate 'f': lsn=12 filenum=0 fname={len=4 data="a.db"} crc=a70c5f35 len=33
r = toku_log_fassociate(logger, &lsn, NO_FSYNC, fn_aname, bs_aname); assert(r==0);
r = toku_log_fassociate(logger, &lsn, NO_FSYNC, fn_aname, 0, bs_aname); assert(r==0);
//end_checkpoint 'X': lsn=13 txnid=9 timestamp=1251309957586872 crc=cd285c30 len=37
r = toku_log_end_checkpoint(logger, &lsn, FSYNC, cp_txnid, 1251309957586872); assert(r==0);
//enq_insert 'I': lsn=14 filenum=1 xid=7 key={len=2 data="b\000"} value={len=2 data="a\000"} crc=40388be4 len=45
......
......@@ -60,6 +60,7 @@ int toku_txn_begin_with_xid (TOKUTXN parent_tokutxn, TOKUTXN *tokutxn, TOKULOGGE
result->rollentry_filename = 0;
result->rollentry_fd = -1;
result->rollentry_filesize = 0;
result->force_fsync_on_commit = 0;
*tokutxn = result;
return 0;
......@@ -78,7 +79,10 @@ int toku_txn_commit_txn(TOKUTXN txn, int nosync, YIELDF yield, void *yieldv) {
int toku_txn_commit_with_lsn(TOKUTXN txn, int nosync, YIELDF yield, void *yieldv, LSN oplsn) {
int r;
// panic handled in log_commit
r = toku_log_commit(txn->logger, (LSN*)0, (txn->parent==0) && !nosync, txn->txnid64); // exits holding neither of the tokulogger locks.
//Child transactions do not actually 'commit'. They promote their changes to parent, so no need to fsync if this txn has a parent.
int do_fsync = !txn->parent && (txn->force_fsync_on_commit || !nosync);
r = toku_log_commit(txn->logger, (LSN*)0, do_fsync, txn->txnid64); // exits holding neither of the tokulogger locks.
if (r!=0)
return r;
r = toku_rollback_commit(txn, yield, yieldv, oplsn);
......
......@@ -41,6 +41,12 @@ static inline void wbuf_nocrc_char (struct wbuf *w, unsigned char ch) {
w->buf[w->ndone++]=ch;
}
/* Write a character. */
static inline void wbuf_nocrc_u_int8_t (struct wbuf *w, u_int8_t ch) {
assert(w->ndone<w->size);
w->buf[w->ndone++]=ch;
}
static inline void wbuf_char (struct wbuf *w, unsigned char ch) {
wbuf_nocrc_char (w, ch);
x1764_add(&w->checksum, &w->buf[w->ndone-1], 1);
......
......@@ -295,9 +295,9 @@ heaviside_next(const DBT *key, const DBT *val, void *extra_h) {
struct extra_heavi *e=extra_h;
int cmp;
cmp = toku_default_compare_fun(db, key, &e->key);
cmp = toku_builtin_compare_fun(db, key, &e->key);
if (cmp != 0) return cmp;
if (val) cmp = toku_default_compare_fun(db, val, &e->val);
if (val) cmp = toku_builtin_compare_fun(db, val, &e->val);
if (cmp != 0) return cmp;
return -1; //Return negative on <=, positive on >
}
......
......@@ -44,7 +44,7 @@
toku_cachetable_print_hash_histogram;
toku_set_lsn_increment;
toku_default_compare_fun;
toku_builtin_compare_fun;
toku_stat;
toku_fstat;
......
......@@ -1277,8 +1277,9 @@ void toku_ltm_invalidate_lt(toku_ltm* mgr, toku_db_id* db_id) {
assert(mgr && db_id);
toku_lt_map* map = NULL;
map = toku_idlth_find(mgr->idlth, db_id);
if (!map) { return; }
toku_idlth_delete(mgr->idlth, db_id);
if (map) {
toku_idlth_delete(mgr->idlth, db_id);
}
}
......
......@@ -110,6 +110,7 @@ BDB_DONTRUN_TESTS = \
backwards_10_each_le_and_msg \
test_dupsort_set_range_reverse \
test_dupsort_get_both_range_reverse \
recover-compare-db \
test_cursor_delete_2119 \
#\ ends prev line
......@@ -156,11 +157,10 @@ TDB_TESTS_THAT_SHOULD_FAIL= \
test_truncate_txn_abort \
test_db_no_env \
#\ ends prev line
ifneq ($(OS_CHOICE),windows)
TDB_TESTS_THAT_SHOULD_FAIL+= \
test_db_remove \
#ifneq ($(OS_CHOICE),windows)
# TDB_TESTS_THAT_SHOULD_FAIL+= \
#\ ends prev line
endif
#endif
TDB_TESTS_THAT_SHOULD_FAIL_LIT= \
test_log8.recover \
......@@ -198,7 +198,6 @@ TLRECOVER = 2 3 4 5 6 7 8 9 10
EXTRA_TDB_TESTS = \
$(patsubst %,test_log%.recover,$(TLRECOVER)) \
# test_db_assoc3.tdbrun_wasbad \# Obsolete right now.
#\ ends prev line
RECOVER_TESTS = $(patsubst %.c,%.abortrecover,$(RECOVER_SRCS))
......@@ -300,8 +299,11 @@ endif
./$< --no-shutdown && \
rm -rf dir.$*.c.tdb.recover && \
mkdir dir.$*.c.tdb.recover && \
cp dir.$*.c.tdb/tokudb.directory dir.$*.c.tdb.recover/ && \
cp dir.$*.c.tdb/tokudb.environment dir.$*.c.tdb.recover/ && \
cp dir.$*.c.tdb/*.tokulog dir.$*.c.tdb.recover/ && \
echo doing recovery &&\
$(VGRIND) ../../newbrt/tdb-recover dir.$*.c.tdb.recover dir.$*.c.tdb && \
$(VGRIND) ../../newbrt/tdb-recover dir.$*.c.tdb.recover dir.$*.c.tdb.recover && \
echo dump and compare &&\
$(TDBDUMP) -h dir.$*.c.tdb foo.db > dir.$*.c.tdb/foo.dump && \
$(TDBDUMP) -h dir.$*.c.tdb.recover foo.db > dir.$*.c.tdb.recover/foo.dump && \
......@@ -421,44 +423,6 @@ libs:
test_db_curs4.tdb$(BINSUF): trace.h
test_db_curs4.bdb$(BINSUF): trace.h
test_db_assoc3.tdb$(BINSUF) test_db_assoc3.bdb$(BINSUF): test.h
# This one failed in both BDB and TokuDB, in the same way. It was a program error. Now it works
test_db_assoc3.tdbrun_wasbad: test_db_assoc3.tdb$(BINSUF)
./$< --seed=1 --count=200
./$< --seed=1 --count=200 --more
./$< --seed=1 --count=200 --more
./$< --seed=1 --count=200 --more
./$< --seed=1 --count=200 --more
./$< --seed=1 --count=200 --more
./$< --seed=1 --count=200 --more
# serialize these two tests since they use the same directory
test_db_assoc3.tdbrun_wasbad: test_db_assoc3.tdbrun
.phony: build_primary_db build_name_db build_expire_db
test_v6_assoc3.dir/dir.test_db_assoc3.c.tdb$(BINSUF):
mkdir $@
build_primary_db: test_v6_assoc3.dir/dir.test_db_assoc3.c.tdb$(BINSUF)
gunzip < test_v6_assoc3.dir/dir.test_db_assoc3.c.tdb.original/primary.db.gz > test_v6_assoc3.dir/dir.test_db_assoc3.c.tdb/primary.db
build_name_db: test_v6_assoc3.dir/dir.test_db_assoc3.c.tdb$(BINSUF)
gunzip < test_v6_assoc3.dir/dir.test_db_assoc3.c.tdb.original/name.db.gz > test_v6_assoc3.dir/dir.test_db_assoc3.c.tdb/name.db
build_expire_db: test_v6_assoc3.dir/dir.test_db_assoc3.c.tdb$(BINSUF)
gunzip < test_v6_assoc3.dir/dir.test_db_assoc3.c.tdb.original/expire.db.gz > test_v6_assoc3.dir/dir.test_db_assoc3.c.tdb/expire.db
test_v6v7_assoc3.tdbrun: test_db_assoc3.tdb$(BINSUF) build_primary_db build_name_db build_expire_db
(cd test_v6_assoc3.dir; LD_LIBRARY_PATH=../.. $(VGRIND) ../test_db_assoc3.tdb$(BINSUF) --seed=3 --count=1000 --more) $(SUMMARIZE_CMD)
test_db_assoc3.tdbrun: test_db_assoc3.tdb$(BINSUF)
$(VGRIND) ./$< --seed=2 --count=100000 $(VERBVERBOSE) && \
$(VGRIND) ./$< --seed=2 --count=100000 --more $(VERBVERBOSE) $(SUMMARIZE_CMD)
# Give up on VGRIND for bdbrun
test_db_assoc3.bdbrun: test_db_assoc3.bdb$(BINSUF) $(WINDOWS_BDB_LIB_NAME)
./$< --seed=2 --count=100000 $(VERBVERBOSE) && \
./$< --seed=2 --count=100000 --more $(VERBVERBOSE) $(SUMMARIZE_CMD)
# a bunch of little tests designed to run in parallel
test_get_both_range.tdbrun: \
tgbr_256_a.tdbrun tgbr_256_b.tdbrun tgbr_256_c.tdbrun \
......
/* -*- mode: C; c-basic-offset: 4 -*- */
#ident "Copyright (c) 2009 Tokutek Inc. All rights reserved."
#include "test.h"
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <unistd.h>
#include <memory.h>
#include <sys/stat.h>
#include <db.h>
#define fname ENVDIR "/each_le_and_msg.tokudb_10"
static void
test_upgrade_from_10 (void) {
DB_TXN * const null_txn = 0;
int r;
system("rm -rf " ENVDIR);
r=toku_os_mkdir(ENVDIR, S_IRWXU+S_IRWXG+S_IRWXO); assert(r==0);
system("gunzip -c backwards_10/each_le_and_msg.tokudb_10.gz > " fname);
const int PAGESIZE=1024;
/* create the dup database file */
DB_ENV *env;
r = db_env_create(&env, 0); assert(r == 0);
r = env->open(env, ".", DB_CREATE+DB_PRIVATE+DB_INIT_MPOOL, 0); assert(r == 0);
DB *db;
r = db_create(&db, env, 0);
assert(r == 0);
r = db->set_pagesize(db, PAGESIZE);
assert(r == 0);
r = db->open(db, null_txn, fname, NULL, DB_BTREE, 0, 0666);
assert(r == 0);
enum {num_leafentries = 7, num_insert_messages=2};
char *keys[num_leafentries+num_insert_messages] = {
"le_committed",
"le_provpair_0",
"le_provpair_25",
"le_provdel_0", //Leafentry should not even exist; query should not find it.
"le_provdel_25", //Leafentry should exist, but query should not find it.
"le_both_0",
"le_both_25",
"message_0",
"message_42"
};
char *vals[num_leafentries+num_insert_messages] = {
"val_le_committed",
"val_le_provpair_0",
"val_le_provpair_25",
"val_le_provdel_0",
"val_le_provdel_25",
"val_le_both_0_and_padding",
"val_le_both_25_and_padding",
"val_message_0",
"val_message_42"
};
int i;
unsigned int VALSIZE = 256;
DBT key,val;
for (i=0; i<num_leafentries+num_insert_messages; i++) {
char valbuf[VALSIZE];
assert(VALSIZE > strlen(vals[i]));
memset(valbuf, 'X', sizeof(valbuf));
strcpy(valbuf, vals[i]);
dbt_init(&key, keys[i], strlen(keys[i]));
if (i<num_leafentries)
dbt_init(&val, valbuf, sizeof(valbuf));
else
dbt_init(&val, vals[i], strlen(vals[i]));
r = db->get(db, null_txn, &key, &val, DB_GET_BOTH); //DB_GET_BOTH);
if (!strcmp(keys[i], "le_provdel_0") ||
!strcmp(keys[i], "le_provdel_25")) {
//Should not find with key/val pair
CKERR2(r, DB_NOTFOUND);
//Should not find with key alone
DBT nothing;
dbt_init(&nothing, NULL, 0);
r = db->get(db, null_txn, &key, &nothing, 0);
CKERR2(r, DB_NOTFOUND);
}
else
CKERR(r);
}
DBC *c;
r = db->cursor(db, NULL, &c, 0);
CKERR(r);
dbt_init(&key, NULL, 0);
dbt_init(&val, NULL, 0);
int num_found = 0;
do {
r = c->c_get(c, &key, &val, DB_NEXT);
CKERR2s(r, 0, DB_NOTFOUND);
if (r==0) num_found++;
} while (r==0);
CKERR2(r, DB_NOTFOUND);
c->c_close(c);
assert(num_found == num_leafentries + num_insert_messages - 2); //le_provdels should not show up
r = db->close(db, 0); assert(r == 0);
r = env->close(env, 0); assert(r == 0);
}
int
test_main(int argc, char *argv[]) {
parse_args(argc, argv);
test_upgrade_from_10();
return 0;
}
......@@ -227,7 +227,7 @@ run_test (int iter, int die) {
int recovery_flags = 0;
if ( do_log_recover ) {
recovery_flags += DB_INIT_LOG;
recovery_flags += DB_INIT_LOG|DB_INIT_TXN;
if ( iter != 0 )
recovery_flags += DB_RECOVER;
}
......
......@@ -207,28 +207,60 @@ db_delete(DICTIONARY d) {
null_dictionary(d);
}
// Create a new dictionary (dest) with a new dname that has same contents as given dictionary (src).
// Method:
// create new dictionary
// close new dictionary
// get inames of both dictionaries
// copy file (by iname) of src to dest
// open dest dictionary
static void UU()
dbcpy(DICTIONARY dest, DICTIONARY src, DB_TXN *open_txn) {
assert(dest->db == NULL);
char source[MAX_NAME*2 + sizeof(ENVDIR "/")];
fill_full_name(src, source, sizeof(source));
int r;
assert(dest->db == NULL);
*dest = *src;
dest->db = NULL;
dest->num++;
char target[MAX_NAME*2 + sizeof(ENVDIR "/")];
fill_full_name(dest, target, sizeof(target));
db_startup(dest, open_txn);
db_shutdown(dest);
char dest_dname[MAX_NAME*2];
fill_name(dest, dest_dname, sizeof(dest_dname));
char src_dname[MAX_NAME*2];
fill_name(src, src_dname, sizeof(src_dname));
DBT dest_dname_dbt;
DBT dest_iname_dbt;
DBT src_dname_dbt;
DBT src_iname_dbt;
dbt_init(&dest_dname_dbt, dest_dname, strlen(dest_dname)+1);
dbt_init(&dest_iname_dbt, NULL, 0);
dest_iname_dbt.flags |= DB_DBT_MALLOC;
r = env->get_iname(env, &dest_dname_dbt, &dest_iname_dbt);
CKERR(r);
dbt_init(&src_dname_dbt, src_dname, strlen(src_dname)+1);
dbt_init(&src_iname_dbt, NULL, 0);
src_iname_dbt.flags |= DB_DBT_MALLOC;
r = env->get_iname(env, &src_dname_dbt, &src_iname_dbt);
CKERR(r);
char * src_iname = src_iname_dbt.data;
char * dest_iname = dest_iname_dbt.data;
int bytes;
char command[sizeof("cp ") + sizeof(source)+ sizeof(" ") + sizeof(target)];
bytes = snprintf(command, sizeof(command), "cp %s %s", source, target);
assert(bytes<(int)sizeof(command));
char command[sizeof("cp -f ") + strlen(src_iname)+ strlen(ENVDIR"/ " ENVDIR"/ ") + strlen(dest_iname)];
bytes = snprintf(command, sizeof(command), "cp -f "ENVDIR"/%s "ENVDIR"/%s", src_iname, dest_iname);
assert(bytes<(int)sizeof(command));
toku_free(src_iname);
toku_free(dest_iname);
int r;
r = system(command);
CKERR(r);
db_startup(dest, open_txn);
......
......@@ -3,7 +3,7 @@
#include <sys/stat.h>
#include "test.h"
const int envflags = DB_INIT_MPOOL|DB_CREATE|DB_THREAD |DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_TXN;
const int envflags = DB_INIT_MPOOL|DB_CREATE|DB_THREAD |DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_TXN|DB_PRIVATE;
char *namea="a.db";
char *nameb="b.db";
......@@ -23,7 +23,14 @@ static void run_test (void) {
r = db->close(db, 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); assert(r != 0);
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
r = db->close(db, 0); CKERR(r);
r = db_create(&db, env, 0); CKERR(r);
#else
assert(r != 0);
#endif
r = toku_os_mkdir(ENVDIR "/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->close(db, 0); CKERR(r);
......
......@@ -21,10 +21,8 @@ static void initialize (void) {
// setup environment
{
r = db_env_create(&env, 0); assert(r == 0);
r = env->set_data_dir(env, ENVDIR);
r = env->set_lg_dir(env, ENVDIR);
env->set_errfile(env, stdout);
r = env->open(env, 0, DB_INIT_MPOOL + DB_PRIVATE + DB_CREATE, 0777);
r = env->open(env, ENVDIR, DB_INIT_MPOOL + DB_PRIVATE + DB_CREATE, 0777);
assert(r == 0);
}
......
......@@ -21,10 +21,8 @@ static void initialize (void) {
// setup environment
{
r = db_env_create(&env, 0); assert(r == 0);
r = env->set_data_dir(env, ENVDIR);
r = env->set_lg_dir(env, ENVDIR);
env->set_errfile(env, stdout);
r = env->open(env, 0, DB_INIT_MPOOL + DB_PRIVATE + DB_CREATE, 0777);
r = env->open(env, ENVDIR, DB_INIT_MPOOL + DB_PRIVATE + DB_CREATE, 0777);
assert(r == 0);
}
......
......@@ -15,7 +15,7 @@
DB_ENV *env;
DB *db;
const char dbname[] = "foo.db";
const int envflags = DB_INIT_MPOOL|DB_CREATE|DB_THREAD |DB_INIT_LOCK|DB_INIT_LOG;
const int envflags = DB_INIT_MPOOL|DB_CREATE|DB_THREAD |DB_INIT_LOCK|DB_INIT_LOG|DB_PRIVATE|DB_INIT_TXN;
static void
open_em (void)
......
......@@ -15,7 +15,7 @@
DB_ENV *env;
DB *db;
const char dbname[] = "foo.db";
const int envflags = DB_INIT_MPOOL|DB_CREATE|DB_THREAD |DB_INIT_LOCK|DB_INIT_LOG;
const int envflags = DB_INIT_MPOOL|DB_CREATE|DB_THREAD |DB_INIT_LOCK|DB_INIT_LOG|DB_PRIVATE|DB_INIT_TXN;
static void
open_em (void)
......
......@@ -3,7 +3,7 @@
#include <sys/stat.h>
#include "test.h"
const int envflags = DB_INIT_MPOOL|DB_CREATE|DB_THREAD |DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_TXN;
const int envflags = DB_INIT_MPOOL|DB_CREATE|DB_THREAD |DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_TXN|DB_PRIVATE;
char *namea="a.db";
char *nameb="b.db";
......
......@@ -3,7 +3,7 @@
#include <sys/stat.h>
#include "test.h"
const int envflags = DB_INIT_MPOOL|DB_CREATE|DB_THREAD |DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_TXN;
const int envflags = DB_INIT_MPOOL|DB_CREATE|DB_THREAD |DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_TXN|DB_PRIVATE;
char *namea="a.db";
char *nameb="b.db";
......
......@@ -3,7 +3,7 @@
#include <sys/stat.h>
#include "test.h"
const int envflags = DB_INIT_MPOOL|DB_CREATE|DB_THREAD |DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_TXN;
const int envflags = DB_INIT_MPOOL|DB_CREATE|DB_THREAD |DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_TXN|DB_PRIVATE;
char *namea="a.db";
char *nameb="b.db";
......
......@@ -3,7 +3,7 @@
#include <sys/stat.h>
#include "test.h"
const int envflags = DB_INIT_MPOOL|DB_CREATE|DB_THREAD |DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_TXN;
const int envflags = DB_INIT_MPOOL|DB_CREATE|DB_THREAD |DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_TXN|DB_PRIVATE;
char *namea="a.db";
char *nameb="b.db";
......
......@@ -3,7 +3,7 @@
#include <sys/stat.h>
#include "test.h"
const int envflags = DB_INIT_MPOOL|DB_CREATE|DB_THREAD |DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_TXN;
const int envflags = DB_INIT_MPOOL|DB_CREATE|DB_THREAD |DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_TXN|DB_PRIVATE;
char *namea="a.db";
char *nameb="b.db";
......
......@@ -3,7 +3,7 @@
#include <sys/stat.h>
#include "test.h"
const int envflags = DB_INIT_MPOOL|DB_CREATE|DB_THREAD |DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_TXN;
const int envflags = DB_INIT_MPOOL|DB_CREATE|DB_THREAD |DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_TXN|DB_PRIVATE;
char *namea="a.db";
char *nameb="b.db";
......
......@@ -4,7 +4,7 @@
#include <fcntl.h>
#include "test.h"
const int envflags = DB_INIT_MPOOL|DB_CREATE|DB_THREAD |DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_TXN;
const int envflags = DB_INIT_MPOOL|DB_CREATE|DB_THREAD |DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_TXN|DB_PRIVATE;
static void run_test (void) {
int r;
......
......@@ -3,7 +3,7 @@
#include <sys/stat.h>
#include "test.h"
const int envflags = DB_INIT_MPOOL|DB_CREATE|DB_THREAD |DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_TXN;
const int envflags = DB_INIT_MPOOL|DB_CREATE|DB_THREAD |DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_TXN|DB_PRIVATE;
char *namea="a.db";
char *nameb="b.db";
......
......@@ -3,7 +3,7 @@
#include <sys/stat.h>
#include "test.h"
const int envflags = DB_INIT_MPOOL|DB_CREATE|DB_THREAD |DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_TXN;
const int envflags = DB_INIT_MPOOL|DB_CREATE|DB_THREAD |DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_TXN|DB_PRIVATE;
char *namea="a.db";
char *nameb="b.db";
......
......@@ -3,7 +3,7 @@
#include <sys/stat.h>
#include "test.h"
const int envflags = DB_INIT_MPOOL|DB_CREATE|DB_THREAD |DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_TXN;
const int envflags = DB_INIT_MPOOL|DB_CREATE|DB_THREAD |DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_TXN|DB_PRIVATE;
char *namea="a.db";
char *nameb="b.db";
......
......@@ -3,7 +3,7 @@
#include <sys/stat.h>
#include "test.h"
const int envflags = DB_INIT_MPOOL|DB_CREATE|DB_THREAD |DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_TXN;
const int envflags = DB_INIT_MPOOL|DB_CREATE|DB_THREAD |DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_TXN|DB_PRIVATE;
char *namea="a.db";
char *nameb="b.db";
......
......@@ -4,7 +4,7 @@
#include <fcntl.h>
#include "test.h"
const int envflags = DB_INIT_MPOOL|DB_CREATE|DB_THREAD |DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_TXN;
const int envflags = DB_INIT_MPOOL|DB_CREATE|DB_THREAD |DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_TXN|DB_PRIVATE;
char *namea="a.db";
......
......@@ -3,11 +3,12 @@
#include <sys/stat.h>
#include "test.h"
const int envflags = DB_INIT_MPOOL|DB_CREATE|DB_THREAD |DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_TXN;
const int envflags = DB_INIT_MPOOL|DB_CREATE|DB_THREAD |DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_TXN|DB_PRIVATE;
#define NAMEA "a.db"
const char *namea=NAMEA;
#define NAMEB "b.db"
#define NAMEB_HINT "b_db"
const char *nameb=NAMEB;
// needed to get .bdb versions to compile
......@@ -56,13 +57,23 @@ static void run_recover (void) {
DB_ENV *env;
int r;
r = rename(ENVDIR "/" NAMEB, ENVDIR "/" NAMEB ".save" ); printf("r=%d error=%d\n", r, errno); CKERR(r);
r = system("rm -rf " ENVDIR "/saveddbs");
CKERR(r);
r = toku_os_mkdir(ENVDIR "/saveddbs", S_IRWXU+S_IRWXG+S_IRWXO);
CKERR(r);
r = system("mv " ENVDIR "/"NAMEB_HINT "*.tokudb " ENVDIR "/saveddbs/");
CKERR(r);
r = db_env_create(&env, 0); CKERR(r);
r = env->open(env, ENVDIR, envflags + DB_RECOVER, S_IRWXU+S_IRWXG+S_IRWXO);
assert(r == DB_RUNRECOVERY);
r = rename(ENVDIR "/" NAMEB ".save" , ENVDIR "/" NAMEB); printf("r=%d error=%d\n", r, errno); CKERR(r);
r = system("rm -rf " ENVDIR "/"NAMEB_HINT"*.tokudb");
CKERR(r);
r = system("mv " ENVDIR "/saveddbs/*.tokudb " ENVDIR "/");
CKERR(r);
r = env->open(env, ENVDIR, envflags + DB_RECOVER, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r = env->close(env, 0); CKERR(r);
......
......@@ -3,7 +3,7 @@
#include <sys/stat.h>
#include "test.h"
const int envflags = DB_INIT_MPOOL|DB_CREATE|DB_THREAD |DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_TXN;
const int envflags = DB_INIT_MPOOL|DB_CREATE|DB_THREAD |DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_TXN|DB_PRIVATE;
#define NAMEA "a.db"
const char *namea=NAMEA;
......@@ -47,13 +47,23 @@ static void run_recover (void) {
DB_ENV *env;
int r;
r = rename(ENVDIR "/" NAMEA, ENVDIR "/" NAMEB); printf("r=%d error=%d\n", r, errno); CKERR(r);
r = system("rm -rf " ENVDIR "/saveddbs");
CKERR(r);
r = toku_os_mkdir(ENVDIR "/saveddbs", S_IRWXU+S_IRWXG+S_IRWXO);
CKERR(r);
r = system("mv " ENVDIR "/*.tokudb " ENVDIR "/saveddbs/");
CKERR(r);
r = db_env_create(&env, 0); CKERR(r);
r = env->open(env, ENVDIR, envflags + DB_RECOVER, S_IRWXU+S_IRWXG+S_IRWXO);
assert(r == DB_RUNRECOVERY);
r = rename(ENVDIR "/" NAMEB, ENVDIR "/" NAMEA); printf("r=%d error=%d\n", r, errno); CKERR(r);
r = system("rm -rf " ENVDIR "/*.tokudb");
CKERR(r);
r = system("mv " ENVDIR "/saveddbs/*.tokudb " ENVDIR "/");
CKERR(r);
r = env->open(env, ENVDIR, envflags + DB_RECOVER, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r = env->close(env, 0); CKERR(r);
......
......@@ -3,7 +3,7 @@
#include <sys/stat.h>
#include "test.h"
const int envflags = DB_INIT_MPOOL|DB_CREATE|DB_THREAD |DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_TXN;
const int envflags = DB_INIT_MPOOL|DB_CREATE|DB_THREAD |DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_TXN|DB_PRIVATE;
char *namea="a.db";
char *nameb="b.db";
......@@ -15,8 +15,10 @@ char *nameb="b.db";
static void run_test (void) {
int r;
system("rm -rf " ENVDIR);
toku_os_mkdir(ENVDIR, S_IRWXU+S_IRWXG+S_IRWXO);
r = system("rm -rf " ENVDIR);
CKERR(r);
r = toku_os_mkdir(ENVDIR, S_IRWXU+S_IRWXG+S_IRWXO);
CKERR(r);
DB_ENV *env;
DB *dba;
......@@ -54,15 +56,23 @@ static void run_recover (void) {
DB_ENV *env;
int r;
r = rename(ENVDIR "/log000000000001.tokulog", ENVDIR "/save000000000001");
assert(r == 0);
r = system("rm -rf " ENVDIR "/savedlogs");
CKERR(r);
r = toku_os_mkdir(ENVDIR "/savedlogs", S_IRWXU+S_IRWXG+S_IRWXO);
CKERR(r);
r = system("mv " ENVDIR "/*.tokulog " ENVDIR "/savedlogs/");
CKERR(r);
r = db_env_create(&env, 0); CKERR(r);
r = env->open(env, ENVDIR, envflags + DB_RECOVER, S_IRWXU+S_IRWXG+S_IRWXO);
assert(r == DB_RUNRECOVERY);
r = rename(ENVDIR "/save000000000001", ENVDIR "/log000000000001.tokulog");
assert(r == 0);
r = system("rm -rf " ENVDIR "/*.tokulog");
CKERR(r);
r = system("mv " ENVDIR "/savedlogs/*.tokulog " ENVDIR "/");
CKERR(r);
r = env->open(env, ENVDIR, envflags + DB_RECOVER, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r = env->close(env, 0); CKERR(r);
......
......@@ -3,7 +3,7 @@
#include <sys/stat.h>
#include "test.h"
const int envflags = DB_INIT_MPOOL|DB_CREATE|DB_THREAD |DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_TXN;
const int envflags = DB_INIT_MPOOL|DB_CREATE|DB_THREAD |DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_TXN|DB_PRIVATE;
char *namea="a.db";
......
......@@ -3,7 +3,7 @@
#include <sys/stat.h>
#include "test.h"
const int envflags = DB_INIT_MPOOL|DB_CREATE|DB_THREAD |DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_TXN;
const int envflags = DB_INIT_MPOOL|DB_CREATE|DB_THREAD |DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_TXN|DB_PRIVATE;
char *namea="a.db";
......
......@@ -14,7 +14,7 @@
#include <sys/stat.h>
#include "test.h"
const int envflags = DB_INIT_MPOOL|DB_CREATE|DB_THREAD |DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_TXN;
const int envflags = DB_INIT_MPOOL|DB_CREATE|DB_THREAD |DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_TXN|DB_PRIVATE;
char *namea="a.db";
char *nameb="b.db";
......
......@@ -14,7 +14,7 @@
#include <sys/stat.h>
#include "test.h"
const int envflags = DB_INIT_MPOOL|DB_CREATE|DB_THREAD |DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_TXN;
const int envflags = DB_INIT_MPOOL|DB_CREATE|DB_THREAD |DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_TXN|DB_PRIVATE;
char *namea="a.db";
char *nameb="b.db";
......
......@@ -14,7 +14,7 @@
#include <sys/stat.h>
#include "test.h"
const int envflags = DB_INIT_MPOOL|DB_CREATE|DB_THREAD |DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_TXN;
const int envflags = DB_INIT_MPOOL|DB_CREATE|DB_THREAD |DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_TXN|DB_PRIVATE;
char *namea="a.db";
char *nameb="b.db";
......
......@@ -14,7 +14,7 @@
#include <sys/stat.h>
#include "test.h"
const int envflags = DB_INIT_MPOOL|DB_CREATE|DB_THREAD |DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_TXN;
const int envflags = DB_INIT_MPOOL|DB_CREATE|DB_THREAD |DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_TXN|DB_PRIVATE;
char *namea="a.db";
char *nameb="b.db";
......
......@@ -18,7 +18,7 @@
#include <sys/stat.h>
#include "test.h"
const int envflags = DB_INIT_MPOOL|DB_CREATE|DB_THREAD |DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_TXN;
const int envflags = DB_INIT_MPOOL|DB_CREATE|DB_THREAD |DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_TXN|DB_PRIVATE;
char *namea="a.db";
char *nameb="b.db";
......
......@@ -18,7 +18,7 @@
#include <sys/stat.h>
#include "test.h"
const int envflags = DB_INIT_MPOOL|DB_CREATE|DB_THREAD |DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_TXN;
const int envflags = DB_INIT_MPOOL|DB_CREATE|DB_THREAD |DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_TXN|DB_PRIVATE;
char *namea="a.db";
char *nameb="b.db";
......
......@@ -410,7 +410,7 @@ static void run_test (int iter, int die UU()) {
if (verbose) printf("%s: iter = %d\n", __FILE__, iter);
int recovery_flags = DB_INIT_LOG;
int recovery_flags = DB_INIT_LOG|DB_INIT_TXN;
if ( iter != 0 )
recovery_flags += DB_RECOVER;
......
......@@ -56,10 +56,8 @@ static void root_fifo_1(int n, int create_outside) {
DB_ENV *env = null_env;
r = db_env_create(&env, 0); assert(r == 0); assert(env != NULL);
r = env->set_data_dir(env, ENVDIR);
r = env->set_lg_dir(env, ENVDIR);
r = env->open(env,
0,
ENVDIR,
DB_INIT_MPOOL+DB_INIT_LOG+DB_INIT_LOCK+DB_INIT_TXN+DB_PRIVATE+DB_CREATE,
S_IRWXU+S_IRWXG+S_IRWXO);
assert(r == 0);
......
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.
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.
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.
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