Commit 00e8c8c2 authored by Zardosht Kasheff's avatar Zardosht Kasheff Committed by Yoni Fogel

[t:3997], merge to main

git-svn-id: file:///svn/toku/tokudb@36689 c7de825b-a66e-492c-adef-691d508d4ae1
parent 7295d909
...@@ -84,8 +84,10 @@ typedef struct __toku_engine_status { ...@@ -84,8 +84,10 @@ typedef struct __toku_engine_status {
char checkpoint_time_begin_complete[26]; /* time of last complete checkpoint begin */ char checkpoint_time_begin_complete[26]; /* time of last complete checkpoint begin */
char checkpoint_time_end[26]; /* time of last checkpoint end */ char checkpoint_time_end[26]; /* time of last checkpoint end */
u_int64_t checkpoint_last_lsn; /* LSN of last complete checkpoint */ u_int64_t checkpoint_last_lsn; /* LSN of last complete checkpoint */
u_int32_t checkpoint_count; /* number of checkpoints taken */ u_int32_t checkpoint_count; /* number of checkpoints taken */
u_int32_t checkpoint_count_fail; /* number of checkpoints failed */ u_int32_t checkpoint_count_fail; /* number of checkpoints failed */
u_int32_t cleaner_period; /* delay between automatic checkpoints */
u_int32_t cleaner_iterations; /* delay between automatic checkpoints */
u_int64_t txn_begin; /* number of transactions ever begun */ u_int64_t txn_begin; /* number of transactions ever begun */
u_int64_t txn_commit; /* txn commit operations */ u_int64_t txn_commit; /* txn commit operations */
u_int64_t txn_abort; /* txn abort operations */ u_int64_t txn_abort; /* txn abort operations */
...@@ -113,6 +115,8 @@ typedef struct __toku_engine_status { ...@@ -113,6 +115,8 @@ typedef struct __toku_engine_status {
int64_t cachetable_size_max; /* the max value (high water mark) of cachetable_size_current */ int64_t cachetable_size_max; /* the max value (high water mark) of cachetable_size_current */
uint64_t cachetable_size_leaf; /* the number of bytes of leaf nodes */ uint64_t cachetable_size_leaf; /* the number of bytes of leaf nodes */
uint64_t cachetable_size_nonleaf; /* the number of bytes of nonleaf nodes */ uint64_t cachetable_size_nonleaf; /* the number of bytes of nonleaf nodes */
uint64_t cachetable_size_rollback; /* the number of bytes of nonleaf nodes */
uint64_t cachetable_size_cachepressure; /* the number of bytes of nonleaf nodes */
int64_t cachetable_size_writing; /* the sum of the sizes of the nodes being written */ int64_t cachetable_size_writing; /* the sum of the sizes of the nodes being written */
int64_t get_and_pin_footprint; /* state of get_and_pin procedure */ int64_t get_and_pin_footprint; /* state of get_and_pin procedure */
int64_t local_checkpoint; /* number of times a local checkpoint is taken for commit */ int64_t local_checkpoint; /* number of times a local checkpoint is taken for commit */
...@@ -325,13 +329,17 @@ struct __toku_db_env { ...@@ -325,13 +329,17 @@ struct __toku_db_env {
#define db_env_struct_i(x) ((x)->i) #define db_env_struct_i(x) ((x)->i)
int (*checkpointing_set_period) (DB_ENV*, u_int32_t) /* Change the delay between automatic checkpoints. 0 means disabled. */; int (*checkpointing_set_period) (DB_ENV*, u_int32_t) /* Change the delay between automatic checkpoints. 0 means disabled. */;
int (*checkpointing_get_period) (DB_ENV*, u_int32_t*) /* Retrieve the delay between automatic checkpoints. 0 means disabled. */; int (*checkpointing_get_period) (DB_ENV*, u_int32_t*) /* Retrieve the delay between automatic checkpoints. 0 means disabled. */;
int (*cleaner_set_period) (DB_ENV*, u_int32_t) /* Change the delay between automatic cleaner attempts. 0 means disabled. */;
int (*cleaner_get_period) (DB_ENV*, u_int32_t*) /* Retrieve the delay between automatic cleaner attempts. 0 means disabled. */;
int (*cleaner_set_iterations) (DB_ENV*, u_int32_t) /* Change the number of attempts on each cleaner invokation. 0 means disabled. */;
int (*cleaner_get_iterations) (DB_ENV*, u_int32_t*) /* Retrieve the number of attempts on each cleaner invokation. 0 means disabled. */;
int (*checkpointing_postpone) (DB_ENV*) /* Use for 'rename table' or any other operation that must be disjoint from a checkpoint */; int (*checkpointing_postpone) (DB_ENV*) /* Use for 'rename table' or any other operation that must be disjoint from a checkpoint */;
int (*checkpointing_resume) (DB_ENV*) /* Alert tokudb 'postpone' is no longer necessary */; int (*checkpointing_resume) (DB_ENV*) /* Alert tokudb 'postpone' is no longer necessary */;
void *app_private; /* 32-bit offset=36 size=4, 64=bit offset=72 size=8 */
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_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 (*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_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 (*get_engine_status) (DB_ENV*, ENGINE_STATUS*, char*, int) /* Fill in status struct, possibly env panic string */; int (*get_engine_status) (DB_ENV*, ENGINE_STATUS*, char*, int) /* Fill in status struct, possibly env panic string */;
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_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 (*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); 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);
...@@ -357,7 +365,7 @@ struct __toku_db_env { ...@@ -357,7 +365,7 @@ struct __toku_db_env {
void (*set_update) (DB_ENV *env, int (*update_function)(DB *, const DBT *key, const DBT *old_val, const DBT *extra, void (*set_val)(const DBT *new_val, void *set_extra), void *set_extra)); void (*set_update) (DB_ENV *env, int (*update_function)(DB *, const DBT *key, const DBT *old_val, const DBT *extra, void (*set_val)(const DBT *new_val, void *set_extra), void *set_extra));
int (*set_lock_timeout) (DB_ENV *env, uint64_t lock_wait_time_msec); int (*set_lock_timeout) (DB_ENV *env, uint64_t lock_wait_time_msec);
int (*get_lock_timeout) (DB_ENV *env, uint64_t *lock_wait_time_msec); int (*get_lock_timeout) (DB_ENV *env, uint64_t *lock_wait_time_msec);
void* __toku_dummy0[11]; void* __toku_dummy0[7];
char __toku_dummy1[64]; char __toku_dummy1[64];
void *api1_internal; /* 32-bit offset=212 size=4, 64=bit offset=360 size=8 */ void *api1_internal; /* 32-bit offset=212 size=4, 64=bit offset=360 size=8 */
void* __toku_dummy2[7]; void* __toku_dummy2[7];
......
...@@ -84,8 +84,10 @@ typedef struct __toku_engine_status { ...@@ -84,8 +84,10 @@ typedef struct __toku_engine_status {
char checkpoint_time_begin_complete[26]; /* time of last complete checkpoint begin */ char checkpoint_time_begin_complete[26]; /* time of last complete checkpoint begin */
char checkpoint_time_end[26]; /* time of last checkpoint end */ char checkpoint_time_end[26]; /* time of last checkpoint end */
u_int64_t checkpoint_last_lsn; /* LSN of last complete checkpoint */ u_int64_t checkpoint_last_lsn; /* LSN of last complete checkpoint */
u_int32_t checkpoint_count; /* number of checkpoints taken */ u_int32_t checkpoint_count; /* number of checkpoints taken */
u_int32_t checkpoint_count_fail; /* number of checkpoints failed */ u_int32_t checkpoint_count_fail; /* number of checkpoints failed */
u_int32_t cleaner_period; /* delay between automatic checkpoints */
u_int32_t cleaner_iterations; /* delay between automatic checkpoints */
u_int64_t txn_begin; /* number of transactions ever begun */ u_int64_t txn_begin; /* number of transactions ever begun */
u_int64_t txn_commit; /* txn commit operations */ u_int64_t txn_commit; /* txn commit operations */
u_int64_t txn_abort; /* txn abort operations */ u_int64_t txn_abort; /* txn abort operations */
...@@ -113,6 +115,8 @@ typedef struct __toku_engine_status { ...@@ -113,6 +115,8 @@ typedef struct __toku_engine_status {
int64_t cachetable_size_max; /* the max value (high water mark) of cachetable_size_current */ int64_t cachetable_size_max; /* the max value (high water mark) of cachetable_size_current */
uint64_t cachetable_size_leaf; /* the number of bytes of leaf nodes */ uint64_t cachetable_size_leaf; /* the number of bytes of leaf nodes */
uint64_t cachetable_size_nonleaf; /* the number of bytes of nonleaf nodes */ uint64_t cachetable_size_nonleaf; /* the number of bytes of nonleaf nodes */
uint64_t cachetable_size_rollback; /* the number of bytes of nonleaf nodes */
uint64_t cachetable_size_cachepressure; /* the number of bytes of nonleaf nodes */
int64_t cachetable_size_writing; /* the sum of the sizes of the nodes being written */ int64_t cachetable_size_writing; /* the sum of the sizes of the nodes being written */
int64_t get_and_pin_footprint; /* state of get_and_pin procedure */ int64_t get_and_pin_footprint; /* state of get_and_pin procedure */
int64_t local_checkpoint; /* number of times a local checkpoint is taken for commit */ int64_t local_checkpoint; /* number of times a local checkpoint is taken for commit */
...@@ -327,15 +331,19 @@ struct __toku_db_env { ...@@ -327,15 +331,19 @@ struct __toku_db_env {
#define db_env_struct_i(x) ((x)->i) #define db_env_struct_i(x) ((x)->i)
int (*checkpointing_set_period) (DB_ENV*, u_int32_t) /* Change the delay between automatic checkpoints. 0 means disabled. */; int (*checkpointing_set_period) (DB_ENV*, u_int32_t) /* Change the delay between automatic checkpoints. 0 means disabled. */;
int (*checkpointing_get_period) (DB_ENV*, u_int32_t*) /* Retrieve the delay between automatic checkpoints. 0 means disabled. */; int (*checkpointing_get_period) (DB_ENV*, u_int32_t*) /* Retrieve the delay between automatic checkpoints. 0 means disabled. */;
int (*cleaner_set_period) (DB_ENV*, u_int32_t) /* Change the delay between automatic cleaner attempts. 0 means disabled. */;
int (*cleaner_get_period) (DB_ENV*, u_int32_t*) /* Retrieve the delay between automatic cleaner attempts. 0 means disabled. */;
int (*cleaner_set_iterations) (DB_ENV*, u_int32_t) /* Change the number of attempts on each cleaner invokation. 0 means disabled. */;
int (*cleaner_get_iterations) (DB_ENV*, u_int32_t*) /* Retrieve the number of attempts on each cleaner invokation. 0 means disabled. */;
int (*checkpointing_postpone) (DB_ENV*) /* Use for 'rename table' or any other operation that must be disjoint from a checkpoint */; int (*checkpointing_postpone) (DB_ENV*) /* Use for 'rename table' or any other operation that must be disjoint from a checkpoint */;
int (*checkpointing_resume) (DB_ENV*) /* Alert tokudb 'postpone' is no longer necessary */; int (*checkpointing_resume) (DB_ENV*) /* Alert tokudb 'postpone' is no longer necessary */;
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_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 (*checkpointing_end_atomic_operation) (DB_ENV*) /* End a set of operations (that must be atomic as far as checkpoints are concerned). */;
void *app_private; /* 32-bit offset=44 size=4, 64=bit offset=88 size=8 */
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_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 (*get_engine_status) (DB_ENV*, ENGINE_STATUS*, char*, int) /* Fill in status struct, possibly env panic string */; int (*get_engine_status) (DB_ENV*, ENGINE_STATUS*, char*, int) /* Fill in status struct, possibly env panic string */;
int (*get_engine_status_text) (DB_ENV*, char*, int) /* Fill in status text */; 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 (*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 (*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 (*create_indexer) (DB_ENV *env, DB_TXN *txn, DB_INDEXER **idxrp, DB *src_db, int N, DB *dbs[/*N*/], uint32_t db_flags[/*N*/], uint32_t indexer_flags); int (*create_indexer) (DB_ENV *env, DB_TXN *txn, DB_INDEXER **idxrp, DB *src_db, int N, DB *dbs[/*N*/], uint32_t db_flags[/*N*/], uint32_t indexer_flags);
int (*put_multiple) (DB_ENV *env, DB *src_db, DB_TXN *txn, int (*put_multiple) (DB_ENV *env, DB *src_db, DB_TXN *txn,
...@@ -359,7 +367,7 @@ struct __toku_db_env { ...@@ -359,7 +367,7 @@ struct __toku_db_env {
void (*set_update) (DB_ENV *env, int (*update_function)(DB *, const DBT *key, const DBT *old_val, const DBT *extra, void (*set_val)(const DBT *new_val, void *set_extra), void *set_extra)); void (*set_update) (DB_ENV *env, int (*update_function)(DB *, const DBT *key, const DBT *old_val, const DBT *extra, void (*set_val)(const DBT *new_val, void *set_extra), void *set_extra));
int (*set_lock_timeout) (DB_ENV *env, uint64_t lock_wait_time_msec); int (*set_lock_timeout) (DB_ENV *env, uint64_t lock_wait_time_msec);
int (*get_lock_timeout) (DB_ENV *env, uint64_t *lock_wait_time_msec); int (*get_lock_timeout) (DB_ENV *env, uint64_t *lock_wait_time_msec);
void* __toku_dummy0[11]; void* __toku_dummy0[7];
char __toku_dummy1[96]; char __toku_dummy1[96];
void *api1_internal; /* 32-bit offset=244 size=4, 64=bit offset=392 size=8 */ void *api1_internal; /* 32-bit offset=244 size=4, 64=bit offset=392 size=8 */
void* __toku_dummy2[7]; void* __toku_dummy2[7];
......
...@@ -84,8 +84,10 @@ typedef struct __toku_engine_status { ...@@ -84,8 +84,10 @@ typedef struct __toku_engine_status {
char checkpoint_time_begin_complete[26]; /* time of last complete checkpoint begin */ char checkpoint_time_begin_complete[26]; /* time of last complete checkpoint begin */
char checkpoint_time_end[26]; /* time of last checkpoint end */ char checkpoint_time_end[26]; /* time of last checkpoint end */
u_int64_t checkpoint_last_lsn; /* LSN of last complete checkpoint */ u_int64_t checkpoint_last_lsn; /* LSN of last complete checkpoint */
u_int32_t checkpoint_count; /* number of checkpoints taken */ u_int32_t checkpoint_count; /* number of checkpoints taken */
u_int32_t checkpoint_count_fail; /* number of checkpoints failed */ u_int32_t checkpoint_count_fail; /* number of checkpoints failed */
u_int32_t cleaner_period; /* delay between automatic checkpoints */
u_int32_t cleaner_iterations; /* delay between automatic checkpoints */
u_int64_t txn_begin; /* number of transactions ever begun */ u_int64_t txn_begin; /* number of transactions ever begun */
u_int64_t txn_commit; /* txn commit operations */ u_int64_t txn_commit; /* txn commit operations */
u_int64_t txn_abort; /* txn abort operations */ u_int64_t txn_abort; /* txn abort operations */
...@@ -113,6 +115,8 @@ typedef struct __toku_engine_status { ...@@ -113,6 +115,8 @@ typedef struct __toku_engine_status {
int64_t cachetable_size_max; /* the max value (high water mark) of cachetable_size_current */ int64_t cachetable_size_max; /* the max value (high water mark) of cachetable_size_current */
uint64_t cachetable_size_leaf; /* the number of bytes of leaf nodes */ uint64_t cachetable_size_leaf; /* the number of bytes of leaf nodes */
uint64_t cachetable_size_nonleaf; /* the number of bytes of nonleaf nodes */ uint64_t cachetable_size_nonleaf; /* the number of bytes of nonleaf nodes */
uint64_t cachetable_size_rollback; /* the number of bytes of nonleaf nodes */
uint64_t cachetable_size_cachepressure; /* the number of bytes of nonleaf nodes */
int64_t cachetable_size_writing; /* the sum of the sizes of the nodes being written */ int64_t cachetable_size_writing; /* the sum of the sizes of the nodes being written */
int64_t get_and_pin_footprint; /* state of get_and_pin procedure */ int64_t get_and_pin_footprint; /* state of get_and_pin procedure */
int64_t local_checkpoint; /* number of times a local checkpoint is taken for commit */ int64_t local_checkpoint; /* number of times a local checkpoint is taken for commit */
...@@ -327,15 +331,19 @@ struct __toku_db_env { ...@@ -327,15 +331,19 @@ struct __toku_db_env {
#define db_env_struct_i(x) ((x)->i) #define db_env_struct_i(x) ((x)->i)
int (*checkpointing_set_period) (DB_ENV*, u_int32_t) /* Change the delay between automatic checkpoints. 0 means disabled. */; int (*checkpointing_set_period) (DB_ENV*, u_int32_t) /* Change the delay between automatic checkpoints. 0 means disabled. */;
int (*checkpointing_get_period) (DB_ENV*, u_int32_t*) /* Retrieve the delay between automatic checkpoints. 0 means disabled. */; int (*checkpointing_get_period) (DB_ENV*, u_int32_t*) /* Retrieve the delay between automatic checkpoints. 0 means disabled. */;
int (*cleaner_set_period) (DB_ENV*, u_int32_t) /* Change the delay between automatic cleaner attempts. 0 means disabled. */;
int (*cleaner_get_period) (DB_ENV*, u_int32_t*) /* Retrieve the delay between automatic cleaner attempts. 0 means disabled. */;
int (*cleaner_set_iterations) (DB_ENV*, u_int32_t) /* Change the number of attempts on each cleaner invokation. 0 means disabled. */;
int (*cleaner_get_iterations) (DB_ENV*, u_int32_t*) /* Retrieve the number of attempts on each cleaner invokation. 0 means disabled. */;
int (*checkpointing_postpone) (DB_ENV*) /* Use for 'rename table' or any other operation that must be disjoint from a checkpoint */; int (*checkpointing_postpone) (DB_ENV*) /* Use for 'rename table' or any other operation that must be disjoint from a checkpoint */;
int (*checkpointing_resume) (DB_ENV*) /* Alert tokudb 'postpone' is no longer necessary */; int (*checkpointing_resume) (DB_ENV*) /* Alert tokudb 'postpone' is no longer necessary */;
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_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 (*checkpointing_end_atomic_operation) (DB_ENV*) /* End a set of operations (that must be atomic as far as checkpoints are concerned). */;
void *app_private; /* 32-bit offset=44 size=4, 64=bit offset=88 size=8 */
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_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 (*get_engine_status) (DB_ENV*, ENGINE_STATUS*, char*, int) /* Fill in status struct, possibly env panic string */; int (*get_engine_status) (DB_ENV*, ENGINE_STATUS*, char*, int) /* Fill in status struct, possibly env panic string */;
int (*get_engine_status_text) (DB_ENV*, char*, int) /* Fill in status text */; 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 (*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 (*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 (*create_indexer) (DB_ENV *env, DB_TXN *txn, DB_INDEXER **idxrp, DB *src_db, int N, DB *dbs[/*N*/], uint32_t db_flags[/*N*/], uint32_t indexer_flags); int (*create_indexer) (DB_ENV *env, DB_TXN *txn, DB_INDEXER **idxrp, DB *src_db, int N, DB *dbs[/*N*/], uint32_t db_flags[/*N*/], uint32_t indexer_flags);
int (*put_multiple) (DB_ENV *env, DB *src_db, DB_TXN *txn, int (*put_multiple) (DB_ENV *env, DB *src_db, DB_TXN *txn,
...@@ -359,7 +367,7 @@ struct __toku_db_env { ...@@ -359,7 +367,7 @@ struct __toku_db_env {
void (*set_update) (DB_ENV *env, int (*update_function)(DB *, const DBT *key, const DBT *old_val, const DBT *extra, void (*set_val)(const DBT *new_val, void *set_extra), void *set_extra)); void (*set_update) (DB_ENV *env, int (*update_function)(DB *, const DBT *key, const DBT *old_val, const DBT *extra, void (*set_val)(const DBT *new_val, void *set_extra), void *set_extra));
int (*set_lock_timeout) (DB_ENV *env, uint64_t lock_wait_time_msec); int (*set_lock_timeout) (DB_ENV *env, uint64_t lock_wait_time_msec);
int (*get_lock_timeout) (DB_ENV *env, uint64_t *lock_wait_time_msec); int (*get_lock_timeout) (DB_ENV *env, uint64_t *lock_wait_time_msec);
void* __toku_dummy0[26]; void* __toku_dummy0[22];
char __toku_dummy1[128]; char __toku_dummy1[128];
void *api1_internal; /* 32-bit offset=336 size=4, 64=bit offset=544 size=8 */ void *api1_internal; /* 32-bit offset=336 size=4, 64=bit offset=544 size=8 */
void* __toku_dummy2[7]; void* __toku_dummy2[7];
......
...@@ -84,8 +84,10 @@ typedef struct __toku_engine_status { ...@@ -84,8 +84,10 @@ typedef struct __toku_engine_status {
char checkpoint_time_begin_complete[26]; /* time of last complete checkpoint begin */ char checkpoint_time_begin_complete[26]; /* time of last complete checkpoint begin */
char checkpoint_time_end[26]; /* time of last checkpoint end */ char checkpoint_time_end[26]; /* time of last checkpoint end */
u_int64_t checkpoint_last_lsn; /* LSN of last complete checkpoint */ u_int64_t checkpoint_last_lsn; /* LSN of last complete checkpoint */
u_int32_t checkpoint_count; /* number of checkpoints taken */ u_int32_t checkpoint_count; /* number of checkpoints taken */
u_int32_t checkpoint_count_fail; /* number of checkpoints failed */ u_int32_t checkpoint_count_fail; /* number of checkpoints failed */
u_int32_t cleaner_period; /* delay between automatic checkpoints */
u_int32_t cleaner_iterations; /* delay between automatic checkpoints */
u_int64_t txn_begin; /* number of transactions ever begun */ u_int64_t txn_begin; /* number of transactions ever begun */
u_int64_t txn_commit; /* txn commit operations */ u_int64_t txn_commit; /* txn commit operations */
u_int64_t txn_abort; /* txn abort operations */ u_int64_t txn_abort; /* txn abort operations */
...@@ -113,6 +115,8 @@ typedef struct __toku_engine_status { ...@@ -113,6 +115,8 @@ typedef struct __toku_engine_status {
int64_t cachetable_size_max; /* the max value (high water mark) of cachetable_size_current */ int64_t cachetable_size_max; /* the max value (high water mark) of cachetable_size_current */
uint64_t cachetable_size_leaf; /* the number of bytes of leaf nodes */ uint64_t cachetable_size_leaf; /* the number of bytes of leaf nodes */
uint64_t cachetable_size_nonleaf; /* the number of bytes of nonleaf nodes */ uint64_t cachetable_size_nonleaf; /* the number of bytes of nonleaf nodes */
uint64_t cachetable_size_rollback; /* the number of bytes of nonleaf nodes */
uint64_t cachetable_size_cachepressure; /* the number of bytes of nonleaf nodes */
int64_t cachetable_size_writing; /* the sum of the sizes of the nodes being written */ int64_t cachetable_size_writing; /* the sum of the sizes of the nodes being written */
int64_t get_and_pin_footprint; /* state of get_and_pin procedure */ int64_t get_and_pin_footprint; /* state of get_and_pin procedure */
int64_t local_checkpoint; /* number of times a local checkpoint is taken for commit */ int64_t local_checkpoint; /* number of times a local checkpoint is taken for commit */
...@@ -327,17 +331,21 @@ struct __toku_db_env { ...@@ -327,17 +331,21 @@ struct __toku_db_env {
#define db_env_struct_i(x) ((x)->i) #define db_env_struct_i(x) ((x)->i)
int (*checkpointing_set_period) (DB_ENV*, u_int32_t) /* Change the delay between automatic checkpoints. 0 means disabled. */; int (*checkpointing_set_period) (DB_ENV*, u_int32_t) /* Change the delay between automatic checkpoints. 0 means disabled. */;
int (*checkpointing_get_period) (DB_ENV*, u_int32_t*) /* Retrieve the delay between automatic checkpoints. 0 means disabled. */; int (*checkpointing_get_period) (DB_ENV*, u_int32_t*) /* Retrieve the delay between automatic checkpoints. 0 means disabled. */;
int (*cleaner_set_period) (DB_ENV*, u_int32_t) /* Change the delay between automatic cleaner attempts. 0 means disabled. */;
int (*cleaner_get_period) (DB_ENV*, u_int32_t*) /* Retrieve the delay between automatic cleaner attempts. 0 means disabled. */;
int (*cleaner_set_iterations) (DB_ENV*, u_int32_t) /* Change the number of attempts on each cleaner invokation. 0 means disabled. */;
int (*cleaner_get_iterations) (DB_ENV*, u_int32_t*) /* Retrieve the number of attempts on each cleaner invokation. 0 means disabled. */;
int (*checkpointing_postpone) (DB_ENV*) /* Use for 'rename table' or any other operation that must be disjoint from a checkpoint */; int (*checkpointing_postpone) (DB_ENV*) /* Use for 'rename table' or any other operation that must be disjoint from a checkpoint */;
int (*checkpointing_resume) (DB_ENV*) /* Alert tokudb 'postpone' is no longer necessary */; int (*checkpointing_resume) (DB_ENV*) /* Alert tokudb 'postpone' is no longer necessary */;
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_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 (*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_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 (*get_engine_status) (DB_ENV*, ENGINE_STATUS*, char*, int) /* Fill in status struct, possibly env panic string */; int (*get_engine_status) (DB_ENV*, ENGINE_STATUS*, char*, int) /* Fill in status struct, possibly env panic string */;
void *app_private; /* 32-bit offset=52 size=4, 64=bit offset=104 size=8 */
int (*get_engine_status_text) (DB_ENV*, char*, int) /* Fill in status text */; 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 (*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); 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 (*create_indexer) (DB_ENV *env, DB_TXN *txn, DB_INDEXER **idxrp, DB *src_db, int N, DB *dbs[/*N*/], uint32_t db_flags[/*N*/], uint32_t indexer_flags); int (*create_indexer) (DB_ENV *env, DB_TXN *txn, DB_INDEXER **idxrp, DB *src_db, int N, DB *dbs[/*N*/], uint32_t db_flags[/*N*/], uint32_t indexer_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, int (*put_multiple) (DB_ENV *env, DB *src_db, DB_TXN *txn,
const DBT *src_key, const DBT *src_val, const DBT *src_key, const DBT *src_val,
uint32_t num_dbs, DB **db_array, DBT *keys, DBT *vals, uint32_t *flags_array) /* insert into multiple DBs */; uint32_t num_dbs, DB **db_array, DBT *keys, DBT *vals, uint32_t *flags_array) /* insert into multiple DBs */;
...@@ -359,7 +367,7 @@ struct __toku_db_env { ...@@ -359,7 +367,7 @@ struct __toku_db_env {
void (*set_update) (DB_ENV *env, int (*update_function)(DB *, const DBT *key, const DBT *old_val, const DBT *extra, void (*set_val)(const DBT *new_val, void *set_extra), void *set_extra)); void (*set_update) (DB_ENV *env, int (*update_function)(DB *, const DBT *key, const DBT *old_val, const DBT *extra, void (*set_val)(const DBT *new_val, void *set_extra), void *set_extra));
int (*set_lock_timeout) (DB_ENV *env, uint64_t lock_wait_time_msec); int (*set_lock_timeout) (DB_ENV *env, uint64_t lock_wait_time_msec);
int (*get_lock_timeout) (DB_ENV *env, uint64_t *lock_wait_time_msec); int (*get_lock_timeout) (DB_ENV *env, uint64_t *lock_wait_time_msec);
void* __toku_dummy0[26]; void* __toku_dummy0[22];
char __toku_dummy1[128]; char __toku_dummy1[128];
void *api1_internal; /* 32-bit offset=336 size=4, 64=bit offset=544 size=8 */ void *api1_internal; /* 32-bit offset=336 size=4, 64=bit offset=544 size=8 */
void* __toku_dummy2[8]; void* __toku_dummy2[8];
......
...@@ -84,8 +84,10 @@ typedef struct __toku_engine_status { ...@@ -84,8 +84,10 @@ typedef struct __toku_engine_status {
char checkpoint_time_begin_complete[26]; /* time of last complete checkpoint begin */ char checkpoint_time_begin_complete[26]; /* time of last complete checkpoint begin */
char checkpoint_time_end[26]; /* time of last checkpoint end */ char checkpoint_time_end[26]; /* time of last checkpoint end */
u_int64_t checkpoint_last_lsn; /* LSN of last complete checkpoint */ u_int64_t checkpoint_last_lsn; /* LSN of last complete checkpoint */
u_int32_t checkpoint_count; /* number of checkpoints taken */ u_int32_t checkpoint_count; /* number of checkpoints taken */
u_int32_t checkpoint_count_fail; /* number of checkpoints failed */ u_int32_t checkpoint_count_fail; /* number of checkpoints failed */
u_int32_t cleaner_period; /* delay between automatic checkpoints */
u_int32_t cleaner_iterations; /* delay between automatic checkpoints */
u_int64_t txn_begin; /* number of transactions ever begun */ u_int64_t txn_begin; /* number of transactions ever begun */
u_int64_t txn_commit; /* txn commit operations */ u_int64_t txn_commit; /* txn commit operations */
u_int64_t txn_abort; /* txn abort operations */ u_int64_t txn_abort; /* txn abort operations */
...@@ -113,6 +115,8 @@ typedef struct __toku_engine_status { ...@@ -113,6 +115,8 @@ typedef struct __toku_engine_status {
int64_t cachetable_size_max; /* the max value (high water mark) of cachetable_size_current */ int64_t cachetable_size_max; /* the max value (high water mark) of cachetable_size_current */
uint64_t cachetable_size_leaf; /* the number of bytes of leaf nodes */ uint64_t cachetable_size_leaf; /* the number of bytes of leaf nodes */
uint64_t cachetable_size_nonleaf; /* the number of bytes of nonleaf nodes */ uint64_t cachetable_size_nonleaf; /* the number of bytes of nonleaf nodes */
uint64_t cachetable_size_rollback; /* the number of bytes of nonleaf nodes */
uint64_t cachetable_size_cachepressure; /* the number of bytes of nonleaf nodes */
int64_t cachetable_size_writing; /* the sum of the sizes of the nodes being written */ int64_t cachetable_size_writing; /* the sum of the sizes of the nodes being written */
int64_t get_and_pin_footprint; /* state of get_and_pin procedure */ int64_t get_and_pin_footprint; /* state of get_and_pin procedure */
int64_t local_checkpoint; /* number of times a local checkpoint is taken for commit */ int64_t local_checkpoint; /* number of times a local checkpoint is taken for commit */
...@@ -328,17 +332,21 @@ struct __toku_db_env { ...@@ -328,17 +332,21 @@ struct __toku_db_env {
#define db_env_struct_i(x) ((x)->i) #define db_env_struct_i(x) ((x)->i)
int (*checkpointing_set_period) (DB_ENV*, u_int32_t) /* Change the delay between automatic checkpoints. 0 means disabled. */; int (*checkpointing_set_period) (DB_ENV*, u_int32_t) /* Change the delay between automatic checkpoints. 0 means disabled. */;
int (*checkpointing_get_period) (DB_ENV*, u_int32_t*) /* Retrieve the delay between automatic checkpoints. 0 means disabled. */; int (*checkpointing_get_period) (DB_ENV*, u_int32_t*) /* Retrieve the delay between automatic checkpoints. 0 means disabled. */;
int (*cleaner_set_period) (DB_ENV*, u_int32_t) /* Change the delay between automatic cleaner attempts. 0 means disabled. */;
int (*cleaner_get_period) (DB_ENV*, u_int32_t*) /* Retrieve the delay between automatic cleaner attempts. 0 means disabled. */;
int (*cleaner_set_iterations) (DB_ENV*, u_int32_t) /* Change the number of attempts on each cleaner invokation. 0 means disabled. */;
int (*cleaner_get_iterations) (DB_ENV*, u_int32_t*) /* Retrieve the number of attempts on each cleaner invokation. 0 means disabled. */;
int (*checkpointing_postpone) (DB_ENV*) /* Use for 'rename table' or any other operation that must be disjoint from a checkpoint */; int (*checkpointing_postpone) (DB_ENV*) /* Use for 'rename table' or any other operation that must be disjoint from a checkpoint */;
int (*checkpointing_resume) (DB_ENV*) /* Alert tokudb 'postpone' is no longer necessary */; int (*checkpointing_resume) (DB_ENV*) /* Alert tokudb 'postpone' is no longer necessary */;
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_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 (*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_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 (*get_engine_status) (DB_ENV*, ENGINE_STATUS*, char*, int) /* Fill in status struct, possibly env panic string */; int (*get_engine_status) (DB_ENV*, ENGINE_STATUS*, char*, int) /* Fill in status struct, possibly env panic string */;
void *app_private; /* 32-bit offset=52 size=4, 64=bit offset=104 size=8 */
int (*get_engine_status_text) (DB_ENV*, char*, int) /* Fill in status text */; 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 (*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); 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 (*create_indexer) (DB_ENV *env, DB_TXN *txn, DB_INDEXER **idxrp, DB *src_db, int N, DB *dbs[/*N*/], uint32_t db_flags[/*N*/], uint32_t indexer_flags); int (*create_indexer) (DB_ENV *env, DB_TXN *txn, DB_INDEXER **idxrp, DB *src_db, int N, DB *dbs[/*N*/], uint32_t db_flags[/*N*/], uint32_t indexer_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, int (*put_multiple) (DB_ENV *env, DB *src_db, DB_TXN *txn,
const DBT *src_key, const DBT *src_val, const DBT *src_key, const DBT *src_val,
uint32_t num_dbs, DB **db_array, DBT *keys, DBT *vals, uint32_t *flags_array) /* insert into multiple DBs */; uint32_t num_dbs, DB **db_array, DBT *keys, DBT *vals, uint32_t *flags_array) /* insert into multiple DBs */;
...@@ -360,7 +368,7 @@ struct __toku_db_env { ...@@ -360,7 +368,7 @@ struct __toku_db_env {
void (*set_update) (DB_ENV *env, int (*update_function)(DB *, const DBT *key, const DBT *old_val, const DBT *extra, void (*set_val)(const DBT *new_val, void *set_extra), void *set_extra)); void (*set_update) (DB_ENV *env, int (*update_function)(DB *, const DBT *key, const DBT *old_val, const DBT *extra, void (*set_val)(const DBT *new_val, void *set_extra), void *set_extra));
int (*set_lock_timeout) (DB_ENV *env, uint64_t lock_wait_time_msec); int (*set_lock_timeout) (DB_ENV *env, uint64_t lock_wait_time_msec);
int (*get_lock_timeout) (DB_ENV *env, uint64_t *lock_wait_time_msec); int (*get_lock_timeout) (DB_ENV *env, uint64_t *lock_wait_time_msec);
void* __toku_dummy0[27]; void* __toku_dummy0[23];
char __toku_dummy1[144]; char __toku_dummy1[144];
void *api1_internal; /* 32-bit offset=356 size=4, 64=bit offset=568 size=8 */ void *api1_internal; /* 32-bit offset=356 size=4, 64=bit offset=568 size=8 */
void* __toku_dummy2[8]; void* __toku_dummy2[8];
......
...@@ -478,8 +478,10 @@ int main (int argc __attribute__((__unused__)), char *const argv[] __attribute__ ...@@ -478,8 +478,10 @@ int main (int argc __attribute__((__unused__)), char *const argv[] __attribute__
printf(" char checkpoint_time_begin_complete[26]; /* time of last complete checkpoint begin */ \n"); printf(" char checkpoint_time_begin_complete[26]; /* time of last complete checkpoint begin */ \n");
printf(" char checkpoint_time_end[26]; /* time of last checkpoint end */ \n"); printf(" char checkpoint_time_end[26]; /* time of last checkpoint end */ \n");
printf(" u_int64_t checkpoint_last_lsn; /* LSN of last complete checkpoint */ \n"); printf(" u_int64_t checkpoint_last_lsn; /* LSN of last complete checkpoint */ \n");
printf(" u_int32_t checkpoint_count; /* number of checkpoints taken */ \n"); printf(" u_int32_t checkpoint_count; /* number of checkpoints taken */ \n");
printf(" u_int32_t checkpoint_count_fail; /* number of checkpoints failed */ \n"); printf(" u_int32_t checkpoint_count_fail; /* number of checkpoints failed */ \n");
printf(" u_int32_t cleaner_period; /* delay between automatic checkpoints */ \n");
printf(" u_int32_t cleaner_iterations; /* delay between automatic checkpoints */ \n");
printf(" u_int64_t txn_begin; /* number of transactions ever begun */ \n"); printf(" u_int64_t txn_begin; /* number of transactions ever begun */ \n");
printf(" u_int64_t txn_commit; /* txn commit operations */ \n"); printf(" u_int64_t txn_commit; /* txn commit operations */ \n");
printf(" u_int64_t txn_abort; /* txn abort operations */ \n"); printf(" u_int64_t txn_abort; /* txn abort operations */ \n");
...@@ -507,6 +509,8 @@ int main (int argc __attribute__((__unused__)), char *const argv[] __attribute__ ...@@ -507,6 +509,8 @@ int main (int argc __attribute__((__unused__)), char *const argv[] __attribute__
printf(" int64_t cachetable_size_max; /* the max value (high water mark) of cachetable_size_current */ \n"); printf(" int64_t cachetable_size_max; /* the max value (high water mark) of cachetable_size_current */ \n");
printf(" uint64_t cachetable_size_leaf; /* the number of bytes of leaf nodes */ \n"); printf(" uint64_t cachetable_size_leaf; /* the number of bytes of leaf nodes */ \n");
printf(" uint64_t cachetable_size_nonleaf; /* the number of bytes of nonleaf nodes */ \n"); printf(" uint64_t cachetable_size_nonleaf; /* the number of bytes of nonleaf nodes */ \n");
printf(" uint64_t cachetable_size_rollback; /* the number of bytes of nonleaf nodes */ \n");
printf(" uint64_t cachetable_size_cachepressure; /* the number of bytes of nonleaf nodes */ \n");
printf(" int64_t cachetable_size_writing; /* the sum of the sizes of the nodes being written */ \n"); printf(" int64_t cachetable_size_writing; /* the sum of the sizes of the nodes being written */ \n");
printf(" int64_t get_and_pin_footprint; /* state of get_and_pin procedure */ \n"); printf(" int64_t get_and_pin_footprint; /* state of get_and_pin procedure */ \n");
printf(" int64_t local_checkpoint; /* number of times a local checkpoint is taken for commit */ \n"); printf(" int64_t local_checkpoint; /* number of times a local checkpoint is taken for commit */ \n");
...@@ -634,6 +638,10 @@ int main (int argc __attribute__((__unused__)), char *const argv[] __attribute__ ...@@ -634,6 +638,10 @@ int main (int argc __attribute__((__unused__)), char *const argv[] __attribute__
const char *extra[]={ const char *extra[]={
"int (*checkpointing_set_period) (DB_ENV*, u_int32_t) /* Change the delay between automatic checkpoints. 0 means disabled. */", "int (*checkpointing_set_period) (DB_ENV*, u_int32_t) /* Change the delay between automatic checkpoints. 0 means disabled. */",
"int (*checkpointing_get_period) (DB_ENV*, u_int32_t*) /* Retrieve the delay between automatic checkpoints. 0 means disabled. */", "int (*checkpointing_get_period) (DB_ENV*, u_int32_t*) /* Retrieve the delay between automatic checkpoints. 0 means disabled. */",
"int (*cleaner_set_period) (DB_ENV*, u_int32_t) /* Change the delay between automatic cleaner attempts. 0 means disabled. */",
"int (*cleaner_get_period) (DB_ENV*, u_int32_t*) /* Retrieve the delay between automatic cleaner attempts. 0 means disabled. */",
"int (*cleaner_set_iterations) (DB_ENV*, u_int32_t) /* Change the number of attempts on each cleaner invokation. 0 means disabled. */",
"int (*cleaner_get_iterations) (DB_ENV*, u_int32_t*) /* Retrieve the number of attempts on each cleaner invokation. 0 means disabled. */",
"int (*checkpointing_postpone) (DB_ENV*) /* Use for 'rename table' or any other operation that must be disjoint from a checkpoint */", "int (*checkpointing_postpone) (DB_ENV*) /* Use for 'rename table' or any other operation that must be disjoint from a checkpoint */",
"int (*checkpointing_resume) (DB_ENV*) /* Alert tokudb 'postpone' is no longer necessary */", "int (*checkpointing_resume) (DB_ENV*) /* Alert tokudb 'postpone' is no longer necessary */",
"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_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 */",
......
...@@ -84,8 +84,10 @@ typedef struct __toku_engine_status { ...@@ -84,8 +84,10 @@ typedef struct __toku_engine_status {
char checkpoint_time_begin_complete[26]; /* time of last complete checkpoint begin */ char checkpoint_time_begin_complete[26]; /* time of last complete checkpoint begin */
char checkpoint_time_end[26]; /* time of last checkpoint end */ char checkpoint_time_end[26]; /* time of last checkpoint end */
u_int64_t checkpoint_last_lsn; /* LSN of last complete checkpoint */ u_int64_t checkpoint_last_lsn; /* LSN of last complete checkpoint */
u_int32_t checkpoint_count; /* number of checkpoints taken */ u_int32_t checkpoint_count; /* number of checkpoints taken */
u_int32_t checkpoint_count_fail; /* number of checkpoints failed */ u_int32_t checkpoint_count_fail; /* number of checkpoints failed */
u_int32_t cleaner_period; /* delay between automatic checkpoints */
u_int32_t cleaner_iterations; /* delay between automatic checkpoints */
u_int64_t txn_begin; /* number of transactions ever begun */ u_int64_t txn_begin; /* number of transactions ever begun */
u_int64_t txn_commit; /* txn commit operations */ u_int64_t txn_commit; /* txn commit operations */
u_int64_t txn_abort; /* txn abort operations */ u_int64_t txn_abort; /* txn abort operations */
...@@ -113,6 +115,8 @@ typedef struct __toku_engine_status { ...@@ -113,6 +115,8 @@ typedef struct __toku_engine_status {
int64_t cachetable_size_max; /* the max value (high water mark) of cachetable_size_current */ int64_t cachetable_size_max; /* the max value (high water mark) of cachetable_size_current */
uint64_t cachetable_size_leaf; /* the number of bytes of leaf nodes */ uint64_t cachetable_size_leaf; /* the number of bytes of leaf nodes */
uint64_t cachetable_size_nonleaf; /* the number of bytes of nonleaf nodes */ uint64_t cachetable_size_nonleaf; /* the number of bytes of nonleaf nodes */
uint64_t cachetable_size_rollback; /* the number of bytes of nonleaf nodes */
uint64_t cachetable_size_cachepressure; /* the number of bytes of nonleaf nodes */
int64_t cachetable_size_writing; /* the sum of the sizes of the nodes being written */ int64_t cachetable_size_writing; /* the sum of the sizes of the nodes being written */
int64_t get_and_pin_footprint; /* state of get_and_pin procedure */ int64_t get_and_pin_footprint; /* state of get_and_pin procedure */
int64_t local_checkpoint; /* number of times a local checkpoint is taken for commit */ int64_t local_checkpoint; /* number of times a local checkpoint is taken for commit */
...@@ -328,17 +332,21 @@ struct __toku_db_env { ...@@ -328,17 +332,21 @@ struct __toku_db_env {
#define db_env_struct_i(x) ((x)->i) #define db_env_struct_i(x) ((x)->i)
int (*checkpointing_set_period) (DB_ENV*, u_int32_t) /* Change the delay between automatic checkpoints. 0 means disabled. */; int (*checkpointing_set_period) (DB_ENV*, u_int32_t) /* Change the delay between automatic checkpoints. 0 means disabled. */;
int (*checkpointing_get_period) (DB_ENV*, u_int32_t*) /* Retrieve the delay between automatic checkpoints. 0 means disabled. */; int (*checkpointing_get_period) (DB_ENV*, u_int32_t*) /* Retrieve the delay between automatic checkpoints. 0 means disabled. */;
int (*cleaner_set_period) (DB_ENV*, u_int32_t) /* Change the delay between automatic cleaner attempts. 0 means disabled. */;
int (*cleaner_get_period) (DB_ENV*, u_int32_t*) /* Retrieve the delay between automatic cleaner attempts. 0 means disabled. */;
int (*cleaner_set_iterations) (DB_ENV*, u_int32_t) /* Change the number of attempts on each cleaner invokation. 0 means disabled. */;
int (*cleaner_get_iterations) (DB_ENV*, u_int32_t*) /* Retrieve the number of attempts on each cleaner invokation. 0 means disabled. */;
int (*checkpointing_postpone) (DB_ENV*) /* Use for 'rename table' or any other operation that must be disjoint from a checkpoint */; int (*checkpointing_postpone) (DB_ENV*) /* Use for 'rename table' or any other operation that must be disjoint from a checkpoint */;
int (*checkpointing_resume) (DB_ENV*) /* Alert tokudb 'postpone' is no longer necessary */; int (*checkpointing_resume) (DB_ENV*) /* Alert tokudb 'postpone' is no longer necessary */;
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_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 (*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_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 (*get_engine_status) (DB_ENV*, ENGINE_STATUS*, char*, int) /* Fill in status struct, possibly env panic string */; int (*get_engine_status) (DB_ENV*, ENGINE_STATUS*, char*, int) /* Fill in status struct, possibly env panic string */;
void *app_private;
int (*get_engine_status_text) (DB_ENV*, char*, int) /* Fill in status text */; 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 (*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); 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 (*create_indexer) (DB_ENV *env, DB_TXN *txn, DB_INDEXER **idxrp, DB *src_db, int N, DB *dbs[/*N*/], uint32_t db_flags[/*N*/], uint32_t indexer_flags); int (*create_indexer) (DB_ENV *env, DB_TXN *txn, DB_INDEXER **idxrp, DB *src_db, int N, DB *dbs[/*N*/], uint32_t db_flags[/*N*/], uint32_t indexer_flags);
void *app_private;
int (*put_multiple) (DB_ENV *env, DB *src_db, DB_TXN *txn, int (*put_multiple) (DB_ENV *env, DB *src_db, DB_TXN *txn,
const DBT *src_key, const DBT *src_val, const DBT *src_key, const DBT *src_val,
uint32_t num_dbs, DB **db_array, DBT *keys, DBT *vals, uint32_t *flags_array) /* insert into multiple DBs */; uint32_t num_dbs, DB **db_array, DBT *keys, DBT *vals, uint32_t *flags_array) /* insert into multiple DBs */;
......
...@@ -156,7 +156,7 @@ static inline uint64_t mysql_get_bigint(unsigned char *d) { ...@@ -156,7 +156,7 @@ static inline uint64_t mysql_get_bigint(unsigned char *d) {
return r; return r;
} }
static int mysql_key_compare(DB *mydb __attribute__((unused)), static int mysql_key_compare(DESCRIPTOR desc __attribute__((unused)),
const DBT *adbt, const DBT *bdbt) { const DBT *adbt, const DBT *bdbt) {
unsigned char *adata = adbt->data; unsigned char *adata = adbt->data;
unsigned char *bdata = bdbt->data; unsigned char *bdata = bdbt->data;
......
...@@ -84,8 +84,10 @@ typedef struct __toku_engine_status { ...@@ -84,8 +84,10 @@ typedef struct __toku_engine_status {
char checkpoint_time_begin_complete[26]; /* time of last complete checkpoint begin */ char checkpoint_time_begin_complete[26]; /* time of last complete checkpoint begin */
char checkpoint_time_end[26]; /* time of last checkpoint end */ char checkpoint_time_end[26]; /* time of last checkpoint end */
u_int64_t checkpoint_last_lsn; /* LSN of last complete checkpoint */ u_int64_t checkpoint_last_lsn; /* LSN of last complete checkpoint */
u_int32_t checkpoint_count; /* number of checkpoints taken */ u_int32_t checkpoint_count; /* number of checkpoints taken */
u_int32_t checkpoint_count_fail; /* number of checkpoints failed */ u_int32_t checkpoint_count_fail; /* number of checkpoints failed */
u_int32_t cleaner_period; /* delay between automatic checkpoints */
u_int32_t cleaner_iterations; /* delay between automatic checkpoints */
u_int64_t txn_begin; /* number of transactions ever begun */ u_int64_t txn_begin; /* number of transactions ever begun */
u_int64_t txn_commit; /* txn commit operations */ u_int64_t txn_commit; /* txn commit operations */
u_int64_t txn_abort; /* txn abort operations */ u_int64_t txn_abort; /* txn abort operations */
...@@ -113,6 +115,8 @@ typedef struct __toku_engine_status { ...@@ -113,6 +115,8 @@ typedef struct __toku_engine_status {
int64_t cachetable_size_max; /* the max value (high water mark) of cachetable_size_current */ int64_t cachetable_size_max; /* the max value (high water mark) of cachetable_size_current */
uint64_t cachetable_size_leaf; /* the number of bytes of leaf nodes */ uint64_t cachetable_size_leaf; /* the number of bytes of leaf nodes */
uint64_t cachetable_size_nonleaf; /* the number of bytes of nonleaf nodes */ uint64_t cachetable_size_nonleaf; /* the number of bytes of nonleaf nodes */
uint64_t cachetable_size_rollback; /* the number of bytes of nonleaf nodes */
uint64_t cachetable_size_cachepressure; /* the number of bytes of nonleaf nodes */
int64_t cachetable_size_writing; /* the sum of the sizes of the nodes being written */ int64_t cachetable_size_writing; /* the sum of the sizes of the nodes being written */
int64_t get_and_pin_footprint; /* state of get_and_pin procedure */ int64_t get_and_pin_footprint; /* state of get_and_pin procedure */
int64_t local_checkpoint; /* number of times a local checkpoint is taken for commit */ int64_t local_checkpoint; /* number of times a local checkpoint is taken for commit */
...@@ -328,17 +332,21 @@ struct __toku_db_env { ...@@ -328,17 +332,21 @@ struct __toku_db_env {
#define db_env_struct_i(x) ((x)->i) #define db_env_struct_i(x) ((x)->i)
int (*checkpointing_set_period) (DB_ENV*, u_int32_t) /* Change the delay between automatic checkpoints. 0 means disabled. */; int (*checkpointing_set_period) (DB_ENV*, u_int32_t) /* Change the delay between automatic checkpoints. 0 means disabled. */;
int (*checkpointing_get_period) (DB_ENV*, u_int32_t*) /* Retrieve the delay between automatic checkpoints. 0 means disabled. */; int (*checkpointing_get_period) (DB_ENV*, u_int32_t*) /* Retrieve the delay between automatic checkpoints. 0 means disabled. */;
int (*cleaner_set_period) (DB_ENV*, u_int32_t) /* Change the delay between automatic cleaner attempts. 0 means disabled. */;
int (*cleaner_get_period) (DB_ENV*, u_int32_t*) /* Retrieve the delay between automatic cleaner attempts. 0 means disabled. */;
int (*cleaner_set_iterations) (DB_ENV*, u_int32_t) /* Change the number of attempts on each cleaner invokation. 0 means disabled. */;
int (*cleaner_get_iterations) (DB_ENV*, u_int32_t*) /* Retrieve the number of attempts on each cleaner invokation. 0 means disabled. */;
int (*checkpointing_postpone) (DB_ENV*) /* Use for 'rename table' or any other operation that must be disjoint from a checkpoint */; int (*checkpointing_postpone) (DB_ENV*) /* Use for 'rename table' or any other operation that must be disjoint from a checkpoint */;
int (*checkpointing_resume) (DB_ENV*) /* Alert tokudb 'postpone' is no longer necessary */; int (*checkpointing_resume) (DB_ENV*) /* Alert tokudb 'postpone' is no longer necessary */;
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_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 (*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_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 (*get_engine_status) (DB_ENV*, ENGINE_STATUS*, char*, int) /* Fill in status struct, possibly env panic string */; int (*get_engine_status) (DB_ENV*, ENGINE_STATUS*, char*, int) /* Fill in status struct, possibly env panic string */;
void *app_private;
int (*get_engine_status_text) (DB_ENV*, char*, int) /* Fill in status text */; 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 (*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); 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 (*create_indexer) (DB_ENV *env, DB_TXN *txn, DB_INDEXER **idxrp, DB *src_db, int N, DB *dbs[/*N*/], uint32_t db_flags[/*N*/], uint32_t indexer_flags); int (*create_indexer) (DB_ENV *env, DB_TXN *txn, DB_INDEXER **idxrp, DB *src_db, int N, DB *dbs[/*N*/], uint32_t db_flags[/*N*/], uint32_t indexer_flags);
void *app_private;
int (*put_multiple) (DB_ENV *env, DB *src_db, DB_TXN *txn, int (*put_multiple) (DB_ENV *env, DB *src_db, DB_TXN *txn,
const DBT *src_key, const DBT *src_val, const DBT *src_key, const DBT *src_val,
uint32_t num_dbs, DB **db_array, DBT *keys, DBT *vals, uint32_t *flags_array) /* insert into multiple DBs */; uint32_t num_dbs, DB **db_array, DBT *keys, DBT *vals, uint32_t *flags_array) /* insert into multiple DBs */;
......
This diff is collapsed.
...@@ -849,7 +849,7 @@ toku_serialize_brtnode_to (int fd, BLOCKNUM blocknum, BRTNODE node, struct brt_h ...@@ -849,7 +849,7 @@ toku_serialize_brtnode_to (int fd, BLOCKNUM blocknum, BRTNODE node, struct brt_h
static void static void
deserialize_child_buffer(NONLEAF_CHILDINFO bnc, struct rbuf *rbuf, deserialize_child_buffer(NONLEAF_CHILDINFO bnc, struct rbuf *rbuf,
DB *cmp_extra, brt_compare_func cmp) { DESCRIPTOR desc, brt_compare_func cmp) {
int r; int r;
int n_bytes_in_buffer = 0; int n_bytes_in_buffer = 0;
int n_in_this_buffer = rbuf_int(rbuf); int n_in_this_buffer = rbuf_int(rbuf);
...@@ -903,7 +903,7 @@ deserialize_child_buffer(NONLEAF_CHILDINFO bnc, struct rbuf *rbuf, ...@@ -903,7 +903,7 @@ deserialize_child_buffer(NONLEAF_CHILDINFO bnc, struct rbuf *rbuf,
invariant(rbuf->ndone == rbuf->size); invariant(rbuf->ndone == rbuf->size);
if (cmp) { if (cmp) {
struct toku_fifo_entry_key_msn_cmp_extra extra = { .cmp_extra = cmp_extra, .cmp = cmp, .fifo = bnc->buffer }; struct toku_fifo_entry_key_msn_cmp_extra extra = { .desc = desc, .cmp = cmp, .fifo = bnc->buffer };
r = mergesort_r(fresh_offsets, nfresh, sizeof fresh_offsets[0], &extra, toku_fifo_entry_key_msn_cmp); r = mergesort_r(fresh_offsets, nfresh, sizeof fresh_offsets[0], &extra, toku_fifo_entry_key_msn_cmp);
assert_zero(r); assert_zero(r);
toku_omt_destroy(&bnc->fresh_message_tree); toku_omt_destroy(&bnc->fresh_message_tree);
...@@ -1199,11 +1199,10 @@ static void setup_brtnode_partitions(BRTNODE node, struct brtnode_fetch_extra* b ...@@ -1199,11 +1199,10 @@ static void setup_brtnode_partitions(BRTNODE node, struct brtnode_fetch_extra* b
// we can possibly require is a single basement node // we can possibly require is a single basement node
// we find out what basement node the query cares about // we find out what basement node the query cares about
// and check if it is available // and check if it is available
assert(bfe->cmp);
assert(bfe->search); assert(bfe->search);
bfe->child_to_read = toku_brt_search_which_child( bfe->child_to_read = toku_brt_search_which_child(
bfe->cmp_extra, &bfe->h->descriptor,
bfe->cmp, bfe->h->compare_fun,
node, node,
bfe->search bfe->search
); );
...@@ -1252,7 +1251,7 @@ deserialize_brtnode_partition( ...@@ -1252,7 +1251,7 @@ deserialize_brtnode_partition(
struct sub_block *sb, struct sub_block *sb,
BRTNODE node, BRTNODE node,
int index, int index,
DB *cmp_extra, DESCRIPTOR desc,
brt_compare_func cmp brt_compare_func cmp
) )
{ {
...@@ -1267,7 +1266,7 @@ deserialize_brtnode_partition( ...@@ -1267,7 +1266,7 @@ deserialize_brtnode_partition(
if (node->height > 0) { if (node->height > 0) {
unsigned char ch = rbuf_char(&rb); unsigned char ch = rbuf_char(&rb);
assert(ch == BRTNODE_PARTITION_FIFO_MSG); assert(ch == BRTNODE_PARTITION_FIFO_MSG);
deserialize_child_buffer(BNC(node, index), &rb, cmp_extra, cmp); deserialize_child_buffer(BNC(node, index), &rb, desc, cmp);
BP_WORKDONE(node, index) = 0; BP_WORKDONE(node, index) = 0;
} }
else { else {
...@@ -1297,11 +1296,11 @@ deserialize_brtnode_partition( ...@@ -1297,11 +1296,11 @@ deserialize_brtnode_partition(
} }
static void static void
decompress_and_deserialize_worker(struct rbuf curr_rbuf, struct sub_block curr_sb, BRTNODE node, int child, DB *cmp_extra, brt_compare_func cmp) decompress_and_deserialize_worker(struct rbuf curr_rbuf, struct sub_block curr_sb, BRTNODE node, int child, DESCRIPTOR desc, brt_compare_func cmp)
{ {
read_and_decompress_sub_block(&curr_rbuf, &curr_sb); read_and_decompress_sub_block(&curr_rbuf, &curr_sb);
// at this point, sb->uncompressed_ptr stores the serialized node partition // at this point, sb->uncompressed_ptr stores the serialized node partition
deserialize_brtnode_partition(&curr_sb, node, child, cmp_extra, cmp); deserialize_brtnode_partition(&curr_sb, node, child, desc, cmp);
toku_free(curr_sb.uncompressed_ptr); toku_free(curr_sb.uncompressed_ptr);
} }
...@@ -1564,7 +1563,7 @@ deserialize_brtnode_from_rbuf( ...@@ -1564,7 +1563,7 @@ deserialize_brtnode_from_rbuf(
switch (BP_STATE(node,i)) { switch (BP_STATE(node,i)) {
case PT_AVAIL: case PT_AVAIL:
// case where we read and decompress the partition // case where we read and decompress the partition
decompress_and_deserialize_worker(curr_rbuf, curr_sb, node, i, bfe->cmp_extra, bfe->cmp); decompress_and_deserialize_worker(curr_rbuf, curr_sb, node, i, &bfe->h->descriptor, bfe->h->compare_fun);
continue; continue;
case PT_COMPRESSED: case PT_COMPRESSED:
// case where we leave the partition in the compressed state // case where we leave the partition in the compressed state
...@@ -1626,7 +1625,7 @@ toku_deserialize_bp_from_disk(BRTNODE node, int childnum, int fd, struct brtnode ...@@ -1626,7 +1625,7 @@ toku_deserialize_bp_from_disk(BRTNODE node, int childnum, int fd, struct brtnode
read_and_decompress_sub_block(&rb, &curr_sb); read_and_decompress_sub_block(&rb, &curr_sb);
// at this point, sb->uncompressed_ptr stores the serialized node partition // at this point, sb->uncompressed_ptr stores the serialized node partition
deserialize_brtnode_partition(&curr_sb, node, childnum, bfe->cmp_extra, bfe->cmp); deserialize_brtnode_partition(&curr_sb, node, childnum, &bfe->h->descriptor, bfe->h->compare_fun);
if (node->height == 0) { if (node->height == 0) {
toku_brt_bn_reset_stats(node, childnum); toku_brt_bn_reset_stats(node, childnum);
} }
...@@ -1638,7 +1637,7 @@ toku_deserialize_bp_from_disk(BRTNODE node, int childnum, int fd, struct brtnode ...@@ -1638,7 +1637,7 @@ toku_deserialize_bp_from_disk(BRTNODE node, int childnum, int fd, struct brtnode
// Take a brtnode partition that is in the compressed state, and make it avail // Take a brtnode partition that is in the compressed state, and make it avail
void void
toku_deserialize_bp_from_compressed(BRTNODE node, int childnum, toku_deserialize_bp_from_compressed(BRTNODE node, int childnum,
DB *cmp_extra, brt_compare_func cmp) { DESCRIPTOR desc, brt_compare_func cmp) {
assert(BP_STATE(node, childnum) == PT_COMPRESSED); assert(BP_STATE(node, childnum) == PT_COMPRESSED);
SUB_BLOCK curr_sb = BSB(node, childnum); SUB_BLOCK curr_sb = BSB(node, childnum);
...@@ -1654,7 +1653,7 @@ toku_deserialize_bp_from_compressed(BRTNODE node, int childnum, ...@@ -1654,7 +1653,7 @@ toku_deserialize_bp_from_compressed(BRTNODE node, int childnum,
curr_sb->compressed_ptr, curr_sb->compressed_ptr,
curr_sb->compressed_size curr_sb->compressed_size
); );
deserialize_brtnode_partition(curr_sb, node, childnum, cmp_extra, cmp); deserialize_brtnode_partition(curr_sb, node, childnum, desc, cmp);
if (node->height == 0) { if (node->height == 0) {
toku_brt_bn_reset_stats(node, childnum); toku_brt_bn_reset_stats(node, childnum);
} }
......
...@@ -32,7 +32,7 @@ BOOL ignore_if_was_already_open; ...@@ -32,7 +32,7 @@ BOOL ignore_if_was_already_open;
int toku_testsetup_leaf(BRT brt, BLOCKNUM *blocknum) { int toku_testsetup_leaf(BRT brt, BLOCKNUM *blocknum) {
BRTNODE node; BRTNODE node;
assert(testsetup_initialized); assert(testsetup_initialized);
int r = toku_read_brt_header_and_store_in_cachefile(brt->cf, MAX_LSN, &brt->h, &ignore_if_was_already_open); int r = toku_read_brt_header_and_store_in_cachefile(brt, brt->cf, MAX_LSN, &brt->h, &ignore_if_was_already_open);
if (r!=0) return r; if (r!=0) return r;
toku_create_new_brtnode(brt, &node, 0, 1); toku_create_new_brtnode(brt, &node, 0, 1);
BP_STATE(node,0) = PT_AVAIL; BP_STATE(node,0) = PT_AVAIL;
...@@ -47,7 +47,7 @@ int toku_testsetup_nonleaf (BRT brt, int height, BLOCKNUM *blocknum, int n_child ...@@ -47,7 +47,7 @@ int toku_testsetup_nonleaf (BRT brt, int height, BLOCKNUM *blocknum, int n_child
BRTNODE node; BRTNODE node;
assert(testsetup_initialized); assert(testsetup_initialized);
assert(n_children<=BRT_FANOUT); assert(n_children<=BRT_FANOUT);
int r = toku_read_brt_header_and_store_in_cachefile(brt->cf, MAX_LSN, &brt->h, &ignore_if_was_already_open); int r = toku_read_brt_header_and_store_in_cachefile(brt, brt->cf, MAX_LSN, &brt->h, &ignore_if_was_already_open);
if (r!=0) return r; if (r!=0) return r;
toku_create_new_brtnode(brt, &node, height, n_children); toku_create_new_brtnode(brt, &node, height, n_children);
int i; int i;
...@@ -56,8 +56,8 @@ int toku_testsetup_nonleaf (BRT brt, int height, BLOCKNUM *blocknum, int n_child ...@@ -56,8 +56,8 @@ int toku_testsetup_nonleaf (BRT brt, int height, BLOCKNUM *blocknum, int n_child
BP_STATE(node,i) = PT_AVAIL; BP_STATE(node,i) = PT_AVAIL;
} }
for (i=0; i+1<n_children; i++) { for (i=0; i+1<n_children; i++) {
node->childkeys[i] = kv_pair_malloc(keys[i], keylens[i], 0, 0); node->childkeys[i] = kv_pair_malloc(keys[i], keylens[i], 0, 0);
node->totalchildkeylens += keylens[i]; node->totalchildkeylens += keylens[i];
} }
*blocknum = node->thisnodename; *blocknum = node->thisnodename;
toku_unpin_brtnode(brt, node); toku_unpin_brtnode(brt, node);
...@@ -66,7 +66,7 @@ int toku_testsetup_nonleaf (BRT brt, int height, BLOCKNUM *blocknum, int n_child ...@@ -66,7 +66,7 @@ int toku_testsetup_nonleaf (BRT brt, int height, BLOCKNUM *blocknum, int n_child
int toku_testsetup_root(BRT brt, BLOCKNUM blocknum) { int toku_testsetup_root(BRT brt, BLOCKNUM blocknum) {
assert(testsetup_initialized); assert(testsetup_initialized);
int r = toku_read_brt_header_and_store_in_cachefile(brt->cf, MAX_LSN, &brt->h, &ignore_if_was_already_open); int r = toku_read_brt_header_and_store_in_cachefile(brt, brt->cf, MAX_LSN, &brt->h, &ignore_if_was_already_open);
if (r!=0) return r; if (r!=0) return r;
brt->h->root = blocknum; brt->h->root = blocknum;
brt->h->root_hash.valid = FALSE; brt->h->root_hash.valid = FALSE;
...@@ -78,7 +78,7 @@ int toku_testsetup_get_sersize(BRT brt, BLOCKNUM diskoff) // Return the size on ...@@ -78,7 +78,7 @@ int toku_testsetup_get_sersize(BRT brt, BLOCKNUM diskoff) // Return the size on
assert(testsetup_initialized); assert(testsetup_initialized);
void *node_v; void *node_v;
struct brtnode_fetch_extra bfe; struct brtnode_fetch_extra bfe;
fill_bfe_for_full_read(&bfe, brt->h, brt->db, brt->compare_fun); fill_bfe_for_full_read(&bfe, brt->h);
int r = toku_cachetable_get_and_pin( int r = toku_cachetable_get_and_pin(
brt->cf, diskoff, brt->cf, diskoff,
toku_cachetable_hash(brt->cf, diskoff), toku_cachetable_hash(brt->cf, diskoff),
...@@ -90,6 +90,7 @@ int toku_testsetup_get_sersize(BRT brt, BLOCKNUM diskoff) // Return the size on ...@@ -90,6 +90,7 @@ int toku_testsetup_get_sersize(BRT brt, BLOCKNUM diskoff) // Return the size on
toku_brtnode_pe_callback, toku_brtnode_pe_callback,
toku_brtnode_pf_req_callback, toku_brtnode_pf_req_callback,
toku_brtnode_pf_callback, toku_brtnode_pf_callback,
toku_brtnode_cleaner_callback,
&bfe, &bfe,
brt->h brt->h
); );
...@@ -106,7 +107,7 @@ int toku_testsetup_insert_to_leaf (BRT brt, BLOCKNUM blocknum, char *key, int ke ...@@ -106,7 +107,7 @@ int toku_testsetup_insert_to_leaf (BRT brt, BLOCKNUM blocknum, char *key, int ke
assert(testsetup_initialized); assert(testsetup_initialized);
struct brtnode_fetch_extra bfe; struct brtnode_fetch_extra bfe;
fill_bfe_for_full_read(&bfe, brt->h, brt->db, brt->compare_fun); fill_bfe_for_full_read(&bfe, brt->h);
r = toku_cachetable_get_and_pin( r = toku_cachetable_get_and_pin(
brt->cf, brt->cf,
blocknum, blocknum,
...@@ -119,6 +120,7 @@ int toku_testsetup_insert_to_leaf (BRT brt, BLOCKNUM blocknum, char *key, int ke ...@@ -119,6 +120,7 @@ int toku_testsetup_insert_to_leaf (BRT brt, BLOCKNUM blocknum, char *key, int ke
toku_brtnode_pe_callback, toku_brtnode_pe_callback,
toku_brtnode_pf_req_callback, toku_brtnode_pf_req_callback,
toku_brtnode_pf_callback, toku_brtnode_pf_callback,
toku_brtnode_cleaner_callback,
&bfe, &bfe,
brt->h brt->h
); );
...@@ -143,7 +145,7 @@ int toku_testsetup_insert_to_leaf (BRT brt, BLOCKNUM blocknum, char *key, int ke ...@@ -143,7 +145,7 @@ int toku_testsetup_insert_to_leaf (BRT brt, BLOCKNUM blocknum, char *key, int ke
assert(r==0); assert(r==0);
struct cmd_leafval_heaviside_extra be = {brt, &keydbt}; struct cmd_leafval_heaviside_extra be = {brt->compare_fun, &brt->h->descriptor, &keydbt};
r = toku_omt_find_zero(BLB_BUFFER(node, 0), toku_cmd_leafval_heaviside, &be, &storeddatav, &idx); r = toku_omt_find_zero(BLB_BUFFER(node, 0), toku_cmd_leafval_heaviside, &be, &storeddatav, &idx);
...@@ -185,7 +187,7 @@ int toku_testsetup_insert_to_nonleaf (BRT brt, BLOCKNUM blocknum, enum brt_msg_t ...@@ -185,7 +187,7 @@ int toku_testsetup_insert_to_nonleaf (BRT brt, BLOCKNUM blocknum, enum brt_msg_t
assert(testsetup_initialized); assert(testsetup_initialized);
struct brtnode_fetch_extra bfe; struct brtnode_fetch_extra bfe;
fill_bfe_for_full_read(&bfe, brt->h, brt->db, brt->compare_fun); fill_bfe_for_full_read(&bfe, brt->h);
r = toku_cachetable_get_and_pin( r = toku_cachetable_get_and_pin(
brt->cf, brt->cf,
blocknum, blocknum,
...@@ -198,6 +200,7 @@ int toku_testsetup_insert_to_nonleaf (BRT brt, BLOCKNUM blocknum, enum brt_msg_t ...@@ -198,6 +200,7 @@ int toku_testsetup_insert_to_nonleaf (BRT brt, BLOCKNUM blocknum, enum brt_msg_t
toku_brtnode_pe_callback, toku_brtnode_pe_callback,
toku_brtnode_pf_req_callback, toku_brtnode_pf_req_callback,
toku_brtnode_pf_callback, toku_brtnode_pf_callback,
toku_brtnode_cleaner_callback,
&bfe, &bfe,
brt->h brt->h
); );
...@@ -208,7 +211,7 @@ int toku_testsetup_insert_to_nonleaf (BRT brt, BLOCKNUM blocknum, enum brt_msg_t ...@@ -208,7 +211,7 @@ int toku_testsetup_insert_to_nonleaf (BRT brt, BLOCKNUM blocknum, enum brt_msg_t
DBT k; DBT k;
int childnum = toku_brtnode_which_child(node, int childnum = toku_brtnode_which_child(node,
toku_fill_dbt(&k, key, keylen), toku_fill_dbt(&k, key, keylen),
brt->db, brt->compare_fun); &brt->h->descriptor, brt->compare_fun);
XIDS xids_0 = xids_get_root_xids(); XIDS xids_0 = xids_get_root_xids();
MSN msn = next_dummymsn(); MSN msn = next_dummymsn();
......
...@@ -175,7 +175,7 @@ toku_verify_brtnode (BRT brt, ...@@ -175,7 +175,7 @@ toku_verify_brtnode (BRT brt,
u_int32_t fullhash = toku_cachetable_hash(brt->cf, blocknum); u_int32_t fullhash = toku_cachetable_hash(brt->cf, blocknum);
{ {
struct brtnode_fetch_extra bfe; struct brtnode_fetch_extra bfe;
fill_bfe_for_full_read(&bfe, brt->h, brt->db, brt->compare_fun); fill_bfe_for_full_read(&bfe, brt->h);
int r = toku_cachetable_get_and_pin( int r = toku_cachetable_get_and_pin(
brt->cf, brt->cf,
blocknum, blocknum,
...@@ -188,6 +188,7 @@ toku_verify_brtnode (BRT brt, ...@@ -188,6 +188,7 @@ toku_verify_brtnode (BRT brt,
toku_brtnode_pe_callback, toku_brtnode_pe_callback,
toku_brtnode_pf_req_callback, toku_brtnode_pf_req_callback,
toku_brtnode_pf_callback, toku_brtnode_pf_callback,
toku_brtnode_cleaner_callback,
&bfe, &bfe,
brt->h brt->h
); );
...@@ -332,7 +333,7 @@ toku_verify_brtnode (BRT brt, ...@@ -332,7 +333,7 @@ toku_verify_brtnode (BRT brt,
} }
done: done:
{ {
int r = toku_cachetable_unpin(brt->cf, blocknum, fullhash, CACHETABLE_CLEAN, 0); int r = toku_cachetable_unpin(brt->cf, blocknum, fullhash, CACHETABLE_CLEAN, make_brtnode_pair_attr(node));
assert_zero(r); // this is a bad failure if it happens. assert_zero(r); // this is a bad failure if it happens.
} }
......
This diff is collapsed.
...@@ -28,7 +28,7 @@ C_BEGIN ...@@ -28,7 +28,7 @@ C_BEGIN
//-infinity depending on direction) //-infinity depending on direction)
typedef int(*BRT_GET_CALLBACK_FUNCTION)(ITEMLEN, bytevec, ITEMLEN, bytevec, void*); typedef int(*BRT_GET_CALLBACK_FUNCTION)(ITEMLEN, bytevec, ITEMLEN, bytevec, void*);
int toku_open_brt (const char *fname, int is_create, BRT *, int nodesize, int basementnodesize, CACHETABLE, TOKUTXN, int(*)(DB*,const DBT*,const DBT*), DB*) __attribute__ ((warn_unused_result)); int toku_open_brt (const char *fname, int is_create, BRT *, int nodesize, int basementnodesize, CACHETABLE, TOKUTXN, int(*)(DB *,const DBT*,const DBT*), DB*) __attribute__ ((warn_unused_result));
int toku_brt_change_descriptor(BRT t, const DBT* old_descriptor, const DBT* new_descriptor, BOOL do_log, TOKUTXN txn); int toku_brt_change_descriptor(BRT t, const DBT* old_descriptor, const DBT* new_descriptor, BOOL do_log, TOKUTXN txn);
int toku_update_descriptor(struct brt_header * h, DESCRIPTOR d, int fd); int toku_update_descriptor(struct brt_header * h, DESCRIPTOR d, int fd);
...@@ -89,10 +89,7 @@ brt_compare_func toku_brt_get_bt_compare (BRT brt); ...@@ -89,10 +89,7 @@ brt_compare_func toku_brt_get_bt_compare (BRT brt);
// Question: Why does the update_function need a DB_TXN? // Question: Why does the update_function need a DB_TXN?
int toku_brt_set_update(BRT brt, int (*update_fun)(DB *, int toku_brt_set_update(BRT brt, brt_update_func update_fun) __attribute__ ((warn_unused_result));
const DBT *key, const DBT *old_val, const DBT *extra,
void (*set_val)(const DBT *new_val, void *set_extra), void *set_extra))
__attribute__ ((warn_unused_result));
int toku_brt_update(BRT brt, TOKUTXN txn, const DBT *key, const DBT *extra) __attribute__ ((warn_unused_result)); int toku_brt_update(BRT brt, TOKUTXN txn, const DBT *key, const DBT *extra) __attribute__ ((warn_unused_result));
int toku_brt_broadcast_update(BRT brt, TOKUTXN txn, const DBT *extra) __attribute__ ((warn_unused_result)); int toku_brt_broadcast_update(BRT brt, TOKUTXN txn, const DBT *extra) __attribute__ ((warn_unused_result));
......
...@@ -120,7 +120,7 @@ static void ...@@ -120,7 +120,7 @@ static void
dump_node (int f, BLOCKNUM blocknum, struct brt_header *h) { dump_node (int f, BLOCKNUM blocknum, struct brt_header *h) {
BRTNODE n; BRTNODE n;
struct brtnode_fetch_extra bfe; struct brtnode_fetch_extra bfe;
fill_bfe_for_full_read(&bfe, h, NULL, NULL); fill_bfe_for_full_read(&bfe, h);
int r = toku_deserialize_brtnode_from (f, blocknum, 0 /*pass zero for hash, it doesn't matter*/, &n, &bfe); int r = toku_deserialize_brtnode_from (f, blocknum, 0 /*pass zero for hash, it doesn't matter*/, &n, &bfe);
assert(r==0); assert(r==0);
assert(n!=0); assert(n!=0);
...@@ -231,7 +231,7 @@ fragmentation_helper(BLOCKNUM b, int64_t size, int64_t UU(address), void *extra) ...@@ -231,7 +231,7 @@ fragmentation_helper(BLOCKNUM b, int64_t size, int64_t UU(address), void *extra)
frag_help_extra *info = extra; frag_help_extra *info = extra;
BRTNODE n; BRTNODE n;
struct brtnode_fetch_extra bfe; struct brtnode_fetch_extra bfe;
fill_bfe_for_full_read(&bfe, info->h, NULL, NULL); fill_bfe_for_full_read(&bfe, info->h);
int r = toku_deserialize_brtnode_from(info->f, b, 0 /*pass zero for hash, it doesn't matter*/, &n, &bfe); int r = toku_deserialize_brtnode_from(info->f, b, 0 /*pass zero for hash, it doesn't matter*/, &n, &bfe);
if (r==0) { if (r==0) {
info->blocksizes += size; info->blocksizes += size;
......
...@@ -38,11 +38,30 @@ typedef u_int64_t TXNID; ...@@ -38,11 +38,30 @@ typedef u_int64_t TXNID;
#define TXNID_NONE_LIVING ((TXNID)0) #define TXNID_NONE_LIVING ((TXNID)0)
#define TXNID_NONE ((TXNID)0) #define TXNID_NONE ((TXNID)0)
typedef struct s_blocknum { int64_t b; } BLOCKNUM; // make a struct so that we will notice type problems. typedef struct blocknum_s { int64_t b; } BLOCKNUM; // make a struct so that we will notice type problems.
#define ROLLBACK_NONE ((BLOCKNUM){0}) #define ROLLBACK_NONE ((BLOCKNUM){0})
static inline BLOCKNUM make_blocknum(int64_t b) { BLOCKNUM result={b}; return result; } static inline BLOCKNUM make_blocknum(int64_t b) { BLOCKNUM result={b}; return result; }
typedef struct pair_attr_s {
long size;
long nonleaf_size;
long leaf_size;
long rollback_size;
long cache_pressure_size;
} PAIR_ATTR;
static inline PAIR_ATTR make_pair_attr(long size) {
PAIR_ATTR result={
.size = size,
.nonleaf_size = 0,
.leaf_size = 0,
.rollback_size = 0,
.cache_pressure_size = 0
};
return result;
}
typedef struct { typedef struct {
u_int32_t len; u_int32_t len;
char *data; char *data;
......
This diff is collapsed.
This diff is collapsed.
...@@ -445,15 +445,27 @@ int toku_rollback_abort(TOKUTXN txn, YIELDF yield, void*yieldv, LSN lsn) { ...@@ -445,15 +445,27 @@ int toku_rollback_abort(TOKUTXN txn, YIELDF yield, void*yieldv, LSN lsn) {
return r; return r;
} }
static inline PAIR_ATTR make_rollback_pair_attr(long size) {
PAIR_ATTR result={
.size = size,
.nonleaf_size = 0,
.leaf_size = 0,
.rollback_size = size,
.cache_pressure_size = 0
};
return result;
}
// Write something out. Keep trying even if partial writes occur. // Write something out. Keep trying even if partial writes occur.
// On error: Return negative with errno set. // On error: Return negative with errno set.
// On success return nbytes. // On success return nbytes.
static size_t static PAIR_ATTR
rollback_memory_size(ROLLBACK_LOG_NODE log) { rollback_memory_size(ROLLBACK_LOG_NODE log) {
size_t size = sizeof(*log); size_t size = sizeof(*log);
size += memarena_total_memory_size(log->rollentry_arena); size += memarena_total_memory_size(log->rollentry_arena);
return size; return make_rollback_pair_attr(size);
} }
static void static void
...@@ -467,7 +479,7 @@ toku_rollback_log_free(ROLLBACK_LOG_NODE *log_p) { ...@@ -467,7 +479,7 @@ toku_rollback_log_free(ROLLBACK_LOG_NODE *log_p) {
} }
static void toku_rollback_flush_callback (CACHEFILE cachefile, int fd, BLOCKNUM logname, static void toku_rollback_flush_callback (CACHEFILE cachefile, int fd, BLOCKNUM logname,
void *rollback_v, void *extraargs, long size, long* new_size, void *rollback_v, void *extraargs, PAIR_ATTR size, PAIR_ATTR* new_size,
BOOL write_me, BOOL keep_me, BOOL for_checkpoint) { BOOL write_me, BOOL keep_me, BOOL for_checkpoint) {
int r; int r;
ROLLBACK_LOG_NODE log = rollback_v; ROLLBACK_LOG_NODE log = rollback_v;
...@@ -499,7 +511,7 @@ static void toku_rollback_flush_callback (CACHEFILE cachefile, int fd, BLOCKNUM ...@@ -499,7 +511,7 @@ static void toku_rollback_flush_callback (CACHEFILE cachefile, int fd, BLOCKNUM
} }
static int toku_rollback_fetch_callback (CACHEFILE cachefile, int fd, BLOCKNUM logname, u_int32_t fullhash, static int toku_rollback_fetch_callback (CACHEFILE cachefile, int fd, BLOCKNUM logname, u_int32_t fullhash,
void **rollback_pv, long *sizep, int * UU(dirtyp), void *extraargs) { void **rollback_pv, PAIR_ATTR *sizep, int * UU(dirtyp), void *extraargs) {
int r; int r;
struct brt_header *h = extraargs; struct brt_header *h = extraargs;
assert(h->cf == cachefile); assert(h->cf == cachefile);
...@@ -527,25 +539,35 @@ static void toku_rollback_pe_est_callback( ...@@ -527,25 +539,35 @@ static void toku_rollback_pe_est_callback(
// callback for partially evicting a cachetable entry // callback for partially evicting a cachetable entry
static int toku_rollback_pe_callback ( static int toku_rollback_pe_callback (
void *rollback_v, void *rollback_v,
long UU(bytes_to_free), PAIR_ATTR UU(old_attr),
long* bytes_freed, PAIR_ATTR* new_attr,
void* UU(extraargs) void* UU(extraargs)
) )
{ {
assert(rollback_v != NULL); assert(rollback_v != NULL);
*bytes_freed = 0; *new_attr = old_attr;
return 0; return 0;
} }
static BOOL toku_rollback_pf_req_callback(void* UU(brtnode_pv), void* UU(read_extraargs)) { static BOOL toku_rollback_pf_req_callback(void* UU(brtnode_pv), void* UU(read_extraargs)) {
return FALSE; return FALSE;
} }
static int toku_rollback_pf_callback(void* UU(brtnode_pv), void* UU(read_extraargs), int UU(fd), long* UU(sizep)) { static int toku_rollback_pf_callback(void* UU(brtnode_pv), void* UU(read_extraargs), int UU(fd), PAIR_ATTR* UU(sizep)) {
// should never be called, given that toku_rollback_pf_req_callback always returns false // should never be called, given that toku_rollback_pf_req_callback always returns false
assert(FALSE); assert(FALSE);
return 0; return 0;
} }
static int toku_rollback_cleaner_callback (
void* UU(brtnode_pv),
BLOCKNUM UU(blocknum),
u_int32_t UU(fullhash),
void* UU(extraargs)
)
{
assert(FALSE);
return 0;
}
static int toku_create_new_rollback_log (TOKUTXN txn, BLOCKNUM older, uint32_t older_hash, ROLLBACK_LOG_NODE *result) { static int toku_create_new_rollback_log (TOKUTXN txn, BLOCKNUM older, uint32_t older_hash, ROLLBACK_LOG_NODE *result) {
...@@ -577,6 +599,7 @@ static int toku_create_new_rollback_log (TOKUTXN txn, BLOCKNUM older, uint32_t o ...@@ -577,6 +599,7 @@ static int toku_create_new_rollback_log (TOKUTXN txn, BLOCKNUM older, uint32_t o
toku_rollback_flush_callback, toku_rollback_flush_callback,
toku_rollback_pe_est_callback, toku_rollback_pe_est_callback,
toku_rollback_pe_callback, toku_rollback_pe_callback,
toku_rollback_cleaner_callback,
h); h);
assert(r==0); assert(r==0);
txn->current_rollback = log->thislogname; txn->current_rollback = log->thislogname;
...@@ -807,6 +830,7 @@ toku_maybe_prefetch_older_rollback_log(TOKUTXN txn, ROLLBACK_LOG_NODE log) { ...@@ -807,6 +830,7 @@ toku_maybe_prefetch_older_rollback_log(TOKUTXN txn, ROLLBACK_LOG_NODE log) {
toku_rollback_pe_callback, toku_rollback_pe_callback,
toku_brtnode_pf_req_callback, toku_brtnode_pf_req_callback,
toku_brtnode_pf_callback, toku_brtnode_pf_callback,
toku_rollback_cleaner_callback,
h, h,
h, h,
&doing_prefetch); &doing_prefetch);
...@@ -838,6 +862,7 @@ int toku_get_and_pin_rollback_log(TOKUTXN txn, TXNID xid, uint64_t sequence, BLO ...@@ -838,6 +862,7 @@ int toku_get_and_pin_rollback_log(TOKUTXN txn, TXNID xid, uint64_t sequence, BLO
toku_rollback_pe_callback, toku_rollback_pe_callback,
toku_rollback_pf_req_callback, toku_rollback_pf_req_callback,
toku_rollback_pf_callback, toku_rollback_pf_callback,
toku_rollback_cleaner_callback,
h, h,
h h
); );
......
...@@ -111,6 +111,7 @@ test_serialize_leaf(int valsize, int nelts, double entropy) { ...@@ -111,6 +111,7 @@ test_serialize_leaf(int valsize, int nelts, double entropy) {
brt_h->type = BRTHEADER_CURRENT; brt_h->type = BRTHEADER_CURRENT;
brt_h->panic = 0; brt_h->panic_string = 0; brt_h->panic = 0; brt_h->panic_string = 0;
brt_h->basementnodesize = 128*1024; brt_h->basementnodesize = 128*1024;
brt_h->compare_fun = long_key_cmp;
toku_blocktable_create_new(&brt_h->blocktable); toku_blocktable_create_new(&brt_h->blocktable);
//Want to use block #20 //Want to use block #20
BLOCKNUM b = make_blocknum(0); BLOCKNUM b = make_blocknum(0);
...@@ -140,7 +141,7 @@ test_serialize_leaf(int valsize, int nelts, double entropy) { ...@@ -140,7 +141,7 @@ test_serialize_leaf(int valsize, int nelts, double entropy) {
printf("serialize leaf: %0.05lf\n", dt); printf("serialize leaf: %0.05lf\n", dt);
struct brtnode_fetch_extra bfe; struct brtnode_fetch_extra bfe;
fill_bfe_for_full_read(&bfe, brt_h, NULL, long_key_cmp); fill_bfe_for_full_read(&bfe, brt_h);
gettimeofday(&t[0], NULL); gettimeofday(&t[0], NULL);
r = toku_deserialize_brtnode_from(fd, make_blocknum(20), 0/*pass zero for hash*/, &dn, &bfe); r = toku_deserialize_brtnode_from(fd, make_blocknum(20), 0/*pass zero for hash*/, &dn, &bfe);
assert(r==0); assert(r==0);
...@@ -241,6 +242,7 @@ test_serialize_nonleaf(int valsize, int nelts, double entropy) { ...@@ -241,6 +242,7 @@ test_serialize_nonleaf(int valsize, int nelts, double entropy) {
brt_h->type = BRTHEADER_CURRENT; brt_h->type = BRTHEADER_CURRENT;
brt_h->panic = 0; brt_h->panic_string = 0; brt_h->panic = 0; brt_h->panic_string = 0;
brt_h->basementnodesize = 128*1024; brt_h->basementnodesize = 128*1024;
brt_h->compare_fun = long_key_cmp;
toku_blocktable_create_new(&brt_h->blocktable); toku_blocktable_create_new(&brt_h->blocktable);
//Want to use block #20 //Want to use block #20
BLOCKNUM b = make_blocknum(0); BLOCKNUM b = make_blocknum(0);
...@@ -270,7 +272,7 @@ test_serialize_nonleaf(int valsize, int nelts, double entropy) { ...@@ -270,7 +272,7 @@ test_serialize_nonleaf(int valsize, int nelts, double entropy) {
printf("serialize nonleaf: %0.05lf\n", dt); printf("serialize nonleaf: %0.05lf\n", dt);
struct brtnode_fetch_extra bfe; struct brtnode_fetch_extra bfe;
fill_bfe_for_full_read(&bfe, brt_h, NULL, long_key_cmp); fill_bfe_for_full_read(&bfe, brt_h);
gettimeofday(&t[0], NULL); gettimeofday(&t[0], NULL);
r = toku_deserialize_brtnode_from(fd, make_blocknum(20), 0/*pass zero for hash*/, &dn, &bfe); r = toku_deserialize_brtnode_from(fd, make_blocknum(20), 0/*pass zero for hash*/, &dn, &bfe);
assert(r==0); assert(r==0);
......
...@@ -94,15 +94,16 @@ string_key_cmp(DB *UU(e), const DBT *a, const DBT *b) ...@@ -94,15 +94,16 @@ string_key_cmp(DB *UU(e), const DBT *a, const DBT *b)
static void static void
setup_dn(enum brtnode_verify_type bft, int fd, struct brt_header *brt_h, BRTNODE *dn) { setup_dn(enum brtnode_verify_type bft, int fd, struct brt_header *brt_h, BRTNODE *dn) {
int r; int r;
brt_h->compare_fun = string_key_cmp;
if (bft == read_all) { if (bft == read_all) {
struct brtnode_fetch_extra bfe; struct brtnode_fetch_extra bfe;
fill_bfe_for_full_read(&bfe, brt_h, NULL, string_key_cmp); fill_bfe_for_full_read(&bfe, brt_h);
r = toku_deserialize_brtnode_from(fd, make_blocknum(20), 0/*pass zero for hash*/, dn, &bfe); r = toku_deserialize_brtnode_from(fd, make_blocknum(20), 0/*pass zero for hash*/, dn, &bfe);
assert(r==0); assert(r==0);
} }
else if (bft == read_compressed || bft == read_none) { else if (bft == read_compressed || bft == read_none) {
struct brtnode_fetch_extra bfe; struct brtnode_fetch_extra bfe;
fill_bfe_for_min_read(&bfe, brt_h, NULL, string_key_cmp); fill_bfe_for_min_read(&bfe, brt_h);
r = toku_deserialize_brtnode_from(fd, make_blocknum(20), 0/*pass zero for hash*/, dn, &bfe); r = toku_deserialize_brtnode_from(fd, make_blocknum(20), 0/*pass zero for hash*/, dn, &bfe);
assert(r==0); assert(r==0);
// assert all bp's are compressed or on disk. // assert all bp's are compressed or on disk.
...@@ -112,8 +113,8 @@ setup_dn(enum brtnode_verify_type bft, int fd, struct brt_header *brt_h, BRTNODE ...@@ -112,8 +113,8 @@ setup_dn(enum brtnode_verify_type bft, int fd, struct brt_header *brt_h, BRTNODE
// if read_none, get rid of the compressed bp's // if read_none, get rid of the compressed bp's
if (bft == read_none) { if (bft == read_none) {
if ((*dn)->height == 0) { if ((*dn)->height == 0) {
long bytes_freed = 0; PAIR_ATTR attr;
toku_brtnode_pe_callback(*dn, 0xffffffff, &bytes_freed, NULL); toku_brtnode_pe_callback(*dn, make_pair_attr(0xffffffff), &attr, NULL);
// assert all bp's are on disk // assert all bp's are on disk
for (int i = 0; i < (*dn)->n_children; i++) { for (int i = 0; i < (*dn)->n_children; i++) {
if ((*dn)->height == 0) { if ((*dn)->height == 0) {
...@@ -129,34 +130,33 @@ setup_dn(enum brtnode_verify_type bft, int fd, struct brt_header *brt_h, BRTNODE ...@@ -129,34 +130,33 @@ setup_dn(enum brtnode_verify_type bft, int fd, struct brt_header *brt_h, BRTNODE
// first decompress everything, and make sure // first decompress everything, and make sure
// that it is available // that it is available
// then run partial eviction to get it compressed // then run partial eviction to get it compressed
fill_bfe_for_full_read(&bfe, brt_h, NULL, string_key_cmp); PAIR_ATTR attr;
fill_bfe_for_full_read(&bfe, brt_h);
assert(toku_brtnode_pf_req_callback(*dn, &bfe)); assert(toku_brtnode_pf_req_callback(*dn, &bfe));
long size; r = toku_brtnode_pf_callback(*dn, &bfe, fd, &attr);
r = toku_brtnode_pf_callback(*dn, &bfe, fd, &size);
assert(r==0); assert(r==0);
// assert all bp's are available // assert all bp's are available
for (int i = 0; i < (*dn)->n_children; i++) { for (int i = 0; i < (*dn)->n_children; i++) {
assert(BP_STATE(*dn,i) == PT_AVAIL); assert(BP_STATE(*dn,i) == PT_AVAIL);
} }
long bytes_freed = 0; toku_brtnode_pe_callback(*dn, make_pair_attr(0xffffffff), &attr, NULL);
toku_brtnode_pe_callback(*dn, 0xffffffff, &bytes_freed, NULL);
for (int i = 0; i < (*dn)->n_children; i++) { for (int i = 0; i < (*dn)->n_children; i++) {
// assert all bp's are still available, because we touched the clock // assert all bp's are still available, because we touched the clock
assert(BP_STATE(*dn,i) == PT_AVAIL); assert(BP_STATE(*dn,i) == PT_AVAIL);
// now assert all should be evicted // now assert all should be evicted
assert(BP_SHOULD_EVICT(*dn, i)); assert(BP_SHOULD_EVICT(*dn, i));
} }
toku_brtnode_pe_callback(*dn, 0xffffffff, &bytes_freed, NULL); toku_brtnode_pe_callback(*dn, make_pair_attr(0xffffffff), &attr, NULL);
for (int i = 0; i < (*dn)->n_children; i++) { for (int i = 0; i < (*dn)->n_children; i++) {
assert(BP_STATE(*dn,i) == PT_COMPRESSED); assert(BP_STATE(*dn,i) == PT_COMPRESSED);
} }
} }
} }
// now decompress them // now decompress them
fill_bfe_for_full_read(&bfe, brt_h, NULL, string_key_cmp); fill_bfe_for_full_read(&bfe, brt_h);
assert(toku_brtnode_pf_req_callback(*dn, &bfe)); assert(toku_brtnode_pf_req_callback(*dn, &bfe));
long size; PAIR_ATTR attr;
r = toku_brtnode_pf_callback(*dn, &bfe, fd, &size); r = toku_brtnode_pf_callback(*dn, &bfe, fd, &attr);
assert(r==0); assert(r==0);
// assert all bp's are available // assert all bp's are available
for (int i = 0; i < (*dn)->n_children; i++) { for (int i = 0; i < (*dn)->n_children; i++) {
......
...@@ -12,7 +12,7 @@ static DB * const null_db = 0; ...@@ -12,7 +12,7 @@ static DB * const null_db = 0;
static int test_cursor_debug = 0; static int test_cursor_debug = 0;
static int test_brt_cursor_keycompare(DB *db __attribute__((unused)), const DBT *a, const DBT *b) { static int test_brt_cursor_keycompare(DB *desc __attribute__((unused)), const DBT *a, const DBT *b) {
return toku_keycompare(a->data, a->size, b->data, b->size); return toku_keycompare(a->data, a->size, b->data, b->size);
} }
......
...@@ -335,13 +335,13 @@ static void test_cursor_next (void) { ...@@ -335,13 +335,13 @@ static void test_cursor_next (void) {
static DB nonce_db; static DB nonce_db;
static int wrong_compare_fun(DB *db, const DBT *a, const DBT *b) { static int wrong_compare_fun(DB* UU(desc), const DBT *a, const DBT *b) {
unsigned int i; unsigned int i;
unsigned char *ad=a->data; unsigned char *ad=a->data;
unsigned char *bd=b->data; unsigned char *bd=b->data;
unsigned int siz=a->size; unsigned int siz=a->size;
assert(a->size==b->size); assert(a->size==b->size);
assert(db==&nonce_db); // make sure the db was passed down correctly //assert(db==&nonce_db); // make sure the db was passed down correctly
for (i=0; i<siz; i++) { for (i=0; i<siz; i++) {
if (ad[siz-1-i]<bd[siz-1-i]) return -1; if (ad[siz-1-i]<bd[siz-1-i]) return -1;
if (ad[siz-1-i]>bd[siz-1-i]) return +1; if (ad[siz-1-i]>bd[siz-1-i]) return +1;
...@@ -363,8 +363,8 @@ static void test_wrongendian_compare (int wrong_p, unsigned int N) { ...@@ -363,8 +363,8 @@ static void test_wrongendian_compare (int wrong_p, unsigned int N) {
char a[4]={0,1,0,0}; char a[4]={0,1,0,0};
char b[4]={1,0,0,0}; char b[4]={1,0,0,0};
DBT at, bt; DBT at, bt;
assert(wrong_compare_fun(&nonce_db, toku_fill_dbt(&at, a, 4), toku_fill_dbt(&bt, b, 4))>0); assert(wrong_compare_fun(NULL, toku_fill_dbt(&at, a, 4), toku_fill_dbt(&bt, b, 4))>0);
assert(wrong_compare_fun(&nonce_db, toku_fill_dbt(&at, b, 4), toku_fill_dbt(&bt, a, 4))<0); assert(wrong_compare_fun(NULL, toku_fill_dbt(&at, b, 4), toku_fill_dbt(&bt, a, 4))<0);
} }
r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0); r = toku_brt_create_cachetable(&ct, 0, ZERO_LSN, NULL_LOGGER); assert(r==0);
...@@ -451,7 +451,7 @@ static void test_wrongendian_compare (int wrong_p, unsigned int N) { ...@@ -451,7 +451,7 @@ static void test_wrongendian_compare (int wrong_p, unsigned int N) {
} }
static int test_brt_cursor_keycompare(DB *db __attribute__((unused)), const DBT *a, const DBT *b) { static int test_brt_cursor_keycompare(DB *desc __attribute__((unused)), const DBT *a, const DBT *b) {
return toku_keycompare(a->data, a->size, b->data, b->size); return toku_keycompare(a->data, a->size, b->data, b->size);
} }
......
...@@ -51,8 +51,8 @@ static int qsort_compare_ints (const void *a, const void *b) { ...@@ -51,8 +51,8 @@ static int qsort_compare_ints (const void *a, const void *b) {
return 0; return 0;
} }
static int compare_int(DB *dest_db, const DBT *akey, const DBT *bkey) { static int compare_int(DB *desc, const DBT *akey, const DBT *bkey) {
assert(dest_db == NULL); assert(desc == NULL);
assert(akey->size == sizeof (int)); assert(akey->size == sizeof (int));
assert(bkey->size == sizeof (int)); assert(bkey->size == sizeof (int));
return qsort_compare_ints(akey->data, bkey->data); return qsort_compare_ints(akey->data, bkey->data);
......
...@@ -45,8 +45,8 @@ static int qsort_compare_ints (const void *a, const void *b) { ...@@ -45,8 +45,8 @@ static int qsort_compare_ints (const void *a, const void *b) {
return 0; return 0;
} }
static int compare_int(DB *dest_db, const DBT *akey, const DBT *bkey) { static int compare_int(DB *desc, const DBT *akey, const DBT *bkey) {
assert(dest_db == NULL); assert(desc == NULL);
assert(akey->size == sizeof (int)); assert(akey->size == sizeof (int));
assert(bkey->size == sizeof (int)); assert(bkey->size == sizeof (int));
return qsort_compare_ints(akey->data, bkey->data); return qsort_compare_ints(akey->data, bkey->data);
......
...@@ -28,8 +28,8 @@ static int qsort_compare_ints (const void *a, const void *b) { ...@@ -28,8 +28,8 @@ static int qsort_compare_ints (const void *a, const void *b) {
return 0; return 0;
} }
static int compare_int(DB *dest_db, const DBT *akey, const DBT *bkey) { static int compare_int(DB *desc, const DBT *akey, const DBT *bkey) {
assert(dest_db == NULL); assert(desc == NULL);
assert(akey->size == sizeof (int)); assert(akey->size == sizeof (int));
assert(bkey->size == sizeof (int)); assert(bkey->size == sizeof (int));
return qsort_compare_ints(akey->data, bkey->data); return qsort_compare_ints(akey->data, bkey->data);
......
...@@ -221,8 +221,7 @@ static int qsort_compare_ints (const void *a, const void *b) { ...@@ -221,8 +221,7 @@ static int qsort_compare_ints (const void *a, const void *b) {
} }
static int compare_ints (DB *dest_db, const DBT *akey, const DBT *bkey) { static int compare_ints (DB* UU(desc), const DBT *akey, const DBT *bkey) {
assert(dest_db==NULL);
assert(akey->size==sizeof(int)); assert(akey->size==sizeof(int));
assert(bkey->size==sizeof(int)); assert(bkey->size==sizeof(int));
return qsort_compare_ints(akey->data, bkey->data); return qsort_compare_ints(akey->data, bkey->data);
......
...@@ -33,7 +33,7 @@ static void *my_malloc(size_t n) { ...@@ -33,7 +33,7 @@ static void *my_malloc(size_t n) {
return malloc(n); return malloc(n);
} }
static int my_compare(DB *UU(db), const DBT *UU(akey), const DBT *UU(bkey)) { static int my_compare(DB *UU(desc), const DBT *UU(akey), const DBT *UU(bkey)) {
return EINVAL; return EINVAL;
} }
......
...@@ -28,8 +28,7 @@ static int qsort_compare_ints (const void *a, const void *b) { ...@@ -28,8 +28,7 @@ static int qsort_compare_ints (const void *a, const void *b) {
} }
static int compare_ints (DB *dest_db, const DBT *akey, const DBT *bkey) { static int compare_ints (DB *UU(desc), const DBT *akey, const DBT *bkey) {
assert(dest_db==NULL);
assert(akey->size==sizeof(int)); assert(akey->size==sizeof(int));
assert(bkey->size==sizeof(int)); assert(bkey->size==sizeof(int));
return qsort_compare_ints(akey->data, bkey->data); return qsort_compare_ints(akey->data, bkey->data);
......
...@@ -27,8 +27,7 @@ static int qsort_compare_ints (const void *a, const void *b) { ...@@ -27,8 +27,7 @@ static int qsort_compare_ints (const void *a, const void *b) {
return 0; return 0;
} }
static int compare_ints (DB *dest_db, const DBT *akey, const DBT *bkey) { static int compare_ints (DB *UU(desc), const DBT *akey, const DBT *bkey) {
assert(dest_db==NULL);
assert(akey->size==sizeof(int)); assert(akey->size==sizeof(int));
assert(bkey->size==sizeof(int)); assert(bkey->size==sizeof(int));
return qsort_compare_ints(akey->data, bkey->data); return qsort_compare_ints(akey->data, bkey->data);
......
...@@ -24,8 +24,7 @@ static int qsort_compare_ints (const void *a, const void *b) { ...@@ -24,8 +24,7 @@ static int qsort_compare_ints (const void *a, const void *b) {
} }
static int compare_ints (DB *dest_db, const DBT *akey, const DBT *bkey) { static int compare_ints (DB* UU(desc), const DBT *akey, const DBT *bkey) {
assert(dest_db==NULL);
assert(akey->size==sizeof(int)); assert(akey->size==sizeof(int));
assert(bkey->size==sizeof(int)); assert(bkey->size==sizeof(int));
return qsort_compare_ints(akey->data, bkey->data); return qsort_compare_ints(akey->data, bkey->data);
......
#ident "$Id: cachetable-simple-verify.c 34757 2011-09-14 19:12:42Z leifwalsh $" #ident "$Id$"
#ident "Copyright (c) 2007-2011 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007-2011 Tokutek Inc. All rights reserved."
#include "includes.h" #include "includes.h"
#include "test.h" #include "test.h"
...@@ -10,86 +10,32 @@ CACHETABLE ct; ...@@ -10,86 +10,32 @@ CACHETABLE ct;
// freed memory was being accessed by toku_cachetable_unpin_and_remove // freed memory was being accessed by toku_cachetable_unpin_and_remove
// //
static void
flush (CACHEFILE f __attribute__((__unused__)),
int UU(fd),
CACHEKEY k __attribute__((__unused__)),
void *v __attribute__((__unused__)),
void *e __attribute__((__unused__)),
long s __attribute__((__unused__)),
long* new_size __attribute__((__unused__)),
BOOL w __attribute__((__unused__)),
BOOL keep __attribute__((__unused__)),
BOOL c __attribute__((__unused__))
) {
}
static int static int
fetch (CACHEFILE f __attribute__((__unused__)), fetch (CACHEFILE f __attribute__((__unused__)),
int UU(fd), int UU(fd),
CACHEKEY k __attribute__((__unused__)), CACHEKEY k __attribute__((__unused__)),
u_int32_t fullhash __attribute__((__unused__)), u_int32_t fullhash __attribute__((__unused__)),
void **value __attribute__((__unused__)), void **value __attribute__((__unused__)),
long *sizep __attribute__((__unused__)), PAIR_ATTR *sizep __attribute__((__unused__)),
int *dirtyp, int *dirtyp,
void *extraargs __attribute__((__unused__)) void *extraargs __attribute__((__unused__))
) { ) {
*dirtyp = 0; *dirtyp = 0;
*value = NULL; *value = NULL;
*sizep = 8; *sizep = make_pair_attr(8);
return 0; return 0;
} }
static void
pe_est_callback(
void* UU(brtnode_pv),
long* bytes_freed_estimate,
enum partial_eviction_cost *cost,
void* UU(write_extraargs)
)
{
*bytes_freed_estimate = 0;
*cost = PE_CHEAP;
}
static int
pe_callback (
void *brtnode_pv __attribute__((__unused__)),
long bytes_to_free __attribute__((__unused__)),
long* bytes_freed,
void* extraargs __attribute__((__unused__))
)
{
*bytes_freed = bytes_to_free;
return 0;
}
static BOOL pf_req_callback(void* UU(brtnode_pv), void* UU(read_extraargs)) {
return FALSE;
}
static int pf_callback(void* UU(brtnode_pv), void* UU(read_extraargs), int UU(fd), long* UU(sizep)) {
assert(FALSE);
}
CACHEFILE f1; CACHEFILE f1;
static void static void
unlock_test_fun (void *v) { unlock_test_fun (void *v) {
assert(v == NULL); assert(v == NULL);
// CT lock is held // CT lock is held
int r = toku_cachetable_unpin_ct_prelocked_no_flush(f1, make_blocknum(2), 2, CACHETABLE_CLEAN, 100); int r = toku_cachetable_unpin_ct_prelocked_no_flush(f1, make_blocknum(2), 2, CACHETABLE_CLEAN, make_pair_attr(8));
assert(r==0); assert(r==0);
} }
static void fake_ydb_lock(void) {
}
static void fake_ydb_unlock(void) {
}
static void static void
run_test (void) { run_test (void) {
const int test_limit = 20; const int test_limit = 20;
...@@ -106,12 +52,12 @@ run_test (void) { ...@@ -106,12 +52,12 @@ run_test (void) {
long s1; long s1;
long s2; long s2;
r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, flush, fetch, pe_est_callback, pe_callback, pf_req_callback, pf_callback, NULL, NULL); r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, def_flush, fetch, def_pe_est_callback, def_pe_callback, def_pf_req_callback, def_pf_callback, def_cleaner_callback, NULL, NULL);
r = toku_cachetable_unpin(f1, make_blocknum(1), 1, CACHETABLE_CLEAN, 8); assert(r==0); r = toku_cachetable_unpin(f1, make_blocknum(1), 1, CACHETABLE_CLEAN, make_pair_attr(8)); assert(r==0);
for (int i = 0; i < 20; i++) { for (int i = 0; i < 20; i++) {
r = toku_cachetable_get_and_pin(f1, make_blocknum(2), 2, &v2, &s2, flush, fetch, pe_est_callback, pe_callback, pf_req_callback, pf_callback, NULL, NULL); r = toku_cachetable_get_and_pin(f1, make_blocknum(2), 2, &v2, &s2, def_flush, fetch, def_pe_est_callback, def_pe_callback, def_pf_req_callback, def_pf_callback, def_cleaner_callback, NULL, NULL);
r = toku_cachetable_unpin(f1, make_blocknum(2), 2, CACHETABLE_CLEAN, 8); assert(r==0); r = toku_cachetable_unpin(f1, make_blocknum(2), 2, CACHETABLE_CLEAN, make_pair_attr(8)); assert(r==0);
} }
// //
...@@ -122,12 +68,12 @@ run_test (void) { ...@@ -122,12 +68,12 @@ run_test (void) {
// pin 1 and 2 // pin 1 and 2
r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v2, &s2, flush, fetch, pe_est_callback, pe_callback, pf_req_callback, pf_callback, NULL, NULL); r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v2, &s2, def_flush, fetch, def_pe_est_callback, def_pe_callback, def_pf_req_callback, def_pf_callback, def_cleaner_callback, NULL, NULL);
r = toku_cachetable_begin_checkpoint(ct, NULL); r = toku_cachetable_begin_checkpoint(ct, NULL);
// mark nodes as pending a checkpoint, so that get_and_pin_nonblocking on block 1 will return TOKUDB_TRY_AGAIN // mark nodes as pending a checkpoint, so that get_and_pin_nonblocking on block 1 will return TOKUDB_TRY_AGAIN
r = toku_cachetable_unpin(f1, make_blocknum(1), 1, CACHETABLE_CLEAN, 8); assert(r==0); r = toku_cachetable_unpin(f1, make_blocknum(1), 1, CACHETABLE_CLEAN, make_pair_attr(8)); assert(r==0);
r = toku_cachetable_get_and_pin(f1, make_blocknum(2), 2, &v2, &s2, flush, fetch, pe_est_callback, pe_callback, pf_req_callback, pf_callback, NULL, NULL); r = toku_cachetable_get_and_pin(f1, make_blocknum(2), 2, &v2, &s2, def_flush, fetch, def_pe_est_callback, def_pe_callback, def_pf_req_callback, def_pf_callback, def_cleaner_callback, NULL, NULL);
// now we try to pin 1, and it should get evicted out from under us // now we try to pin 1, and it should get evicted out from under us
struct unlockers foo; struct unlockers foo;
foo.extra = NULL; foo.extra = NULL;
...@@ -140,12 +86,13 @@ run_test (void) { ...@@ -140,12 +86,13 @@ run_test (void) {
1, 1,
&v1, &v1,
&s1, &s1,
flush, def_flush,
fetch, fetch,
pe_est_callback, def_pe_est_callback,
pe_callback, def_pe_callback,
pf_req_callback, def_pf_req_callback,
pf_callback, def_pf_callback,
def_cleaner_callback,
NULL, NULL,
NULL, NULL,
&foo &foo
......
...@@ -9,8 +9,8 @@ flush (CACHEFILE f __attribute__((__unused__)), ...@@ -9,8 +9,8 @@ flush (CACHEFILE f __attribute__((__unused__)),
CACHEKEY k __attribute__((__unused__)), CACHEKEY k __attribute__((__unused__)),
void *v __attribute__((__unused__)), void *v __attribute__((__unused__)),
void *e __attribute__((__unused__)), void *e __attribute__((__unused__)),
long s __attribute__((__unused__)), PAIR_ATTR s __attribute__((__unused__)),
long* new_size __attribute__((__unused__)), PAIR_ATTR* new_size __attribute__((__unused__)),
BOOL w __attribute__((__unused__)), BOOL w __attribute__((__unused__)),
BOOL keep __attribute__((__unused__)), BOOL keep __attribute__((__unused__)),
BOOL c __attribute__((__unused__)) BOOL c __attribute__((__unused__))
...@@ -22,55 +22,6 @@ flush (CACHEFILE f __attribute__((__unused__)), ...@@ -22,55 +22,6 @@ flush (CACHEFILE f __attribute__((__unused__)),
} }
} }
static int
fetch (CACHEFILE f __attribute__((__unused__)),
int UU(fd),
CACHEKEY k __attribute__((__unused__)),
u_int32_t fullhash __attribute__((__unused__)),
void **value __attribute__((__unused__)),
long *sizep __attribute__((__unused__)),
int *dirtyp,
void *extraargs __attribute__((__unused__))
) {
*dirtyp = 0;
*value = NULL;
*sizep = 8;
return 0;
}
static void
pe_est_callback(
void* UU(brtnode_pv),
long* bytes_freed_estimate,
enum partial_eviction_cost *cost,
void* UU(write_extraargs)
)
{
*bytes_freed_estimate = 0;
*cost = PE_CHEAP;
}
static int
pe_callback (
void *brtnode_pv __attribute__((__unused__)),
long bytes_to_free __attribute__((__unused__)),
long* bytes_freed,
void* extraargs __attribute__((__unused__))
)
{
*bytes_freed = bytes_to_free;
return 0;
}
static BOOL pf_req_callback(void* UU(brtnode_pv), void* UU(read_extraargs)) {
return FALSE;
}
static int pf_callback(void* UU(brtnode_pv), void* UU(read_extraargs), int UU(fd), long* UU(sizep)) {
assert(FALSE);
}
static void static void
cachetable_test (void) { cachetable_test (void) {
...@@ -86,14 +37,14 @@ cachetable_test (void) { ...@@ -86,14 +37,14 @@ cachetable_test (void) {
void* v1; void* v1;
void* v2; void* v2;
long s1, s2; long s1, s2;
r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, flush, fetch, pe_est_callback, pe_callback, pf_req_callback, pf_callback, NULL, NULL); r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, flush, def_fetch, def_pe_est_callback, def_pe_callback, def_pf_req_callback, def_pf_callback, def_cleaner_callback, NULL, NULL);
r = toku_cachetable_unpin(f1, make_blocknum(1), 1, CACHETABLE_DIRTY, 8); r = toku_cachetable_unpin(f1, make_blocknum(1), 1, CACHETABLE_DIRTY, make_pair_attr(8));
r = toku_cachetable_get_and_pin(f1, make_blocknum(2), 2, &v2, &s2, flush, fetch, pe_est_callback, pe_callback, pf_req_callback, pf_callback, NULL, NULL); r = toku_cachetable_get_and_pin(f1, make_blocknum(2), 2, &v2, &s2, flush, def_fetch, def_pe_est_callback, def_pe_callback, def_pf_req_callback, def_pf_callback, def_cleaner_callback, NULL, NULL);
// usleep (2*1024*1024); // usleep (2*1024*1024);
//r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, flush, fetch, pe_est_callback, pe_callback, pf_req_callback, pf_callback, NULL); //r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, flush, def_fetch, def_pe_est_callback, pe_callback, pf_req_callback, pf_callback, NULL);
r = toku_cachetable_unpin(f1, make_blocknum(2), 2, CACHETABLE_CLEAN, 8); r = toku_cachetable_unpin(f1, make_blocknum(2), 2, CACHETABLE_CLEAN, make_pair_attr(8));
//r = toku_cachetable_unpin(f1, make_blocknum(1), 1, CACHETABLE_CLEAN, 8); //r = toku_cachetable_unpin(f1, make_blocknum(1), 1, CACHETABLE_CLEAN, 8);
......
...@@ -32,10 +32,21 @@ sleep_random (void) ...@@ -32,10 +32,21 @@ sleep_random (void)
int expect_value = 42; // initially 42, later 43 int expect_value = 42; // initially 42, later 43
static void static void
flush (CACHEFILE UU(thiscf), int UU(fd), CACHEKEY UU(key), void *value, void *UU(extraargs), long size, long* UU(new_size), BOOL write_me, BOOL keep_me, BOOL UU(for_checkpoint)) flush (
CACHEFILE UU(thiscf),
int UU(fd),
CACHEKEY UU(key),
void *value,
void *UU(extraargs),
PAIR_ATTR size,
PAIR_ATTR* UU(new_size),
BOOL write_me,
BOOL keep_me,
BOOL UU(for_checkpoint)
)
{ {
// printf("f"); // printf("f");
assert(size == item_size); assert(size.size== item_size);
int *v = value; int *v = value;
if (*v!=expect_value) printf("got %d expect %d\n", *v, expect_value); if (*v!=expect_value) printf("got %d expect %d\n", *v, expect_value);
assert(*v==expect_value); assert(*v==expect_value);
...@@ -46,44 +57,21 @@ flush (CACHEFILE UU(thiscf), int UU(fd), CACHEKEY UU(key), void *value, void *UU ...@@ -46,44 +57,21 @@ flush (CACHEFILE UU(thiscf), int UU(fd), CACHEKEY UU(key), void *value, void *UU
} }
static int static int
fetch (CACHEFILE UU(thiscf), int UU(fd), CACHEKEY UU(key), u_int32_t UU(fullhash), void **UU(value), long *UU(sizep), int *UU(dirtyp), void *UU(extraargs)) fetch (
{ CACHEFILE UU(thiscf),
assert(0); // should not be called int UU(fd),
return 0; CACHEKEY UU(key),
} u_int32_t UU(fullhash),
void **UU(value),
static void PAIR_ATTR *UU(sizep),
pe_est_callback( int *UU(dirtyp),
void* UU(brtnode_pv), void *UU(extraargs)
long* bytes_freed_estimate,
enum partial_eviction_cost *cost,
void* UU(write_extraargs)
) )
{ {
*bytes_freed_estimate = 0; assert(0); // should not be called
*cost = PE_CHEAP;
}
static int
pe_callback (
void *brtnode_pv __attribute__((__unused__)),
long bytes_to_free __attribute__((__unused__)),
long* bytes_freed,
void* extraargs __attribute__((__unused__))
)
{
*bytes_freed = bytes_to_free;
return 0; return 0;
} }
static BOOL pf_req_callback(void* UU(brtnode_pv), void* UU(read_extraargs)) {
// placeholder for now
return FALSE;
}
static int pf_callback(void* UU(brtnode_pv), void* UU(read_extraargs), int UU(fd), long* UU(sizep)) {
assert(FALSE);
}
static void* static void*
do_update (void *UU(ignore)) do_update (void *UU(ignore))
...@@ -95,7 +83,7 @@ do_update (void *UU(ignore)) ...@@ -95,7 +83,7 @@ do_update (void *UU(ignore))
u_int32_t hi = toku_cachetable_hash(cf, key); u_int32_t hi = toku_cachetable_hash(cf, key);
void *vv; void *vv;
long size; long size;
int r = toku_cachetable_get_and_pin(cf, key, hi, &vv, &size, flush, fetch, pe_est_callback, pe_callback, pf_req_callback, pf_callback, 0, 0); int r = toku_cachetable_get_and_pin(cf, key, hi, &vv, &size, flush, fetch, def_pe_est_callback, def_pe_callback, def_pf_req_callback, def_pf_callback, def_cleaner_callback, 0, 0);
//printf("g"); //printf("g");
assert(r==0); assert(r==0);
assert(size==sizeof(int)); assert(size==sizeof(int));
...@@ -103,7 +91,7 @@ do_update (void *UU(ignore)) ...@@ -103,7 +91,7 @@ do_update (void *UU(ignore))
assert(*v==42); assert(*v==42);
*v = 43; *v = 43;
//printf("[%d]43\n", i); //printf("[%d]43\n", i);
r = toku_cachetable_unpin(cf, key, hi, CACHETABLE_DIRTY, item_size); r = toku_cachetable_unpin(cf, key, hi, CACHETABLE_DIRTY, make_pair_attr(item_size));
sleep_random(); sleep_random();
} }
return 0; return 0;
...@@ -144,10 +132,10 @@ static void checkpoint_pending(void) { ...@@ -144,10 +132,10 @@ static void checkpoint_pending(void) {
CACHEKEY key = make_blocknum(i); CACHEKEY key = make_blocknum(i);
u_int32_t hi = toku_cachetable_hash(cf, key); u_int32_t hi = toku_cachetable_hash(cf, key);
values[i] = 42; values[i] = 42;
r = toku_cachetable_put(cf, key, hi, &values[i], sizeof(int), flush, pe_est_callback, pe_callback, 0); r = toku_cachetable_put(cf, key, hi, &values[i], make_pair_attr(sizeof(int)), flush, def_pe_est_callback, def_pe_callback, def_cleaner_callback, 0);
assert(r == 0); assert(r == 0);
r = toku_cachetable_unpin(cf, key, hi, CACHETABLE_DIRTY, item_size); r = toku_cachetable_unpin(cf, key, hi, CACHETABLE_DIRTY, make_pair_attr(item_size));
assert(r == 0); assert(r == 0);
} }
......
#ident "$Id: cachetable-simple-verify.c 34757 2011-09-14 19:12:42Z leifwalsh $" #ident "$Id$"
#ident "Copyright (c) 2007-2011 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007-2011 Tokutek Inc. All rights reserved."
#include "includes.h" #include "includes.h"
#include "test.h" #include "test.h"
...@@ -15,8 +15,8 @@ flush (CACHEFILE f __attribute__((__unused__)), ...@@ -15,8 +15,8 @@ flush (CACHEFILE f __attribute__((__unused__)),
CACHEKEY k __attribute__((__unused__)), CACHEKEY k __attribute__((__unused__)),
void *v __attribute__((__unused__)), void *v __attribute__((__unused__)),
void *e __attribute__((__unused__)), void *e __attribute__((__unused__)),
long s __attribute__((__unused__)), PAIR_ATTR s __attribute__((__unused__)),
long* new_size __attribute__((__unused__)), PAIR_ATTR* new_size __attribute__((__unused__)),
BOOL w __attribute__((__unused__)), BOOL w __attribute__((__unused__)),
BOOL keep __attribute__((__unused__)), BOOL keep __attribute__((__unused__)),
BOOL c __attribute__((__unused__)) BOOL c __attribute__((__unused__))
...@@ -41,7 +41,7 @@ fetch (CACHEFILE f __attribute__((__unused__)), ...@@ -41,7 +41,7 @@ fetch (CACHEFILE f __attribute__((__unused__)),
CACHEKEY k __attribute__((__unused__)), CACHEKEY k __attribute__((__unused__)),
u_int32_t fullhash __attribute__((__unused__)), u_int32_t fullhash __attribute__((__unused__)),
void **value __attribute__((__unused__)), void **value __attribute__((__unused__)),
long *sizep __attribute__((__unused__)), PAIR_ATTR *sizep __attribute__((__unused__)),
int *dirtyp, int *dirtyp,
void *extraargs __attribute__((__unused__)) void *extraargs __attribute__((__unused__))
) { ) {
...@@ -52,49 +52,10 @@ fetch (CACHEFILE f __attribute__((__unused__)), ...@@ -52,49 +52,10 @@ fetch (CACHEFILE f __attribute__((__unused__)),
else { else {
*value = &clean_val; *value = &clean_val;
} }
*sizep = 8; *sizep = make_pair_attr(8);
return 0; return 0;
} }
static void
pe_est_callback(
void* UU(brtnode_pv),
long* bytes_freed_estimate,
enum partial_eviction_cost *cost,
void* UU(write_extraargs)
)
{
*bytes_freed_estimate = 0;
*cost = PE_CHEAP;
}
static int
pe_callback (
void *brtnode_pv __attribute__((__unused__)),
long bytes_to_free __attribute__((__unused__)),
long* bytes_freed,
void* extraargs __attribute__((__unused__))
)
{
*bytes_freed = bytes_to_free;
return 0;
}
static BOOL pf_req_callback(void* UU(brtnode_pv), void* UU(read_extraargs)) {
return FALSE;
}
static int pf_callback(void* UU(brtnode_pv), void* UU(read_extraargs), int UU(fd), long* UU(sizep)) {
assert(FALSE);
}
static void fake_ydb_lock(void) {
}
static void fake_ydb_unlock(void) {
}
static void static void
cachetable_test (void) { cachetable_test (void) {
const int test_limit = 20; const int test_limit = 20;
...@@ -110,8 +71,8 @@ cachetable_test (void) { ...@@ -110,8 +71,8 @@ cachetable_test (void) {
void* v2; void* v2;
long s1; long s1;
long s2; long s2;
r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, flush, fetch, pe_est_callback, pe_callback, pf_req_callback, pf_callback, &dirty_val, &dirty_val); r = toku_cachetable_get_and_pin(f1, make_blocknum(1), 1, &v1, &s1, flush, fetch, def_pe_est_callback, def_pe_callback, def_pf_req_callback, def_pf_callback, def_cleaner_callback, &dirty_val, &dirty_val);
r = toku_cachetable_get_and_pin(f1, make_blocknum(2), 2, &v2, &s2, flush, fetch, pe_est_callback, pe_callback, pf_req_callback, pf_callback, NULL, NULL); r = toku_cachetable_get_and_pin(f1, make_blocknum(2), 2, &v2, &s2, flush, fetch, def_pe_est_callback, def_pe_callback, def_pf_req_callback, def_pf_callback, def_cleaner_callback, NULL, NULL);
// //
// Here is the test, we have two pairs, v1 is dirty, v2 is clean, but both are currently pinned // Here is the test, we have two pairs, v1 is dirty, v2 is clean, but both are currently pinned
...@@ -122,8 +83,8 @@ cachetable_test (void) { ...@@ -122,8 +83,8 @@ cachetable_test (void) {
r = toku_cachetable_begin_checkpoint(ct, NULL); assert(r == 0); r = toku_cachetable_begin_checkpoint(ct, NULL); assert(r == 0);
r = toku_cachetable_unpin(f1, make_blocknum(1), 1, CACHETABLE_DIRTY, 8); r = toku_cachetable_unpin(f1, make_blocknum(1), 1, CACHETABLE_DIRTY, make_pair_attr(8));
r = toku_cachetable_unpin(f1, make_blocknum(2), 2, CACHETABLE_CLEAN, 8); r = toku_cachetable_unpin(f1, make_blocknum(2), 2, CACHETABLE_CLEAN, make_pair_attr(8));
check_me = TRUE; check_me = TRUE;
flush_called = FALSE; flush_called = FALSE;
...@@ -138,8 +99,6 @@ cachetable_test (void) { ...@@ -138,8 +99,6 @@ cachetable_test (void) {
assert(r==0); assert(r==0);
assert(flush_called); assert(flush_called);
check_me = FALSE; check_me = FALSE;
toku_cachetable_verify(ct); toku_cachetable_verify(ct);
r = toku_cachefile_close(&f1, 0, FALSE, ZERO_LSN); assert(r == 0 && f1 == 0); r = toku_cachefile_close(&f1, 0, FALSE, ZERO_LSN); assert(r == 0 && f1 == 0);
......
#ident "$Id: cachetable-simple-verify.c 34757 2011-09-14 19:12:42Z leifwalsh $" #ident "$Id$"
#ident "Copyright (c) 2007-2011 Tokutek Inc. All rights reserved." #ident "Copyright (c) 2007-2011 Tokutek Inc. All rights reserved."
#include "includes.h" #include "includes.h"
#include "test.h" #include "test.h"
...@@ -15,8 +15,8 @@ flush (CACHEFILE f __attribute__((__unused__)), ...@@ -15,8 +15,8 @@ flush (CACHEFILE f __attribute__((__unused__)),
CACHEKEY k __attribute__((__unused__)), CACHEKEY k __attribute__((__unused__)),
void *v __attribute__((__unused__)), void *v __attribute__((__unused__)),
void *e __attribute__((__unused__)), void *e __attribute__((__unused__)),
long s __attribute__((__unused__)), PAIR_ATTR s __attribute__((__unused__)),
long* new_size __attribute__((__unused__)), PAIR_ATTR* new_size __attribute__((__unused__)),
BOOL w __attribute__((__unused__)), BOOL w __attribute__((__unused__)),
BOOL keep __attribute__((__unused__)), BOOL keep __attribute__((__unused__)),
BOOL c __attribute__((__unused__)) BOOL c __attribute__((__unused__))
...@@ -41,7 +41,7 @@ fetch (CACHEFILE f __attribute__((__unused__)), ...@@ -41,7 +41,7 @@ fetch (CACHEFILE f __attribute__((__unused__)),
CACHEKEY k __attribute__((__unused__)), CACHEKEY k __attribute__((__unused__)),
u_int32_t fullhash __attribute__((__unused__)), u_int32_t fullhash __attribute__((__unused__)),
void **value __attribute__((__unused__)), void **value __attribute__((__unused__)),
long *sizep __attribute__((__unused__)), PAIR_ATTR *sizep __attribute__((__unused__)),
int *dirtyp, int *dirtyp,
void *extraargs __attribute__((__unused__)) void *extraargs __attribute__((__unused__))
) { ) {
...@@ -54,49 +54,10 @@ fetch (CACHEFILE f __attribute__((__unused__)), ...@@ -54,49 +54,10 @@ fetch (CACHEFILE f __attribute__((__unused__)),
*value = &clean_val; *value = &clean_val;
*dirtyp = FALSE; *dirtyp = FALSE;
} }
*sizep = 8; *sizep = make_pair_attr(8);
return 0; return 0;
} }
static void
pe_est_callback(
void* UU(brtnode_pv),
long* bytes_freed_estimate,
enum partial_eviction_cost *cost,
void* UU(write_extraargs)
)
{
*bytes_freed_estimate = 0;
*cost = PE_CHEAP;
}
static int
pe_callback (
void *brtnode_pv __attribute__((__unused__)),
long bytes_to_free __attribute__((__unused__)),
long* bytes_freed,
void* extraargs __attribute__((__unused__))
)
{
*bytes_freed = bytes_to_free;
return 0;
}
static BOOL pf_req_callback(void* UU(brtnode_pv), void* UU(read_extraargs)) {
return FALSE;
}
static int pf_callback(void* UU(brtnode_pv), void* UU(read_extraargs), int UU(fd), long* UU(sizep)) {
assert(FALSE);
}
static void fake_ydb_lock(void) {
}
static void fake_ydb_unlock(void) {
}
static void static void
cachetable_test (void) { cachetable_test (void) {
const int test_limit = 20; const int test_limit = 20;
...@@ -109,10 +70,10 @@ cachetable_test (void) { ...@@ -109,10 +70,10 @@ cachetable_test (void) {
r = toku_cachetable_openf(&f1, ct, fname1, O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); assert(r == 0); r = toku_cachetable_openf(&f1, ct, fname1, O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); assert(r == 0);
BOOL doing_prefetch = FALSE; BOOL doing_prefetch = FALSE;
r = toku_cachefile_prefetch(f1, make_blocknum(1), 1, flush, fetch, pe_est_callback, pe_callback, pf_req_callback, pf_callback, &dirty_val, &dirty_val, &doing_prefetch); r = toku_cachefile_prefetch(f1, make_blocknum(1), 1, flush, fetch, def_pe_est_callback, def_pe_callback, def_pf_req_callback, def_pf_callback, def_cleaner_callback, &dirty_val, &dirty_val, &doing_prefetch);
assert(doing_prefetch); assert(doing_prefetch);
doing_prefetch = FALSE; doing_prefetch = FALSE;
r = toku_cachefile_prefetch(f1, make_blocknum(2), 2, flush, fetch, pe_est_callback, pe_callback, pf_req_callback, pf_callback, NULL, NULL, &doing_prefetch); r = toku_cachefile_prefetch(f1, make_blocknum(2), 2, flush, fetch, def_pe_est_callback, def_pe_callback, def_pf_req_callback, def_pf_callback, def_cleaner_callback, NULL, NULL, &doing_prefetch);
assert(doing_prefetch); assert(doing_prefetch);
// //
......
...@@ -12,40 +12,15 @@ static const int item_size = 1; ...@@ -12,40 +12,15 @@ static const int item_size = 1;
static int n_flush, n_write_me, n_keep_me, n_fetch; static int n_flush, n_write_me, n_keep_me, n_fetch;
static void flush(CACHEFILE cf, int UU(fd), CACHEKEY key, void *value, void *extraargs, long size, long* UU(new_size), BOOL write_me, BOOL keep_me, BOOL UU(for_checkpoint)) { static void flush(CACHEFILE cf, int UU(fd), CACHEKEY key, void *value, void *extraargs, PAIR_ATTR size, PAIR_ATTR* UU(new_size), BOOL write_me, BOOL keep_me, BOOL UU(for_checkpoint)) {
cf = cf; key = key; value = value; extraargs = extraargs; cf = cf; key = key; value = value; extraargs = extraargs;
// assert(key == make_blocknum((long)value)); // assert(key == make_blocknum((long)value));
assert(size == item_size); assert(size.size == item_size);
n_flush++; n_flush++;
if (write_me) n_write_me++; if (write_me) n_write_me++;
if (keep_me) n_keep_me++; if (keep_me) n_keep_me++;
} }
static void
pe_est_callback(
void* UU(brtnode_pv),
long* bytes_freed_estimate,
enum partial_eviction_cost *cost,
void* UU(write_extraargs)
)
{
*bytes_freed_estimate = 0;
*cost = PE_CHEAP;
}
static int
pe_callback (
void *brtnode_pv __attribute__((__unused__)),
long bytes_to_free __attribute__((__unused__)),
long* bytes_freed,
void* extraargs __attribute__((__unused__))
)
{
*bytes_freed = bytes_to_free;
return 0;
}
static int callback_was_called = 0; static int callback_was_called = 0;
static int callback2_was_called = 0; static int callback2_was_called = 0;
...@@ -86,10 +61,10 @@ static void cachetable_checkpoint_test(int n, enum cachetable_dirty dirty) { ...@@ -86,10 +61,10 @@ static void cachetable_checkpoint_test(int n, enum cachetable_dirty dirty) {
for (i=0; i<n; i++) { for (i=0; i<n; i++) {
CACHEKEY key = make_blocknum(i); CACHEKEY key = make_blocknum(i);
u_int32_t hi = toku_cachetable_hash(f1, key); u_int32_t hi = toku_cachetable_hash(f1, key);
r = toku_cachetable_put(f1, key, hi, (void *)(long)i, 1, flush, pe_est_callback, pe_callback, 0); r = toku_cachetable_put(f1, key, hi, (void *)(long)i, make_pair_attr(1), flush, def_pe_est_callback, def_pe_callback, def_cleaner_callback, 0);
assert(r == 0); assert(r == 0);
r = toku_cachetable_unpin(f1, key, hi, dirty, item_size); r = toku_cachetable_unpin(f1, key, hi, dirty, make_pair_attr(item_size));
assert(r == 0); assert(r == 0);
void *v; void *v;
...@@ -122,7 +97,7 @@ static void cachetable_checkpoint_test(int n, enum cachetable_dirty dirty) { ...@@ -122,7 +97,7 @@ static void cachetable_checkpoint_test(int n, enum cachetable_dirty dirty) {
r = toku_cachetable_maybe_get_and_pin(f1, key, hi, &v); r = toku_cachetable_maybe_get_and_pin(f1, key, hi, &v);
if (r != 0) if (r != 0)
continue; continue;
r = toku_cachetable_unpin(f1, key, hi, CACHETABLE_CLEAN, item_size); r = toku_cachetable_unpin(f1, key, hi, CACHETABLE_CLEAN, make_pair_attr(item_size));
assert(r == 0); assert(r == 0);
int its_dirty; int its_dirty;
......
This diff is collapsed.
#ident "$Id$"
#ident "Copyright (c) 2007-2011 Tokutek Inc. All rights reserved."
#include "includes.h"
#include "test.h"
//
// simple tests for cleaner thread with an empty cachetable
//
static void
cachetable_test (void) {
const int test_limit = 1000;
int r;
CACHETABLE ct;
r = toku_create_cachetable(&ct, test_limit, ZERO_LSN, NULL_LOGGER); assert(r == 0);
r = toku_set_cleaner_period(ct, 1); assert(r == 0);
char fname1[] = __FILE__ "test1.dat";
unlink(fname1);
CACHEFILE f1;
r = toku_cachetable_openf(&f1, ct, fname1, O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); assert(r == 0);
usleep(4000000);
r = toku_cachetable_begin_checkpoint(ct, NULL); assert(r == 0);
r = toku_cachetable_end_checkpoint(
ct,
NULL,
fake_ydb_lock,
fake_ydb_unlock,
NULL,
NULL
);
assert(r==0);
toku_cachetable_verify(ct);
r = toku_cachefile_close(&f1, 0, FALSE, ZERO_LSN); assert(r == 0 && f1 == 0);
r = toku_cachetable_close(&ct); lazy_assert_zero(r);
}
int
test_main(int argc, const char *argv[]) {
default_parse_args(argc, argv);
cachetable_test();
return 0;
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -12,8 +12,7 @@ ...@@ -12,8 +12,7 @@
static TOKUTXN const null_txn = 0; static TOKUTXN const null_txn = 0;
static DB * const null_db = 0; static DB * const null_db = 0;
static int static int test_brt_cursor_keycompare(DB *desc __attribute__((unused)), const DBT *a, const DBT *b) {
test_brt_cursor_keycompare(DB *UU(db), const DBT *a, const DBT *b) {
return toku_keycompare(a->data, a->size, b->data, b->size); return toku_keycompare(a->data, a->size, b->data, b->size);
} }
......
...@@ -16,7 +16,7 @@ static TOKUTXN const null_txn = 0; ...@@ -16,7 +16,7 @@ static TOKUTXN const null_txn = 0;
static DB * const null_db = 0; static DB * const null_db = 0;
static int static int
test_keycompare(DB *UU(db), const DBT *a, const DBT *b) { test_keycompare(DB* UU(desc), const DBT *a, const DBT *b) {
return toku_keycompare(a->data, a->size, b->data, b->size); return toku_keycompare(a->data, a->size, b->data, b->size);
} }
......
...@@ -12,8 +12,7 @@ ...@@ -12,8 +12,7 @@
static TOKUTXN const null_txn = 0; static TOKUTXN const null_txn = 0;
static DB * const null_db = 0; static DB * const null_db = 0;
static int static int test_brt_cursor_keycompare(DB *db __attribute__((unused)), const DBT *a, const DBT *b) {
test_brt_cursor_keycompare(DB *UU(db), const DBT *a, const DBT *b) {
return toku_keycompare(a->data, a->size, b->data, b->size); return toku_keycompare(a->data, a->size, b->data, b->size);
} }
......
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