Commit 17405b43 authored by Bradley C. Kuszmaul's avatar Bradley C. Kuszmaul Committed by Yoni Fogel

Merge the fixes for #2862, #2861, and #2269 onto main. Fixes #2269, #2861,...

Merge the fixes for #2862, #2861, and #2269 onto main.  Fixes #2269, #2861, #2862.  close[t:2269] close[t:2861] close[t:2862]
{{{
svn merge -r 23006:23042 https://svn.tokutek.com/tokudb/toku/tokudb.2862b
}}}
.


git-svn-id: file:///svn/toku/tokudb@23046 c7de825b-a66e-492c-adef-691d508d4ae1
parent a33d64c3
......@@ -169,8 +169,6 @@ typedef enum {
#define DB_LOCK_DEFAULT 1
#define DB_LOCK_OLDEST 6
#define DB_LOCK_RANDOM 7
#define DB_DUP 2
#define DB_DUPSORT 4
#define DB_KEYFIRST 16
#define DB_KEYLAST 17
#define DB_NOOVERWRITE 23
......@@ -194,12 +192,9 @@ typedef enum {
#define DB_DELETE_ANY 65536
#define DB_TRUNCATE_WITHCURSORS 131072
#define DB_FIRST 10
#define DB_GET_BOTH 11
#define DB_GET_BOTH_RANGE 13
#define DB_LAST 18
#define DB_CURRENT 8
#define DB_NEXT 19
#define DB_NEXT_DUP 20
#define DB_NEXT_NODUP 21
#define DB_PREV 27
#define DB_PREV_NODUP 28
......@@ -207,7 +202,6 @@ typedef enum {
#define DB_SET_RANGE 32
#define DB_CURRENT_BINDING 253
#define DB_SET_RANGE_REVERSE 252
#define DB_GET_BOTH_RANGE_REVERSE 251
#define DB_RMW 1073741824
#define DB_PRELOCKED 0x00800000
#define DB_PRELOCKED_WRITE 0x00400000
......@@ -247,9 +241,8 @@ struct __toku_db_env {
int (*checkpointing_begin_atomic_operation) (DB_ENV*) /* Begin a set of operations (that must be atomic as far as checkpoints are concerned). i.e. inserting into every index in one table */;
int (*checkpointing_end_atomic_operation) (DB_ENV*) /* End a set of operations (that must be atomic as far as checkpoints are concerned). */;
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. */;
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 *app_private; /* 32-bit offset=36 size=4, 64=bit offset=72 size=8 */
int (*get_engine_status_text) (DB_ENV*, char*, int) /* Fill in status text */;
int (*get_iname) (DB_ENV* env, DBT* dname_dbt, DBT* iname_dbt) /* FOR TEST ONLY: lookup existing iname */;
int (*create_loader) (DB_ENV *env, DB_TXN *txn, DB_LOADER **blp, DB *src_db, int N, DB *dbs[/*N*/], uint32_t db_flags[/*N*/], uint32_t dbt_flags[/*N*/], uint32_t loader_flags);
......@@ -273,7 +266,7 @@ struct __toku_db_env {
void *extra));
int (*get_redzone) (DB_ENV *env, int *redzone) /* get the redzone limit */;
int (*set_redzone) (DB_ENV *env, int redzone) /* set the redzone limit in percent of total space */;
void* __toku_dummy0[17];
void* __toku_dummy0[18];
char __toku_dummy1[64];
void *api1_internal; /* 32-bit offset=212 size=4, 64=bit offset=360 size=8 */
void* __toku_dummy2[7];
......@@ -355,21 +348,19 @@ struct __toku_db {
#define db_struct_i(x) ((x)->i)
int (*key_range64)(DB*, DB_TXN *, DBT *, u_int64_t *less, u_int64_t *equal, u_int64_t *greater, int *is_exact);
int (*stat64)(DB *, DB_TXN *, DB_BTREE_STAT64 *);
int (*pre_acquire_read_lock)(DB*, DB_TXN*, const DBT*, const DBT*, const DBT*, const DBT*);
int (*pre_acquire_read_lock)(DB*, DB_TXN*, const DBT*, const DBT*);
void *app_private; /* 32-bit offset=16 size=4, 64=bit offset=32 size=8 */
DB_ENV *dbenv; /* 32-bit offset=20 size=4, 64=bit offset=40 size=8 */
int (*pre_acquire_table_lock)(DB*, DB_TXN*);
const DBT* (*dbt_pos_infty)(void) /* Return the special DBT that refers to positive infinity in the lock table.*/;
const DBT* (*dbt_neg_infty)(void)/* Return the special DBT that refers to negative infinity in the lock table.*/;
int (*delboth) (DB*, DB_TXN*, DBT*, DBT*, u_int32_t) /* Delete the key/value pair. */;
int (*row_size_supported) (DB*, u_int32_t) /* Test whether a row size is supported. */;
DESCRIPTOR descriptor /* saved row/dictionary descriptor for aiding in comparisons */;
int (*set_descriptor) (DB*, u_int32_t version, const DBT* descriptor) /* set row/dictionary descriptor for a db. Available only while db is open */;
int (*getf_set)(DB*, DB_TXN*, u_int32_t, DBT*, YDB_CALLBACK_FUNCTION, void*) /* same as DBC->c_getf_set without a persistent cursor) */;
int (*getf_get_both)(DB*, DB_TXN*, u_int32_t, DBT*, DBT*, YDB_CALLBACK_FUNCTION, void*) /* same as DBC->c_getf_get_both without a persistent cursor) */;
int (*flatten)(DB*, DB_TXN*) /* Flatten a dictionary, similar to (but faster than) a table scan */;
int (*get_fragmentation)(DB*,TOKU_DB_FRAGMENTATION);
void* __toku_dummy0[18];
void* __toku_dummy0[20];
char __toku_dummy1[96];
void *api_internal; /* 32-bit offset=236 size=4, 64=bit offset=376 size=8 */
void* __toku_dummy2[5];
......@@ -386,21 +377,19 @@ struct __toku_db {
int (*remove) (DB *, const char *, const char *, u_int32_t); /* 32-bit offset=316 size=4, 64=bit offset=536 size=8 */
int (*rename) (DB *, const char *, const char *, const char *, u_int32_t); /* 32-bit offset=320 size=4, 64=bit offset=544 size=8 */
int (*truncate) (DB *, DB_TXN *, u_int32_t *, u_int32_t); /* 32-bit offset=324 size=4, 64=bit offset=552 size=8 */
void* __toku_dummy5[4];
int (*set_dup_compare) (DB *, int (*)(DB *, const DBT *, const DBT *)); /* 32-bit offset=344 size=4, 64=bit offset=592 size=8 */
void* __toku_dummy6[2];
void* __toku_dummy5[7];
void (*set_errfile) (DB *, FILE*); /* 32-bit offset=356 size=4, 64=bit offset=616 size=8 */
void* __toku_dummy7[2];
void* __toku_dummy6[2];
int (*set_flags) (DB *, u_int32_t); /* 32-bit offset=368 size=4, 64=bit offset=640 size=8 */
void* __toku_dummy8[1];
void* __toku_dummy7[1];
int (*set_pagesize) (DB *, u_int32_t); /* 32-bit offset=376 size=4, 64=bit offset=656 size=8 */
void* __toku_dummy9[1];
void* __toku_dummy8[1];
int (*stat) (DB *, void *, u_int32_t); /* 32-bit offset=384 size=4, 64=bit offset=672 size=8 */
void* __toku_dummy10[2];
void* __toku_dummy9[2];
int (*verify) (DB *, const char *, const char *, FILE *, u_int32_t); /* 32-bit offset=396 size=4, 64=bit offset=696 size=8 */
int (*set_bt_compare) (DB *, int (*)(DB *, const DBT *, const DBT *)); /* 32-bit offset=400 size=4, 64=bit offset=704 size=8 */
void* __toku_dummy11[15]; /* Padding at the end */
char __toku_dummy12[8]; /* Padding at the end */
void* __toku_dummy10[15]; /* Padding at the end */
char __toku_dummy11[8]; /* Padding at the end */
};
struct __toku_db_txn_active {
u_int32_t txnid; /* 32-bit offset=0 size=4, 64=bit offset=0 size=4 */
......@@ -450,20 +439,13 @@ struct __toku_dbc {
int (*c_getf_first)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_last)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_next)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_next_dup)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_next_nodup)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_prev)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_prev_dup)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_prev_nodup)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_current)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_current_binding)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_set)(DBC *, u_int32_t, DBT *, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_set_range)(DBC *, u_int32_t, DBT *, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_set_range_reverse)(DBC *, u_int32_t, DBT *, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_get_both)(DBC *, u_int32_t, DBT *, DBT *, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_get_both_range)(DBC *, u_int32_t, DBT *, DBT *, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_get_both_range_reverse)(DBC *, u_int32_t, DBT *, DBT *, YDB_CALLBACK_FUNCTION, void *);
void* __toku_dummy0[4];
void* __toku_dummy0[11];
char __toku_dummy1[104];
int (*c_close) (DBC *); /* 32-bit offset=188 size=4, 64=bit offset=272 size=8 */
int (*c_count) (DBC *, db_recno_t *, u_int32_t); /* 32-bit offset=192 size=4, 64=bit offset=280 size=8 */
......
......@@ -169,8 +169,6 @@ typedef enum {
#define DB_LOCK_DEFAULT 1
#define DB_LOCK_OLDEST 7
#define DB_LOCK_RANDOM 8
#define DB_DUP 2
#define DB_DUPSORT 4
#define DB_KEYFIRST 15
#define DB_KEYLAST 16
#define DB_NOOVERWRITE 22
......@@ -195,12 +193,9 @@ typedef enum {
#define DB_DELETE_ANY 65536
#define DB_TRUNCATE_WITHCURSORS 131072
#define DB_FIRST 9
#define DB_GET_BOTH 10
#define DB_GET_BOTH_RANGE 12
#define DB_LAST 17
#define DB_CURRENT 7
#define DB_NEXT 18
#define DB_NEXT_DUP 19
#define DB_NEXT_NODUP 20
#define DB_PREV 25
#define DB_PREV_NODUP 26
......@@ -208,7 +203,6 @@ typedef enum {
#define DB_SET_RANGE 30
#define DB_CURRENT_BINDING 253
#define DB_SET_RANGE_REVERSE 252
#define DB_GET_BOTH_RANGE_REVERSE 251
#define DB_RMW 536870912
#define DB_PRELOCKED 0x00800000
#define DB_PRELOCKED_WRITE 0x00400000
......@@ -249,11 +243,10 @@ struct __toku_db_env {
int (*checkpointing_begin_atomic_operation) (DB_ENV*) /* Begin a set of operations (that must be atomic as far as checkpoints are concerned). i.e. inserting into every index in one table */;
int (*checkpointing_end_atomic_operation) (DB_ENV*) /* End a set of operations (that must be atomic as far as checkpoints are concerned). */;
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_engine_status_text) (DB_ENV*, char*, int) /* Fill in status text */;
void *app_private; /* 32-bit offset=44 size=4, 64=bit offset=88 size=8 */
int (*get_iname) (DB_ENV* env, DBT* dname_dbt, DBT* iname_dbt) /* FOR TEST ONLY: lookup existing iname */;
void *app_private; /* 32-bit offset=44 size=4, 64=bit offset=88 size=8 */
int (*create_loader) (DB_ENV *env, DB_TXN *txn, DB_LOADER **blp, DB *src_db, int N, DB *dbs[/*N*/], uint32_t db_flags[/*N*/], uint32_t dbt_flags[/*N*/], uint32_t loader_flags);
int (*put_multiple) (DB_ENV *env, DB *src_db, DB_TXN *txn,
const DBT *key, const DBT *val,
......@@ -275,7 +268,7 @@ struct __toku_db_env {
void *extra));
int (*get_redzone) (DB_ENV *env, int *redzone) /* get the redzone limit */;
int (*set_redzone) (DB_ENV *env, int redzone) /* set the redzone limit in percent of total space */;
void* __toku_dummy0[17];
void* __toku_dummy0[18];
char __toku_dummy1[96];
void *api1_internal; /* 32-bit offset=244 size=4, 64=bit offset=392 size=8 */
void* __toku_dummy2[7];
......@@ -365,21 +358,19 @@ struct __toku_db {
#define db_struct_i(x) ((x)->i)
int (*key_range64)(DB*, DB_TXN *, DBT *, u_int64_t *less, u_int64_t *equal, u_int64_t *greater, int *is_exact);
int (*stat64)(DB *, DB_TXN *, DB_BTREE_STAT64 *);
int (*pre_acquire_read_lock)(DB*, DB_TXN*, const DBT*, const DBT*, const DBT*, const DBT*);
int (*pre_acquire_read_lock)(DB*, DB_TXN*, const DBT*, const DBT*);
void *app_private; /* 32-bit offset=16 size=4, 64=bit offset=32 size=8 */
DB_ENV *dbenv; /* 32-bit offset=20 size=4, 64=bit offset=40 size=8 */
int (*pre_acquire_table_lock)(DB*, DB_TXN*);
const DBT* (*dbt_pos_infty)(void) /* Return the special DBT that refers to positive infinity in the lock table.*/;
const DBT* (*dbt_neg_infty)(void)/* Return the special DBT that refers to negative infinity in the lock table.*/;
int (*delboth) (DB*, DB_TXN*, DBT*, DBT*, u_int32_t) /* Delete the key/value pair. */;
int (*row_size_supported) (DB*, u_int32_t) /* Test whether a row size is supported. */;
DESCRIPTOR descriptor /* saved row/dictionary descriptor for aiding in comparisons */;
int (*set_descriptor) (DB*, u_int32_t version, const DBT* descriptor) /* set row/dictionary descriptor for a db. Available only while db is open */;
int (*getf_set)(DB*, DB_TXN*, u_int32_t, DBT*, YDB_CALLBACK_FUNCTION, void*) /* same as DBC->c_getf_set without a persistent cursor) */;
int (*getf_get_both)(DB*, DB_TXN*, u_int32_t, DBT*, DBT*, YDB_CALLBACK_FUNCTION, void*) /* same as DBC->c_getf_get_both without a persistent cursor) */;
int (*flatten)(DB*, DB_TXN*) /* Flatten a dictionary, similar to (but faster than) a table scan */;
int (*get_fragmentation)(DB*,TOKU_DB_FRAGMENTATION);
void* __toku_dummy0[21];
void* __toku_dummy0[23];
char __toku_dummy1[96];
void *api_internal; /* 32-bit offset=248 size=4, 64=bit offset=400 size=8 */
void* __toku_dummy2[5];
......@@ -400,22 +391,20 @@ struct __toku_db {
int (*remove) (DB *, const char *, const char *, u_int32_t); /* 32-bit offset=376 size=4, 64=bit offset=656 size=8 */
int (*rename) (DB *, const char *, const char *, const char *, u_int32_t); /* 32-bit offset=380 size=4, 64=bit offset=664 size=8 */
int (*truncate) (DB *, DB_TXN *, u_int32_t *, u_int32_t); /* 32-bit offset=384 size=4, 64=bit offset=672 size=8 */
void* __toku_dummy7[3];
int (*set_dup_compare) (DB *, int (*)(DB *, const DBT *, const DBT *)); /* 32-bit offset=400 size=4, 64=bit offset=704 size=8 */
void* __toku_dummy8[2];
void* __toku_dummy7[6];
void (*set_errfile) (DB *, FILE*); /* 32-bit offset=412 size=4, 64=bit offset=728 size=8 */
void* __toku_dummy9[2];
void* __toku_dummy8[2];
int (*set_flags) (DB *, u_int32_t); /* 32-bit offset=424 size=4, 64=bit offset=752 size=8 */
void* __toku_dummy10[4];
void* __toku_dummy9[4];
int (*set_pagesize) (DB *, u_int32_t); /* 32-bit offset=444 size=4, 64=bit offset=792 size=8 */
void* __toku_dummy11[1];
void* __toku_dummy10[1];
int (*stat) (DB *, void *, u_int32_t); /* 32-bit offset=452 size=4, 64=bit offset=808 size=8 */
void* __toku_dummy12[3];
void* __toku_dummy11[3];
int (*verify) (DB *, const char *, const char *, FILE *, u_int32_t); /* 32-bit offset=468 size=4, 64=bit offset=840 size=8 */
void* __toku_dummy13[1];
void* __toku_dummy12[1];
int (*set_bt_compare) (DB *, int (*)(DB *, const DBT *, const DBT *)); /* 32-bit offset=476 size=4, 64=bit offset=856 size=8 */
void* __toku_dummy14[23]; /* Padding at the end */
char __toku_dummy15[8]; /* Padding at the end */
void* __toku_dummy13[23]; /* Padding at the end */
char __toku_dummy14[8]; /* Padding at the end */
};
struct __toku_db_txn_active {
u_int32_t txnid; /* 32-bit offset=0 size=4, 64=bit offset=0 size=4 */
......@@ -466,20 +455,13 @@ struct __toku_dbc {
int (*c_getf_first)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_last)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_next)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_next_dup)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_next_nodup)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_prev)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_prev_dup)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_prev_nodup)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_current)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_current_binding)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_set)(DBC *, u_int32_t, DBT *, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_set_range)(DBC *, u_int32_t, DBT *, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_set_range_reverse)(DBC *, u_int32_t, DBT *, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_get_both)(DBC *, u_int32_t, DBT *, DBT *, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_get_both_range)(DBC *, u_int32_t, DBT *, DBT *, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_get_both_range_reverse)(DBC *, u_int32_t, DBT *, DBT *, YDB_CALLBACK_FUNCTION, void *);
void* __toku_dummy0[2];
void* __toku_dummy0[9];
char __toku_dummy1[112];
int (*c_close) (DBC *); /* 32-bit offset=188 size=4, 64=bit offset=264 size=8 */
int (*c_count) (DBC *, db_recno_t *, u_int32_t); /* 32-bit offset=192 size=4, 64=bit offset=272 size=8 */
......
......@@ -169,8 +169,6 @@ typedef enum {
#define DB_LOCK_DEFAULT 1
#define DB_LOCK_OLDEST 7
#define DB_LOCK_RANDOM 8
#define DB_DUP 16384
#define DB_DUPSORT 32768
#define DB_KEYFIRST 15
#define DB_KEYLAST 16
#define DB_NOOVERWRITE 22
......@@ -195,12 +193,9 @@ typedef enum {
#define DB_DELETE_ANY 65536
#define DB_TRUNCATE_WITHCURSORS 131072
#define DB_FIRST 9
#define DB_GET_BOTH 10
#define DB_GET_BOTH_RANGE 12
#define DB_LAST 17
#define DB_CURRENT 7
#define DB_NEXT 18
#define DB_NEXT_DUP 19
#define DB_NEXT_NODUP 20
#define DB_PREV 25
#define DB_PREV_NODUP 26
......@@ -208,7 +203,6 @@ typedef enum {
#define DB_SET_RANGE 30
#define DB_CURRENT_BINDING 253
#define DB_SET_RANGE_REVERSE 252
#define DB_GET_BOTH_RANGE_REVERSE 251
#define DB_RMW 536870912
#define DB_PRELOCKED 0x00800000
#define DB_PRELOCKED_WRITE 0x00400000
......@@ -251,11 +245,10 @@ struct __toku_db_env {
int (*checkpointing_begin_atomic_operation) (DB_ENV*) /* Begin a set of operations (that must be atomic as far as checkpoints are concerned). i.e. inserting into every index in one table */;
int (*checkpointing_end_atomic_operation) (DB_ENV*) /* End a set of operations (that must be atomic as far as checkpoints are concerned). */;
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_engine_status_text) (DB_ENV*, char*, int) /* Fill in status text */;
void *app_private; /* 32-bit offset=44 size=4, 64=bit offset=88 size=8 */
int (*get_iname) (DB_ENV* env, DBT* dname_dbt, DBT* iname_dbt) /* FOR TEST ONLY: lookup existing iname */;
void *app_private; /* 32-bit offset=44 size=4, 64=bit offset=88 size=8 */
int (*create_loader) (DB_ENV *env, DB_TXN *txn, DB_LOADER **blp, DB *src_db, int N, DB *dbs[/*N*/], uint32_t db_flags[/*N*/], uint32_t dbt_flags[/*N*/], uint32_t loader_flags);
int (*put_multiple) (DB_ENV *env, DB *src_db, DB_TXN *txn,
const DBT *key, const DBT *val,
......@@ -277,7 +270,7 @@ struct __toku_db_env {
void *extra));
int (*get_redzone) (DB_ENV *env, int *redzone) /* get the redzone limit */;
int (*set_redzone) (DB_ENV *env, int redzone) /* set the redzone limit in percent of total space */;
void* __toku_dummy0[32];
void* __toku_dummy0[33];
char __toku_dummy1[128];
void *api1_internal; /* 32-bit offset=336 size=4, 64=bit offset=544 size=8 */
void* __toku_dummy2[7];
......@@ -369,21 +362,19 @@ struct __toku_db {
#define db_struct_i(x) ((x)->i)
int (*key_range64)(DB*, DB_TXN *, DBT *, u_int64_t *less, u_int64_t *equal, u_int64_t *greater, int *is_exact);
int (*stat64)(DB *, DB_TXN *, DB_BTREE_STAT64 *);
int (*pre_acquire_read_lock)(DB*, DB_TXN*, const DBT*, const DBT*, const DBT*, const DBT*);
int (*pre_acquire_read_lock)(DB*, DB_TXN*, const DBT*, const DBT*);
void *app_private; /* 32-bit offset=16 size=4, 64=bit offset=32 size=8 */
DB_ENV *dbenv; /* 32-bit offset=20 size=4, 64=bit offset=40 size=8 */
int (*pre_acquire_table_lock)(DB*, DB_TXN*);
const DBT* (*dbt_pos_infty)(void) /* Return the special DBT that refers to positive infinity in the lock table.*/;
const DBT* (*dbt_neg_infty)(void)/* Return the special DBT that refers to negative infinity in the lock table.*/;
int (*delboth) (DB*, DB_TXN*, DBT*, DBT*, u_int32_t) /* Delete the key/value pair. */;
int (*row_size_supported) (DB*, u_int32_t) /* Test whether a row size is supported. */;
DESCRIPTOR descriptor /* saved row/dictionary descriptor for aiding in comparisons */;
int (*set_descriptor) (DB*, u_int32_t version, const DBT* descriptor) /* set row/dictionary descriptor for a db. Available only while db is open */;
int (*getf_set)(DB*, DB_TXN*, u_int32_t, DBT*, YDB_CALLBACK_FUNCTION, void*) /* same as DBC->c_getf_set without a persistent cursor) */;
int (*getf_get_both)(DB*, DB_TXN*, u_int32_t, DBT*, DBT*, YDB_CALLBACK_FUNCTION, void*) /* same as DBC->c_getf_get_both without a persistent cursor) */;
int (*flatten)(DB*, DB_TXN*) /* Flatten a dictionary, similar to (but faster than) a table scan */;
int (*get_fragmentation)(DB*,TOKU_DB_FRAGMENTATION);
void* __toku_dummy0[23];
void* __toku_dummy0[25];
char __toku_dummy1[96];
void *api_internal; /* 32-bit offset=256 size=4, 64=bit offset=416 size=8 */
void* __toku_dummy2[5];
......@@ -407,22 +398,20 @@ struct __toku_db {
int (*rename) (DB *, const char *, const char *, const char *, u_int32_t); /* 32-bit offset=428 size=4, 64=bit offset=760 size=8 */
void* __toku_dummy9[2];
int (*set_bt_compare) (DB *, int (*)(DB *, const DBT *, const DBT *)); /* 32-bit offset=440 size=4, 64=bit offset=784 size=8 */
void* __toku_dummy10[3];
int (*set_dup_compare) (DB *, int (*)(DB *, const DBT *, const DBT *)); /* 32-bit offset=456 size=4, 64=bit offset=816 size=8 */
void* __toku_dummy11[2];
void* __toku_dummy10[6];
void (*set_errfile) (DB *, FILE*); /* 32-bit offset=468 size=4, 64=bit offset=840 size=8 */
void* __toku_dummy12[2];
void* __toku_dummy11[2];
int (*set_flags) (DB *, u_int32_t); /* 32-bit offset=480 size=4, 64=bit offset=864 size=8 */
void* __toku_dummy13[6];
void* __toku_dummy12[6];
int (*set_pagesize) (DB *, u_int32_t); /* 32-bit offset=508 size=4, 64=bit offset=920 size=8 */
void* __toku_dummy14[6];
void* __toku_dummy13[6];
int (*stat) (DB *, void *, u_int32_t); /* 32-bit offset=536 size=4, 64=bit offset=976 size=8 */
void* __toku_dummy15[2];
void* __toku_dummy14[2];
int (*truncate) (DB *, DB_TXN *, u_int32_t *, u_int32_t); /* 32-bit offset=548 size=4, 64=bit offset=1000 size=8 */
void* __toku_dummy16[1];
void* __toku_dummy15[1];
int (*verify) (DB *, const char *, const char *, FILE *, u_int32_t); /* 32-bit offset=556 size=4, 64=bit offset=1016 size=8 */
void* __toku_dummy17[5]; /* Padding at the end */
char __toku_dummy18[16]; /* Padding at the end */
void* __toku_dummy16[5]; /* Padding at the end */
char __toku_dummy17[16]; /* Padding at the end */
};
struct __toku_db_txn_active {
u_int32_t txnid; /* 32-bit offset=0 size=4, 64=bit offset=0 size=4 */
......@@ -474,20 +463,13 @@ struct __toku_dbc {
int (*c_getf_first)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_last)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_next)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_next_dup)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_next_nodup)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_prev)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_prev_dup)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_prev_nodup)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_current)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_current_binding)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_set)(DBC *, u_int32_t, DBT *, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_set_range)(DBC *, u_int32_t, DBT *, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_set_range_reverse)(DBC *, u_int32_t, DBT *, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_get_both)(DBC *, u_int32_t, DBT *, DBT *, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_get_both_range)(DBC *, u_int32_t, DBT *, DBT *, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_get_both_range_reverse)(DBC *, u_int32_t, DBT *, DBT *, YDB_CALLBACK_FUNCTION, void *);
void* __toku_dummy0[4];
void* __toku_dummy0[11];
char __toku_dummy1[104];
int (*c_close) (DBC *); /* 32-bit offset=188 size=4, 64=bit offset=272 size=8 */
int (*c_count) (DBC *, db_recno_t *, u_int32_t); /* 32-bit offset=192 size=4, 64=bit offset=280 size=8 */
......
......@@ -169,8 +169,6 @@ typedef enum {
#define DB_LOCK_DEFAULT 1
#define DB_LOCK_OLDEST 7
#define DB_LOCK_RANDOM 8
#define DB_DUP 32768
#define DB_DUPSORT 65536
#define DB_KEYFIRST 13
#define DB_KEYLAST 14
#define DB_NOOVERWRITE 20
......@@ -195,12 +193,9 @@ typedef enum {
#define DB_DELETE_ANY 65536
#define DB_TRUNCATE_WITHCURSORS 131072
#define DB_FIRST 7
#define DB_GET_BOTH 8
#define DB_GET_BOTH_RANGE 10
#define DB_LAST 15
#define DB_CURRENT 6
#define DB_NEXT 16
#define DB_NEXT_DUP 17
#define DB_NEXT_NODUP 18
#define DB_PREV 23
#define DB_PREV_NODUP 24
......@@ -208,7 +203,6 @@ typedef enum {
#define DB_SET_RANGE 27
#define DB_CURRENT_BINDING 253
#define DB_SET_RANGE_REVERSE 252
#define DB_GET_BOTH_RANGE_REVERSE 251
#define DB_RMW 1073741824
#define DB_PRELOCKED 0x00800000
#define DB_PRELOCKED_WRITE 0x00400000
......@@ -251,16 +245,15 @@ struct __toku_db_env {
int (*checkpointing_begin_atomic_operation) (DB_ENV*) /* Begin a set of operations (that must be atomic as far as checkpoints are concerned). i.e. inserting into every index in one table */;
int (*checkpointing_end_atomic_operation) (DB_ENV*) /* End a set of operations (that must be atomic as far as checkpoints are concerned). */;
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_engine_status_text) (DB_ENV*, char*, int) /* Fill in status text */;
int (*get_iname) (DB_ENV* env, DBT* dname_dbt, DBT* iname_dbt) /* FOR TEST ONLY: lookup existing iname */;
int (*create_loader) (DB_ENV *env, DB_TXN *txn, DB_LOADER **blp, DB *src_db, int N, DB *dbs[/*N*/], uint32_t db_flags[/*N*/], uint32_t dbt_flags[/*N*/], uint32_t loader_flags);
void *app_private; /* 32-bit offset=52 size=4, 64=bit offset=104 size=8 */
int (*put_multiple) (DB_ENV *env, DB *src_db, DB_TXN *txn,
const DBT *key, const DBT *val,
uint32_t num_dbs, DB **db_array, DBT *keys, DBT *vals, uint32_t *flags_array,
void *extra) /* Insert into multiple dbs */;
void *app_private; /* 32-bit offset=52 size=4, 64=bit offset=104 size=8 */
int (*set_generate_row_callback_for_put) (DB_ENV *env,
int (*generate_row_for_put)(DB *dest_db, DB *src_db,
DBT *dest_key, DBT *dest_val,
......@@ -277,7 +270,7 @@ struct __toku_db_env {
void *extra));
int (*get_redzone) (DB_ENV *env, int *redzone) /* get the redzone limit */;
int (*set_redzone) (DB_ENV *env, int redzone) /* set the redzone limit in percent of total space */;
void* __toku_dummy0[32];
void* __toku_dummy0[33];
char __toku_dummy1[128];
void *api1_internal; /* 32-bit offset=336 size=4, 64=bit offset=544 size=8 */
void* __toku_dummy2[8];
......@@ -369,21 +362,19 @@ struct __toku_db {
#define db_struct_i(x) ((x)->i)
int (*key_range64)(DB*, DB_TXN *, DBT *, u_int64_t *less, u_int64_t *equal, u_int64_t *greater, int *is_exact);
int (*stat64)(DB *, DB_TXN *, DB_BTREE_STAT64 *);
int (*pre_acquire_read_lock)(DB*, DB_TXN*, const DBT*, const DBT*, const DBT*, const DBT*);
int (*pre_acquire_read_lock)(DB*, DB_TXN*, const DBT*, const DBT*);
void *app_private; /* 32-bit offset=16 size=4, 64=bit offset=32 size=8 */
DB_ENV *dbenv; /* 32-bit offset=20 size=4, 64=bit offset=40 size=8 */
int (*pre_acquire_table_lock)(DB*, DB_TXN*);
const DBT* (*dbt_pos_infty)(void) /* Return the special DBT that refers to positive infinity in the lock table.*/;
const DBT* (*dbt_neg_infty)(void)/* Return the special DBT that refers to negative infinity in the lock table.*/;
int (*delboth) (DB*, DB_TXN*, DBT*, DBT*, u_int32_t) /* Delete the key/value pair. */;
int (*row_size_supported) (DB*, u_int32_t) /* Test whether a row size is supported. */;
DESCRIPTOR descriptor /* saved row/dictionary descriptor for aiding in comparisons */;
int (*set_descriptor) (DB*, u_int32_t version, const DBT* descriptor) /* set row/dictionary descriptor for a db. Available only while db is open */;
int (*getf_set)(DB*, DB_TXN*, u_int32_t, DBT*, YDB_CALLBACK_FUNCTION, void*) /* same as DBC->c_getf_set without a persistent cursor) */;
int (*getf_get_both)(DB*, DB_TXN*, u_int32_t, DBT*, DBT*, YDB_CALLBACK_FUNCTION, void*) /* same as DBC->c_getf_get_both without a persistent cursor) */;
int (*flatten)(DB*, DB_TXN*) /* Flatten a dictionary, similar to (but faster than) a table scan */;
int (*get_fragmentation)(DB*,TOKU_DB_FRAGMENTATION);
void* __toku_dummy0[26];
void* __toku_dummy0[28];
char __toku_dummy1[96];
void *api_internal; /* 32-bit offset=268 size=4, 64=bit offset=440 size=8 */
void* __toku_dummy2[5];
......@@ -407,22 +398,20 @@ struct __toku_db {
int (*rename) (DB *, const char *, const char *, const char *, u_int32_t); /* 32-bit offset=440 size=4, 64=bit offset=784 size=8 */
void* __toku_dummy9[2];
int (*set_bt_compare) (DB *, int (*)(DB *, const DBT *, const DBT *)); /* 32-bit offset=452 size=4, 64=bit offset=808 size=8 */
void* __toku_dummy10[3];
int (*set_dup_compare) (DB *, int (*)(DB *, const DBT *, const DBT *)); /* 32-bit offset=468 size=4, 64=bit offset=840 size=8 */
void* __toku_dummy11[2];
void* __toku_dummy10[6];
void (*set_errfile) (DB *, FILE*); /* 32-bit offset=480 size=4, 64=bit offset=864 size=8 */
void* __toku_dummy12[2];
void* __toku_dummy11[2];
int (*set_flags) (DB *, u_int32_t); /* 32-bit offset=492 size=4, 64=bit offset=888 size=8 */
void* __toku_dummy13[6];
void* __toku_dummy12[6];
int (*set_pagesize) (DB *, u_int32_t); /* 32-bit offset=520 size=4, 64=bit offset=944 size=8 */
void* __toku_dummy14[6];
void* __toku_dummy13[6];
int (*stat) (DB *, void *, u_int32_t); /* 32-bit offset=548 size=4, 64=bit offset=1000 size=8 */
void* __toku_dummy15[2];
void* __toku_dummy14[2];
int (*truncate) (DB *, DB_TXN *, u_int32_t *, u_int32_t); /* 32-bit offset=560 size=4, 64=bit offset=1024 size=8 */
void* __toku_dummy16[1];
void* __toku_dummy15[1];
int (*verify) (DB *, const char *, const char *, FILE *, u_int32_t); /* 32-bit offset=568 size=4, 64=bit offset=1040 size=8 */
void* __toku_dummy17[5]; /* Padding at the end */
char __toku_dummy18[16]; /* Padding at the end */
void* __toku_dummy16[5]; /* Padding at the end */
char __toku_dummy17[16]; /* Padding at the end */
};
struct __toku_db_txn_active {
u_int32_t txnid; /* 32-bit offset=0 size=4, 64=bit offset=0 size=4 */
......@@ -474,20 +463,13 @@ struct __toku_dbc {
int (*c_getf_first)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_last)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_next)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_next_dup)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_next_nodup)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_prev)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_prev_dup)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_prev_nodup)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_current)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_current_binding)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_set)(DBC *, u_int32_t, DBT *, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_set_range)(DBC *, u_int32_t, DBT *, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_set_range_reverse)(DBC *, u_int32_t, DBT *, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_get_both)(DBC *, u_int32_t, DBT *, DBT *, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_get_both_range)(DBC *, u_int32_t, DBT *, DBT *, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_get_both_range_reverse)(DBC *, u_int32_t, DBT *, DBT *, YDB_CALLBACK_FUNCTION, void *);
void* __toku_dummy0[8];
void* __toku_dummy0[15];
char __toku_dummy1[104];
int (*c_close) (DBC *); /* 32-bit offset=204 size=4, 64=bit offset=304 size=8 */
int (*c_count) (DBC *, db_recno_t *, u_int32_t); /* 32-bit offset=208 size=4, 64=bit offset=312 size=8 */
......
......@@ -169,8 +169,6 @@ typedef enum {
#define DB_LOCK_DEFAULT 1
#define DB_LOCK_OLDEST 7
#define DB_LOCK_RANDOM 8
#define DB_DUP 32768
#define DB_DUPSORT 65536
#define DB_KEYFIRST 13
#define DB_KEYLAST 14
#define DB_NOOVERWRITE 20
......@@ -195,21 +193,16 @@ typedef enum {
#define DB_DELETE_ANY 65536
#define DB_TRUNCATE_WITHCURSORS 131072
#define DB_FIRST 7
#define DB_GET_BOTH 8
#define DB_GET_BOTH_RANGE 10
#define DB_LAST 15
#define DB_CURRENT 6
#define DB_NEXT 16
#define DB_NEXT_DUP 17
#define DB_NEXT_NODUP 18
#define DB_PREV 23
#define DB_PREV_DUP 24
#define DB_PREV_NODUP 25
#define DB_SET 26
#define DB_SET_RANGE 27
#define DB_CURRENT_BINDING 253
#define DB_SET_RANGE_REVERSE 252
#define DB_GET_BOTH_RANGE_REVERSE 251
#define DB_RMW 1073741824
#define DB_PRELOCKED 0x00800000
#define DB_PRELOCKED_WRITE 0x00400000
......@@ -253,16 +246,15 @@ struct __toku_db_env {
int (*checkpointing_begin_atomic_operation) (DB_ENV*) /* Begin a set of operations (that must be atomic as far as checkpoints are concerned). i.e. inserting into every index in one table */;
int (*checkpointing_end_atomic_operation) (DB_ENV*) /* End a set of operations (that must be atomic as far as checkpoints are concerned). */;
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_engine_status_text) (DB_ENV*, char*, int) /* Fill in status text */;
int (*get_iname) (DB_ENV* env, DBT* dname_dbt, DBT* iname_dbt) /* FOR TEST ONLY: lookup existing iname */;
int (*create_loader) (DB_ENV *env, DB_TXN *txn, DB_LOADER **blp, DB *src_db, int N, DB *dbs[/*N*/], uint32_t db_flags[/*N*/], uint32_t dbt_flags[/*N*/], uint32_t loader_flags);
void *app_private; /* 32-bit offset=52 size=4, 64=bit offset=104 size=8 */
int (*put_multiple) (DB_ENV *env, DB *src_db, DB_TXN *txn,
const DBT *key, const DBT *val,
uint32_t num_dbs, DB **db_array, DBT *keys, DBT *vals, uint32_t *flags_array,
void *extra) /* Insert into multiple dbs */;
void *app_private; /* 32-bit offset=52 size=4, 64=bit offset=104 size=8 */
int (*set_generate_row_callback_for_put) (DB_ENV *env,
int (*generate_row_for_put)(DB *dest_db, DB *src_db,
DBT *dest_key, DBT *dest_val,
......@@ -279,7 +271,7 @@ struct __toku_db_env {
void *extra));
int (*get_redzone) (DB_ENV *env, int *redzone) /* get the redzone limit */;
int (*set_redzone) (DB_ENV *env, int redzone) /* set the redzone limit in percent of total space */;
void* __toku_dummy0[33];
void* __toku_dummy0[34];
char __toku_dummy1[144];
void *api1_internal; /* 32-bit offset=356 size=4, 64=bit offset=568 size=8 */
void* __toku_dummy2[8];
......@@ -375,19 +367,17 @@ struct __toku_db {
char __toku_dummy0[8];
void *app_private; /* 32-bit offset=20 size=4, 64=bit offset=32 size=8 */
DB_ENV *dbenv; /* 32-bit offset=24 size=4, 64=bit offset=40 size=8 */
int (*pre_acquire_read_lock)(DB*, DB_TXN*, const DBT*, const DBT*, const DBT*, const DBT*);
int (*pre_acquire_read_lock)(DB*, DB_TXN*, const DBT*, const DBT*);
int (*pre_acquire_table_lock)(DB*, DB_TXN*);
const DBT* (*dbt_pos_infty)(void) /* Return the special DBT that refers to positive infinity in the lock table.*/;
const DBT* (*dbt_neg_infty)(void)/* Return the special DBT that refers to negative infinity in the lock table.*/;
int (*delboth) (DB*, DB_TXN*, DBT*, DBT*, u_int32_t) /* Delete the key/value pair. */;
int (*row_size_supported) (DB*, u_int32_t) /* Test whether a row size is supported. */;
DESCRIPTOR descriptor /* saved row/dictionary descriptor for aiding in comparisons */;
int (*set_descriptor) (DB*, u_int32_t version, const DBT* descriptor) /* set row/dictionary descriptor for a db. Available only while db is open */;
int (*getf_set)(DB*, DB_TXN*, u_int32_t, DBT*, YDB_CALLBACK_FUNCTION, void*) /* same as DBC->c_getf_set without a persistent cursor) */;
int (*getf_get_both)(DB*, DB_TXN*, u_int32_t, DBT*, DBT*, YDB_CALLBACK_FUNCTION, void*) /* same as DBC->c_getf_get_both without a persistent cursor) */;
int (*flatten)(DB*, DB_TXN*) /* Flatten a dictionary, similar to (but faster than) a table scan */;
int (*get_fragmentation)(DB*,TOKU_DB_FRAGMENTATION);
void* __toku_dummy1[30];
void* __toku_dummy1[32];
char __toku_dummy2[80];
void *api_internal; /* 32-bit offset=276 size=4, 64=bit offset=464 size=8 */
void* __toku_dummy3[5];
......@@ -411,22 +401,20 @@ struct __toku_db {
int (*rename) (DB *, const char *, const char *, const char *, u_int32_t); /* 32-bit offset=460 size=4, 64=bit offset=832 size=8 */
void* __toku_dummy10[2];
int (*set_bt_compare) (DB *, int (*)(DB *, const DBT *, const DBT *)); /* 32-bit offset=472 size=4, 64=bit offset=856 size=8 */
void* __toku_dummy11[3];
int (*set_dup_compare) (DB *, int (*)(DB *, const DBT *, const DBT *)); /* 32-bit offset=488 size=4, 64=bit offset=888 size=8 */
void* __toku_dummy12[2];
void* __toku_dummy11[6];
void (*set_errfile) (DB *, FILE*); /* 32-bit offset=500 size=4, 64=bit offset=912 size=8 */
void* __toku_dummy13[2];
void* __toku_dummy12[2];
int (*set_flags) (DB *, u_int32_t); /* 32-bit offset=512 size=4, 64=bit offset=936 size=8 */
void* __toku_dummy14[7];
void* __toku_dummy13[7];
int (*set_pagesize) (DB *, u_int32_t); /* 32-bit offset=544 size=4, 64=bit offset=1000 size=8 */
void* __toku_dummy15[7];
void* __toku_dummy14[7];
int (*stat) (DB *, void *, u_int32_t); /* 32-bit offset=576 size=4, 64=bit offset=1064 size=8 */
void* __toku_dummy16[2];
void* __toku_dummy15[2];
int (*truncate) (DB *, DB_TXN *, u_int32_t *, u_int32_t); /* 32-bit offset=588 size=4, 64=bit offset=1088 size=8 */
void* __toku_dummy17[1];
void* __toku_dummy16[1];
int (*verify) (DB *, const char *, const char *, FILE *, u_int32_t); /* 32-bit offset=596 size=4, 64=bit offset=1104 size=8 */
void* __toku_dummy18[5]; /* Padding at the end */
char __toku_dummy19[16]; /* Padding at the end */
void* __toku_dummy17[5]; /* Padding at the end */
char __toku_dummy18[16]; /* Padding at the end */
};
struct __toku_db_txn_active {
u_int32_t txnid; /* 32-bit offset=0 size=4, 64=bit offset=0 size=4 */
......@@ -479,20 +467,13 @@ struct __toku_dbc {
int (*c_getf_first)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_last)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_next)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_next_dup)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_next_nodup)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_prev)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_prev_dup)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_prev_nodup)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_current)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_current_binding)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_set)(DBC *, u_int32_t, DBT *, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_set_range)(DBC *, u_int32_t, DBT *, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_set_range_reverse)(DBC *, u_int32_t, DBT *, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_get_both)(DBC *, u_int32_t, DBT *, DBT *, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_get_both_range)(DBC *, u_int32_t, DBT *, DBT *, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_get_both_range_reverse)(DBC *, u_int32_t, DBT *, DBT *, YDB_CALLBACK_FUNCTION, void *);
void* __toku_dummy0[18];
void* __toku_dummy0[25];
char __toku_dummy1[104];
int (*c_close) (DBC *); /* 32-bit offset=244 size=4, 64=bit offset=384 size=8 */
int (*c_count) (DBC *, db_recno_t *, u_int32_t); /* 32-bit offset=248 size=4, 64=bit offset=392 size=8 */
......
......@@ -95,8 +95,8 @@ static void print_defines (void) {
dodefine(DB_LOCK_OLDEST);
dodefine(DB_LOCK_RANDOM);
dodefine(DB_DUP);
dodefine(DB_DUPSORT);
//dodefine(DB_DUP); No longer supported #2862
//dodefine(DB_DUPSORT); No longer supported #2862
dodefine(DB_KEYFIRST);
dodefine(DB_KEYLAST);
......@@ -132,23 +132,23 @@ static void print_defines (void) {
printf("#define DB_TRUNCATE_WITHCURSORS %d\n", 1<<17); // private tokudb
dodefine(DB_FIRST);
dodefine(DB_GET_BOTH);
dodefine(DB_GET_BOTH_RANGE);
//dodefine(DB_GET_BOTH); No longer supported #2862.
//dodefine(DB_GET_BOTH_RANGE); No longer supported because we only support NODUP. #2862.
dodefine(DB_LAST);
dodefine(DB_CURRENT);
dodefine(DB_NEXT);
dodefine(DB_NEXT_DUP);
//dodefine(DB_NEXT_DUP); No longer supported #2862
dodefine(DB_NEXT_NODUP);
dodefine(DB_PREV);
#if defined(DB_PREV_DUP)
dodefine(DB_PREV_DUP);
//dodefine(DB_PREV_DUP);
#endif
dodefine(DB_PREV_NODUP);
dodefine(DB_SET);
dodefine(DB_SET_RANGE);
printf("#define DB_CURRENT_BINDING 253\n"); // private tokudb
printf("#define DB_SET_RANGE_REVERSE 252\n"); // private tokudb
printf("#define DB_GET_BOTH_RANGE_REVERSE 251\n"); // private tokudb
//printf("#define DB_GET_BOTH_RANGE_REVERSE 251\n"); // private tokudb. No longer supported #2862.
dodefine(DB_RMW);
printf("#define DB_PRELOCKED 0x00800000\n"); // private tokudb
printf("#define DB_PRELOCKED_WRITE 0x00400000\n"); // private tokudb
......@@ -529,7 +529,6 @@ int main (int argc __attribute__((__unused__)), char *const argv[] __attribute__
"int (*checkpointing_begin_atomic_operation) (DB_ENV*) /* Begin a set of operations (that must be atomic as far as checkpoints are concerned). i.e. inserting into every index in one table */",
"int (*checkpointing_end_atomic_operation) (DB_ENV*) /* End a set of operations (that must be atomic as far as checkpoints are concerned). */",
"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_engine_status_text) (DB_ENV*, char*, int) /* Fill in status text */",
"int (*get_iname) (DB_ENV* env, DBT* dname_dbt, DBT* iname_dbt) /* FOR TEST ONLY: lookup existing iname */",
......@@ -595,16 +594,14 @@ int main (int argc __attribute__((__unused__)), char *const argv[] __attribute__
const char *extra[]={"int (*key_range64)(DB*, DB_TXN *, DBT *, u_int64_t *less, u_int64_t *equal, u_int64_t *greater, int *is_exact)",
"int (*stat64)(DB *, DB_TXN *, DB_BTREE_STAT64 *)",
"int (*pre_acquire_read_lock)(DB*, DB_TXN*, const DBT*, const DBT*, const DBT*, const DBT*)",
"int (*pre_acquire_read_lock)(DB*, DB_TXN*, const DBT*, const DBT*)",
"int (*pre_acquire_table_lock)(DB*, DB_TXN*)",
"const DBT* (*dbt_pos_infty)(void) /* Return the special DBT that refers to positive infinity in the lock table.*/",
"const DBT* (*dbt_neg_infty)(void)/* Return the special DBT that refers to negative infinity in the lock table.*/",
"int (*delboth) (DB*, DB_TXN*, DBT*, DBT*, u_int32_t) /* Delete the key/value pair. */",
"int (*row_size_supported) (DB*, u_int32_t) /* Test whether a row size is supported. */",
"DESCRIPTOR descriptor /* saved row/dictionary descriptor for aiding in comparisons */",
"int (*set_descriptor) (DB*, u_int32_t version, const DBT* descriptor) /* set row/dictionary descriptor for a db. Available only while db is open */",
"int (*getf_set)(DB*, DB_TXN*, u_int32_t, DBT*, YDB_CALLBACK_FUNCTION, void*) /* same as DBC->c_getf_set without a persistent cursor) */",
"int (*getf_get_both)(DB*, DB_TXN*, u_int32_t, DBT*, DBT*, YDB_CALLBACK_FUNCTION, void*) /* same as DBC->c_getf_get_both without a persistent cursor) */",
"int (*flatten)(DB*, DB_TXN*) /* Flatten a dictionary, similar to (but faster than) a table scan */",
"int (*get_fragmentation)(DB*,TOKU_DB_FRAGMENTATION)",
NULL};
......@@ -643,20 +640,13 @@ int main (int argc __attribute__((__unused__)), char *const argv[] __attribute__
"int (*c_getf_first)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *)",
"int (*c_getf_last)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *)",
"int (*c_getf_next)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *)",
"int (*c_getf_next_dup)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *)",
"int (*c_getf_next_nodup)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *)",
"int (*c_getf_prev)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *)",
"int (*c_getf_prev_dup)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *)",
"int (*c_getf_prev_nodup)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *)",
"int (*c_getf_current)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *)",
"int (*c_getf_current_binding)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *)",
"int (*c_getf_set)(DBC *, u_int32_t, DBT *, YDB_CALLBACK_FUNCTION, void *)",
"int (*c_getf_set_range)(DBC *, u_int32_t, DBT *, YDB_CALLBACK_FUNCTION, void *)",
"int (*c_getf_set_range_reverse)(DBC *, u_int32_t, DBT *, YDB_CALLBACK_FUNCTION, void *)",
"int (*c_getf_get_both)(DBC *, u_int32_t, DBT *, DBT *, YDB_CALLBACK_FUNCTION, void *)",
"int (*c_getf_get_both_range)(DBC *, u_int32_t, DBT *, DBT *, YDB_CALLBACK_FUNCTION, void *)",
"int (*c_getf_get_both_range_reverse)(DBC *, u_int32_t, DBT *, DBT *, YDB_CALLBACK_FUNCTION, void *)",
NULL};
assert(sizeof(dbc_fields32)==sizeof(dbc_fields64));
print_struct("dbc", INTERNAL_AT_END, dbc_fields32, dbc_fields64, sizeof(dbc_fields32)/sizeof(dbc_fields32[0]), extra);
......
......@@ -144,7 +144,6 @@ void sample_db_offsets (void) {
STRUCT_SETUP(DB, remove, "int (*%s) (DB *, const char *, const char *, u_int32_t)");
STRUCT_SETUP(DB, rename, "int (*%s) (DB *, const char *, const char *, const char *, u_int32_t)");
STRUCT_SETUP(DB, set_bt_compare, "int (*%s) (DB *, int (*)(DB *, const DBT *, const DBT *))");
STRUCT_SETUP(DB, set_dup_compare, "int (*%s) (DB *, int (*)(DB *, const DBT *, const DBT *))");
STRUCT_SETUP(DB, set_errfile, "void (*%s) (DB *, FILE*)");
STRUCT_SETUP(DB, set_flags, "int (*%s) (DB *, u_int32_t)");
STRUCT_SETUP(DB, set_pagesize, "int (*%s) (DB *, u_int32_t)");
......
......@@ -60,7 +60,6 @@ struct fieldinfo db_fields32[] = {
{"int (*remove) (DB *, const char *, const char *, u_int32_t)", 316, 4},
{"int (*rename) (DB *, const char *, const char *, const char *, u_int32_t)", 320, 4},
{"int (*truncate) (DB *, DB_TXN *, u_int32_t *, u_int32_t)", 324, 4},
{"int (*set_dup_compare) (DB *, int (*)(DB *, const DBT *, const DBT *))", 344, 4},
{"void (*set_errfile) (DB *, FILE*)", 356, 4},
{"int (*set_flags) (DB *, u_int32_t)", 368, 4},
{"int (*set_pagesize) (DB *, u_int32_t)", 376, 4},
......
......@@ -66,7 +66,6 @@ struct fieldinfo db_fields32[] = {
{"int (*remove) (DB *, const char *, const char *, u_int32_t)", 376, 4},
{"int (*rename) (DB *, const char *, const char *, const char *, u_int32_t)", 380, 4},
{"int (*truncate) (DB *, DB_TXN *, u_int32_t *, u_int32_t)", 384, 4},
{"int (*set_dup_compare) (DB *, int (*)(DB *, const DBT *, const DBT *))", 400, 4},
{"void (*set_errfile) (DB *, FILE*)", 412, 4},
{"int (*set_flags) (DB *, u_int32_t)", 424, 4},
{"int (*set_pagesize) (DB *, u_int32_t)", 444, 4},
......
......@@ -66,7 +66,6 @@ struct fieldinfo db_fields32[] = {
{"int (*remove) (DB *, const char *, const char *, u_int32_t)", 424, 4},
{"int (*rename) (DB *, const char *, const char *, const char *, u_int32_t)", 428, 4},
{"int (*set_bt_compare) (DB *, int (*)(DB *, const DBT *, const DBT *))", 440, 4},
{"int (*set_dup_compare) (DB *, int (*)(DB *, const DBT *, const DBT *))", 456, 4},
{"void (*set_errfile) (DB *, FILE*)", 468, 4},
{"int (*set_flags) (DB *, u_int32_t)", 480, 4},
{"int (*set_pagesize) (DB *, u_int32_t)", 508, 4},
......
......@@ -65,7 +65,6 @@ struct fieldinfo db_fields32[] = {
{"int (*remove) (DB *, const char *, const char *, u_int32_t)", 436, 4},
{"int (*rename) (DB *, const char *, const char *, const char *, u_int32_t)", 440, 4},
{"int (*set_bt_compare) (DB *, int (*)(DB *, const DBT *, const DBT *))", 452, 4},
{"int (*set_dup_compare) (DB *, int (*)(DB *, const DBT *, const DBT *))", 468, 4},
{"void (*set_errfile) (DB *, FILE*)", 480, 4},
{"int (*set_flags) (DB *, u_int32_t)", 492, 4},
{"int (*set_pagesize) (DB *, u_int32_t)", 520, 4},
......
......@@ -65,7 +65,6 @@ struct fieldinfo db_fields32[] = {
{"int (*remove) (DB *, const char *, const char *, u_int32_t)", 456, 4},
{"int (*rename) (DB *, const char *, const char *, const char *, u_int32_t)", 460, 4},
{"int (*set_bt_compare) (DB *, int (*)(DB *, const DBT *, const DBT *))", 472, 4},
{"int (*set_dup_compare) (DB *, int (*)(DB *, const DBT *, const DBT *))", 488, 4},
{"void (*set_errfile) (DB *, FILE*)", 500, 4},
{"int (*set_flags) (DB *, u_int32_t)", 512, 4},
{"int (*set_pagesize) (DB *, u_int32_t)", 544, 4},
......
......@@ -60,7 +60,6 @@ struct fieldinfo db_fields64[] = {
{"int (*remove) (DB *, const char *, const char *, u_int32_t)", 536, 8},
{"int (*rename) (DB *, const char *, const char *, const char *, u_int32_t)", 544, 8},
{"int (*truncate) (DB *, DB_TXN *, u_int32_t *, u_int32_t)", 552, 8},
{"int (*set_dup_compare) (DB *, int (*)(DB *, const DBT *, const DBT *))", 592, 8},
{"void (*set_errfile) (DB *, FILE*)", 616, 8},
{"int (*set_flags) (DB *, u_int32_t)", 640, 8},
{"int (*set_pagesize) (DB *, u_int32_t)", 656, 8},
......
......@@ -66,7 +66,6 @@ struct fieldinfo db_fields64[] = {
{"int (*remove) (DB *, const char *, const char *, u_int32_t)", 656, 8},
{"int (*rename) (DB *, const char *, const char *, const char *, u_int32_t)", 664, 8},
{"int (*truncate) (DB *, DB_TXN *, u_int32_t *, u_int32_t)", 672, 8},
{"int (*set_dup_compare) (DB *, int (*)(DB *, const DBT *, const DBT *))", 704, 8},
{"void (*set_errfile) (DB *, FILE*)", 728, 8},
{"int (*set_flags) (DB *, u_int32_t)", 752, 8},
{"int (*set_pagesize) (DB *, u_int32_t)", 792, 8},
......
......@@ -66,7 +66,6 @@ struct fieldinfo db_fields64[] = {
{"int (*remove) (DB *, const char *, const char *, u_int32_t)", 752, 8},
{"int (*rename) (DB *, const char *, const char *, const char *, u_int32_t)", 760, 8},
{"int (*set_bt_compare) (DB *, int (*)(DB *, const DBT *, const DBT *))", 784, 8},
{"int (*set_dup_compare) (DB *, int (*)(DB *, const DBT *, const DBT *))", 816, 8},
{"void (*set_errfile) (DB *, FILE*)", 840, 8},
{"int (*set_flags) (DB *, u_int32_t)", 864, 8},
{"int (*set_pagesize) (DB *, u_int32_t)", 920, 8},
......
......@@ -65,7 +65,6 @@ struct fieldinfo db_fields64[] = {
{"int (*remove) (DB *, const char *, const char *, u_int32_t)", 776, 8},
{"int (*rename) (DB *, const char *, const char *, const char *, u_int32_t)", 784, 8},
{"int (*set_bt_compare) (DB *, int (*)(DB *, const DBT *, const DBT *))", 808, 8},
{"int (*set_dup_compare) (DB *, int (*)(DB *, const DBT *, const DBT *))", 840, 8},
{"void (*set_errfile) (DB *, FILE*)", 864, 8},
{"int (*set_flags) (DB *, u_int32_t)", 888, 8},
{"int (*set_pagesize) (DB *, u_int32_t)", 944, 8},
......
......@@ -65,7 +65,6 @@ struct fieldinfo db_fields64[] = {
{"int (*remove) (DB *, const char *, const char *, u_int32_t)", 824, 8},
{"int (*rename) (DB *, const char *, const char *, const char *, u_int32_t)", 832, 8},
{"int (*set_bt_compare) (DB *, int (*)(DB *, const DBT *, const DBT *))", 856, 8},
{"int (*set_dup_compare) (DB *, int (*)(DB *, const DBT *, const DBT *))", 888, 8},
{"void (*set_errfile) (DB *, FILE*)", 912, 8},
{"int (*set_flags) (DB *, u_int32_t)", 936, 8},
{"int (*set_pagesize) (DB *, u_int32_t)", 1000, 8},
......
......@@ -65,7 +65,6 @@ struct fieldinfo db_fields64[] = {
{"int (*remove) (DB *, const char *, const char *, u_int32_t)", 864, 8},
{"int (*rename) (DB *, const char *, const char *, const char *, u_int32_t)", 872, 8},
{"int (*set_bt_compare) (DB *, int (*)(DB *, const DBT *, const DBT *))", 896, 8},
{"int (*set_dup_compare) (DB *, int (*)(DB *, const DBT *, const DBT *))", 928, 8},
{"void (*set_errfile) (DB *, FILE*)", 952, 8},
{"int (*set_flags) (DB *, u_int32_t)", 976, 8},
{"int (*set_pagesize) (DB *, u_int32_t)", 1040, 8},
......
......@@ -169,8 +169,6 @@ typedef enum {
#define DB_LOCK_DEFAULT 1
#define DB_LOCK_OLDEST 7
#define DB_LOCK_RANDOM 8
#define DB_DUP 32768
#define DB_DUPSORT 65536
#define DB_KEYFIRST 13
#define DB_KEYLAST 14
#define DB_NOOVERWRITE 20
......@@ -195,21 +193,16 @@ typedef enum {
#define DB_DELETE_ANY 65536
#define DB_TRUNCATE_WITHCURSORS 131072
#define DB_FIRST 7
#define DB_GET_BOTH 8
#define DB_GET_BOTH_RANGE 10
#define DB_LAST 15
#define DB_CURRENT 6
#define DB_NEXT 16
#define DB_NEXT_DUP 17
#define DB_NEXT_NODUP 18
#define DB_PREV 23
#define DB_PREV_DUP 24
#define DB_PREV_NODUP 25
#define DB_SET 26
#define DB_SET_RANGE 27
#define DB_CURRENT_BINDING 253
#define DB_SET_RANGE_REVERSE 252
#define DB_GET_BOTH_RANGE_REVERSE 251
#define DB_RMW 1073741824
#define DB_PRELOCKED 0x00800000
#define DB_PRELOCKED_WRITE 0x00400000
......@@ -253,16 +246,15 @@ struct __toku_db_env {
int (*checkpointing_begin_atomic_operation) (DB_ENV*) /* Begin a set of operations (that must be atomic as far as checkpoints are concerned). i.e. inserting into every index in one table */;
int (*checkpointing_end_atomic_operation) (DB_ENV*) /* End a set of operations (that must be atomic as far as checkpoints are concerned). */;
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_engine_status_text) (DB_ENV*, char*, int) /* Fill in status text */;
int (*get_iname) (DB_ENV* env, DBT* dname_dbt, DBT* iname_dbt) /* FOR TEST ONLY: lookup existing iname */;
int (*create_loader) (DB_ENV *env, DB_TXN *txn, DB_LOADER **blp, DB *src_db, int N, DB *dbs[/*N*/], uint32_t db_flags[/*N*/], uint32_t dbt_flags[/*N*/], uint32_t loader_flags);
void *app_private;
int (*put_multiple) (DB_ENV *env, DB *src_db, DB_TXN *txn,
const DBT *key, const DBT *val,
uint32_t num_dbs, DB **db_array, DBT *keys, DBT *vals, uint32_t *flags_array,
void *extra) /* Insert into multiple dbs */;
void *app_private;
int (*set_generate_row_callback_for_put) (DB_ENV *env,
int (*generate_row_for_put)(DB *dest_db, DB *src_db,
DBT *dest_key, DBT *dest_val,
......@@ -344,16 +336,14 @@ struct __toku_db {
int (*stat64)(DB *, DB_TXN *, DB_BTREE_STAT64 *);
void *app_private;
DB_ENV *dbenv;
int (*pre_acquire_read_lock)(DB*, DB_TXN*, const DBT*, const DBT*, const DBT*, const DBT*);
int (*pre_acquire_read_lock)(DB*, DB_TXN*, const DBT*, const DBT*);
int (*pre_acquire_table_lock)(DB*, DB_TXN*);
const DBT* (*dbt_pos_infty)(void) /* Return the special DBT that refers to positive infinity in the lock table.*/;
const DBT* (*dbt_neg_infty)(void)/* Return the special DBT that refers to negative infinity in the lock table.*/;
int (*delboth) (DB*, DB_TXN*, DBT*, DBT*, u_int32_t) /* Delete the key/value pair. */;
int (*row_size_supported) (DB*, u_int32_t) /* Test whether a row size is supported. */;
DESCRIPTOR descriptor /* saved row/dictionary descriptor for aiding in comparisons */;
int (*set_descriptor) (DB*, u_int32_t version, const DBT* descriptor) /* set row/dictionary descriptor for a db. Available only while db is open */;
int (*getf_set)(DB*, DB_TXN*, u_int32_t, DBT*, YDB_CALLBACK_FUNCTION, void*) /* same as DBC->c_getf_set without a persistent cursor) */;
int (*getf_get_both)(DB*, DB_TXN*, u_int32_t, DBT*, DBT*, YDB_CALLBACK_FUNCTION, void*) /* same as DBC->c_getf_get_both without a persistent cursor) */;
int (*flatten)(DB*, DB_TXN*) /* Flatten a dictionary, similar to (but faster than) a table scan */;
int (*get_fragmentation)(DB*,TOKU_DB_FRAGMENTATION);
void *api_internal;
......@@ -370,7 +360,6 @@ struct __toku_db {
int (*remove) (DB *, const char *, const char *, u_int32_t);
int (*rename) (DB *, const char *, const char *, const char *, u_int32_t);
int (*set_bt_compare) (DB *, int (*)(DB *, const DBT *, const DBT *));
int (*set_dup_compare) (DB *, int (*)(DB *, const DBT *, const DBT *));
void (*set_errfile) (DB *, FILE*);
int (*set_flags) (DB *, u_int32_t);
int (*set_pagesize) (DB *, u_int32_t);
......@@ -415,19 +404,12 @@ struct __toku_dbc {
int (*c_getf_first)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_last)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_next)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_next_dup)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_next_nodup)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_prev)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_prev_dup)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_prev_nodup)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_current)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_current_binding)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_set)(DBC *, u_int32_t, DBT *, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_set_range)(DBC *, u_int32_t, DBT *, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_set_range_reverse)(DBC *, u_int32_t, DBT *, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_get_both)(DBC *, u_int32_t, DBT *, DBT *, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_get_both_range)(DBC *, u_int32_t, DBT *, DBT *, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_get_both_range_reverse)(DBC *, u_int32_t, DBT *, DBT *, YDB_CALLBACK_FUNCTION, void *);
int (*c_close) (DBC *);
int (*c_count) (DBC *, db_recno_t *, u_int32_t);
int (*c_del) (DBC *, u_int32_t);
......
......@@ -127,11 +127,6 @@ int Db::set_bt_compare(bt_compare_fcn_type bt_compare_fcn) {
return the_Env->maybe_throw_error(ret);
}
int Db::set_dup_compare(dup_compare_fcn_type dup_compare_fcn) {
int ret = the_db->set_dup_compare(the_db, dup_compare_fcn);
return the_Env->maybe_throw_error(ret);
}
int Db::fd(int *fdp) {
int ret = the_db->fd(the_db, fdp);
return the_Env->maybe_throw_error(ret);
......@@ -142,12 +137,6 @@ extern "C" int toku_dup_compare_callback_c(DB *db_c, const DBT *a, const DBT *b)
return db_cxx->dup_compare_callback_cxx(db_cxx, Dbt::get_const_Dbt(a), Dbt::get_const_Dbt(b));
}
int Db::set_dup_compare(int (*dup_compare_callback)(Db *, const Dbt *, const Dbt *)) {
dup_compare_callback_cxx = dup_compare_callback;
int ret = the_db->set_dup_compare(the_db, toku_dup_compare_callback_c);
return the_Env->maybe_throw_error(ret);
}
void Db::set_errpfx(const char *errpfx) {
the_Env->set_errpfx(errpfx);
}
......
......@@ -116,7 +116,6 @@ check: $(TARGETS) \
check_test_reverse_compare_fun \
check_test1e \
check_db_create \
check_db_create_DSM \
check_db_create_1 check_db_create_2 check_db_create_3 check_db_create_4 \
check_permissions \
check_exceptions \
......@@ -137,10 +136,6 @@ check_db_create: db_create
rm -rf $@.dir
mkdir $@.dir
$(VGRIND) ./db_create --env_dir $@.dir -s main $@.tdb $(SUMMARIZE_CMD)
check_db_create_DSM: db_create
rm -rf $@.dir
mkdir $@.dir
$(VGRIND) ./db_create --env_dir $@.dir -D -S -s main $@.tdb $(SUMMARIZE_CMD)
# These don't need to set the env dir
check_db_create_1: db_create
......
......@@ -45,7 +45,7 @@ static int dbcreate(char *dbfile, char *dbname, int dbflags, int argc, char *arg
}
static int usage() {
fprintf(stderr, "db_create [-s DBNAME] [-D] [-S] DBFILE [KEY VAL]*\n");
fprintf(stderr, "db_create [-s DBNAME] DBFILE [KEY VAL]*\n");
fprintf(stderr, "[--set_data_dir DIRNAME]\n");
return 1;
}
......@@ -65,14 +65,6 @@ int main(int argc, char *argv[]) {
dbname = argv[++i];
continue;
}
if (0 == strcmp(arg, "-D")) {
dbflags += DB_DUP;
continue;
}
if (0 == strcmp(arg, "-S")) {
dbflags += DB_DUPSORT;
continue;
}
if (0 == strcmp(arg, "--env_dir")) {
if (i+1 >= argc)
return usage();
......
......@@ -34,10 +34,12 @@ static int dbdump(const char *env_dir, const char *dbfile, const char *dbname) {
u_int32_t dbflags;
r = db.get_flags(&dbflags); assert(r == 0);
#ifndef TOKUDB
if (dbflags & DB_DUP)
printf("duplicates=1\n");
if (dbflags & DB_DUPSORT)
printf("dupsort=1\n");
#endif
#if 0
u_int32_t nodesize;
r = db.get_nodesize(&nodesize); assert(r == 0);
......
......@@ -190,9 +190,8 @@ void walk(Db *db, int n) {
r = my_cursor_count(cursor, &mycount, db); assert(r == 0);
assert(mycount == count);
#endif
if (k == n/2) assert((int)count == n); else assert(count == 1);
assert(count==1); // we support only NODUP databases now.
}
assert(i == 2*n-1);
toku_free(key.get_data());
toku_free(val.get_data());
r = cursor->close(); assert(r == 0);
......@@ -213,7 +212,7 @@ void test_zero_count(Db *db, int n) {
r = cursor_set(cursor, htonl(n/2)); assert(r == 0);
db_recno_t count;
r = cursor->count(&count, 0); assert(r == 0);
assert((int)count == n);
assert((int)count == 1);
Dbt key; key.set_flags(DB_DBT_REALLOC);
Dbt val; val.set_flags(DB_DBT_REALLOC);
......@@ -226,10 +225,10 @@ void test_zero_count(Db *db, int n) {
break;
assert(newcount == count - 1);
count = newcount;
r = cursor->get(&key, &val, DB_NEXT_DUP);
r = cursor->get(&key, &val, DB_NEXT);
if (r != 0) break;
}
assert(i == n);
assert(i == 2);
if (key.get_data()) toku_free(key.get_data());
if (val.get_data()) toku_free(val.get_data());
r = cursor->close(); assert(r == 0);
......@@ -249,7 +248,7 @@ void test_next_nodup(Db *db, int n) {
int v = *(int*)val.get_data();
if (verbose) printf("%d %d\n", k, v);
assert(k == i);
if (k == n/2) assert(v == 0); else assert(v == i);
if (k == n/2) assert(v == n-1); else assert(v == i);
i += 1;
// r = my_next_nodup(cursor, &key, &val);
r = cursor->get(&key, &val, DB_NEXT_NODUP);
......@@ -285,47 +284,6 @@ void test_prev_nodup(Db *db, int n) {
r = cursor->close(); assert(r == 0);
}
void test_next_dup(Db *db, int n) {
if (verbose) printf("test_next_dup\n");
int r;
Dbc *cursor;
r = db->cursor(0, &cursor, 0); assert(r == 0);
int k = htonl(n/2);
Dbt setkey(&k, sizeof k);
Dbt key; key.set_flags(DB_DBT_REALLOC);
Dbt val; val.set_flags(DB_DBT_REALLOC);
r = cursor->get(&setkey, &val, DB_SET); assert(r == 0);
r = cursor->get(&key, &val, DB_CURRENT); assert(r == 0);
int i = 0;
while (r == 0) {
int k = htonl(*(int*)key.get_data());
int v = *(int*)val.get_data();
if (verbose) printf("%d %d\n", k, v);
assert(k == n/2); assert(v == i);
i += 1;
// r = my_next_dup(cursor, &key, &val);
r = cursor->get(&key, &val, DB_NEXT_DUP);
}
assert(i == n);
#ifdef DB_PREV_DUP
i = n - 1;
for (;;) {
r = cursor->get(&key, &val, DB_CURRENT);
assert(r == 0);
int k = htonl(*(int*)key.get_data());
int v = *(int*)val.get_data();
assert(k == n/2); assert(v == i);
r = cursor->get(&key, &val, DB_PREV_DUP);
if (r != 0) break;
i -= 1;
}
assert(i == 0);
#endif
if (key.get_data()) toku_free(key.get_data());
if (val.get_data()) toku_free(val.get_data());
r = cursor->close(); assert(r == 0);
}
#define DIR "test_cursor_count.dir"
int main(int argc, char *argv[]) {
......@@ -349,7 +307,6 @@ int main(int argc, char *argv[]) {
Db db(0, DB_CXX_NO_EXCEPTIONS);
#endif
r = db.set_flags(DB_DUP + DB_DUPSORT); assert(r == 0);
unlink(FNAME);
r = db.open(0, FNAME, 0, DB_BTREE, DB_CREATE, 0777); assert(r == 0);
......@@ -358,7 +315,6 @@ int main(int argc, char *argv[]) {
walk(&db, 10);
test_next_nodup(&db, 10);
test_prev_nodup(&db, 10);
test_next_dup(&db, 10);
test_zero_count(&db, 10);
return 0;
......
......@@ -53,8 +53,8 @@ void expect(Dbc *cursor, int k, int v) {
toku_free(val.get_data());
}
void test_reverse_compare(int n, int dup_flags) {
if (verbose) printf("test_reverse_compare:%d %d\n", n, dup_flags);
void test_reverse_compare(int n) {
if (verbose) printf("test_reverse_compare:%d\n", n);
Db *db;
DbTxn * const null_txn = 0;
......@@ -72,21 +72,17 @@ void test_reverse_compare(int n, int dup_flags) {
r = env.open(DIR, DB_INIT_MPOOL + DB_CREATE + DB_PRIVATE, 0777); assert(r == 0);
db = new Db(&env, DB_CXX_NO_EXCEPTIONS);
assert(db);
r = db->set_flags(dup_flags);
assert(r == 0);
r = db->set_pagesize(4096);
assert(r == 0);
r = db->set_bt_compare(reverse_compare);
assert(r == 0);
r = db->set_dup_compare(reverse_compare);
assert(r == 0);
r = db->open(null_txn, fname, "main", DB_BTREE, DB_CREATE, 0666);
assert(r == 0);
/* insert n unique keys {0, 1, n-1} */
for (i=0; i<n; i++) {
int k, v;
k = htonl(dup_flags ? n : i);
k = htonl(i);
Dbt key(&k, sizeof k);
v = htonl(i);
Dbt val(&v, sizeof v);
......@@ -101,21 +97,17 @@ void test_reverse_compare(int n, int dup_flags) {
db = new Db(&env, 0);
assert(db);
r = db->set_flags(dup_flags);
assert(r == 0);
r = db->set_pagesize(4096);
assert(r == 0);
r = db->set_bt_compare(reverse_compare);
assert(r == 0);
r = db->set_dup_compare(reverse_compare);
assert(r == 0);
r = db->open(null_txn, fname, "main", DB_BTREE, 0, 0666);
assert(r == 0);
/* insert n unique keys {n, n+1, 2*n-1} */
for (i=n; i<2*n; i++) {
int k, v;
k = htonl(dup_flags ? n : i);
k = htonl(i);
Dbt key(&k, sizeof k);
v = htonl(i);
Dbt val(&v, sizeof v);
......@@ -130,7 +122,7 @@ void test_reverse_compare(int n, int dup_flags) {
//for (i=0; i<2*n; i++)
for (i=2*n-1; i>=0; i--)
expect(cursor, htonl(dup_flags ? n : i), htonl(i));
expect(cursor, htonl(i), htonl(i));
r = cursor->close();
assert(r == 0);
......@@ -143,8 +135,7 @@ void test_reverse_compare(int n, int dup_flags) {
int main(int argc, const char *argv[]) {
int i;
for (i = 1; i <= (1<<16); i *= 2) {
test_reverse_compare(i, 0);
test_reverse_compare(i, DB_DUP + DB_DUPSORT);
test_reverse_compare(i);
}
return 0;
}
......@@ -69,22 +69,17 @@ endif
build.bdb: $(TARGET_BDB) $(SCANSCAN_BDB) $(WINDOWS_BDB_LIB_NAME)
build.tdb: $(TARGET_TDB) $(SCANSCAN_TDB)
check: check-default check-rowsize-dup check-rowsize check-xfast check-x check-no-rollback check-4G child.benchmark.dir
check: check-default check-rowsize check-xfast check-x check-no-rollback check-4G child.benchmark.dir
SUPPORT_KEYSIZE=$$((3*1024)) # at least 3KiB
SUPPORT_ROWSIZE=$$((80*1024)) # at least 80KiB
.PHONY: check-rowsize check-rowsize-dup
.PHONY: check-rowsize
check-rowsize: $(TARGET_TDB)
( $(VGRIND) ./$(TARGET_TDB) $(VERBVERBOSE) --env rowsize.key.dir --keysize $(SUPPORT_KEYSIZE) --periter 256 1 && \
$(VGRIND) ./$(TARGET_TDB) $(VERBVERBOSE) --env rowsize.val.dir --valsize $(SUPPORT_ROWSIZE) --periter 256 1 && \
$(VGRIND) ./$(TARGET_TDB) $(VERBVERBOSE) --env rowsize.keyval.dir --keysize $(SUPPORT_KEYSIZE) --valsize $(SUPPORT_ROWSIZE) --periter 256 1 ) $(SUMMARIZE_CMD)
check-rowsize-dup: $(TARGET_TDB)
( $(VGRIND) ./$(TARGET_TDB) $(VERBVERBOSE) --env rowsize.dup.key.dir --dupsort --keysize $(SUPPORT_KEYSIZE) --periter 256 1 && \
$(VGRIND) ./$(TARGET_TDB) $(VERBVERBOSE) --env rowsize.dup.val.dir --valsize $(SUPPORT_ROWSIZE) --periter 256 1 && \
$(VGRIND) ./$(TARGET_TDB) $(VERBVERBOSE) --env rowsize.dup.keyval.dir --dupsort --keysize $(SUPPORT_KEYSIZE) --valsize $(SUPPORT_ROWSIZE) --periter 256 1 ) $(SUMMARIZE_CMD)
check-default: $(TARGET_TDB)
$(VGRIND) ./$(TARGET_TDB) $(VERBVERBOSE) $(SUMMARIZE_CMD)
......
......@@ -612,9 +612,6 @@ static int test_main (int argc, char *const argv[]) {
} else if (strcmp(arg, "--pagesize") == 0) {
if (i+1 >= argc) return print_usage(argv[0]);
pagesize = atoi(argv[++i]);
} else if (strcmp(arg, "--dupsort") == 0) {
dupflags = DB_DUP + DB_DUPSORT;
continue;
} else if (strcmp(arg, "--env") == 0) {
if (i+1 >= argc) return print_usage(argv[0]);
dbdir = argv[++i];
......
......@@ -189,8 +189,7 @@ static void scanscan_setup (void) {
if (prelock) {
r = db->pre_acquire_read_lock(db,
tid,
db->dbt_neg_infty(), db->dbt_neg_infty(),
db->dbt_pos_infty(), db->dbt_pos_infty());
db->dbt_neg_infty(), db->dbt_pos_infty());
assert(r==0);
}
#endif
......@@ -386,8 +385,6 @@ static void scanscan_range (void) {
#ifdef TOKUDB
typedef struct foo{int a; } FOO;
struct extra_verify {
long long totalbytes;
int rowcounter;
......
......@@ -169,8 +169,6 @@ typedef enum {
#define DB_LOCK_DEFAULT 1
#define DB_LOCK_OLDEST 7
#define DB_LOCK_RANDOM 8
#define DB_DUP 32768
#define DB_DUPSORT 65536
#define DB_KEYFIRST 13
#define DB_KEYLAST 14
#define DB_NOOVERWRITE 20
......@@ -195,21 +193,16 @@ typedef enum {
#define DB_DELETE_ANY 65536
#define DB_TRUNCATE_WITHCURSORS 131072
#define DB_FIRST 7
#define DB_GET_BOTH 8
#define DB_GET_BOTH_RANGE 10
#define DB_LAST 15
#define DB_CURRENT 6
#define DB_NEXT 16
#define DB_NEXT_DUP 17
#define DB_NEXT_NODUP 18
#define DB_PREV 23
#define DB_PREV_DUP 24
#define DB_PREV_NODUP 25
#define DB_SET 26
#define DB_SET_RANGE 27
#define DB_CURRENT_BINDING 253
#define DB_SET_RANGE_REVERSE 252
#define DB_GET_BOTH_RANGE_REVERSE 251
#define DB_RMW 1073741824
#define DB_PRELOCKED 0x00800000
#define DB_PRELOCKED_WRITE 0x00400000
......@@ -253,16 +246,15 @@ struct __toku_db_env {
int (*checkpointing_begin_atomic_operation) (DB_ENV*) /* Begin a set of operations (that must be atomic as far as checkpoints are concerned). i.e. inserting into every index in one table */;
int (*checkpointing_end_atomic_operation) (DB_ENV*) /* End a set of operations (that must be atomic as far as checkpoints are concerned). */;
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_engine_status_text) (DB_ENV*, char*, int) /* Fill in status text */;
int (*get_iname) (DB_ENV* env, DBT* dname_dbt, DBT* iname_dbt) /* FOR TEST ONLY: lookup existing iname */;
int (*create_loader) (DB_ENV *env, DB_TXN *txn, DB_LOADER **blp, DB *src_db, int N, DB *dbs[/*N*/], uint32_t db_flags[/*N*/], uint32_t dbt_flags[/*N*/], uint32_t loader_flags);
void *app_private;
int (*put_multiple) (DB_ENV *env, DB *src_db, DB_TXN *txn,
const DBT *key, const DBT *val,
uint32_t num_dbs, DB **db_array, DBT *keys, DBT *vals, uint32_t *flags_array,
void *extra) /* Insert into multiple dbs */;
void *app_private;
int (*set_generate_row_callback_for_put) (DB_ENV *env,
int (*generate_row_for_put)(DB *dest_db, DB *src_db,
DBT *dest_key, DBT *dest_val,
......@@ -344,16 +336,14 @@ struct __toku_db {
int (*stat64)(DB *, DB_TXN *, DB_BTREE_STAT64 *);
void *app_private;
DB_ENV *dbenv;
int (*pre_acquire_read_lock)(DB*, DB_TXN*, const DBT*, const DBT*, const DBT*, const DBT*);
int (*pre_acquire_read_lock)(DB*, DB_TXN*, const DBT*, const DBT*);
int (*pre_acquire_table_lock)(DB*, DB_TXN*);
const DBT* (*dbt_pos_infty)(void) /* Return the special DBT that refers to positive infinity in the lock table.*/;
const DBT* (*dbt_neg_infty)(void)/* Return the special DBT that refers to negative infinity in the lock table.*/;
int (*delboth) (DB*, DB_TXN*, DBT*, DBT*, u_int32_t) /* Delete the key/value pair. */;
int (*row_size_supported) (DB*, u_int32_t) /* Test whether a row size is supported. */;
DESCRIPTOR descriptor /* saved row/dictionary descriptor for aiding in comparisons */;
int (*set_descriptor) (DB*, u_int32_t version, const DBT* descriptor) /* set row/dictionary descriptor for a db. Available only while db is open */;
int (*getf_set)(DB*, DB_TXN*, u_int32_t, DBT*, YDB_CALLBACK_FUNCTION, void*) /* same as DBC->c_getf_set without a persistent cursor) */;
int (*getf_get_both)(DB*, DB_TXN*, u_int32_t, DBT*, DBT*, YDB_CALLBACK_FUNCTION, void*) /* same as DBC->c_getf_get_both without a persistent cursor) */;
int (*flatten)(DB*, DB_TXN*) /* Flatten a dictionary, similar to (but faster than) a table scan */;
int (*get_fragmentation)(DB*,TOKU_DB_FRAGMENTATION);
void *api_internal;
......@@ -370,7 +360,6 @@ struct __toku_db {
int (*remove) (DB *, const char *, const char *, u_int32_t);
int (*rename) (DB *, const char *, const char *, const char *, u_int32_t);
int (*set_bt_compare) (DB *, int (*)(DB *, const DBT *, const DBT *));
int (*set_dup_compare) (DB *, int (*)(DB *, const DBT *, const DBT *));
void (*set_errfile) (DB *, FILE*);
int (*set_flags) (DB *, u_int32_t);
int (*set_pagesize) (DB *, u_int32_t);
......@@ -415,19 +404,12 @@ struct __toku_dbc {
int (*c_getf_first)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_last)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_next)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_next_dup)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_next_nodup)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_prev)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_prev_dup)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_prev_nodup)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_current)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_current_binding)(DBC *, u_int32_t, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_set)(DBC *, u_int32_t, DBT *, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_set_range)(DBC *, u_int32_t, DBT *, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_set_range_reverse)(DBC *, u_int32_t, DBT *, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_get_both)(DBC *, u_int32_t, DBT *, DBT *, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_get_both_range)(DBC *, u_int32_t, DBT *, DBT *, YDB_CALLBACK_FUNCTION, void *);
int (*c_getf_get_both_range_reverse)(DBC *, u_int32_t, DBT *, DBT *, YDB_CALLBACK_FUNCTION, void *);
int (*c_close) (DBC *);
int (*c_count) (DBC *, db_recno_t *, u_int32_t);
int (*c_del) (DBC *, u_int32_t);
......
This diff is collapsed.
/* -*- mode: C; c-basic-offset: 4 -*- */
#ident "$Id$"
#ident "Copyright (c) 2007-2010 Tokutek Inc. All rights reserved."
#ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it."
#ifndef BACKWARD_11_H
#define BACKWARD_11_H
static int upgrade_brtheader_11_12 (int fd, struct brt_header **brth_11, struct brt_header **brth_12);
static int upgrade_brtnode_11_12 (BRTNODE *brtnode_11, BRTNODE *brtnode_12);
static int deserialize_brtheader_11 (int fd, struct rbuf *rb, struct brt_header **brth);
static int decompress_brtnode_from_raw_block_into_rbuf_11(u_int8_t *raw_block, struct rbuf *rb, BLOCKNUM blocknum);
static int deserialize_brtnode_from_rbuf_11 (BLOCKNUM blocknum, u_int32_t fullhash, BRTNODE *brtnode, struct brt_header *h, struct rbuf *rb);
#endif
......@@ -201,7 +201,6 @@ struct brt {
BOOL did_set_descriptor;
DESCRIPTOR_S temp_descriptor;
int (*compare_fun)(DB*,const DBT*,const DBT*);
int (*dup_compare)(DB*,const DBT*,const DBT*);
DB *db; // To pass to the compare fun, and close once transactions are done.
OMT txns; // transactions that are using this OMT (note that the transaction checks the cf also)
......@@ -265,8 +264,7 @@ extern u_int32_t toku_calc_fingerprint_cmd (u_int32_t type, XIDS xids, const voi
extern u_int32_t toku_calc_fingerprint_cmdstruct (BRT_MSG cmd);
// How long is the pivot key?
unsigned int toku_brt_pivot_key_len (BRT, struct kv_pair *); // Given the tree
unsigned int toku_brtnode_pivot_key_len (BRTNODE, struct kv_pair *); // Given the node
unsigned int toku_brt_pivot_key_len (struct kv_pair *);
// Values to be used to update brtcursor if a search is successful.
struct brt_cursor_leaf_info_to_be {
......@@ -305,7 +303,7 @@ struct brt_cursor {
// logs the memory allocation, but not the creation of the new node
int toku_create_new_brtnode (BRT t, BRTNODE *result, int height, size_t mpsize);
int toku_unpin_brtnode (BRT brt, BRTNODE node);
unsigned int toku_brtnode_which_child (BRTNODE node , DBT *k, DBT *d, BRT t);
unsigned int toku_brtnode_which_child (BRTNODE node , DBT *k, BRT t);
/* Stuff for testing */
int toku_testsetup_leaf(BRT brt, BLOCKNUM *);
......@@ -319,7 +317,6 @@ int toku_testsetup_insert_to_nonleaf (BRT brt, BLOCKNUM, enum brt_msg_type, char
struct cmd_leafval_heaviside_extra {
BRT t;
BRT_MSG cmd;
int compare_both_keys; // Set to 1 for DUPSORT databases that are not doing a DELETE_BOTH
};
int toku_cmd_leafval_heaviside (OMTVALUE leafentry, void *extra);
......
......@@ -20,7 +20,7 @@ struct brt_search;
the compare function should be a step function from 0 to 1 for a left to right search
and 1 to 0 for a right to left search */
typedef int (*brt_search_compare_func_t)(struct brt_search */*so*/, DBT */*x*/, DBT */*y*/);
typedef int (*brt_search_compare_func_t)(struct brt_search */*so*/, DBT *);
/* the search object contains the compare function, search direction, and the kv pair that
is used in the compare function. the context is the user's private data */
......@@ -29,13 +29,12 @@ typedef struct brt_search {
brt_search_compare_func_t compare;
enum brt_search_direction_e direction;
const DBT *k;
const DBT *v;
void *context;
} brt_search_t;
/* initialize the search compare object */
static inline brt_search_t *brt_search_init(brt_search_t *so, brt_search_compare_func_t compare, enum brt_search_direction_e direction, const DBT *k, const DBT *v, void *context) {
so->compare = compare; so->direction = direction; so->k = k; so->v = v; so->context = context;
static inline brt_search_t *brt_search_init(brt_search_t *so, brt_search_compare_func_t compare, enum brt_search_direction_e direction, const DBT *k, void *context) {
so->compare = compare; so->direction = direction; so->k = k; so->context = context;
return so;
}
......
......@@ -6,10 +6,6 @@
#include "includes.h"
#include "toku_atomic.h"
#include "backwards_11.h"
// NOTE: The backwards compatability functions are in a file that is included at the END of this file.
static BRT_UPGRADE_STATUS_S upgrade_status; // accountability, used in backwards_x.c
void
......@@ -206,9 +202,8 @@ toku_serialize_brtnode_size_slow (BRTNODE node) {
size += 4; /* n_children */
size += 4; /* subtree fingerprint. */
size += 4*(node->u.n.n_children-1); /* key lengths*/
if (node->flags & TOKU_DB_DUPSORT) size += 4*(node->u.n.n_children-1);
for (int i=0; i<node->u.n.n_children-1; i++) {
csize += toku_brtnode_pivot_key_len(node, node->u.n.childkeys[i]);
csize += toku_brt_pivot_key_len(node->u.n.childkeys[i]);
}
size += (8+4+4+1+3*8)*(node->u.n.n_children); /* For each child, a child offset, a count for the number of hash table entries, the subtree fingerprint, and 3*8 for the subtree estimates and 1 for the exact bit for the estimates. */
int n_buffers = node->u.n.n_children;
......@@ -245,7 +240,6 @@ toku_serialize_brtnode_size (BRTNODE node) {
result += 4; /* subtree fingerpirnt */
result += 4; /* n_children */
result += 4*(node->u.n.n_children-1); /* key lengths*/
if (node->flags & TOKU_DB_DUPSORT) result += 4*(node->u.n.n_children-1); /* data lengths */
assert(node->u.n.totalchildkeylens < (1<<30));
result += node->u.n.totalchildkeylens; /* the lengths of the pivot keys, without their key lengths. */
result += (8+4+4+1+3*8)*(node->u.n.n_children); /* For each child, a child offset, a count for the number of hash table entries, the subtree fingerprint, and 3*8 for the subtree estimates and one for the exact bit. */
......@@ -317,12 +311,7 @@ serialize_nonleaf(BRTNODE node, int n_sub_blocks, struct sub_block sub_block[],
}
//printf("%s:%d w.ndone=%d\n", __FILE__, __LINE__, w.ndone);
for (int i = 0; i < node->u.n.n_children-1; i++) {
if (node->flags & TOKU_DB_DUPSORT) {
wbuf_nocrc_bytes(wbuf, kv_pair_key(node->u.n.childkeys[i]), kv_pair_keylen(node->u.n.childkeys[i]));
wbuf_nocrc_bytes(wbuf, kv_pair_val(node->u.n.childkeys[i]), kv_pair_vallen(node->u.n.childkeys[i]));
} else {
wbuf_nocrc_bytes(wbuf, kv_pair_key(node->u.n.childkeys[i]), toku_brtnode_pivot_key_len(node, node->u.n.childkeys[i]));
}
wbuf_nocrc_bytes(wbuf, kv_pair_key(node->u.n.childkeys[i]), toku_brt_pivot_key_len(node->u.n.childkeys[i]));
//printf("%s:%d w.ndone=%d (childkeylen[%d]=%d\n", __FILE__, __LINE__, w.ndone, i, node->childkeylens[i]);
}
for (int i = 0; i < node->u.n.n_children; i++) {
......@@ -683,20 +672,12 @@ deserialize_brtnode_nonleaf_from_rbuf (BRTNODE result, bytevec magic, struct rbu
se->exact = (BOOL) (rbuf_char(rb) != 0);
}
for (int i=0; i<result->u.n.n_children-1; i++) {
if (result->flags & TOKU_DB_DUPSORT) {
bytevec keyptr, dataptr;
unsigned int keylen, datalen;
rbuf_bytes(rb, &keyptr, &keylen);
rbuf_bytes(rb, &dataptr, &datalen);
result->u.n.childkeys[i] = kv_pair_malloc(keyptr, keylen, dataptr, datalen);
} else {
bytevec childkeyptr;
unsigned int cklen;
rbuf_bytes(rb, &childkeyptr, &cklen); /* Returns a pointer into the rbuf. */
result->u.n.childkeys[i] = kv_pair_malloc((void*)childkeyptr, cklen, 0, 0);
}
bytevec childkeyptr;
unsigned int cklen;
rbuf_bytes(rb, &childkeyptr, &cklen); /* Returns a pointer into the rbuf. */
result->u.n.childkeys[i] = kv_pair_malloc((void*)childkeyptr, cklen, 0, 0);
//printf(" key %d length=%d data=%s\n", i, result->childkeylens[i], result->childkeys[i]);
result->u.n.totalchildkeylens+=toku_brtnode_pivot_key_len(result, result->u.n.childkeys[i]);
result->u.n.totalchildkeylens+=toku_brt_pivot_key_len(result->u.n.childkeys[i]);
}
for (int i=0; i<result->u.n.n_children; i++) {
BNC_BLOCKNUM(result,i) = rbuf_blocknum(rb);
......@@ -758,16 +739,9 @@ deserialize_brtnode_leaf_from_rbuf (BRTNODE result, bytevec magic, struct rbuf *
// deserialize partition pivots
for (int p = 0; p < npartitions-1; p++) {
// just throw them away for now
if (result->flags & TOKU_DB_DUPSORT) {
bytevec keyptr, dataptr;
unsigned int keylen, datalen;
rbuf_bytes(rb, &keyptr, &keylen);
rbuf_bytes(rb, &dataptr, &datalen);
} else {
bytevec childkeyptr;
unsigned int cklen;
rbuf_bytes(rb, &childkeyptr, &cklen);
}
bytevec childkeyptr;
unsigned int cklen;
rbuf_bytes(rb, &childkeyptr, &cklen);
}
// deserialize the partition map
......@@ -955,9 +929,6 @@ static int
decompress_from_raw_block_into_rbuf_versioned(u_int32_t version, u_int8_t *raw_block, size_t raw_block_size, struct rbuf *rb, BLOCKNUM blocknum) {
int r;
switch (version) {
case BRT_LAYOUT_VERSION_11:
r = decompress_brtnode_from_raw_block_into_rbuf_11(raw_block, rb, blocknum);
break;
case BRT_LAYOUT_VERSION:
r = decompress_from_raw_block_into_rbuf(raw_block, raw_block_size, rb, blocknum);
break;
......@@ -970,18 +941,10 @@ decompress_from_raw_block_into_rbuf_versioned(u_int32_t version, u_int8_t *raw_b
static int
deserialize_brtnode_from_rbuf_versioned (u_int32_t version, BLOCKNUM blocknum, u_int32_t fullhash, BRTNODE *brtnode, struct brt_header *h, struct rbuf *rb) {
int r = 0;
BRTNODE brtnode_11 = NULL;
BRTNODE brtnode_12 = NULL;
int upgrade = 0;
switch (version) {
case BRT_LAYOUT_VERSION_11:
if (!upgrade)
r = deserialize_brtnode_from_rbuf_11(blocknum, fullhash, &brtnode_11, h, rb);
upgrade++;
if (r==0)
r = upgrade_brtnode_11_12(&brtnode_11, &brtnode_12);
//Fall through on purpose.
case BRT_LAYOUT_VERSION:
if (!upgrade)
r = deserialize_brtnode_from_rbuf(blocknum, fullhash, &brtnode_12, h, rb);
......@@ -1492,18 +1455,10 @@ deserialize_brtheader (int fd, struct rbuf *rb, struct brt_header **brth) {
static int
deserialize_brtheader_versioned (int fd, struct rbuf *rb, struct brt_header **brth, u_int32_t version) {
int rval;
struct brt_header *brth_11 = NULL;
struct brt_header *brth_12 = NULL;
int upgrade = 0;
switch(version) {
case BRT_LAYOUT_VERSION_11:
if (!upgrade)
rval = deserialize_brtheader_11(fd, rb, &brth_11);
upgrade++;
if (rval == 0)
rval = upgrade_brtheader_11_12(fd, &brth_11, &brth_12);
//Fall through on purpose.
case BRT_LAYOUT_VERSION:
if (!upgrade)
rval = deserialize_brtheader (fd, rb, &brth_12);
......@@ -1687,21 +1642,8 @@ toku_deserialize_brtheader_from (int fd, struct brt_header **brth) {
}
unsigned int
toku_brt_pivot_key_len (BRT brt, struct kv_pair *pk) {
if (brt->flags & TOKU_DB_DUPSORT) {
return kv_pair_keylen(pk) + kv_pair_vallen(pk);
} else {
return kv_pair_keylen(pk);
}
}
unsigned int
toku_brtnode_pivot_key_len (BRTNODE node, struct kv_pair *pk) {
if (node->flags & TOKU_DB_DUPSORT) {
return kv_pair_keylen(pk) + kv_pair_vallen(pk);
} else {
return kv_pair_keylen(pk);
}
toku_brt_pivot_key_len (struct kv_pair *pk) {
return kv_pair_keylen(pk);
}
int
......@@ -1943,8 +1885,3 @@ cleanup:
}
// NOTE: Backwards compatibility functions are in the included .c file(s):
#include "backwards_11.c"
......@@ -91,7 +91,7 @@ int toku_testsetup_insert_to_leaf (BRT brt, BLOCKNUM blocknum, char *key, int ke
assert(r==0);
struct cmd_leafval_heaviside_extra be = {brt, &cmd, node->flags & TOKU_DB_DUPSORT};
struct cmd_leafval_heaviside_extra be = {brt, &cmd};
r = toku_omt_find_zero(node->u.l.buffer, toku_cmd_leafval_heaviside, &be, &storeddatav, &idx, NULL);
......@@ -129,10 +129,9 @@ int toku_testsetup_insert_to_nonleaf (BRT brt, BLOCKNUM blocknum, enum brt_msg_t
BRTNODE node=node_v;
assert(node->height>0);
DBT k,v;
DBT k;
int childnum = toku_brtnode_which_child(node,
toku_fill_dbt(&k, key, keylen),
toku_fill_dbt(&v, val, vallen),
brt);
XIDS xids_0 = xids_get_root_xids();
......
......@@ -40,11 +40,6 @@ static int compare_pairs (BRT brt, struct kv_pair *a, struct kv_pair *b) {
int cmp = brt->compare_fun(brt->db,
toku_fill_dbt(&x, kv_pair_key(a), kv_pair_keylen(a)),
toku_fill_dbt(&y, kv_pair_key(b), kv_pair_keylen(b)));
if (cmp==0 && (brt->flags & TOKU_DB_DUPSORT)) {
cmp = brt->dup_compare(brt->db,
toku_fill_dbt(&x, kv_pair_val(a), kv_pair_vallen(a)),
toku_fill_dbt(&y, kv_pair_val(b), kv_pair_vallen(b)));
}
return cmp;
}
static int compare_leafentries (BRT brt, LEAFENTRY a, LEAFENTRY b) {
......@@ -52,11 +47,6 @@ static int compare_leafentries (BRT brt, LEAFENTRY a, LEAFENTRY b) {
int cmp = brt->compare_fun(brt->db,
toku_fill_dbt(&x, le_key(a), le_keylen(a)),
toku_fill_dbt(&y, le_key(b), le_keylen(b)));
if (cmp==0 && (brt->flags & TOKU_DB_DUPSORT)) {
cmp = brt->dup_compare(brt->db,
toku_fill_dbt(&x, le_innermost_inserted_val(a), le_innermost_inserted_vallen(a)),
toku_fill_dbt(&y, le_innermost_inserted_val(b), le_innermost_inserted_vallen(b)));
}
return cmp;
}
......@@ -71,29 +61,6 @@ struct verify_pair_arg {
int *resultp;
};
static void verify_pair (bytevec key, unsigned int keylen,
bytevec data __attribute__((__unused__)),
unsigned int datalen __attribute__((__unused__)),
int type __attribute__((__unused__)),
XIDS xids __attribute__((__unused__)),
void *arg) {
struct verify_pair_arg *vparg = (struct verify_pair_arg *)arg;
BRT brt = vparg->brt;
int i = vparg->i;
bytevec thislorange = vparg->thislorange; ITEMLEN thislolen = vparg->thislolen;
bytevec thishirange = vparg->thishirange; ITEMLEN thishilen = vparg->thishilen;
DBT k1,k2;
if (thislorange) assert(brt->compare_fun(brt->db,
toku_fill_dbt(&k1,thislorange,thislolen),
toku_fill_dbt(&k2,key,keylen)) <= 0);
if (thishirange && (brt->compare_fun(brt->db,
toku_fill_dbt(&k1,key,keylen),
toku_fill_dbt(&k2,thishirange,thishilen)) >= 0)) {
printf("%s:%d in buffer %d key %s is bigger than %s\n", __FILE__, __LINE__, i, (char*)key, (char*)thishirange);
*vparg->resultp = 1;
}
}
struct check_increasing_arg {
BRT brt;
LEAFENTRY prev;
......@@ -133,19 +100,14 @@ int toku_verify_brtnode (BRT brt, BLOCKNUM blocknum, bytevec lorange, ITEMLEN lo
thislolen =lolen;
} else {
thislorange=kv_pair_key(node->u.n.childkeys[i-1]);
thislolen =toku_brt_pivot_key_len(brt, node->u.n.childkeys[i-1]);
thislolen =toku_brt_pivot_key_len(node->u.n.childkeys[i-1]);
}
if (node->u.n.n_children==0 || i+1>=node->u.n.n_children) {
thishirange=hirange;
thishilen =hilen;
} else {
thishirange=kv_pair_key(node->u.n.childkeys[i]);
thishilen =toku_brt_pivot_key_len(brt, node->u.n.childkeys[i]);
}
struct verify_pair_arg vparg = { brt, i, thislorange, thislolen, thishirange, thishilen, &result };
if (!(brt->flags & TOKU_DB_DUP)) {
// verify_pair doesn't work for dupsort
toku_fifo_iterate(BNC_BUFFER(node,i), verify_pair, &vparg);
thishilen =toku_brt_pivot_key_len(node->u.n.childkeys[i]);
}
}
//if (lorange) printf("%s:%d lorange=%s\n", __FILE__, __LINE__, (char*)lorange);
......@@ -157,16 +119,16 @@ int toku_verify_brtnode (BRT brt, BLOCKNUM blocknum, bytevec lorange, ITEMLEN lo
if (i>0) {
//printf(" %s:%d i=%d %p v=%s\n", __FILE__, __LINE__, i, node->u.n.childkeys[i-1], (char*)kv_pair_key(node->u.n.childkeys[i-1]));
DBT k1,k2,k3;
toku_fill_dbt(&k2, kv_pair_key(node->u.n.childkeys[i-1]), toku_brt_pivot_key_len(brt, node->u.n.childkeys[i-1]));
toku_fill_dbt(&k2, kv_pair_key(node->u.n.childkeys[i-1]), toku_brt_pivot_key_len(node->u.n.childkeys[i-1]));
if (lorange) assert(brt->compare_fun(brt->db, toku_fill_dbt(&k1, lorange, lolen), &k2) <0);
if (hirange) assert(brt->compare_fun(brt->db, &k2, toku_fill_dbt(&k3, hirange, hilen)) <=0);
}
if (recurse) {
result|=toku_verify_brtnode(brt, BNC_BLOCKNUM(node, i),
(i==0) ? lorange : kv_pair_key(node->u.n.childkeys[i-1]),
(i==0) ? lolen : toku_brt_pivot_key_len(brt, node->u.n.childkeys[i-1]),
(i==0) ? lolen : toku_brt_pivot_key_len(node->u.n.childkeys[i-1]),
(i==node->u.n.n_children-1) ? hirange : kv_pair_key(node->u.n.childkeys[i]),
(i==node->u.n.n_children-1) ? hilen : toku_brt_pivot_key_len(brt, node->u.n.childkeys[i]),
(i==node->u.n.n_children-1) ? hilen : toku_brt_pivot_key_len(node->u.n.childkeys[i]),
recurse);
}
}
......
This diff is collapsed.
......@@ -42,13 +42,12 @@ int toku_dictionary_redirect_abort(struct brt_header *old_h, struct brt_header *
u_int32_t toku_serialize_descriptor_size(const DESCRIPTOR desc);
int toku_brt_create(BRT *);
int toku_brt_set_flags(BRT, unsigned int flags);
int toku_brt_set_descriptor (BRT t, u_int32_t version, const DBT* descriptor);
int toku_brt_get_flags(BRT, unsigned int *flags);
int toku_brt_set_descriptor (BRT t, u_int32_t version, const DBT* descriptor);
int toku_brt_set_nodesize(BRT, unsigned int nodesize);
int toku_brt_get_nodesize(BRT, unsigned int *nodesize);
int toku_brt_set_bt_compare(BRT, brt_compare_func);
int toku_brt_set_dup_compare(BRT, brt_compare_func);
brt_compare_func toku_brt_get_bt_compare (BRT brt);
......@@ -61,7 +60,7 @@ int toku_brt_open_recovery(BRT, const char *fname_in_env,
int toku_brt_remove_subdb(BRT brt, const char *dbname, u_int32_t flags);
int toku_brt_broadcast_commit_all (BRT brt);
int toku_brt_lookup (BRT brt, DBT *k, DBT *v, BRT_GET_CALLBACK_FUNCTION getf, void *getf_v);
int toku_brt_lookup (BRT brt, DBT *k, BRT_GET_CALLBACK_FUNCTION getf, void *getf_v);
// Effect: Insert a key and data pair into a brt
// Returns 0 if successful
......@@ -132,19 +131,17 @@ typedef struct brt_cursor *BRT_CURSOR;
int toku_brt_cursor (BRT, BRT_CURSOR*, TOKULOGGER, TXNID, BOOL);
// get is deprecated in favor of the individual functions below
int toku_brt_cursor_get (BRT_CURSOR cursor, DBT *key, DBT *val, BRT_GET_CALLBACK_FUNCTION getf, void *getf_v, int get_flags);
int toku_brt_cursor_get (BRT_CURSOR cursor, DBT *key, BRT_GET_CALLBACK_FUNCTION getf, void *getf_v, int get_flags);
int toku_brt_flatten(BRT, TOKULOGGER logger);
int toku_brt_cursor_first(BRT_CURSOR cursor, BRT_GET_CALLBACK_FUNCTION getf, void *getf_v);
int toku_brt_cursor_last(BRT_CURSOR cursor, BRT_GET_CALLBACK_FUNCTION getf, void *getf_v);
int toku_brt_cursor_next(BRT_CURSOR cursor, BRT_GET_CALLBACK_FUNCTION getf, void *getf_v);
int toku_brt_cursor_next_nodup(BRT_CURSOR cursor, BRT_GET_CALLBACK_FUNCTION getf, void *getf_v);
int toku_brt_cursor_next_dup(BRT_CURSOR cursor, BRT_GET_CALLBACK_FUNCTION getf, void *getf_v);
int toku_brt_cursor_prev(BRT_CURSOR cursor, BRT_GET_CALLBACK_FUNCTION getf, void *getf_v);
int toku_brt_cursor_prev_nodup(BRT_CURSOR cursor, BRT_GET_CALLBACK_FUNCTION getf, void *getf_v);
int toku_brt_cursor_prev_dup(BRT_CURSOR cursor, BRT_GET_CALLBACK_FUNCTION getf, void *getf_v);
int toku_brt_cursor_current(BRT_CURSOR cursor, int op, BRT_GET_CALLBACK_FUNCTION getf, void *getf_v);
int toku_brt_cursor_set(BRT_CURSOR cursor, DBT *key, DBT *val, BRT_GET_CALLBACK_FUNCTION getf, void *getf_v);
int toku_brt_cursor_set(BRT_CURSOR cursor, DBT *key, BRT_GET_CALLBACK_FUNCTION getf, void *getf_v);
int toku_brt_cursor_set_range(BRT_CURSOR cursor, DBT *key, BRT_GET_CALLBACK_FUNCTION getf, void *getf_v);
int toku_brt_cursor_set_range_reverse(BRT_CURSOR cursor, DBT *key, BRT_GET_CALLBACK_FUNCTION getf, void *getf_v);
int toku_brt_cursor_get_both_range(BRT_CURSOR cursor, DBT *key, DBT *val, BRT_GET_CALLBACK_FUNCTION getf, void *getf_v);
......@@ -170,10 +167,10 @@ DICTIONARY_ID toku_brt_get_dictionary_id(BRT);
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<<0),
TOKU_DB_DUPSORT = (1<<1),
//TOKU_DB_DUP = (1<<0), //Obsolete #2862
//TOKU_DB_DUPSORT = (1<<1), //Obsolete #2862
TOKU_DB_KEYCMP_BUILTIN = (1<<2),
TOKU_DB_VALCMP_BUILTIN = (1<<3),
//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);
......
......@@ -94,10 +94,8 @@ dump_node (int f, BLOCKNUM blocknum, struct brt_header *h) {
for (i=0; i<n->u.n.n_children-1; i++) {
struct kv_pair *piv = n->u.n.childkeys[i];
printf(" pivot %d:", i);
assert(n->flags == 0 || n->flags == TOKU_DB_DUP+TOKU_DB_DUPSORT);
assert(n->flags == 0);
print_item(kv_pair_key_const(piv), kv_pair_keylen(piv));
if (n->flags == TOKU_DB_DUP+TOKU_DB_DUPSORT)
print_item(kv_pair_val_const(piv), kv_pair_vallen(piv));
printf("\n");
}
printf(" children:\n");
......@@ -116,11 +114,8 @@ dump_node (int f, BLOCKNUM blocknum, struct brt_header *h) {
case BRT_INSERT: printf("INSERT"); goto ok;
case BRT_INSERT_NO_OVERWRITE: printf("INSERT_NO_OVERWRITE"); goto ok;
case BRT_DELETE_ANY: printf("DELETE_ANY"); goto ok;
case BRT_DELETE_BOTH: printf("DELETE_BOTH"); goto ok;
case BRT_ABORT_ANY: printf("ABORT_ANY"); goto ok;
case BRT_ABORT_BOTH: printf("ABORT_BOTH"); goto ok;
case BRT_COMMIT_ANY: printf("COMMIT_ANY"); goto ok;
case BRT_COMMIT_BOTH: printf("COMMIT_BOTH"); goto ok;
case BRT_COMMIT_BROADCAST_ALL: printf("COMMIT_BROADCAST_ALL"); goto ok;
case BRT_COMMIT_BROADCAST_TXN: printf("COMMIT_BROADCAST_TXN"); goto ok;
case BRT_ABORT_BROADCAST_TXN: printf("ABORT_BROADCAST_TXN"); goto ok;
......
......@@ -86,11 +86,11 @@ enum brt_msg_type {
BRT_NONE = 0,
BRT_INSERT = 1,
BRT_DELETE_ANY = 2, // Delete any matching key. This used to be called BRT_DELETE.
BRT_DELETE_BOTH = 3,
//BRT_DELETE_BOTH = 3,
BRT_ABORT_ANY = 4, // Abort any commands on any matching key.
BRT_ABORT_BOTH = 5, // Abort commands that match both the key and the value
//BRT_ABORT_BOTH = 5, // Abort commands that match both the key and the value
BRT_COMMIT_ANY = 6,
BRT_COMMIT_BOTH = 7,
//BRT_COMMIT_BOTH = 7,
BRT_COMMIT_BROADCAST_ALL = 8, // Broadcast to all leafentries, (commit all transactions).
BRT_COMMIT_BROADCAST_TXN = 9, // Broadcast to all leafentries, (commit specific transaction).
BRT_ABORT_BROADCAST_TXN = 10, // Broadcast to all leafentries, (commit specific transaction).
......
......@@ -21,11 +21,6 @@ static void toku_calc_more_murmur_kvpair (struct x1764 *mm, const void *key, int
u_int32_t toku_calccrc32_kvpair (const void *key, int keylen, const void *val, int vallen) {
return toku_calc_more_crc32_kvpair(toku_null_crc, key, keylen, val, vallen);
}
u_int32_t toku_calccrc32_kvpair_struct (const struct kv_pair *kvp) {
return toku_calccrc32_kvpair(kv_pair_key_const(kvp), kv_pair_keylen(kvp),
kv_pair_val_const(kvp), kv_pair_vallen(kvp));
}
#endif
u_int32_t toku_calc_fingerprint_cmd (u_int32_t type, XIDS xids, const void *key, u_int32_t keylen, const void *val, u_int32_t vallen) {
......
......@@ -67,18 +67,6 @@ static inline unsigned int kv_pair_keylen(const struct kv_pair *pair) {
return pair->keylen;
}
static inline void *kv_pair_val(struct kv_pair *pair) {
return pair->key + pair->keylen;
}
static inline const void *kv_pair_val_const(const struct kv_pair *pair) {
return pair->key + pair->keylen;
}
static inline unsigned int kv_pair_vallen(const struct kv_pair *pair) {
return pair->vallen;
}
#if defined(__cplusplus) || defined(__cilkplusplus)
};
#endif
......
......@@ -56,16 +56,6 @@ const struct logtype rollbacks[] = {
{"FILENUM", "filenum", 0},
{"BYTESTRING", "key", 0},
NULLFIELD}},
{"cmdinsertboth", 'I', FA{
{"FILENUM", "filenum", 0},
{"BYTESTRING", "key", 0},
{"BYTESTRING", "data", 0},
NULLFIELD}},
{"cmddeleteboth", 'D', FA{
{"FILENUM", "filenum", 0},
{"BYTESTRING", "key", 0},
{"BYTESTRING", "data", 0},
NULLFIELD}},
{"cmddelete", 'd', FA{
{"FILENUM", "filenum", 0},
{"BYTESTRING", "key", 0},
......@@ -157,11 +147,6 @@ const struct logtype logtypes[] = {
{"BYTESTRING", "key", 0},
{"BYTESTRING", "value", 0},
NULLFIELD}},
{"enq_delete_both", 'D', FA{{"FILENUM", "filenum", 0},
{"TXNID", "xid", 0},
{"BYTESTRING", "key", 0},
{"BYTESTRING", "value", 0},
NULLFIELD}},
{"enq_delete_any", 'E', FA{{"FILENUM", "filenum", 0},
{"TXNID", "xid", 0},
{"BYTESTRING", "key", 0},
......
......@@ -176,7 +176,6 @@ struct recover_env {
CACHETABLE ct;
TOKULOGGER logger;
brt_compare_func bt_compare;
brt_compare_func dup_compare;
generate_row_for_put_func generate_row_for_put;
generate_row_for_del_func generate_row_for_del;
struct scan_state ss;
......@@ -185,7 +184,7 @@ struct recover_env {
};
typedef struct recover_env *RECOVER_ENV;
static int recover_env_init (RECOVER_ENV renv, brt_compare_func bt_compare, brt_compare_func dup_compare,
static int recover_env_init (RECOVER_ENV renv, brt_compare_func bt_compare,
generate_row_for_put_func generate_row_for_put,
generate_row_for_del_func generate_row_for_del,
size_t cachetable_size) {
......@@ -198,7 +197,6 @@ static int recover_env_init (RECOVER_ENV renv, brt_compare_func bt_compare, brt_
toku_logger_write_log_files(renv->logger, FALSE);
toku_logger_set_cachetable(renv->logger, renv->ct);
renv->bt_compare = bt_compare;
renv->dup_compare = dup_compare;
renv->generate_row_for_put = generate_row_for_put;
renv->generate_row_for_del = generate_row_for_del;
file_map_init(&renv->fmap);
......@@ -252,8 +250,6 @@ static int internal_recover_fopen_or_fcreate (RECOVER_ENV renv, BOOL must_create
// set the key compare functions
if (!(treeflags & TOKU_DB_KEYCMP_BUILTIN) && renv->bt_compare)
toku_brt_set_bt_compare(brt, renv->bt_compare);
if (!(treeflags & TOKU_DB_VALCMP_BUILTIN) && renv->dup_compare)
toku_brt_set_dup_compare(brt, renv->dup_compare);
// TODO mode (FUTURE FEATURE)
mode = mode;
......@@ -799,30 +795,6 @@ static int toku_recover_backward_enq_insert_no_overwrite (struct logtype_enq_ins
return 0;
}
static int toku_recover_enq_delete_both (struct logtype_enq_delete_both *l, RECOVER_ENV renv) {
int r;
TOKUTXN txn = NULL;
r = toku_txnid2txn(renv->logger, l->xid, &txn);
assert(r == 0);
assert(txn!=NULL);
struct file_map_tuple *tuple = NULL;
r = file_map_find(&renv->fmap, l->filenum, &tuple);
if (r==0) {
//Maybe do the deletion if we found the cachefile.
DBT keydbt, valdbt;
toku_fill_dbt(&keydbt, l->key.data, l->key.len);
toku_fill_dbt(&valdbt, l->value.data, l->value.len);
r = toku_brt_maybe_delete_both(tuple->brt, &keydbt, &valdbt, txn, TRUE, l->lsn);
assert(r == 0);
}
return 0;
}
static int toku_recover_backward_enq_delete_both (struct logtype_enq_delete_both *UU(l), RECOVER_ENV UU(renv)) {
// nothing
return 0;
}
static int toku_recover_enq_delete_any (struct logtype_enq_delete_any *l, RECOVER_ENV renv) {
int r;
TOKUTXN txn = NULL;
......@@ -1321,7 +1293,6 @@ toku_recover_unlock(int lockfd) {
int tokudb_recover(const char *env_dir, const char *log_dir,
brt_compare_func bt_compare,
brt_compare_func dup_compare,
generate_row_for_put_func generate_row_for_put,
generate_row_for_del_func generate_row_for_del,
size_t cachetable_size) {
......@@ -1335,7 +1306,7 @@ int tokudb_recover(const char *env_dir, const char *log_dir,
int rr = 0;
if (tokudb_needs_recovery(log_dir, FALSE)) {
struct recover_env renv;
r = recover_env_init(&renv, bt_compare, dup_compare,
r = recover_env_init(&renv, bt_compare,
generate_row_for_put,
generate_row_for_del,
cachetable_size);
......
......@@ -21,7 +21,6 @@ extern "C" {
// Returns 0 if success
int tokudb_recover (const char *env_dir, const char *log_dir,
brt_compare_func bt_compare,
brt_compare_func dup_compare,
generate_row_for_put_func generate_row_for_put,
generate_row_for_del_func generate_row_for_del,
size_t cachetable_size);
......
......@@ -182,23 +182,6 @@ int toku_commit_cmdinsert (FILENUM filenum, BYTESTRING key, TOKUTXN txn, YIELDF
#endif
}
int
toku_commit_cmdinsertboth (FILENUM filenum,
BYTESTRING key,
BYTESTRING data,
TOKUTXN txn,
YIELDF UU(yield),
void * UU(yieldv),
LSN oplsn)
{
#if TOKU_DO_COMMIT_CMD_INSERT
return do_insertion (BRT_COMMIT_BOTH, filenum, key, &data, txn, oplsn);
#else
key = key; data = data; oplsn = oplsn;
return do_nothing_with_filenum(txn, filenum);
#endif
}
int
toku_rollback_cmdinsert (FILENUM filenum,
BYTESTRING key,
......@@ -210,47 +193,6 @@ toku_rollback_cmdinsert (FILENUM filenum,
return do_insertion (BRT_ABORT_ANY, filenum, key, 0, txn, oplsn);
}
int
toku_rollback_cmdinsertboth (FILENUM filenum,
BYTESTRING key,
BYTESTRING data,
TOKUTXN txn,
YIELDF UU(yield),
void * UU(yieldv),
LSN oplsn)
{
return do_insertion (BRT_ABORT_BOTH, filenum, key, &data, txn, oplsn);
}
int
toku_commit_cmddeleteboth (FILENUM filenum,
BYTESTRING key,
BYTESTRING data,
TOKUTXN txn,
YIELDF UU(yield),
void * UU(yieldv),
LSN oplsn)
{
#if TOKU_DO_COMMIT_CMD_DELETE_BOTH
return do_insertion (BRT_COMMIT_BOTH, filenum, key, &data, txn, oplsn);
#else
xid = xid; key = key; data = data;
return do_nothing_with_filenum(txn, filenum);
#endif
}
int
toku_rollback_cmddeleteboth (FILENUM filenum,
BYTESTRING key,
BYTESTRING data,
TOKUTXN txn,
YIELDF UU(yield),
void * UU(yieldv),
LSN oplsn)
{
return do_insertion (BRT_ABORT_BOTH, filenum, key, &data, txn, oplsn);
}
int
toku_commit_cmddelete (FILENUM filenum,
BYTESTRING key,
......
......@@ -36,7 +36,7 @@ int recovery_main (int argc, const char *const argv[]) {
return(1);
}
int r = tokudb_recover(data_dir, log_dir, NULL, NULL, NULL, NULL, 0);
int r = tokudb_recover(data_dir, log_dir, NULL, NULL, NULL, 0);
if (r!=0) {
fprintf(stderr, "Recovery failed\n");
return(1);
......
......@@ -57,7 +57,7 @@ static void test_sub_block(int n) {
int k = htonl(i);
int v = i;
struct check_pair pair = {sizeof k, &k, sizeof v, &v, 0};
error = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_NEXT);
error = toku_brt_cursor_get(cursor, NULL, lookup_checkf, &pair, DB_NEXT);
if (error != 0) {
assert(pair.call_count==0);
break;
......
......@@ -115,7 +115,7 @@ test_serialize_nonleaf(void) {
assert(dn->rand4fingerprint==randval);
assert(dn->u.n.n_children==2);
assert(strcmp(kv_pair_key(dn->u.n.childkeys[0]), "hello")==0);
assert(toku_brtnode_pivot_key_len(dn, dn->u.n.childkeys[0])==6);
assert(toku_brt_pivot_key_len(dn->u.n.childkeys[0])==6);
assert(dn->u.n.totalchildkeylens==6);
assert(BNC_BLOCKNUM(dn,0).b==30);
assert(BNC_BLOCKNUM(dn,1).b==35);
......
......@@ -57,12 +57,11 @@ static void test_multiple_brt_cursor_dbts(int n, DB *db) {
void *ptrs[n];
for (i=0; i<n; i++) {
DBT kbt, vbt;
DBT kbt;
char key[10];
snprintf(key, sizeof key, "k%04d", i);
r = toku_brt_cursor_get(cursors[i],
toku_fill_dbt(&kbt, key, 1+strlen(key)),
toku_init_dbt(&vbt),
save_data,
&ptrs[i],
DB_SET);
......
This diff is collapsed.
This diff is collapsed.
......@@ -23,7 +23,7 @@ static void test1 (void) {
toku_brt_insert(t, toku_fill_dbt(&k, "hello", 6), toku_fill_dbt(&v, "there", 6), null_txn);
{
struct check_pair pair = {6, "hello", 6, "there", 0};
r = toku_brt_lookup(t, toku_fill_dbt(&k, "hello", 6), NULL, lookup_checkf, &pair);
r = toku_brt_lookup(t, toku_fill_dbt(&k, "hello", 6), lookup_checkf, &pair);
assert(r==0);
assert(pair.call_count==1);
}
......
......@@ -42,7 +42,7 @@ static void test5 (void) {
snprintf(key, 100, "key%d", rk);
snprintf(valexpected, 100, "val%d", values[rk]);
struct check_pair pair = {1+strlen(key), key, 1+strlen(valexpected), valexpected, 0};
r = toku_brt_lookup(t, toku_fill_dbt(&k, key, 1+strlen(key)), NULL, lookup_checkf, &pair);
r = toku_brt_lookup(t, toku_fill_dbt(&k, key, 1+strlen(key)), lookup_checkf, &pair);
assert(r==0);
assert(pair.call_count==1);
}
......
......@@ -62,7 +62,7 @@ static void verify_dbfile(int n, const char *name) {
int kk = i;
int vv = i;
struct check_pair pair = {sizeof kk, &kk, sizeof vv, &vv, 0};
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_NEXT);
r = toku_brt_cursor_get(cursor, NULL, lookup_checkf, &pair, DB_NEXT);
if (r != 0) {
assert(pair.call_count ==0);
break;
......
......@@ -259,7 +259,7 @@ static void verify_dbfile(int n, int sorted_keys[], const char *sorted_vals[], c
int i;
for (i=0; i<n; i++) {
struct check_pair pair = {sizeof sorted_keys[i], &sorted_keys[i], strlen(sorted_vals[i]), sorted_vals[i], 0};
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_NEXT);
r = toku_brt_cursor_get(cursor, NULL, lookup_checkf, &pair, DB_NEXT);
if (r != 0) {
assert(pair.call_count ==0);
break;
......@@ -268,7 +268,7 @@ static void verify_dbfile(int n, int sorted_keys[], const char *sorted_vals[], c
}
struct check_pair pair; memset(&pair, 0, sizeof pair);
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_NEXT);
r = toku_brt_cursor_get(cursor, NULL, lookup_checkf, &pair, DB_NEXT);
assert(r != 0);
r = toku_brt_cursor_close(cursor); assert(r == 0);
......
/* -*- mode: C; c-basic-offset: 4 -*- */
#ident "Copyright (c) 2008 Tokutek Inc. All rights reserved."
/* Insert N duplicates into a BRT.
* Delete them with a single delete.
* Close the BRT.
* Check to see that the BRT is empty.
*/
#include "includes.h"
#include "test.h"
#include <unistd.h>
static TOKUTXN const null_txn = 0;
static DB * const null_db = 0;
static void test_delete_all (void) {
char fname[]= __FILE__ ".brt";
u_int32_t limit =200;
unlink(fname);
CACHETABLE ct;
int r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0);
BRT t;
r = toku_brt_create(&t); assert(r==0);
r = toku_brt_set_flags(t, TOKU_DB_DUP + TOKU_DB_DUPSORT); assert(r == 0);
r = toku_brt_set_nodesize(t, 4096); assert(r == 0);
r = toku_brt_open(t, fname, 1, 1, ct, null_txn, (DB*)0); assert(r==0);
u_int32_t i;
for (i=0; i<limit; i++) {
char key[100];
char val[100];
snprintf(key, 100, "%03u", limit/2);
snprintf(val, 100, "%03u", i);
DBT k,v;
r = toku_brt_insert(t, toku_fill_dbt(&k, key, 1+strlen(key)), toku_fill_dbt(&v,val, 1+strlen(val)), null_txn);
assert(r == 0);
}
//printf("Initial insert done\n"); toku_dump_brt(stdout, t);
// Now reopen the DB to force non-leaf buffering.
r = toku_close_brt(t, 0); assert(r==0);
r = toku_cachetable_close(&ct); assert(r==0);
r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0);
r = toku_brt_create(&t); assert(r==0);
r = toku_brt_open(t, fname, 0, 0, ct, null_txn, (DB*)0); assert(r==0);
// Don't do a dump here, because that will warm the cachetable. We want subsequent inserts to be buffered at the root.
// Insert some more stuff
if (1) {
u_int32_t j;
for (j=0; j<1; j++) {
char key[100];
char val[100];
snprintf(key, 100, "%03u", limit/2);
snprintf(val, 100, "%03u", limit+j);
DBT k,v;
r = toku_brt_insert(t, toku_fill_dbt(&k, key, 1+strlen(key)), toku_fill_dbt(&v,val, 1+strlen(val)), null_txn);
assert(r == 0);
}
}
// Don't do a dump here, because that will warm the cachetable.
// Delete everything
{
char key[100];
DBT k;
snprintf(key, 100, "%03u", limit/2);
r = toku_brt_delete(t, toku_fill_dbt(&k, key, 1+strlen(key)), null_txn);
assert(r == 0);
}
//printf("Deleted\n"); toku_dump_brt(stdout, t);
// Now use a cursor to see if it is all empty
{
BRT_CURSOR cursor = 0;
r = toku_brt_cursor(t, &cursor, 0, TXNID_NONE, FALSE); assert(r==0);
struct check_pair pair = {len_ignore, NULL, len_ignore, NULL, 0};
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_FIRST);
assert(r == DB_NOTFOUND);
r = toku_brt_cursor_close(cursor);
assert(r==0);
}
//printf("Looked\n"); toku_dump_brt(stdout, t);
r = toku_close_brt(t, 0); assert(r==0);
r = toku_cachetable_close(&ct); assert(r==0);
}
int
test_main (int argc , const char *argv[]) {
default_parse_args(argc, argv);
test_delete_all();
if (verbose) printf("test ok\n");
return 0;
}
/* -*- mode: C; c-basic-offset: 4 -*- */
#ident "Copyright (c) 2008 Tokutek Inc. All rights reserved."
#include "includes.h"
#include "test.h"
#include <unistd.h>
static TOKUTXN const null_txn = 0;
static DB * const null_db = 0;
static void test_flat (void) {
char fname[]= __FILE__ ".brt";
u_int64_t limit=100;
u_int64_t ilimit=100;
unlink(fname);
CACHETABLE ct;
// 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_brt_create(&t); assert(r==0);
r = toku_brt_set_flags(t, TOKU_DB_DUP + TOKU_DB_DUPSORT); assert(r == 0);
r = toku_brt_set_nodesize(t, 4096); assert(r == 0);
r = toku_brt_open(t, fname, 1, 1, ct, null_txn, (DB*)0);
u_int64_t i;
for (i=0; i<limit; i++) {
u_int64_t j;
for (j=0; j<ilimit; j++) {
char key[100],val[100];
snprintf(key, 100, "%08llu", (unsigned long long)2*i+1);
snprintf(val, 100, "%08llu", (unsigned long long)2*j+1);
DBT k,v;
r = toku_brt_insert(t, toku_fill_dbt(&k, key, 1+strlen(key)), toku_fill_dbt(&v,val, 1+strlen(val)), null_txn);
assert(r == 0);
}
}
u_int64_t prevless = 0;
u_int64_t prevgreater = limit*ilimit;
for (i=0; i<2*limit+1; i++) {
char key[100];
snprintf(key, 100, "%08llu", (unsigned long long)i);
DBT k;
u_int64_t less,equal,greater;
r = toku_brt_keyrange(t, toku_fill_dbt(&k, key, 1+strlen(key)), &less, &equal, &greater);
assert(r == 0);
//printf("key %llu/%llu %llu %llu %llu\n", (unsigned long long)2*i+1, (unsigned long long)2*limit+1, (unsigned long long)less, (unsigned long long)equal, (unsigned long long)greater);
assert(less<=ilimit*i);
assert(equal<=ilimit);
assert(less+equal+greater <= limit*ilimit);
assert(less>=prevless); prevless=less;
assert(greater<=prevgreater); prevgreater=greater;
}
r = toku_close_brt(t, 0); assert(r==0);
r = toku_cachetable_close(&ct); assert(r==0);
}
int
test_main (int argc , const char *argv[]) {
default_parse_args(argc, argv);
test_flat();
toku_malloc_cleanup();
if (verbose) printf("test ok\n");
return 0;
}
/* -*- mode: C; c-basic-offset: 4 -*- */
#ident "Copyright (c) 2008 Tokutek Inc. All rights reserved."
#include "includes.h"
#include "test.h"
#include <unistd.h>
static TOKUTXN const null_txn = 0;
static DB * const null_db = 0;
static void test_flat (void) {
char fname[]= __FILE__ ".brt";
u_int64_t limit=100;
u_int64_t ilimit=100;
unlink(fname);
CACHETABLE ct;
int r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0);
BRT t;
r = toku_brt_create(&t); assert(r==0);
r = toku_brt_set_flags(t, TOKU_DB_DUP + TOKU_DB_DUPSORT); assert(r == 0);
r = toku_brt_set_nodesize(t, 4096); assert(r == 0);
r = toku_brt_open(t, fname, 1, 1, ct, null_txn, (DB*)0);
u_int64_t i;
for (i=0; i<limit; i++) {
u_int64_t j;
for (j=0; j<ilimit; j++) {
char key[100],val[100];
snprintf(key, 100, "%08llu", (unsigned long long)2*i+1);
snprintf(val, 100, "%08llu", (unsigned long long)2*j+1);
DBT k,v;
r = toku_brt_insert(t, toku_fill_dbt(&k, key, 1+strlen(key)), toku_fill_dbt(&v,val, 1+strlen(val)), null_txn);
assert(r == 0);
}
}
// flatten it.
for (i=0; i<limit; i++) {
u_int64_t j;
for (j=0; j<ilimit; j++) {
char key[100],val[100];
snprintf(key, 100, "%08llu", (unsigned long long)2*i+1);
snprintf(val, 100, "%08llu", (unsigned long long)2*j+1);
DBT k,v;
struct check_pair pair = {1+strlen(key), key, 1+strlen(val), val, 0};
r = toku_brt_lookup(t, toku_fill_dbt(&k, key, 1+strlen(key)), toku_fill_dbt(&v, val, 1+strlen(val)),
lookup_checkf, &pair);
assert(r==0);
assert(pair.call_count==1);
}
}
for (i=0; i<limit; i++) {
char key[100];
snprintf(key, 100, "%08llu", (unsigned long long)2*i+1);
DBT k;
u_int64_t less,equal,greater;
r = toku_brt_keyrange(t, toku_fill_dbt(&k, key, 1+strlen(key)), &less, &equal, &greater);
assert(r == 0);
//printf("key %llu/%llu %llu %llu %llu\n", (unsigned long long)2*i+1, (unsigned long long)2*limit+1, (unsigned long long)less, (unsigned long long)equal, (unsigned long long)greater);
assert(less==ilimit*i);
assert(equal==ilimit);
assert(less+equal+greater == limit*ilimit);
}
for (i=0; i<1+limit; i++) {
char key[100];
snprintf(key, 100, "%08llu", (unsigned long long)2*i);
DBT k;
u_int64_t less,equal,greater;
r = toku_brt_keyrange(t, toku_fill_dbt(&k, key, 1+strlen(key)), &less, &equal, &greater);
assert(r == 0);
//printf("key %llu/%llu %llu %llu %llu\n", (unsigned long long)2*i, (unsigned long long)2*limit, (unsigned long long)less, (unsigned long long)equal, (unsigned long long)greater);
assert(less==ilimit*i);
assert(equal==0);
assert(less+equal+greater == limit*ilimit);
}
r = toku_close_brt(t, 0); assert(r==0);
r = toku_cachetable_close(&ct); assert(r==0);
}
int
test_main (int argc , const char *argv[]) {
default_parse_args(argc, argv);
test_flat();
toku_malloc_cleanup();
if (verbose) printf("test ok\n");
return 0;
}
......@@ -32,7 +32,7 @@ static void test_flat (void) {
snprintf(key, 100, "%08llu", (unsigned long long)2*i+1);
DBT k;
struct check_pair pair = {1+strlen(key), key, 1+strlen(key), key, 0};
r = toku_brt_lookup(t, toku_fill_dbt(&k, key, 1+strlen(key)), NULL, lookup_checkf, &pair);
r = toku_brt_lookup(t, toku_fill_dbt(&k, key, 1+strlen(key)), lookup_checkf, &pair);
assert(r==0);
assert(pair.call_count==1);
}
......
......@@ -56,7 +56,7 @@ run_test(void) {
else
break;
// run recovery
r = tokudb_recover(TESTDIR, TESTDIR, 0, 0, NULL, NULL, 0);
r = tokudb_recover(TESTDIR, TESTDIR, 0, 0, NULL, 0);
assert(r == 0);
trim += 1;
......
......@@ -41,7 +41,7 @@ run_test(void) {
r = close(devnul); assert(r==0);
// run recovery
r = tokudb_recover(TESTDIR, TESTDIR, 0, 0, NULL, NULL, 0);
r = tokudb_recover(TESTDIR, TESTDIR, 0, 0, NULL, 0);
assert(r == 0);
r = system("rm -rf " TESTDIR);
......
......@@ -26,7 +26,7 @@ run_test(void) {
r = toku_logger_close(&logger); assert(r == 0);
// run recovery
r = tokudb_recover(TESTDIR, TESTDIR, 0, 0, NULL, NULL, 0);
r = tokudb_recover(TESTDIR, TESTDIR, 0, 0, NULL, 0);
assert(r == 0);
r = system("rm -rf " TESTDIR);
......
......@@ -32,7 +32,7 @@ run_test(void) {
r = close(devnul);
assert(r==0);
r = tokudb_recover(TESTDIR, TESTDIR, 0, 0, NULL, NULL, 0);
r = tokudb_recover(TESTDIR, TESTDIR, 0, 0, NULL, 0);
assert(r == 0);
r = system("rm -rf " TESTDIR);
......
......@@ -35,7 +35,7 @@ run_test(void) {
// run recovery
r = tokudb_recover(TESTDIR, TESTDIR,
toku_builtin_compare_fun, toku_builtin_compare_fun,
toku_builtin_compare_fun,
NULL, NULL,
0);
assert(r == 0);
......
......@@ -29,7 +29,7 @@ run_test(void) {
}
// run recovery
r = tokudb_recover(TESTDIR, TESTDIR, 0, 0, NULL, NULL, 0);
r = tokudb_recover(TESTDIR, TESTDIR, 0, 0, NULL, 0);
assert(r == DB_RUNRECOVERY);
r = system("rm -rf " TESTDIR);
......
......@@ -35,7 +35,7 @@ run_test(void) {
r = close(devnul); assert(r==0);
// run recovery
r = tokudb_recover(TESTDIR, TESTDIR, 0, 0, NULL, NULL, 0);
r = tokudb_recover(TESTDIR, TESTDIR, 0, 0, NULL, 0);
assert(r == 0);
r = system("rm -rf " TESTDIR);
......
......@@ -35,7 +35,7 @@ run_test(void) {
r = close(devnul); assert(r==0);
// run recovery
r = tokudb_recover(TESTDIR, TESTDIR, 0, 0, NULL, NULL, 0);
r = tokudb_recover(TESTDIR, TESTDIR, 0, 0, NULL, 0);
assert(r == 0);
r = system("rm -rf " TESTDIR);
......
......@@ -65,7 +65,7 @@ run_test(void) {
toku_recover_set_callback(recover_callback_at_turnaround, NULL);
// run recovery
r = tokudb_recover(TESTDIR, TESTDIR, 0, 0, NULL, NULL, 0);
r = tokudb_recover(TESTDIR, TESTDIR, 0, 0, NULL, 0);
assert(r != 0);
r = system("rm -rf " TESTDIR);
......
......@@ -29,7 +29,7 @@ run_test(void) {
r = close(devnul); assert(r==0);
// run recovery
r = tokudb_recover("/junk", TESTDIR, 0, 0, NULL, NULL, 0);
r = tokudb_recover("/junk", TESTDIR, 0, 0, NULL, 0);
assert(r != 0);
r = system("rm -rf " TESTDIR);
......
......@@ -21,7 +21,7 @@ run_test(void) {
r = close(devnul); assert(r==0);
// run recovery
r = tokudb_recover(TESTDIR, TESTDIR, 0, 0, NULL, NULL, 0);
r = tokudb_recover(TESTDIR, TESTDIR, 0, 0, NULL, 0);
assert(r != 0);
r = system("rm -rf " TESTDIR);
......
......@@ -15,7 +15,7 @@ run_test(void) {
r = toku_os_mkdir(TESTDIR, S_IRWXU); assert(r == 0);
// run recovery
r = tokudb_recover(NULL, NULL, 0, 0, NULL, NULL, 0);
r = tokudb_recover(NULL, NULL, 0, 0, NULL, 0);
assert(r != 0);
r = system("rm -rf " TESTDIR);
......
......@@ -34,11 +34,11 @@ test_main (int argc __attribute__((__unused__)), const char *argv[] __attribute
{
struct check_pair pair = {5, "0000", 5, "0000", 0};
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_NEXT); assert(r==0); assert(pair.call_count==1);
r = toku_brt_cursor_get(cursor, NULL, lookup_checkf, &pair, DB_NEXT); assert(r==0); assert(pair.call_count==1);
}
{
struct check_pair pair = {5, "0001", 5, "0001", 0};
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_NEXT); assert(r==0); assert(pair.call_count==1);
r = toku_brt_cursor_get(cursor, NULL, lookup_checkf, &pair, DB_NEXT); assert(r==0); assert(pair.call_count==1);
}
// This will invalidate due to the root counter bumping, but the OMT itself will still be valid.
......@@ -49,7 +49,7 @@ test_main (int argc __attribute__((__unused__)), const char *argv[] __attribute
{
struct check_pair pair = {5, "0002", 5, "0002", 0};
r = toku_brt_cursor_get(cursor, NULL, NULL, lookup_checkf, &pair, DB_NEXT); assert(r==0); assert(pair.call_count==1);
r = toku_brt_cursor_get(cursor, NULL, lookup_checkf, &pair, DB_NEXT); assert(r==0); assert(pair.call_count==1);
}
r = toku_brt_cursor_close(cursor); assert(r==0);
......
/* Check to see that delete_both works on both dup and nodup databases. *
* For recovery to work right, delete_both must work on both cases.
* Specifically, for a nodup database delete_both must not remove pairs unless
* they match both key and value.
*/
#include "includes.h"
#include "test.h"
static TOKUTXN const null_txn = 0;
static void
doit (void) {
int r;
CACHETABLE ct;
BRT t;
char fname[] = __FILE__ ".tdb";
DBT k,v;
if (verbose) printf("%s\n", __FUNCTION__);
r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0);
unlink(fname);
r = toku_brt_create(&t); assert(r==0);
r = toku_brt_open(t, fname, 1, 1, ct, null_txn, (DB*)0); assert(r==0);
r = toku_brt_insert(t, toku_fill_dbt(&k, "a", 2), toku_fill_dbt(&v, "x", 2), null_txn);
assert(r==0);
r = toku_brt_delete_both(t, toku_fill_dbt(&k, "a", 2), toku_fill_dbt(&v, "y", 2), null_txn);
assert(r==0);
{
struct check_pair pair = {len_ignore, 0, 2, "x", 0};
r = toku_brt_lookup(t, toku_fill_dbt(&k, "a", 2), NULL, lookup_checkf, &pair);
assert(r==0);
assert(pair.call_count==1);
}
r = toku_brt_delete_both(t, toku_fill_dbt(&k, "a", 2), toku_fill_dbt(&v, "x", 2), null_txn);
assert(r==0);
{
struct check_pair pair = {0,0,0,0,0};
r = toku_brt_lookup(t, toku_fill_dbt(&k, "a", 2), NULL, lookup_checkf, &pair);
assert(r==DB_NOTFOUND);
assert(pair.call_count==0);
}
r = toku_close_brt(t, 0); assert(r==0);
r = toku_cachetable_close(&ct); assert(r==0);
}
int
test_main (int argc, const char *argv[]) {
default_parse_args(argc, argv);
doit();
if (verbose) printf("test ok\n");
toku_malloc_cleanup();
return 0;
}
......@@ -54,7 +54,7 @@ doit (void) {
memset(&v, 0, sizeof(v));
struct check_pair pair = {6, "hello", 6, "there", 0};
r = toku_brt_lookup(t, &k, &v, lookup_checkf, &pair);
r = toku_brt_lookup(t, &k, lookup_checkf, &pair);
assert(r==0);
assert(pair.call_count == 1);
......
......@@ -549,15 +549,11 @@ test_le_empty_apply(void) {
msg_init(&msg, BRT_COMMIT_ANY, msg_xids, &key, &val);
test_le_apply(&ule_initial, &msg, &ule_expected);
msg_init(&msg, BRT_COMMIT_BOTH, msg_xids, &key, &val);
test_le_apply(&ule_initial, &msg, &ule_expected);
msg_init(&msg, BRT_COMMIT_BROADCAST_TXN, msg_xids, &key, &val);
test_le_apply(&ule_initial, &msg, &ule_expected);
msg_init(&msg, BRT_ABORT_ANY, msg_xids, &key, &val);
test_le_apply(&ule_initial, &msg, &ule_expected);
msg_init(&msg, BRT_ABORT_BOTH, msg_xids, &key, &val);
test_le_apply(&ule_initial, &msg, &ule_expected);
msg_init(&msg, BRT_ABORT_BROADCAST_TXN, msg_xids, &key, &val);
test_le_apply(&ule_initial, &msg, &ule_expected);
}
......@@ -567,8 +563,6 @@ test_le_empty_apply(void) {
msg_init(&msg, BRT_DELETE_ANY, msg_xids, &key, &val);
test_le_apply(&ule_initial, &msg, &ule_expected);
msg_init(&msg, BRT_DELETE_BOTH, msg_xids, &key, &val);
test_le_apply(&ule_initial, &msg, &ule_expected);
}
{
msg_init(&msg, BRT_INSERT, msg_xids, &key, &val);
......@@ -670,15 +664,11 @@ test_le_committed_apply(void) {
ULE_S ule_expected = ule_initial;
msg_init(&msg, BRT_COMMIT_ANY, msg_xids, &key, &val);
test_le_apply(&ule_initial, &msg, &ule_expected);
msg_init(&msg, BRT_COMMIT_BOTH, msg_xids, &key, &val);
test_le_apply(&ule_initial, &msg, &ule_expected);
msg_init(&msg, BRT_COMMIT_BROADCAST_TXN, msg_xids, &key, &val);
test_le_apply(&ule_initial, &msg, &ule_expected);
msg_init(&msg, BRT_ABORT_ANY, msg_xids, &key, &val);
test_le_apply(&ule_initial, &msg, &ule_expected);
msg_init(&msg, BRT_ABORT_BOTH, msg_xids, &key, &val);
test_le_apply(&ule_initial, &msg, &ule_expected);
msg_init(&msg, BRT_ABORT_BROADCAST_TXN, msg_xids, &key, &val);
test_le_apply(&ule_initial, &msg, &ule_expected);
}
......@@ -688,8 +678,6 @@ test_le_committed_apply(void) {
ULE_S ule_expected;
generate_provdel_for(&ule_expected, &msg);
test_le_apply(&ule_initial, &msg, &ule_expected);
msg_init(&msg, BRT_DELETE_BOTH, msg_xids, &key, &val);
test_le_apply(&ule_initial, &msg, &ule_expected);
}
{
......
......@@ -60,7 +60,7 @@ brt_lookup_and_check_nodup (BRT t, char *keystring, char *valstring)
struct check_pair pair = {1+strlen(keystring), keystring,
1+strlen(valstring), valstring,
0};
int r = toku_brt_lookup(t, &k, 0, lookup_checkf, &pair);
int r = toku_brt_lookup(t, &k, lookup_checkf, &pair);
assert(r==0);
assert(pair.call_count==1);
}
......@@ -76,7 +76,7 @@ brt_lookup_and_fail_nodup (BRT t, char *keystring)
struct check_pair pair = {1+strlen(keystring), keystring,
0, 0,
0};
int r = toku_brt_lookup(t, &k, 0, lookup_checkf, &pair);
int r = toku_brt_lookup(t, &k, lookup_checkf, &pair);
assert(r!=0);
assert(pair.call_count==0);
}
......
......@@ -170,16 +170,13 @@ msg_modify_ule(ULE ule, BRT_MSG msg) {
ule_apply_insert(ule, xids, vallen, valp);
break;
case BRT_DELETE_ANY:
case BRT_DELETE_BOTH:
ule_apply_delete(ule, xids);
break;
case BRT_ABORT_ANY:
case BRT_ABORT_BOTH:
case BRT_ABORT_BROADCAST_TXN:
ule_apply_abort(ule, xids);
break;
case BRT_COMMIT_ANY:
case BRT_COMMIT_BOTH:
case BRT_COMMIT_BROADCAST_TXN:
ule_apply_commit(ule, xids);
break;
......
......@@ -443,10 +443,7 @@ int main (int argc, const char *argv[]) {
valsize = atoi(argv[++i]);
} else if (strcmp(arg, "--pagesize") == 0) {
if (i+1 >= argc) return print_usage(argv[0]);
pagesize = atoi(argv[++i]);
} else if (strcmp(arg, "--dupsort") == 0) {
dupflags = DB_DUP + DB_DUPSORT;
continue;
pagesize = atoi(argv[++i]);
} else if (strcmp(arg, "--env") == 0) {
if (i+1 >= argc) return print_usage(argv[0]);
dbdir = argv[++i];
......
......@@ -132,8 +132,7 @@ static void scanscan_setup (void) {
if (prelock) {
r = db->pre_acquire_read_lock(db,
tid,
db->dbt_neg_infty(), db->dbt_neg_infty(),
db->dbt_pos_infty(), db->dbt_pos_infty());
db->dbt_neg_infty(), db->dbt_pos_infty());
assert(r==0);
}
#endif
......
This diff is collapsed.
This diff is collapsed.
......@@ -5,16 +5,15 @@ int main(void) {
toku_lock_tree* lt = NULL;
toku_ltm* mgr = NULL;
u_int32_t max_locks = 1000;
BOOL duplicates;
r = toku_ltm_create(&mgr, max_locks, dbpanic,
get_compare_fun_from_db, get_dup_compare_from_db,
get_compare_fun_from_db,
toku_malloc, toku_free, toku_realloc);
CKERR(r);
for (duplicates = FALSE; duplicates < TRUE; duplicates++) {
r = toku_lt_create(&lt, duplicates, dbpanic, mgr,
get_compare_fun_from_db, get_dup_compare_from_db,
{
r = toku_lt_create(&lt, dbpanic, mgr,
get_compare_fun_from_db,
toku_malloc, toku_free, toku_realloc);
CKERR(r);
assert(lt);
......
This diff is collapsed.
This diff is collapsed.
......@@ -11,21 +11,20 @@ toku_lock_tree* lt [10] = {0};
toku_ltm* ltm = NULL;
DB* db = (DB*)1;
u_int32_t max_locks = 10;
BOOL duplicates = FALSE;
int nums[10000];
static void setup_ltm(void) {
assert(!ltm);
r = toku_ltm_create(&ltm, max_locks, dbpanic,
get_compare_fun_from_db, get_dup_compare_from_db,
get_compare_fun_from_db,
toku_malloc, toku_free, toku_realloc);
CKERR(r);
assert(ltm);
}
static void setup_tree(BOOL dups, size_t index, DICTIONARY_ID dict_id) {
static void setup_tree(size_t index, DICTIONARY_ID dict_id) {
assert(!lt[index] && ltm);
r = toku_ltm_get_lt(ltm, &lt[index], dups, dict_id);
r = toku_ltm_get_lt(ltm, &lt[index], dict_id);
CKERR(r);
assert(lt[index]);
}
......@@ -40,26 +39,26 @@ static void close_ltm(void) {
ltm = NULL;
}
static void run_test(BOOL dups) {
static void run_test(void) {
DICTIONARY_ID dict_id1 = {1};
DICTIONARY_ID dict_id2 = {2};
DICTIONARY_ID dict_id3 = dict_id1;
setup_ltm();
setup_tree(dups, 0, dict_id1);
setup_tree(dups, 1, dict_id1);
setup_tree(0, dict_id1);
setup_tree(1, dict_id1);
assert(lt[0] == lt[1]);
setup_tree(dups, 2, dict_id2);
setup_tree(2, dict_id2);
assert(lt[0] != lt[2]);
setup_tree(dups, 3, dict_id3);
setup_tree(3, dict_id3);
assert(lt[0] == lt[3]);
toku_ltm_invalidate_lt(ltm, dict_id1);
setup_tree(dups, 4, dict_id1);
setup_tree(4, dict_id1);
assert(lt[0] != lt[4]);
setup_tree(dups, 5, dict_id1);
setup_tree(5, dict_id1);
assert(lt[0] != lt[5]);
assert(lt[4] == lt[5]);
......@@ -75,8 +74,7 @@ int main(int argc, const char *argv[]) {
CKERR(r);
toku_os_mkdir(TESTDIR, S_IRWXU|S_IRWXG|S_IRWXO);
run_test(FALSE);
run_test(TRUE);
run_test();
return 0;
}
......@@ -207,7 +207,6 @@ BDB_BINS = $(patsubst %.c,%.bdb$(BINSUF),$(filter-out $(patsubst %,%.c,$(BDB_DON
endif
TDB_TESTS_THAT_SHOULD_FAIL= \
test944 \
test_truncate_txn_abort \
test_db_no_env \
#\ ends prev line
......
......@@ -89,7 +89,6 @@ setup (void) {
env->set_errfile(env, stderr);
r=env->open(env, ENVDIR, DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_CREATE|DB_PRIVATE, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
r=db_create(&db, env, 0); CKERR(r);
r=db->set_flags(db, DB_DUPSORT);
r=env->txn_begin(env, 0, &txn, 0); assert(r==0);
r=db->open(db, txn, "foo.db", 0, DB_BTREE, DB_CREATE, S_IRWXU+S_IRWXG+S_IRWXO); CKERR(r);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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.
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