Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
19b7090f
Commit
19b7090f
authored
Apr 17, 2013
by
Zardosht Kasheff
Committed by
Yoni Fogel
Apr 17, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[t:4456], merge to main
git-svn-id:
file:///svn/toku/tokudb@39504
c7de825b-a66e-492c-adef-691d508d4ae1
parent
a244bd5a
Changes
68
Show whitespace changes
Inline
Side-by-side
Showing
68 changed files
with
454 additions
and
854 deletions
+454
-854
newbrt/brt-cachetable-wrappers.c
newbrt/brt-cachetable-wrappers.c
+5
-22
newbrt/brt-cachetable-wrappers.h
newbrt/brt-cachetable-wrappers.h
+1
-0
newbrt/brt-flusher.h
newbrt/brt-flusher.h
+0
-16
newbrt/brt-internal.h
newbrt/brt-internal.h
+11
-0
newbrt/brt-test-helpers.c
newbrt/brt-test-helpers.c
+6
-18
newbrt/brt.c
newbrt/brt.c
+5
-14
newbrt/cachetable.c
newbrt/cachetable.c
+24
-84
newbrt/cachetable.h
newbrt/cachetable.h
+17
-33
newbrt/rollback.c
newbrt/rollback.c
+12
-15
newbrt/tests/cachetable-3969.c
newbrt/tests/cachetable-3969.c
+6
-31
newbrt/tests/cachetable-4357.c
newbrt/tests/cachetable-4357.c
+2
-37
newbrt/tests/cachetable-4365.c
newbrt/tests/cachetable-4365.c
+3
-39
newbrt/tests/cachetable-all-write.c
newbrt/tests/cachetable-all-write.c
+4
-2
newbrt/tests/cachetable-checkpoint-pending.c
newbrt/tests/cachetable-checkpoint-pending.c
+6
-2
newbrt/tests/cachetable-checkpoint-pinned-nodes.c
newbrt/tests/cachetable-checkpoint-pinned-nodes.c
+5
-2
newbrt/tests/cachetable-checkpoint-prefetched-nodes.c
newbrt/tests/cachetable-checkpoint-prefetched-nodes.c
+5
-2
newbrt/tests/cachetable-checkpoint-test.c
newbrt/tests/cachetable-checkpoint-test.c
+3
-1
newbrt/tests/cachetable-cleaner-checkpoint.c
newbrt/tests/cachetable-cleaner-checkpoint.c
+4
-17
newbrt/tests/cachetable-cleaner-checkpoint2.c
newbrt/tests/cachetable-cleaner-checkpoint2.c
+4
-17
newbrt/tests/cachetable-cleaner-dev-null.c
newbrt/tests/cachetable-cleaner-dev-null.c
+4
-17
newbrt/tests/cachetable-cleaner-thread-attrs-accumulate.c
newbrt/tests/cachetable-cleaner-thread-attrs-accumulate.c
+7
-10
newbrt/tests/cachetable-cleaner-thread-everything-pinned.c
newbrt/tests/cachetable-cleaner-thread-everything-pinned.c
+5
-6
newbrt/tests/cachetable-cleaner-thread-nothing-needs-flushing.c
.../tests/cachetable-cleaner-thread-nothing-needs-flushing.c
+4
-5
newbrt/tests/cachetable-cleaner-thread-simple.c
newbrt/tests/cachetable-cleaner-thread-simple.c
+7
-11
newbrt/tests/cachetable-clock-all-pinned.c
newbrt/tests/cachetable-clock-all-pinned.c
+3
-19
newbrt/tests/cachetable-clock-eviction.c
newbrt/tests/cachetable-clock-eviction.c
+7
-5
newbrt/tests/cachetable-clock-eviction2.c
newbrt/tests/cachetable-clock-eviction2.c
+20
-5
newbrt/tests/cachetable-clock-eviction3.c
newbrt/tests/cachetable-clock-eviction3.c
+25
-5
newbrt/tests/cachetable-clock-eviction4.c
newbrt/tests/cachetable-clock-eviction4.c
+9
-5
newbrt/tests/cachetable-count-pinned-test.c
newbrt/tests/cachetable-count-pinned-test.c
+2
-1
newbrt/tests/cachetable-debug-test.c
newbrt/tests/cachetable-debug-test.c
+2
-1
newbrt/tests/cachetable-eviction-close-test.c
newbrt/tests/cachetable-eviction-close-test.c
+7
-10
newbrt/tests/cachetable-eviction-close-test2.c
newbrt/tests/cachetable-eviction-close-test2.c
+9
-10
newbrt/tests/cachetable-eviction-getandpin-test.c
newbrt/tests/cachetable-eviction-getandpin-test.c
+9
-12
newbrt/tests/cachetable-eviction-getandpin-test2.c
newbrt/tests/cachetable-eviction-getandpin-test2.c
+7
-20
newbrt/tests/cachetable-flush-during-cleaner.c
newbrt/tests/cachetable-flush-during-cleaner.c
+3
-35
newbrt/tests/cachetable-flush-test.c
newbrt/tests/cachetable-flush-test.c
+3
-2
newbrt/tests/cachetable-getandpin-test.c
newbrt/tests/cachetable-getandpin-test.c
+3
-25
newbrt/tests/cachetable-kibbutz_and_flush_cachefile.c
newbrt/tests/cachetable-kibbutz_and_flush_cachefile.c
+3
-2
newbrt/tests/cachetable-partial-fetch.c
newbrt/tests/cachetable-partial-fetch.c
+9
-36
newbrt/tests/cachetable-pin-checkpoint.c
newbrt/tests/cachetable-pin-checkpoint.c
+8
-8
newbrt/tests/cachetable-prefetch-checkpoint-test.c
newbrt/tests/cachetable-prefetch-checkpoint-test.c
+4
-2
newbrt/tests/cachetable-prefetch-close-leak-test.c
newbrt/tests/cachetable-prefetch-close-leak-test.c
+3
-1
newbrt/tests/cachetable-prefetch-close-test.c
newbrt/tests/cachetable-prefetch-close-test.c
+4
-6
newbrt/tests/cachetable-prefetch-flowcontrol-test.c
newbrt/tests/cachetable-prefetch-flowcontrol-test.c
+4
-2
newbrt/tests/cachetable-prefetch-getandpin-test.c
newbrt/tests/cachetable-prefetch-getandpin-test.c
+6
-8
newbrt/tests/cachetable-prefetch-maybegetandpin-test.c
newbrt/tests/cachetable-prefetch-maybegetandpin-test.c
+2
-1
newbrt/tests/cachetable-prefetch2-test.c
newbrt/tests/cachetable-prefetch2-test.c
+3
-2
newbrt/tests/cachetable-put-checkpoint.c
newbrt/tests/cachetable-put-checkpoint.c
+14
-12
newbrt/tests/cachetable-put-test.c
newbrt/tests/cachetable-put-test.c
+2
-1
newbrt/tests/cachetable-rename-test.c
newbrt/tests/cachetable-rename-test.c
+6
-2
newbrt/tests/cachetable-scan.c
newbrt/tests/cachetable-scan.c
+6
-2
newbrt/tests/cachetable-simple-maybe-get-pin.c
newbrt/tests/cachetable-simple-maybe-get-pin.c
+2
-34
newbrt/tests/cachetable-simple-pin-dep-nodes.c
newbrt/tests/cachetable-simple-pin-dep-nodes.c
+8
-4
newbrt/tests/cachetable-simple-pin-nonblocking.c
newbrt/tests/cachetable-simple-pin-nonblocking.c
+10
-24
newbrt/tests/cachetable-simple-pin.c
newbrt/tests/cachetable-simple-pin.c
+6
-20
newbrt/tests/cachetable-simple-put-dep-nodes.c
newbrt/tests/cachetable-simple-put-dep-nodes.c
+5
-7
newbrt/tests/cachetable-simple-unpin-remove-checkpoint.c
newbrt/tests/cachetable-simple-unpin-remove-checkpoint.c
+3
-35
newbrt/tests/cachetable-simple-verify.c
newbrt/tests/cachetable-simple-verify.c
+2
-34
newbrt/tests/cachetable-test.c
newbrt/tests/cachetable-test.c
+41
-26
newbrt/tests/cachetable-test2.c
newbrt/tests/cachetable-test2.c
+9
-7
newbrt/tests/cachetable-unpin-and-remove-test.c
newbrt/tests/cachetable-unpin-and-remove-test.c
+5
-3
newbrt/tests/cachetable-unpin-remove-and-checkpoint.c
newbrt/tests/cachetable-unpin-remove-and-checkpoint.c
+3
-2
newbrt/tests/cachetable-unpin-test.c
newbrt/tests/cachetable-unpin-test.c
+2
-1
newbrt/tests/cachetable-writer-thread-limit.c
newbrt/tests/cachetable-writer-thread-limit.c
+3
-1
newbrt/tests/test.h
newbrt/tests/test.h
+10
-0
newbrt/tests/test4302.c
newbrt/tests/test4302.c
+8
-11
src/ydb.c
src/ydb.c
+4
-4
No files found.
newbrt/brt-cachetable-wrappers.c
View file @
19b7090f
...
@@ -8,7 +8,6 @@
...
@@ -8,7 +8,6 @@
#include <brttypes.h>
#include <brttypes.h>
#include <brt-flusher.h>
#include <brt-flusher.h>
#include <brt-internal.h>
#include <brt-internal.h>
#include <cachetable.h>
static
void
static
void
brtnode_get_key_and_fullhash
(
brtnode_get_key_and_fullhash
(
...
@@ -49,11 +48,7 @@ cachetable_put_empty_node_with_dep_nodes(
...
@@ -49,11 +48,7 @@ cachetable_put_empty_node_with_dep_nodes(
brtnode_get_key_and_fullhash
,
brtnode_get_key_and_fullhash
,
new_node
,
new_node
,
make_pair_attr
(
sizeof
(
BRTNODE
)),
make_pair_attr
(
sizeof
(
BRTNODE
)),
toku_brtnode_flush_callback
,
get_write_callbacks_for_node
(
h
),
toku_brtnode_pe_est_callback
,
toku_brtnode_pe_callback
,
toku_brtnode_cleaner_callback
,
h
,
h
,
h
,
num_dependent_nodes
,
num_dependent_nodes
,
dependent_cf
,
dependent_cf
,
...
@@ -142,15 +137,11 @@ toku_pin_brtnode(
...
@@ -142,15 +137,11 @@ toku_pin_brtnode(
fullhash
,
fullhash
,
&
node_v
,
&
node_v
,
NULL
,
NULL
,
toku_brtnode_flush_callback
,
get_write_callbacks_for_node
(
brt
->
h
)
,
toku_brtnode_fetch_callback
,
toku_brtnode_fetch_callback
,
toku_brtnode_pe_est_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
,
//read_extraargs
bfe
,
//read_extraargs
brt
->
h
,
//write_extraargs
unlockers
);
unlockers
);
if
(
r
==
0
)
{
if
(
r
==
0
)
{
BRTNODE
node
=
node_v
;
BRTNODE
node
=
node_v
;
...
@@ -184,15 +175,11 @@ toku_pin_brtnode_holding_lock(
...
@@ -184,15 +175,11 @@ toku_pin_brtnode_holding_lock(
fullhash
,
fullhash
,
&
node_v
,
&
node_v
,
NULL
,
NULL
,
toku_brtnode_flush_callback
,
get_write_callbacks_for_node
(
brt
->
h
)
,
toku_brtnode_fetch_callback
,
toku_brtnode_fetch_callback
,
toku_brtnode_pe_est_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
);
);
assert
(
r
==
0
);
assert
(
r
==
0
);
BRTNODE
node
=
node_v
;
BRTNODE
node
=
node_v
;
...
@@ -228,15 +215,11 @@ toku_pin_brtnode_off_client_thread(
...
@@ -228,15 +215,11 @@ toku_pin_brtnode_off_client_thread(
fullhash
,
fullhash
,
&
node_v
,
&
node_v
,
NULL
,
NULL
,
toku_brtnode_flush_callback
,
get_write_callbacks_for_node
(
h
)
,
toku_brtnode_fetch_callback
,
toku_brtnode_fetch_callback
,
toku_brtnode_pe_est_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
,
h
,
num_dependent_nodes
,
num_dependent_nodes
,
dependent_cf
,
dependent_cf
,
dependent_keys
,
dependent_keys
,
...
...
newbrt/brt-cachetable-wrappers.h
View file @
19b7090f
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
#include <c_dialects.h>
#include <c_dialects.h>
#include <brttypes.h>
#include <brttypes.h>
#include "cachetable.h"
C_BEGIN
C_BEGIN
...
...
newbrt/brt-flusher.h
View file @
19b7090f
...
@@ -65,22 +65,6 @@ toku_flusher_thread_set_callback(
...
@@ -65,22 +65,6 @@ toku_flusher_thread_set_callback(
void
*
extra
void
*
extra
);
);
/**
* Brings the node into memory and flushes the fullest buffer. If the
* heaviest child is empty, does nothing, otherwise, executes
* flush_some_child to do the flush.
*
* Wrapped by toku_brtnode_cleaner_callback to provide access to
* brt_status which currently just lives in brt.c.
*/
int
toku_brtnode_cleaner_callback
(
void
*
brtnode_pv
,
BLOCKNUM
blocknum
,
u_int32_t
fullhash
,
void
*
extraargs
);
/**
/**
* Puts a workitem on the flusher thread queue, scheduling the node to be
* Puts a workitem on the flusher thread queue, scheduling the node to be
* flushed by flush_some_child.
* flushed by flush_some_child.
...
...
newbrt/brt-internal.h
View file @
19b7090f
...
@@ -532,10 +532,21 @@ extern void toku_brtnode_pe_est_callback(void* brtnode_pv, long* bytes_freed_est
...
@@ -532,10 +532,21 @@ extern void toku_brtnode_pe_est_callback(void* brtnode_pv, long* bytes_freed_est
extern
int
toku_brtnode_pe_callback
(
void
*
brtnode_pv
,
PAIR_ATTR
old_attr
,
PAIR_ATTR
*
new_attr
,
void
*
extraargs
);
extern
int
toku_brtnode_pe_callback
(
void
*
brtnode_pv
,
PAIR_ATTR
old_attr
,
PAIR_ATTR
*
new_attr
,
void
*
extraargs
);
extern
BOOL
toku_brtnode_pf_req_callback
(
void
*
brtnode_pv
,
void
*
read_extraargs
);
extern
BOOL
toku_brtnode_pf_req_callback
(
void
*
brtnode_pv
,
void
*
read_extraargs
);
int
toku_brtnode_pf_callback
(
void
*
brtnode_pv
,
void
*
read_extraargs
,
int
fd
,
PAIR_ATTR
*
sizep
);
int
toku_brtnode_pf_callback
(
void
*
brtnode_pv
,
void
*
read_extraargs
,
int
fd
,
PAIR_ATTR
*
sizep
);
extern
int
toku_brtnode_cleaner_callback
(
void
*
brtnode_pv
,
BLOCKNUM
blocknum
,
u_int32_t
fullhash
,
void
*
extraargs
);
extern
int
toku_brt_alloc_init_header
(
BRT
t
,
TOKUTXN
txn
);
extern
int
toku_brt_alloc_init_header
(
BRT
t
,
TOKUTXN
txn
);
extern
int
toku_read_brt_header_and_store_in_cachefile
(
BRT
brt
,
CACHEFILE
cf
,
LSN
max_acceptable_lsn
,
struct
brt_header
**
header
,
BOOL
*
was_open
);
extern
int
toku_read_brt_header_and_store_in_cachefile
(
BRT
brt
,
CACHEFILE
cf
,
LSN
max_acceptable_lsn
,
struct
brt_header
**
header
,
BOOL
*
was_open
);
extern
CACHEKEY
*
toku_calculate_root_offset_pointer
(
struct
brt_header
*
h
,
u_int32_t
*
root_hash
);
extern
CACHEKEY
*
toku_calculate_root_offset_pointer
(
struct
brt_header
*
h
,
u_int32_t
*
root_hash
);
static
inline
CACHETABLE_WRITE_CALLBACK
get_write_callbacks_for_node
(
struct
brt_header
*
h
)
{
CACHETABLE_WRITE_CALLBACK
wc
;
wc
.
flush_callback
=
toku_brtnode_flush_callback
;
wc
.
pe_est_callback
=
toku_brtnode_pe_est_callback
;
wc
.
pe_callback
=
toku_brtnode_pe_callback
;
wc
.
cleaner_callback
=
toku_brtnode_cleaner_callback
;
wc
.
write_extraargs
=
h
;
return
wc
;
}
static
const
BRTNODE
null_brtnode
=
0
;
static
const
BRTNODE
null_brtnode
=
0
;
// How long is the pivot key?
// How long is the pivot key?
...
...
newbrt/brt-test-helpers.c
View file @
19b7090f
...
@@ -94,15 +94,11 @@ int toku_testsetup_get_sersize(BRT brt, BLOCKNUM diskoff) // Return the size on
...
@@ -94,15 +94,11 @@ int toku_testsetup_get_sersize(BRT brt, BLOCKNUM diskoff) // Return the size on
toku_cachetable_hash
(
brt
->
cf
,
diskoff
),
toku_cachetable_hash
(
brt
->
cf
,
diskoff
),
&
node_v
,
&
node_v
,
NULL
,
NULL
,
toku_brtnode_flush_callback
,
get_write_callbacks_for_node
(
brt
->
h
)
,
toku_brtnode_fetch_callback
,
toku_brtnode_fetch_callback
,
toku_brtnode_pe_est_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
);
);
assert
(
r
==
0
);
assert
(
r
==
0
);
int
size
=
toku_serialize_brtnode_size
(
node_v
);
int
size
=
toku_serialize_brtnode_size
(
node_v
);
...
@@ -124,15 +120,11 @@ int toku_testsetup_insert_to_leaf (BRT brt, BLOCKNUM blocknum, char *key, int ke
...
@@ -124,15 +120,11 @@ int toku_testsetup_insert_to_leaf (BRT brt, BLOCKNUM blocknum, char *key, int ke
toku_cachetable_hash
(
brt
->
cf
,
blocknum
),
toku_cachetable_hash
(
brt
->
cf
,
blocknum
),
&
node_v
,
&
node_v
,
NULL
,
NULL
,
toku_brtnode_flush_callback
,
get_write_callbacks_for_node
(
brt
->
h
)
,
toku_brtnode_fetch_callback
,
toku_brtnode_fetch_callback
,
toku_brtnode_pe_est_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
);
);
if
(
r
!=
0
)
return
r
;
if
(
r
!=
0
)
return
r
;
BRTNODE
node
=
node_v
;
BRTNODE
node
=
node_v
;
...
@@ -200,15 +192,11 @@ int toku_testsetup_insert_to_nonleaf (BRT brt, BLOCKNUM blocknum, enum brt_msg_t
...
@@ -200,15 +192,11 @@ int toku_testsetup_insert_to_nonleaf (BRT brt, BLOCKNUM blocknum, enum brt_msg_t
toku_cachetable_hash
(
brt
->
cf
,
blocknum
),
toku_cachetable_hash
(
brt
->
cf
,
blocknum
),
&
node_v
,
&
node_v
,
NULL
,
NULL
,
toku_brtnode_flush_callback
,
get_write_callbacks_for_node
(
brt
->
h
)
,
toku_brtnode_fetch_callback
,
toku_brtnode_fetch_callback
,
toku_brtnode_pe_est_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
);
);
if
(
r
!=
0
)
return
r
;
if
(
r
!=
0
)
return
r
;
BRTNODE
node
=
node_v
;
BRTNODE
node
=
node_v
;
...
...
newbrt/brt.c
View file @
19b7090f
...
@@ -1298,8 +1298,7 @@ brt_init_new_root(BRT brt, BRTNODE nodea, BRTNODE nodeb, DBT splitk, CACHEKEY *r
...
@@ -1298,8 +1298,7 @@ brt_init_new_root(BRT brt, BRTNODE nodea, BRTNODE nodeb, DBT splitk, CACHEKEY *r
//printf("%s:%d put %lld\n", __FILE__, __LINE__, newroot_diskoff);
//printf("%s:%d put %lld\n", __FILE__, __LINE__, newroot_diskoff);
u_int32_t
fullhash
=
toku_cachetable_hash
(
brt
->
cf
,
newroot_diskoff
);
u_int32_t
fullhash
=
toku_cachetable_hash
(
brt
->
cf
,
newroot_diskoff
);
newroot
->
fullhash
=
fullhash
;
newroot
->
fullhash
=
fullhash
;
toku_cachetable_put
(
brt
->
cf
,
newroot_diskoff
,
fullhash
,
newroot
,
make_brtnode_pair_attr
(
newroot
),
toku_cachetable_put
(
brt
->
cf
,
newroot_diskoff
,
fullhash
,
newroot
,
make_brtnode_pair_attr
(
newroot
),
get_write_callbacks_for_node
(
brt
->
h
));
toku_brtnode_flush_callback
,
toku_brtnode_pe_est_callback
,
toku_brtnode_pe_callback
,
toku_brtnode_cleaner_callback
,
brt
->
h
);
*
newrootp
=
newroot
;
*
newrootp
=
newroot
;
}
}
...
@@ -2915,7 +2914,7 @@ static int setup_initial_brt_root_node (BRT t, BLOCKNUM blocknum) {
...
@@ -2915,7 +2914,7 @@ static int setup_initial_brt_root_node (BRT t, BLOCKNUM blocknum) {
node
->
fullhash
=
fullhash
;
node
->
fullhash
=
fullhash
;
int
r
=
toku_cachetable_put
(
t
->
cf
,
blocknum
,
fullhash
,
int
r
=
toku_cachetable_put
(
t
->
cf
,
blocknum
,
fullhash
,
node
,
make_brtnode_pair_attr
(
node
),
node
,
make_brtnode_pair_attr
(
node
),
toku_brtnode_flush_callback
,
toku_brtnode_pe_est_callback
,
toku_brtnode_pe_callback
,
toku_brtnode_cleaner_callback
,
t
->
h
);
get_write_callbacks_for_node
(
t
->
h
)
);
if
(
r
!=
0
)
if
(
r
!=
0
)
toku_free
(
node
);
toku_free
(
node
);
else
else
...
@@ -4999,15 +4998,11 @@ brt_node_maybe_prefetch(BRT brt, BRTNODE node, int childnum, BRT_CURSOR brtcurso
...
@@ -4999,15 +4998,11 @@ brt_node_maybe_prefetch(BRT brt, BRTNODE node, int childnum, BRT_CURSOR brtcurso
brt
->
cf
,
brt
->
cf
,
nextchildblocknum
,
nextchildblocknum
,
nextfullhash
,
nextfullhash
,
toku_brtnode_flush_callback
,
get_write_callbacks_for_node
(
brt
->
h
)
,
brtnode_fetch_callback_and_free_bfe
,
brtnode_fetch_callback_and_free_bfe
,
toku_brtnode_pe_est_callback
,
toku_brtnode_pe_callback
,
toku_brtnode_pf_req_callback
,
toku_brtnode_pf_req_callback
,
brtnode_pf_callback_and_free_bfe
,
brtnode_pf_callback_and_free_bfe
,
toku_brtnode_cleaner_callback
,
bfe
,
bfe
,
brt
->
h
,
&
doing_prefetch
&
doing_prefetch
);
);
if
(
!
doing_prefetch
)
{
if
(
!
doing_prefetch
)
{
...
@@ -6011,15 +6006,11 @@ toku_dump_brtnode (FILE *file, BRT brt, BLOCKNUM blocknum, int depth, struct kv_
...
@@ -6011,15 +6006,11 @@ toku_dump_brtnode (FILE *file, BRT brt, BLOCKNUM blocknum, int depth, struct kv_
fullhash
,
fullhash
,
&
node_v
,
&
node_v
,
NULL
,
NULL
,
toku_brtnode_flush_callback
,
get_write_callbacks_for_node
(
brt
->
h
),
toku_brtnode_fetch_callback
,
toku_brtnode_fetch_callback
,
toku_brtnode_pe_est_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
);
);
assert_zero
(
r
);
assert_zero
(
r
);
node
=
node_v
;
node
=
node_v
;
...
...
newbrt/cachetable.c
View file @
19b7090f
...
@@ -1745,11 +1745,7 @@ static PAIR cachetable_insert_at(CACHETABLE ct,
...
@@ -1745,11 +1745,7 @@ static PAIR cachetable_insert_at(CACHETABLE ct,
enum
ctpair_state
state
,
enum
ctpair_state
state
,
u_int32_t
fullhash
,
u_int32_t
fullhash
,
PAIR_ATTR
attr
,
PAIR_ATTR
attr
,
CACHETABLE_FLUSH_CALLBACK
flush_callback
,
CACHETABLE_WRITE_CALLBACK
write_callback
,
CACHETABLE_PARTIAL_EVICTION_EST_CALLBACK
pe_est_callback
,
CACHETABLE_PARTIAL_EVICTION_CALLBACK
pe_callback
,
CACHETABLE_CLEANER_CALLBACK
cleaner_callback
,
void
*
write_extraargs
,
enum
cachetable_dirty
dirty
)
{
enum
cachetable_dirty
dirty
)
{
PAIR
MALLOC
(
p
);
PAIR
MALLOC
(
p
);
assert
(
p
);
assert
(
p
);
...
@@ -1762,11 +1758,11 @@ static PAIR cachetable_insert_at(CACHETABLE ct,
...
@@ -1762,11 +1758,11 @@ static PAIR cachetable_insert_at(CACHETABLE ct,
p
->
dirty
=
dirty
;
p
->
dirty
=
dirty
;
p
->
attr
=
attr
;
p
->
attr
=
attr
;
p
->
state
=
state
;
p
->
state
=
state
;
p
->
flush_callback
=
flush_callback
;
p
->
flush_callback
=
write_callback
.
flush_callback
;
p
->
pe_callback
=
pe_callback
;
p
->
pe_callback
=
write_callback
.
pe_callback
;
p
->
pe_est_callback
=
pe_est_callback
;
p
->
pe_est_callback
=
write_callback
.
pe_est_callback
;
p
->
cleaner_callback
=
cleaner_callback
;
p
->
cleaner_callback
=
write_callback
.
cleaner_callback
;
p
->
write_extraargs
=
write_extraargs
;
p
->
write_extraargs
=
write_
callback
.
write_
extraargs
;
p
->
fullhash
=
fullhash
;
p
->
fullhash
=
fullhash
;
p
->
clock_next
=
p
->
clock_prev
=
0
;
p
->
clock_next
=
p
->
clock_prev
=
0
;
p
->
remove_me
=
FALSE
;
p
->
remove_me
=
FALSE
;
...
@@ -1811,11 +1807,7 @@ static int cachetable_put_internal(
...
@@ -1811,11 +1807,7 @@ static int cachetable_put_internal(
u_int32_t
fullhash
,
u_int32_t
fullhash
,
void
*
value
,
void
*
value
,
PAIR_ATTR
attr
,
PAIR_ATTR
attr
,
CACHETABLE_FLUSH_CALLBACK
flush_callback
,
CACHETABLE_WRITE_CALLBACK
write_callback
CACHETABLE_PARTIAL_EVICTION_EST_CALLBACK
pe_est_callback
,
CACHETABLE_PARTIAL_EVICTION_CALLBACK
pe_callback
,
CACHETABLE_CLEANER_CALLBACK
cleaner_callback
,
void
*
write_extraargs
)
)
{
{
CACHETABLE
ct
=
cachefile
->
cachetable
;
CACHETABLE
ct
=
cachefile
->
cachetable
;
...
@@ -1833,9 +1825,9 @@ static int cachetable_put_internal(
...
@@ -1833,9 +1825,9 @@ static int cachetable_put_internal(
//
//
// Semantically, these two asserts are not strictly right. After all, when are two functions eq?
// Semantically, these two asserts are not strictly right. After all, when are two functions eq?
// In practice, the functions better be the same.
// In practice, the functions better be the same.
assert
(
p
->
flush_callback
==
flush_callback
);
assert
(
p
->
flush_callback
==
write_callback
.
flush_callback
);
assert
(
p
->
pe_callback
==
pe_callback
);
assert
(
p
->
pe_callback
==
write_callback
.
pe_callback
);
assert
(
p
->
cleaner_callback
==
cleaner_callback
);
assert
(
p
->
cleaner_callback
==
write_callback
.
cleaner_callback
);
return
-
1
;
/* Already present, don't grab lock. */
return
-
1
;
/* Already present, don't grab lock. */
}
}
}
}
...
@@ -1850,11 +1842,7 @@ static int cachetable_put_internal(
...
@@ -1850,11 +1842,7 @@ static int cachetable_put_internal(
CTPAIR_IDLE
,
CTPAIR_IDLE
,
fullhash
,
fullhash
,
attr
,
attr
,
flush_callback
,
write_callback
,
pe_est_callback
,
pe_callback
,
cleaner_callback
,
write_extraargs
,
CACHETABLE_DIRTY
CACHETABLE_DIRTY
);
);
assert
(
p
);
assert
(
p
);
...
@@ -1956,11 +1944,7 @@ int toku_cachetable_put_with_dep_pairs(
...
@@ -1956,11 +1944,7 @@ int toku_cachetable_put_with_dep_pairs(
CACHETABLE_GET_KEY_AND_FULLHASH
get_key_and_fullhash
,
CACHETABLE_GET_KEY_AND_FULLHASH
get_key_and_fullhash
,
void
*
value
,
void
*
value
,
PAIR_ATTR
attr
,
PAIR_ATTR
attr
,
CACHETABLE_FLUSH_CALLBACK
flush_callback
,
CACHETABLE_WRITE_CALLBACK
write_callback
,
CACHETABLE_PARTIAL_EVICTION_EST_CALLBACK
pe_est_callback
,
CACHETABLE_PARTIAL_EVICTION_CALLBACK
pe_callback
,
CACHETABLE_CLEANER_CALLBACK
cleaner_callback
,
void
*
write_extraargs
,
// parameter for flush_callback, pe_est_callback, pe_callback, and cleaner_callback
void
*
get_key_and_fullhash_extra
,
void
*
get_key_and_fullhash_extra
,
u_int32_t
num_dependent_pairs
,
// number of dependent pairs that we may need to checkpoint
u_int32_t
num_dependent_pairs
,
// number of dependent pairs that we may need to checkpoint
CACHEFILE
*
dependent_cfs
,
// array of cachefiles of dependent pairs
CACHEFILE
*
dependent_cfs
,
// array of cachefiles of dependent pairs
...
@@ -2012,11 +1996,7 @@ int toku_cachetable_put_with_dep_pairs(
...
@@ -2012,11 +1996,7 @@ int toku_cachetable_put_with_dep_pairs(
*
fullhash
,
*
fullhash
,
value
,
value
,
attr
,
attr
,
flush_callback
,
write_callback
pe_est_callback
,
pe_callback
,
cleaner_callback
,
write_extraargs
);
);
//
//
...
@@ -2040,11 +2020,7 @@ int toku_cachetable_put_with_dep_pairs(
...
@@ -2040,11 +2020,7 @@ int toku_cachetable_put_with_dep_pairs(
int
toku_cachetable_put
(
CACHEFILE
cachefile
,
CACHEKEY
key
,
u_int32_t
fullhash
,
void
*
value
,
PAIR_ATTR
attr
,
int
toku_cachetable_put
(
CACHEFILE
cachefile
,
CACHEKEY
key
,
u_int32_t
fullhash
,
void
*
value
,
PAIR_ATTR
attr
,
CACHETABLE_FLUSH_CALLBACK
flush_callback
,
CACHETABLE_WRITE_CALLBACK
write_callback
CACHETABLE_PARTIAL_EVICTION_EST_CALLBACK
pe_est_callback
,
CACHETABLE_PARTIAL_EVICTION_CALLBACK
pe_callback
,
CACHETABLE_CLEANER_CALLBACK
cleaner_callback
,
void
*
write_extraargs
// parameter for flush_callback, pe_est_callback, pe_callback, and cleaner_callback
)
{
)
{
WHEN_TRACE_CT
(
printf
(
"%s:%d CT cachetable_put(%lld)=%p
\n
"
,
__FILE__
,
__LINE__
,
key
,
value
));
WHEN_TRACE_CT
(
printf
(
"%s:%d CT cachetable_put(%lld)=%p
\n
"
,
__FILE__
,
__LINE__
,
key
,
value
));
CACHETABLE
ct
=
cachefile
->
cachetable
;
CACHETABLE
ct
=
cachefile
->
cachetable
;
...
@@ -2057,11 +2033,7 @@ int toku_cachetable_put(CACHEFILE cachefile, CACHEKEY key, u_int32_t fullhash, v
...
@@ -2057,11 +2033,7 @@ int toku_cachetable_put(CACHEFILE cachefile, CACHEKEY key, u_int32_t fullhash, v
fullhash
,
fullhash
,
value
,
value
,
attr
,
attr
,
flush_callback
,
write_callback
pe_est_callback
,
pe_callback
,
cleaner_callback
,
write_extraargs
);
);
cachetable_unlock
(
ct
);
cachetable_unlock
(
ct
);
return
r
;
return
r
;
...
@@ -2171,15 +2143,11 @@ int toku_cachetable_get_and_pin (
...
@@ -2171,15 +2143,11 @@ int toku_cachetable_get_and_pin (
u_int32_t
fullhash
,
u_int32_t
fullhash
,
void
**
value
,
void
**
value
,
long
*
sizep
,
long
*
sizep
,
CACHETABLE_
FLUSH_CALLBACK
flush_callback
,
CACHETABLE_
WRITE_CALLBACK
write_callback
,
CACHETABLE_FETCH_CALLBACK
fetch_callback
,
CACHETABLE_FETCH_CALLBACK
fetch_callback
,
CACHETABLE_PARTIAL_EVICTION_EST_CALLBACK
pe_est_callback
,
CACHETABLE_PARTIAL_EVICTION_CALLBACK
pe_callback
,
CACHETABLE_PARTIAL_FETCH_REQUIRED_CALLBACK
pf_req_callback
,
CACHETABLE_PARTIAL_FETCH_REQUIRED_CALLBACK
pf_req_callback
,
CACHETABLE_PARTIAL_FETCH_CALLBACK
pf_callback
,
CACHETABLE_PARTIAL_FETCH_CALLBACK
pf_callback
,
CACHETABLE_CLEANER_CALLBACK
cleaner_callback
,
void
*
read_extraargs
// parameter for fetch_callback, pf_req_callback, and pf_callback
void
*
read_extraargs
,
// parameter for fetch_callback, pf_req_callback, and pf_callback
void
*
write_extraargs
// parameter for flush_callback, pe_est_callback, pe_callback, and cleaner_callback
)
)
{
{
// We have separate parameters of read_extraargs and write_extraargs because
// We have separate parameters of read_extraargs and write_extraargs because
...
@@ -2194,15 +2162,11 @@ int toku_cachetable_get_and_pin (
...
@@ -2194,15 +2162,11 @@ int toku_cachetable_get_and_pin (
fullhash
,
fullhash
,
value
,
value
,
sizep
,
sizep
,
flush_callback
,
write_callback
,
fetch_callback
,
fetch_callback
,
pe_est_callback
,
pe_callback
,
pf_req_callback
,
pf_req_callback
,
pf_callback
,
pf_callback
,
cleaner_callback
,
read_extraargs
,
read_extraargs
,
write_extraargs
,
0
,
// number of dependent pairs that we may need to checkpoint
0
,
// number of dependent pairs that we may need to checkpoint
NULL
,
// array of cachefiles of dependent pairs
NULL
,
// array of cachefiles of dependent pairs
NULL
,
// array of cachekeys of dependent pairs
NULL
,
// array of cachekeys of dependent pairs
...
@@ -2218,15 +2182,11 @@ int toku_cachetable_get_and_pin_with_dep_pairs (
...
@@ -2218,15 +2182,11 @@ int toku_cachetable_get_and_pin_with_dep_pairs (
u_int32_t
fullhash
,
u_int32_t
fullhash
,
void
**
value
,
void
**
value
,
long
*
sizep
,
long
*
sizep
,
CACHETABLE_
FLUSH_CALLBACK
flush_callback
,
CACHETABLE_
WRITE_CALLBACK
write_callback
,
CACHETABLE_FETCH_CALLBACK
fetch_callback
,
CACHETABLE_FETCH_CALLBACK
fetch_callback
,
CACHETABLE_PARTIAL_EVICTION_EST_CALLBACK
pe_est_callback
,
CACHETABLE_PARTIAL_EVICTION_CALLBACK
pe_callback
,
CACHETABLE_PARTIAL_FETCH_REQUIRED_CALLBACK
pf_req_callback
,
CACHETABLE_PARTIAL_FETCH_REQUIRED_CALLBACK
pf_req_callback
,
CACHETABLE_PARTIAL_FETCH_CALLBACK
pf_callback
,
CACHETABLE_PARTIAL_FETCH_CALLBACK
pf_callback
,
CACHETABLE_CLEANER_CALLBACK
cleaner_callback
,
void
*
read_extraargs
,
// parameter for fetch_callback, pf_req_callback, and pf_callback
void
*
read_extraargs
,
// parameter for fetch_callback, pf_req_callback, and pf_callback
void
*
write_extraargs
,
// parameter for flush_callback, pe_est_callback, pe_callback, and cleaner_callback
u_int32_t
num_dependent_pairs
,
// number of dependent pairs that we may need to checkpoint
u_int32_t
num_dependent_pairs
,
// number of dependent pairs that we may need to checkpoint
CACHEFILE
*
dependent_cfs
,
// array of cachefiles of dependent pairs
CACHEFILE
*
dependent_cfs
,
// array of cachefiles of dependent pairs
CACHEKEY
*
dependent_keys
,
// array of cachekeys of dependent pairs
CACHEKEY
*
dependent_keys
,
// array of cachekeys of dependent pairs
...
@@ -2294,11 +2254,7 @@ int toku_cachetable_get_and_pin_with_dep_pairs (
...
@@ -2294,11 +2254,7 @@ int toku_cachetable_get_and_pin_with_dep_pairs (
CTPAIR_READING
,
CTPAIR_READING
,
fullhash
,
fullhash
,
zero_attr
,
zero_attr
,
flush_callback
,
write_callback
,
pe_est_callback
,
pe_callback
,
cleaner_callback
,
write_extraargs
,
CACHETABLE_CLEAN
CACHETABLE_CLEAN
);
);
assert
(
p
);
assert
(
p
);
...
@@ -2507,15 +2463,11 @@ int toku_cachetable_get_and_pin_nonblocking (
...
@@ -2507,15 +2463,11 @@ int toku_cachetable_get_and_pin_nonblocking (
u_int32_t
fullhash
,
u_int32_t
fullhash
,
void
**
value
,
void
**
value
,
long
*
sizep
,
long
*
sizep
,
CACHETABLE_
FLUSH_CALLBACK
flush_callback
,
CACHETABLE_
WRITE_CALLBACK
write_callback
,
CACHETABLE_FETCH_CALLBACK
fetch_callback
,
CACHETABLE_FETCH_CALLBACK
fetch_callback
,
CACHETABLE_PARTIAL_EVICTION_EST_CALLBACK
pe_est_callback
,
CACHETABLE_PARTIAL_EVICTION_CALLBACK
pe_callback
,
CACHETABLE_PARTIAL_FETCH_REQUIRED_CALLBACK
pf_req_callback
,
CACHETABLE_PARTIAL_FETCH_REQUIRED_CALLBACK
pf_req_callback
,
CACHETABLE_PARTIAL_FETCH_CALLBACK
pf_callback
,
CACHETABLE_PARTIAL_FETCH_CALLBACK
pf_callback
,
CACHETABLE_CLEANER_CALLBACK
cleaner_callback
,
void
*
read_extraargs
,
void
*
read_extraargs
,
void
*
write_extraargs
,
// parameter for flush_callback, pe_est_callback, pe_callback, and cleaner_callback
UNLOCKERS
unlockers
UNLOCKERS
unlockers
)
)
// Effect: If the block is in the cachetable, then pin it and return it.
// Effect: If the block is in the cachetable, then pin it and return it.
...
@@ -2642,11 +2594,7 @@ int toku_cachetable_get_and_pin_nonblocking (
...
@@ -2642,11 +2594,7 @@ int toku_cachetable_get_and_pin_nonblocking (
CTPAIR_READING
,
CTPAIR_READING
,
fullhash
,
fullhash
,
zero_attr
,
zero_attr
,
flush_callback
,
write_callback
,
pe_est_callback
,
pe_callback
,
cleaner_callback
,
write_extraargs
,
CACHETABLE_CLEAN
CACHETABLE_CLEAN
);
);
assert
(
p
);
assert
(
p
);
...
@@ -2675,15 +2623,11 @@ struct cachefile_partial_prefetch_args {
...
@@ -2675,15 +2623,11 @@ struct cachefile_partial_prefetch_args {
};
};
int
toku_cachefile_prefetch
(
CACHEFILE
cf
,
CACHEKEY
key
,
u_int32_t
fullhash
,
int
toku_cachefile_prefetch
(
CACHEFILE
cf
,
CACHEKEY
key
,
u_int32_t
fullhash
,
CACHETABLE_
FLUSH_CALLBACK
flush
_callback
,
CACHETABLE_
WRITE_CALLBACK
write
_callback
,
CACHETABLE_FETCH_CALLBACK
fetch_callback
,
CACHETABLE_FETCH_CALLBACK
fetch_callback
,
CACHETABLE_PARTIAL_EVICTION_EST_CALLBACK
pe_est_callback
,
CACHETABLE_PARTIAL_EVICTION_CALLBACK
pe_callback
,
CACHETABLE_PARTIAL_FETCH_REQUIRED_CALLBACK
pf_req_callback
,
CACHETABLE_PARTIAL_FETCH_REQUIRED_CALLBACK
pf_req_callback
,
CACHETABLE_PARTIAL_FETCH_CALLBACK
pf_callback
,
CACHETABLE_PARTIAL_FETCH_CALLBACK
pf_callback
,
CACHETABLE_CLEANER_CALLBACK
cleaner_callback
,
void
*
read_extraargs
,
void
*
read_extraargs
,
void
*
write_extraargs
,
// parameter for flush_callback, pe_est_callback, pe_callback, and cleaner_callback
BOOL
*
doing_prefetch
)
BOOL
*
doing_prefetch
)
// Effect: See the documentation for this function in cachetable.h
// Effect: See the documentation for this function in cachetable.h
{
{
...
@@ -2723,11 +2667,7 @@ int toku_cachefile_prefetch(CACHEFILE cf, CACHEKEY key, u_int32_t fullhash,
...
@@ -2723,11 +2667,7 @@ int toku_cachefile_prefetch(CACHEFILE cf, CACHEKEY key, u_int32_t fullhash,
CTPAIR_READING
,
CTPAIR_READING
,
fullhash
,
fullhash
,
zero_attr
,
zero_attr
,
flush_callback
,
write_callback
,
pe_est_callback
,
pe_callback
,
cleaner_callback
,
write_extraargs
,
CACHETABLE_CLEAN
CACHETABLE_CLEAN
);
);
assert
(
p
);
assert
(
p
);
...
...
newbrt/cachetable.h
View file @
19b7090f
...
@@ -178,6 +178,14 @@ typedef int (*CACHETABLE_PARTIAL_FETCH_CALLBACK)(void *brtnode_pv, void *read_ex
...
@@ -178,6 +178,14 @@ typedef int (*CACHETABLE_PARTIAL_FETCH_CALLBACK)(void *brtnode_pv, void *read_ex
// TODO(leif) XXX TODO XXX
// TODO(leif) XXX TODO XXX
typedef
int
(
*
CACHETABLE_CLEANER_CALLBACK
)(
void
*
brtnode_pv
,
BLOCKNUM
blocknum
,
u_int32_t
fullhash
,
void
*
write_extraargs
);
typedef
int
(
*
CACHETABLE_CLEANER_CALLBACK
)(
void
*
brtnode_pv
,
BLOCKNUM
blocknum
,
u_int32_t
fullhash
,
void
*
write_extraargs
);
typedef
struct
{
CACHETABLE_FLUSH_CALLBACK
flush_callback
;
CACHETABLE_PARTIAL_EVICTION_EST_CALLBACK
pe_est_callback
;
CACHETABLE_PARTIAL_EVICTION_CALLBACK
pe_callback
;
CACHETABLE_CLEANER_CALLBACK
cleaner_callback
;
void
*
write_extraargs
;
// parameter for flush_callback, pe_est_callback, pe_callback, and cleaner_callback
}
CACHETABLE_WRITE_CALLBACK
;
typedef
void
(
*
CACHETABLE_GET_KEY_AND_FULLHASH
)(
CACHEKEY
*
cachekey
,
u_int32_t
*
fullhash
,
void
*
extra
);
typedef
void
(
*
CACHETABLE_GET_KEY_AND_FULLHASH
)(
CACHEKEY
*
cachekey
,
u_int32_t
*
fullhash
,
void
*
extra
);
typedef
void
(
*
CACHETABLE_REMOVE_KEY
)(
CACHEKEY
*
cachekey
,
BOOL
for_checkpoint
,
void
*
extra
);
typedef
void
(
*
CACHETABLE_REMOVE_KEY
)(
CACHEKEY
*
cachekey
,
BOOL
for_checkpoint
,
void
*
extra
);
...
@@ -210,11 +218,7 @@ int toku_cachetable_put_with_dep_pairs(
...
@@ -210,11 +218,7 @@ int toku_cachetable_put_with_dep_pairs(
CACHETABLE_GET_KEY_AND_FULLHASH
get_key_and_fullhash
,
CACHETABLE_GET_KEY_AND_FULLHASH
get_key_and_fullhash
,
void
*
value
,
void
*
value
,
PAIR_ATTR
attr
,
PAIR_ATTR
attr
,
CACHETABLE_FLUSH_CALLBACK
flush_callback
,
CACHETABLE_WRITE_CALLBACK
write_callback
,
CACHETABLE_PARTIAL_EVICTION_EST_CALLBACK
pe_est_callback
,
CACHETABLE_PARTIAL_EVICTION_CALLBACK
pe_callback
,
CACHETABLE_CLEANER_CALLBACK
cleaner_callback
,
void
*
write_extraargs
,
// parameter for flush_callback, pe_est_callback, pe_callback, and cleaner_callback
void
*
get_key_and_fullhash_extra
,
void
*
get_key_and_fullhash_extra
,
u_int32_t
num_dependent_pairs
,
// number of dependent pairs that we may need to checkpoint
u_int32_t
num_dependent_pairs
,
// number of dependent pairs that we may need to checkpoint
CACHEFILE
*
dependent_cfs
,
// array of cachefiles of dependent pairs
CACHEFILE
*
dependent_cfs
,
// array of cachefiles of dependent pairs
...
@@ -234,11 +238,7 @@ int toku_cachetable_put_with_dep_pairs(
...
@@ -234,11 +238,7 @@ int toku_cachetable_put_with_dep_pairs(
// error number.
// error number.
int
toku_cachetable_put
(
CACHEFILE
cf
,
CACHEKEY
key
,
u_int32_t
fullhash
,
int
toku_cachetable_put
(
CACHEFILE
cf
,
CACHEKEY
key
,
u_int32_t
fullhash
,
void
*
value
,
PAIR_ATTR
size
,
void
*
value
,
PAIR_ATTR
size
,
CACHETABLE_FLUSH_CALLBACK
flush_callback
,
CACHETABLE_WRITE_CALLBACK
write_callback
CACHETABLE_PARTIAL_EVICTION_EST_CALLBACK
pe_est_callback
,
CACHETABLE_PARTIAL_EVICTION_CALLBACK
pe_callback
,
CACHETABLE_CLEANER_CALLBACK
cleaner_callback
,
void
*
write_extraargs
// parameter for flush_callback, pe_est_callback, pe_callback, and cleaner_callback
);
);
...
@@ -258,15 +258,11 @@ int toku_cachetable_get_and_pin_with_dep_pairs (
...
@@ -258,15 +258,11 @@ int toku_cachetable_get_and_pin_with_dep_pairs (
u_int32_t
fullhash
,
u_int32_t
fullhash
,
void
**
value
,
void
**
value
,
long
*
sizep
,
long
*
sizep
,
CACHETABLE_
FLUSH_CALLBACK
flush_callback
,
CACHETABLE_
WRITE_CALLBACK
write_callback
,
CACHETABLE_FETCH_CALLBACK
fetch_callback
,
CACHETABLE_FETCH_CALLBACK
fetch_callback
,
CACHETABLE_PARTIAL_EVICTION_EST_CALLBACK
pe_est_callback
,
CACHETABLE_PARTIAL_EVICTION_CALLBACK
pe_callback
,
CACHETABLE_PARTIAL_FETCH_REQUIRED_CALLBACK
pf_req_callback
,
CACHETABLE_PARTIAL_FETCH_REQUIRED_CALLBACK
pf_req_callback
,
CACHETABLE_PARTIAL_FETCH_CALLBACK
pf_callback
,
CACHETABLE_PARTIAL_FETCH_CALLBACK
pf_callback
,
CACHETABLE_CLEANER_CALLBACK
cleaner_callback
,
void
*
read_extraargs
,
// parameter for fetch_callback, pf_req_callback, and pf_callback
void
*
read_extraargs
,
// parameter for fetch_callback, pf_req_callback, and pf_callback
void
*
write_extraargs
,
// parameter for flush_callback, pe_est_callback, pe_callback, and cleaner_callback
u_int32_t
num_dependent_pairs
,
// number of dependent pairs that we may need to checkpoint
u_int32_t
num_dependent_pairs
,
// number of dependent pairs that we may need to checkpoint
CACHEFILE
*
dependent_cfs
,
// array of cachefiles of dependent pairs
CACHEFILE
*
dependent_cfs
,
// array of cachefiles of dependent pairs
CACHEKEY
*
dependent_keys
,
// array of cachekeys of dependent pairs
CACHEKEY
*
dependent_keys
,
// array of cachekeys of dependent pairs
...
@@ -286,15 +282,11 @@ int toku_cachetable_get_and_pin (
...
@@ -286,15 +282,11 @@ int toku_cachetable_get_and_pin (
u_int32_t
fullhash
,
u_int32_t
fullhash
,
void
**
value
,
void
**
value
,
long
*
sizep
,
long
*
sizep
,
CACHETABLE_
FLUSH_CALLBACK
flush_callback
,
CACHETABLE_
WRITE_CALLBACK
write_callback
,
CACHETABLE_FETCH_CALLBACK
fetch_callback
,
CACHETABLE_FETCH_CALLBACK
fetch_callback
,
CACHETABLE_PARTIAL_EVICTION_EST_CALLBACK
pe_est_callback
,
CACHETABLE_PARTIAL_FETCH_REQUIRED_CALLBACK
pf_req_callback
,
CACHETABLE_PARTIAL_EVICTION_CALLBACK
pe_callback
,
CACHETABLE_PARTIAL_FETCH_CALLBACK
pf_callback
,
CACHETABLE_PARTIAL_FETCH_REQUIRED_CALLBACK
pf_req_callback
__attribute__
((
unused
)),
void
*
read_extraargs
// parameter for fetch_callback, pf_req_callback, and pf_callback
CACHETABLE_PARTIAL_FETCH_CALLBACK
pf_callback
__attribute__
((
unused
)),
CACHETABLE_CLEANER_CALLBACK
cleaner_callback
,
void
*
read_extraargs
,
// parameter for fetch_callback, pf_req_callback, and pf_callback
void
*
write_extraargs
// parameter for flush_callback, pe_est_callback, pe_callback, and cleaner_callback
);
);
struct
unlockers
{
struct
unlockers
{
...
@@ -313,15 +305,11 @@ int toku_cachetable_get_and_pin_nonblocking (
...
@@ -313,15 +305,11 @@ int toku_cachetable_get_and_pin_nonblocking (
u_int32_t
fullhash
,
u_int32_t
fullhash
,
void
**
value
,
void
**
value
,
long
*
sizep
,
long
*
sizep
,
CACHETABLE_
FLUSH_CALLBACK
flush_callback
,
CACHETABLE_
WRITE_CALLBACK
write_callback
,
CACHETABLE_FETCH_CALLBACK
fetch_callback
,
CACHETABLE_FETCH_CALLBACK
fetch_callback
,
CACHETABLE_PARTIAL_EVICTION_EST_CALLBACK
pe_est_callback
,
CACHETABLE_PARTIAL_EVICTION_CALLBACK
pe_callback
,
CACHETABLE_PARTIAL_FETCH_REQUIRED_CALLBACK
pf_req_callback
__attribute__
((
unused
)),
CACHETABLE_PARTIAL_FETCH_REQUIRED_CALLBACK
pf_req_callback
__attribute__
((
unused
)),
CACHETABLE_PARTIAL_FETCH_CALLBACK
pf_callback
__attribute__
((
unused
)),
CACHETABLE_PARTIAL_FETCH_CALLBACK
pf_callback
__attribute__
((
unused
)),
CACHETABLE_CLEANER_CALLBACK
cleaner_callback
,
void
*
read_extraargs
,
// parameter for fetch_callback, pf_req_callback, and pf_callback
void
*
read_extraargs
,
// parameter for fetch_callback, pf_req_callback, and pf_callback
void
*
write_extraargs
,
// parameter for flush_callback, pe_est_callback, pe_callback, and cleaner_callback
UNLOCKERS
unlockers
UNLOCKERS
unlockers
);
);
...
@@ -353,15 +341,11 @@ int toku_cachetable_unpin_and_remove (CACHEFILE, CACHEKEY, CACHETABLE_REMOVE_KEY
...
@@ -353,15 +341,11 @@ int toku_cachetable_unpin_and_remove (CACHEFILE, CACHEKEY, CACHETABLE_REMOVE_KEY
// Requires: The object must be pinned exactly once.
// Requires: The object must be pinned exactly once.
int
toku_cachefile_prefetch
(
CACHEFILE
cf
,
CACHEKEY
key
,
u_int32_t
fullhash
,
int
toku_cachefile_prefetch
(
CACHEFILE
cf
,
CACHEKEY
key
,
u_int32_t
fullhash
,
CACHETABLE_
FLUSH_CALLBACK
flush_callback
,
CACHETABLE_
WRITE_CALLBACK
write_callback
,
CACHETABLE_FETCH_CALLBACK
fetch_callback
,
CACHETABLE_FETCH_CALLBACK
fetch_callback
,
CACHETABLE_PARTIAL_EVICTION_EST_CALLBACK
pe_est_callback
,
CACHETABLE_PARTIAL_EVICTION_CALLBACK
pe_callback
,
CACHETABLE_PARTIAL_FETCH_REQUIRED_CALLBACK
pf_req_callback
,
CACHETABLE_PARTIAL_FETCH_REQUIRED_CALLBACK
pf_req_callback
,
CACHETABLE_PARTIAL_FETCH_CALLBACK
pf_callback
,
CACHETABLE_PARTIAL_FETCH_CALLBACK
pf_callback
,
CACHETABLE_CLEANER_CALLBACK
cleaner_callback
,
void
*
read_extraargs
,
// parameter for fetch_callback, pf_req_callback, and pf_callback
void
*
read_extraargs
,
// parameter for fetch_callback, pf_req_callback, and pf_callback
void
*
write_extraargs
,
// parameter for flush_callback, pe_est_callback, pe_callback, and cleaner_callback
BOOL
*
doing_prefetch
);
BOOL
*
doing_prefetch
);
// Effect: Prefetch a memory object for a given key into the cachetable
// Effect: Prefetch a memory object for a given key into the cachetable
// Precondition: The cachetable mutex is NOT held.
// Precondition: The cachetable mutex is NOT held.
...
...
newbrt/rollback.c
View file @
19b7090f
...
@@ -578,6 +578,15 @@ static int toku_rollback_cleaner_callback (
...
@@ -578,6 +578,15 @@ static int toku_rollback_cleaner_callback (
return
0
;
return
0
;
}
}
static
inline
CACHETABLE_WRITE_CALLBACK
get_write_callbacks_for_rollback_log
(
struct
brt_header
*
h
)
{
CACHETABLE_WRITE_CALLBACK
wc
;
wc
.
flush_callback
=
toku_rollback_flush_callback
;
wc
.
pe_est_callback
=
toku_rollback_pe_est_callback
;
wc
.
pe_callback
=
toku_rollback_pe_callback
;
wc
.
cleaner_callback
=
toku_rollback_cleaner_callback
;
wc
.
write_extraargs
=
h
;
return
wc
;
}
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
)
{
ROLLBACK_LOG_NODE
MALLOC
(
log
);
ROLLBACK_LOG_NODE
MALLOC
(
log
);
...
@@ -605,11 +614,7 @@ static int toku_create_new_rollback_log (TOKUTXN txn, BLOCKNUM older, uint32_t o
...
@@ -605,11 +614,7 @@ static int toku_create_new_rollback_log (TOKUTXN txn, BLOCKNUM older, uint32_t o
*
result
=
log
;
*
result
=
log
;
r
=
toku_cachetable_put
(
cf
,
log
->
thislogname
,
log
->
thishash
,
r
=
toku_cachetable_put
(
cf
,
log
->
thislogname
,
log
->
thishash
,
log
,
rollback_memory_size
(
log
),
log
,
rollback_memory_size
(
log
),
toku_rollback_flush_callback
,
get_write_callbacks_for_rollback_log
(
h
));
toku_rollback_pe_est_callback
,
toku_rollback_pe_callback
,
toku_rollback_cleaner_callback
,
h
);
assert
(
r
==
0
);
assert
(
r
==
0
);
txn
->
current_rollback
=
log
->
thislogname
;
txn
->
current_rollback
=
log
->
thislogname
;
txn
->
current_rollback_hash
=
log
->
thishash
;
txn
->
current_rollback_hash
=
log
->
thishash
;
...
@@ -833,14 +838,10 @@ toku_maybe_prefetch_older_rollback_log(TOKUTXN txn, ROLLBACK_LOG_NODE log) {
...
@@ -833,14 +838,10 @@ toku_maybe_prefetch_older_rollback_log(TOKUTXN txn, ROLLBACK_LOG_NODE log) {
struct
brt_header
*
h
=
toku_cachefile_get_userdata
(
cf
);
struct
brt_header
*
h
=
toku_cachefile_get_userdata
(
cf
);
BOOL
doing_prefetch
=
FALSE
;
BOOL
doing_prefetch
=
FALSE
;
r
=
toku_cachefile_prefetch
(
cf
,
name
,
hash
,
r
=
toku_cachefile_prefetch
(
cf
,
name
,
hash
,
toku_rollback_flush_callback
,
get_write_callbacks_for_rollback_log
(
h
)
,
toku_rollback_fetch_callback
,
toku_rollback_fetch_callback
,
toku_rollback_pe_est_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
,
&
doing_prefetch
);
&
doing_prefetch
);
assert
(
r
==
0
);
assert
(
r
==
0
);
...
@@ -865,14 +866,10 @@ int toku_get_and_pin_rollback_log(TOKUTXN txn, TXNID xid, uint64_t sequence, BLO
...
@@ -865,14 +866,10 @@ int toku_get_and_pin_rollback_log(TOKUTXN txn, TXNID xid, uint64_t sequence, BLO
struct
brt_header
*
h
=
toku_cachefile_get_userdata
(
cf
);
struct
brt_header
*
h
=
toku_cachefile_get_userdata
(
cf
);
r
=
toku_cachetable_get_and_pin
(
cf
,
name
,
hash
,
r
=
toku_cachetable_get_and_pin
(
cf
,
name
,
hash
,
&
log_v
,
NULL
,
&
log_v
,
NULL
,
toku_rollback_flush_callback
,
get_write_callbacks_for_rollback_log
(
h
),
toku_rollback_fetch_callback
,
toku_rollback_fetch_callback
,
toku_rollback_pe_est_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
);
);
assert
(
r
==
0
);
assert
(
r
==
0
);
...
...
newbrt/tests/cachetable-3969.c
View file @
19b7090f
...
@@ -5,27 +5,6 @@
...
@@ -5,27 +5,6 @@
CACHETABLE
ct
;
CACHETABLE
ct
;
//
// This test exposed a bug (#3970) caught only by Valgrind.
// freed memory was being accessed by toku_cachetable_unpin_and_remove
//
static
int
fetch
(
CACHEFILE
f
__attribute__
((
__unused__
)),
int
UU
(
fd
),
CACHEKEY
k
__attribute__
((
__unused__
)),
u_int32_t
fullhash
__attribute__
((
__unused__
)),
void
**
value
__attribute__
((
__unused__
)),
PAIR_ATTR
*
sizep
__attribute__
((
__unused__
)),
int
*
dirtyp
,
void
*
extraargs
__attribute__
((
__unused__
))
)
{
*
dirtyp
=
0
;
*
value
=
NULL
;
*
sizep
=
make_pair_attr
(
8
);
return
0
;
}
CACHEFILE
f1
;
CACHEFILE
f1
;
static
void
static
void
...
@@ -52,11 +31,11 @@ run_test (void) {
...
@@ -52,11 +31,11 @@ run_test (void) {
long
s1
;
long
s1
;
long
s2
;
long
s2
;
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_get_and_pin
(
f1
,
make_blocknum
(
1
),
1
,
&
v1
,
&
s1
,
def_
write_callback
(
NULL
),
def_fetch
,
def_pf_req_callback
,
def_pf_callback
,
NULL
);
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
1
),
1
,
CACHETABLE_CLEAN
,
make_pair_attr
(
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
,
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_get_and_pin
(
f1
,
make_blocknum
(
2
),
2
,
&
v2
,
&
s2
,
def_
write_callback
(
NULL
),
def_fetch
,
def_pf_req_callback
,
def_pf_callback
,
NULL
);
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
2
),
2
,
CACHETABLE_CLEAN
,
make_pair_attr
(
8
));
assert
(
r
==
0
);
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
2
),
2
,
CACHETABLE_CLEAN
,
make_pair_attr
(
8
));
assert
(
r
==
0
);
}
}
...
@@ -68,12 +47,12 @@ run_test (void) {
...
@@ -68,12 +47,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
,
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_get_and_pin
(
f1
,
make_blocknum
(
1
),
1
,
&
v2
,
&
s2
,
def_
write_callback
(
NULL
),
def_fetch
,
def_pf_req_callback
,
def_pf_callback
,
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
,
make_pair_attr
(
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
,
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_get_and_pin
(
f1
,
make_blocknum
(
2
),
2
,
&
v2
,
&
s2
,
def_
write_callback
(
NULL
),
def_fetch
,
def_pf_req_callback
,
def_pf_callback
,
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
;
...
@@ -86,14 +65,10 @@ run_test (void) {
...
@@ -86,14 +65,10 @@ run_test (void) {
1
,
1
,
&
v1
,
&
v1
,
&
s1
,
&
s1
,
def_flush
,
def_write_callback
(
NULL
),
fetch
,
def_fetch
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_pf_callback
,
def_cleaner_callback
,
NULL
,
NULL
,
NULL
,
&
foo
&
foo
);
);
...
...
newbrt/tests/cachetable-4357.c
View file @
19b7090f
...
@@ -3,39 +3,6 @@
...
@@ -3,39 +3,6 @@
#include "includes.h"
#include "includes.h"
#include "test.h"
#include "test.h"
static
void
flush
(
CACHEFILE
f
__attribute__
((
__unused__
)),
int
UU
(
fd
),
CACHEKEY
k
__attribute__
((
__unused__
)),
void
*
v
__attribute__
((
__unused__
)),
void
*
e
__attribute__
((
__unused__
)),
PAIR_ATTR
s
__attribute__
((
__unused__
)),
PAIR_ATTR
*
new_size
__attribute__
((
__unused__
)),
BOOL
w
__attribute__
((
__unused__
)),
BOOL
keep
__attribute__
((
__unused__
)),
BOOL
c
__attribute__
((
__unused__
))
)
{
/* Do nothing */
if
(
verbose
)
{
printf
(
"FLUSH: %d
\n
"
,
(
int
)
k
.
b
);
}
//usleep (5*1024*1024);
}
static
int
fetch
(
CACHEFILE
f
__attribute__
((
__unused__
)),
int
UU
(
fd
),
CACHEKEY
k
__attribute__
((
__unused__
)),
u_int32_t
fullhash
__attribute__
((
__unused__
)),
void
**
value
__attribute__
((
__unused__
)),
PAIR_ATTR
*
sizep
__attribute__
((
__unused__
)),
int
*
dirtyp
,
void
*
extraargs
__attribute__
((
__unused__
))
)
{
*
dirtyp
=
0
;
*
value
=
NULL
;
*
sizep
=
make_pair_attr
(
8
);
return
0
;
}
CACHEFILE
f1
;
CACHEFILE
f1
;
static
void
*
pin_nonblocking
(
void
*
arg
)
{
static
void
*
pin_nonblocking
(
void
*
arg
)
{
...
@@ -47,8 +14,7 @@ static void *pin_nonblocking(void *arg) {
...
@@ -47,8 +14,7 @@ static void *pin_nonblocking(void *arg) {
toku_cachetable_hash
(
f1
,
make_blocknum
(
1
)),
toku_cachetable_hash
(
f1
,
make_blocknum
(
1
)),
&
v1
,
&
v1
,
&
s1
,
&
s1
,
flush
,
fetch
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
def_write_callback
(
NULL
),
def_fetch
,
def_pf_req_callback
,
def_pf_callback
,
NULL
,
NULL
,
NULL
,
NULL
NULL
);
);
...
@@ -75,8 +41,7 @@ cachetable_test (void) {
...
@@ -75,8 +41,7 @@ cachetable_test (void) {
toku_cachetable_hash
(
f1
,
make_blocknum
(
1
)),
toku_cachetable_hash
(
f1
,
make_blocknum
(
1
)),
&
v1
,
&
v1
,
&
s1
,
&
s1
,
flush
,
fetch
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
def_write_callback
(
NULL
),
def_fetch
,
def_pf_req_callback
,
def_pf_callback
,
NULL
,
NULL
NULL
);
);
toku_pthread_t
pin_nonblocking_tid
;
toku_pthread_t
pin_nonblocking_tid
;
...
...
newbrt/tests/cachetable-4365.c
View file @
19b7090f
...
@@ -3,39 +3,6 @@
...
@@ -3,39 +3,6 @@
#include "includes.h"
#include "includes.h"
#include "test.h"
#include "test.h"
static
void
flush
(
CACHEFILE
f
__attribute__
((
__unused__
)),
int
UU
(
fd
),
CACHEKEY
k
__attribute__
((
__unused__
)),
void
*
v
__attribute__
((
__unused__
)),
void
*
e
__attribute__
((
__unused__
)),
PAIR_ATTR
s
__attribute__
((
__unused__
)),
PAIR_ATTR
*
new_size
__attribute__
((
__unused__
)),
BOOL
w
__attribute__
((
__unused__
)),
BOOL
keep
__attribute__
((
__unused__
)),
BOOL
c
__attribute__
((
__unused__
))
)
{
/* Do nothing */
if
(
verbose
)
{
printf
(
"FLUSH: %d
\n
"
,
(
int
)
k
.
b
);
}
//usleep (5*1024*1024);
}
static
int
fetch
(
CACHEFILE
f
__attribute__
((
__unused__
)),
int
UU
(
fd
),
CACHEKEY
k
__attribute__
((
__unused__
)),
u_int32_t
fullhash
__attribute__
((
__unused__
)),
void
**
value
__attribute__
((
__unused__
)),
PAIR_ATTR
*
sizep
__attribute__
((
__unused__
)),
int
*
dirtyp
,
void
*
extraargs
__attribute__
((
__unused__
))
)
{
*
dirtyp
=
0
;
*
value
=
NULL
;
*
sizep
=
make_pair_attr
(
8
);
return
0
;
}
CACHEFILE
f1
;
CACHEFILE
f1
;
static
void
*
pin_nonblocking
(
void
*
arg
)
{
static
void
*
pin_nonblocking
(
void
*
arg
)
{
...
@@ -47,8 +14,7 @@ static void *pin_nonblocking(void *arg) {
...
@@ -47,8 +14,7 @@ static void *pin_nonblocking(void *arg) {
toku_cachetable_hash
(
f1
,
make_blocknum
(
1
)),
toku_cachetable_hash
(
f1
,
make_blocknum
(
1
)),
&
v1
,
&
v1
,
&
s1
,
&
s1
,
flush
,
fetch
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
def_write_callback
(
NULL
),
def_fetch
,
def_pf_req_callback
,
def_pf_callback
,
NULL
,
NULL
,
NULL
,
NULL
NULL
);
);
...
@@ -63,8 +29,7 @@ static void *put_same_key(void *arg) {
...
@@ -63,8 +29,7 @@ static void *put_same_key(void *arg) {
toku_cachetable_hash
(
f1
,
make_blocknum
(
1
)),
toku_cachetable_hash
(
f1
,
make_blocknum
(
1
)),
NULL
,
NULL
,
make_pair_attr
(
4
),
make_pair_attr
(
4
),
flush
,
def_pe_est_callback
,
def_pe_callback
,
def_cleaner_callback
,
def_write_callback
(
NULL
)
NULL
);
);
assert
(
r
==
0
);
assert
(
r
==
0
);
return
arg
;
return
arg
;
...
@@ -97,8 +62,7 @@ cachetable_test (void) {
...
@@ -97,8 +62,7 @@ cachetable_test (void) {
toku_cachetable_hash
(
f1
,
make_blocknum
(
1
)),
toku_cachetable_hash
(
f1
,
make_blocknum
(
1
)),
&
v1
,
&
v1
,
&
s1
,
&
s1
,
flush
,
fetch
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
def_write_callback
(
NULL
),
def_fetch
,
def_pf_req_callback
,
def_pf_callback
,
NULL
,
NULL
NULL
);
);
toku_pthread_t
pin_nonblocking_tid
;
toku_pthread_t
pin_nonblocking_tid
;
...
...
newbrt/tests/cachetable-all-write.c
View file @
19b7090f
...
@@ -37,9 +37,11 @@ cachetable_test (void) {
...
@@ -37,9 +37,11 @@ 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
,
def_fetch
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
NULL
,
NULL
);
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
wc
.
flush_callback
=
flush
;
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
1
),
1
,
&
v1
,
&
s1
,
wc
,
def_fetch
,
def_pf_req_callback
,
def_pf_callback
,
NULL
);
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
1
),
1
,
CACHETABLE_DIRTY
,
make_pair_attr
(
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
,
def_fetch
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
NULL
,
NULL
);
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
2
),
2
,
&
v2
,
&
s2
,
wc
,
def_fetch
,
def_pf_req_callback
,
def_pf_callback
,
NULL
);
// usleep (2*1024*1024);
// usleep (2*1024*1024);
//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_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);
...
...
newbrt/tests/cachetable-checkpoint-pending.c
View file @
19b7090f
...
@@ -82,7 +82,9 @@ do_update (void *UU(ignore))
...
@@ -82,7 +82,9 @@ 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
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
0
,
0
);
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
wc
.
flush_callback
=
flush
;
int
r
=
toku_cachetable_get_and_pin
(
cf
,
key
,
hi
,
&
vv
,
&
size
,
wc
,
fetch
,
def_pf_req_callback
,
def_pf_callback
,
0
);
//printf("g");
//printf("g");
assert
(
r
==
0
);
assert
(
r
==
0
);
assert
(
size
==
sizeof
(
int
));
assert
(
size
==
sizeof
(
int
));
...
@@ -131,7 +133,9 @@ static void checkpoint_pending(void) {
...
@@ -131,7 +133,9 @@ 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
],
make_pair_attr
(
sizeof
(
int
)),
flush
,
def_pe_est_callback
,
def_pe_callback
,
def_cleaner_callback
,
0
);
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
wc
.
flush_callback
=
flush
;
r
=
toku_cachetable_put
(
cf
,
key
,
hi
,
&
values
[
i
],
make_pair_attr
(
sizeof
(
int
)),
wc
);
assert
(
r
==
0
);
assert
(
r
==
0
);
r
=
toku_cachetable_unpin
(
cf
,
key
,
hi
,
CACHETABLE_DIRTY
,
make_pair_attr
(
item_size
));
r
=
toku_cachetable_unpin
(
cf
,
key
,
hi
,
CACHETABLE_DIRTY
,
make_pair_attr
(
item_size
));
...
...
newbrt/tests/cachetable-checkpoint-pinned-nodes.c
View file @
19b7090f
...
@@ -71,8 +71,11 @@ cachetable_test (void) {
...
@@ -71,8 +71,11 @@ 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
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
&
dirty_val
,
&
dirty_val
);
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
&
dirty_val
);
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
);
wc
.
flush_callback
=
flush
;
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
1
),
1
,
&
v1
,
&
s1
,
wc
,
fetch
,
def_pf_req_callback
,
def_pf_callback
,
&
dirty_val
);
wc
.
write_extraargs
=
NULL
;
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
2
),
2
,
&
v2
,
&
s2
,
wc
,
fetch
,
def_pf_req_callback
,
def_pf_callback
,
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
...
...
newbrt/tests/cachetable-checkpoint-prefetched-nodes.c
View file @
19b7090f
...
@@ -70,10 +70,13 @@ cachetable_test (void) {
...
@@ -70,10 +70,13 @@ 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
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
&
dirty_val
,
&
dirty_val
,
&
doing_prefetch
);
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
&
dirty_val
);
wc
.
flush_callback
=
flush
;
r
=
toku_cachefile_prefetch
(
f1
,
make_blocknum
(
1
),
1
,
wc
,
fetch
,
def_pf_req_callback
,
def_pf_callback
,
&
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
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
NULL
,
NULL
,
&
doing_prefetch
);
wc
.
write_extraargs
=
NULL
;
r
=
toku_cachefile_prefetch
(
f1
,
make_blocknum
(
2
),
2
,
wc
,
fetch
,
def_pf_req_callback
,
def_pf_callback
,
NULL
,
&
doing_prefetch
);
assert
(
doing_prefetch
);
assert
(
doing_prefetch
);
//
//
...
...
newbrt/tests/cachetable-checkpoint-test.c
View file @
19b7090f
...
@@ -61,7 +61,9 @@ static void cachetable_checkpoint_test(int n, enum cachetable_dirty dirty) {
...
@@ -61,7 +61,9 @@ 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
,
make_pair_attr
(
1
),
flush
,
def_pe_est_callback
,
def_pe_callback
,
def_cleaner_callback
,
0
);
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
wc
.
flush_callback
=
flush
;
r
=
toku_cachetable_put
(
f1
,
key
,
hi
,
(
void
*
)(
long
)
i
,
make_pair_attr
(
1
),
wc
);
assert
(
r
==
0
);
assert
(
r
==
0
);
r
=
toku_cachetable_unpin
(
f1
,
key
,
hi
,
dirty
,
make_pair_attr
(
item_size
));
r
=
toku_cachetable_unpin
(
f1
,
key
,
hi
,
dirty
,
make_pair_attr
(
item_size
));
...
...
newbrt/tests/cachetable-cleaner-checkpoint.c
View file @
19b7090f
...
@@ -32,22 +32,6 @@ flush (CACHEFILE f __attribute__((__unused__)),
...
@@ -32,22 +32,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__
)),
PAIR_ATTR
*
sizep
__attribute__
((
__unused__
)),
int
*
dirtyp
,
void
*
extraargs
__attribute__
((
__unused__
))
)
{
*
dirtyp
=
0
;
*
value
=
NULL
;
*
sizep
=
make_pair_attr
(
8
);
return
0
;
}
BOOL
cleaner_called
;
BOOL
cleaner_called
;
static
int
static
int
...
@@ -83,7 +67,10 @@ cachetable_test (void) {
...
@@ -83,7 +67,10 @@ 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
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
cleaner_callback
,
NULL
,
NULL
);
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
wc
.
flush_callback
=
flush
;
wc
.
cleaner_callback
=
cleaner_callback
;
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
1
),
1
,
&
v1
,
&
s1
,
wc
,
def_fetch
,
def_pf_req_callback
,
def_pf_callback
,
NULL
);
PAIR_ATTR
attr
=
make_pair_attr
(
8
);
PAIR_ATTR
attr
=
make_pair_attr
(
8
);
attr
.
cache_pressure_size
=
8
;
attr
.
cache_pressure_size
=
8
;
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
1
),
1
,
CACHETABLE_DIRTY
,
attr
);
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
1
),
1
,
CACHETABLE_DIRTY
,
attr
);
...
...
newbrt/tests/cachetable-cleaner-checkpoint2.c
View file @
19b7090f
...
@@ -32,22 +32,6 @@ flush (CACHEFILE f __attribute__((__unused__)),
...
@@ -32,22 +32,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__
)),
PAIR_ATTR
*
sizep
__attribute__
((
__unused__
)),
int
*
dirtyp
,
void
*
extraargs
__attribute__
((
__unused__
))
)
{
*
dirtyp
=
0
;
*
value
=
NULL
;
*
sizep
=
make_pair_attr
(
8
);
return
0
;
}
BOOL
cleaner_called
;
BOOL
cleaner_called
;
static
int
static
int
...
@@ -83,7 +67,10 @@ cachetable_test (void) {
...
@@ -83,7 +67,10 @@ 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
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
cleaner_callback
,
NULL
,
NULL
);
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
wc
.
flush_callback
=
flush
;
wc
.
cleaner_callback
=
cleaner_callback
;
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
1
),
1
,
&
v1
,
&
s1
,
wc
,
def_fetch
,
def_pf_req_callback
,
def_pf_callback
,
NULL
);
PAIR_ATTR
attr
=
make_pair_attr
(
8
);
PAIR_ATTR
attr
=
make_pair_attr
(
8
);
attr
.
cache_pressure_size
=
8
;
attr
.
cache_pressure_size
=
8
;
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
1
),
1
,
CACHETABLE_DIRTY
,
attr
);
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
1
),
1
,
CACHETABLE_DIRTY
,
attr
);
...
...
newbrt/tests/cachetable-cleaner-dev-null.c
View file @
19b7090f
...
@@ -29,22 +29,6 @@ flush (CACHEFILE f __attribute__((__unused__)),
...
@@ -29,22 +29,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__
)),
PAIR_ATTR
*
sizep
__attribute__
((
__unused__
)),
int
*
dirtyp
,
void
*
extraargs
__attribute__
((
__unused__
))
)
{
*
dirtyp
=
0
;
*
value
=
NULL
;
*
sizep
=
make_pair_attr
(
8
);
return
0
;
}
static
int
static
int
cleaner_callback
(
cleaner_callback
(
void
*
UU
(
brtnode_pv
),
void
*
UU
(
brtnode_pv
),
...
@@ -72,7 +56,10 @@ cachetable_test (void) {
...
@@ -72,7 +56,10 @@ 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
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
cleaner_callback
,
NULL
,
NULL
);
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
wc
.
flush_callback
=
flush
;
wc
.
cleaner_callback
=
cleaner_callback
;
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
1
),
1
,
&
v1
,
&
s1
,
wc
,
def_fetch
,
def_pf_req_callback
,
def_pf_callback
,
NULL
);
PAIR_ATTR
attr
=
make_pair_attr
(
8
);
PAIR_ATTR
attr
=
make_pair_attr
(
8
);
attr
.
cache_pressure_size
=
8
;
attr
.
cache_pressure_size
=
8
;
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
1
),
1
,
CACHETABLE_DIRTY
,
attr
);
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
1
),
1
,
CACHETABLE_DIRTY
,
attr
);
...
...
newbrt/tests/cachetable-cleaner-thread-attrs-accumulate.c
View file @
19b7090f
...
@@ -76,16 +76,16 @@ run_test (void) {
...
@@ -76,16 +76,16 @@ run_test (void) {
long
ss
[
n_pairs
];
long
ss
[
n_pairs
];
//long s2;
//long s2;
PAIR_ATTR
expect
=
{
.
size
=
0
,
.
nonleaf_size
=
0
,
.
leaf_size
=
0
,
.
rollback_size
=
0
,
.
cache_pressure_size
=
0
};
PAIR_ATTR
expect
=
{
.
size
=
0
,
.
nonleaf_size
=
0
,
.
leaf_size
=
0
,
.
rollback_size
=
0
,
.
cache_pressure_size
=
0
};
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
wc
.
flush_callback
=
flush
;
wc
.
write_extraargs
=
&
expect
;
for
(
int
i
=
0
;
i
<
n_pairs
;
++
i
)
{
for
(
int
i
=
0
;
i
<
n_pairs
;
++
i
)
{
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
i
+
1
),
i
+
1
,
&
vs
[
i
],
&
ss
[
i
],
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
i
+
1
),
i
+
1
,
&
vs
[
i
],
&
ss
[
i
],
flush
,
wc
,
def_fetch
,
def_fetch
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_pf_callback
,
def_cleaner_callback
,
&
expect
);
NULL
,
&
expect
);
assert_zero
(
r
);
assert_zero
(
r
);
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
i
+
1
),
i
+
1
,
CACHETABLE_DIRTY
,
attrs
[
i
]);
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
i
+
1
),
i
+
1
,
CACHETABLE_DIRTY
,
attrs
[
i
]);
assert_zero
(
r
);
assert_zero
(
r
);
...
@@ -105,14 +105,11 @@ run_test (void) {
...
@@ -105,14 +105,11 @@ run_test (void) {
void
*
big_v
;
void
*
big_v
;
long
big_s
;
long
big_s
;
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
n_pairs
+
1
),
n_pairs
+
1
,
&
big_v
,
&
big_s
,
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
n_pairs
+
1
),
n_pairs
+
1
,
&
big_v
,
&
big_s
,
flush
,
wc
,
def_fetch
,
def_fetch
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_pf_callback
,
def_cleaner_callback
,
&
expect
);
NULL
,
&
expect
);
toku_cachetable_unpin
(
f1
,
make_blocknum
(
n_pairs
+
1
),
n_pairs
+
1
,
CACHETABLE_CLEAN
,
toku_cachetable_unpin
(
f1
,
make_blocknum
(
n_pairs
+
1
),
n_pairs
+
1
,
CACHETABLE_CLEAN
,
make_pair_attr
(
test_limit
-
expect
.
size
+
20
));
make_pair_attr
(
test_limit
-
expect
.
size
+
20
));
...
...
newbrt/tests/cachetable-cleaner-thread-everything-pinned.c
View file @
19b7090f
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
// everything is pinned.
// everything is pinned.
//
//
static
UU
()
int
static
int
everything_pinned_cleaner_callback
(
everything_pinned_cleaner_callback
(
void
*
UU
(
brtnode_pv
),
void
*
UU
(
brtnode_pv
),
BLOCKNUM
UU
(
blocknum
),
BLOCKNUM
UU
(
blocknum
),
...
@@ -40,15 +40,14 @@ run_test (void) {
...
@@ -40,15 +40,14 @@ run_test (void) {
long
ss
[
8
];
long
ss
[
8
];
//long s2;
//long s2;
for
(
int
i
=
0
;
i
<
8
;
++
i
)
{
for
(
int
i
=
0
;
i
<
8
;
++
i
)
{
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
wc
.
cleaner_callback
=
everything_pinned_cleaner_callback
;
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
i
+
1
),
i
+
1
,
&
vs
[
i
],
&
ss
[
i
],
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
i
+
1
),
i
+
1
,
&
vs
[
i
],
&
ss
[
i
],
def_flush
,
wc
,
def_fetch
,
def_fetch
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_pf_callback
,
everything_pinned_cleaner_callback
,
NULL
);
NULL
,
NULL
);
assert_zero
(
r
);
assert_zero
(
r
);
}
}
...
...
newbrt/tests/cachetable-cleaner-thread-nothing-needs-flushing.c
View file @
19b7090f
...
@@ -38,15 +38,14 @@ run_test (void) {
...
@@ -38,15 +38,14 @@ run_test (void) {
long
ss
[
8
];
long
ss
[
8
];
//long s2;
//long s2;
for
(
int
i
=
0
;
i
<
8
;
++
i
)
{
for
(
int
i
=
0
;
i
<
8
;
++
i
)
{
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
wc
.
cleaner_callback
=
everything_pinned_cleaner_callback
;
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
i
+
1
),
i
+
1
,
&
vs
[
i
],
&
ss
[
i
],
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
i
+
1
),
i
+
1
,
&
vs
[
i
],
&
ss
[
i
],
def_flush
,
wc
,
def_fetch
,
def_fetch
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_pf_callback
,
everything_pinned_cleaner_callback
,
NULL
);
NULL
,
NULL
);
assert_zero
(
r
);
assert_zero
(
r
);
// set cachepressure_size to 0
// set cachepressure_size to 0
PAIR_ATTR
attr
=
make_pair_attr
(
8
);
PAIR_ATTR
attr
=
make_pair_attr
(
8
);
...
...
newbrt/tests/cachetable-cleaner-thread-simple.c
View file @
19b7090f
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
CACHEFILE
f1
;
CACHEFILE
f1
;
bool
my_cleaner_callback_called
;
bool
my_cleaner_callback_called
;
static
UU
()
int
static
int
my_cleaner_callback
(
my_cleaner_callback
(
void
*
UU
(
brtnode_pv
),
void
*
UU
(
brtnode_pv
),
BLOCKNUM
UU
(
blocknum
),
BLOCKNUM
UU
(
blocknum
),
...
@@ -45,29 +45,25 @@ run_test (void) {
...
@@ -45,29 +45,25 @@ run_test (void) {
//void* v2;
//void* v2;
long
ss
[
5
];
long
ss
[
5
];
//long s2;
//long s2;
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
wc
.
cleaner_callback
=
my_cleaner_callback
;
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
100
),
100
,
&
vs
[
4
],
&
ss
[
4
],
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
100
),
100
,
&
vs
[
4
],
&
ss
[
4
],
def_flush
,
wc
,
def_fetch
,
def_fetch
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_pf_callback
,
my_cleaner_callback
,
NULL
);
NULL
,
NULL
);
PAIR_ATTR
attr
=
make_pair_attr
(
8
);
PAIR_ATTR
attr
=
make_pair_attr
(
8
);
attr
.
cache_pressure_size
=
100
;
attr
.
cache_pressure_size
=
100
;
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
100
),
100
,
CACHETABLE_CLEAN
,
attr
);
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
100
),
100
,
CACHETABLE_CLEAN
,
attr
);
for
(
int
i
=
0
;
i
<
4
;
++
i
)
{
for
(
int
i
=
0
;
i
<
4
;
++
i
)
{
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
i
+
1
),
i
+
1
,
&
vs
[
i
],
&
ss
[
i
],
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
i
+
1
),
i
+
1
,
&
vs
[
i
],
&
ss
[
i
],
def_flush
,
wc
,
def_fetch
,
def_fetch
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_pf_callback
,
def_cleaner_callback
,
NULL
);
NULL
,
NULL
);
assert_zero
(
r
);
assert_zero
(
r
);
// set cachepressure_size to 0
// set cachepressure_size to 0
attr
=
make_pair_attr
(
8
);
attr
=
make_pair_attr
(
8
);
...
...
newbrt/tests/cachetable-clock-all-pinned.c
View file @
19b7090f
...
@@ -4,23 +4,6 @@
...
@@ -4,23 +4,6 @@
#include "test.h"
#include "test.h"
static
void
flush
(
CACHEFILE
f
__attribute__
((
__unused__
)),
int
UU
(
fd
),
CACHEKEY
k
__attribute__
((
__unused__
)),
void
*
v
__attribute__
((
__unused__
)),
void
*
e
__attribute__
((
__unused__
)),
PAIR_ATTR
s
__attribute__
((
__unused__
)),
PAIR_ATTR
*
new_size
__attribute__
((
__unused__
)),
BOOL
w
__attribute__
((
__unused__
)),
BOOL
keep
__attribute__
((
__unused__
)),
BOOL
c
__attribute__
((
__unused__
))
)
{
}
static
void
static
void
cachetable_test
(
void
)
{
cachetable_test
(
void
)
{
int
num_entries
=
100
;
int
num_entries
=
100
;
...
@@ -34,14 +17,15 @@ cachetable_test (void) {
...
@@ -34,14 +17,15 @@ 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
);
// test that putting something too big in the cachetable works fine
// test that putting something too big in the cachetable works fine
r
=
toku_cachetable_put
(
f1
,
make_blocknum
(
num_entries
+
1
),
num_entries
+
1
,
NULL
,
make_pair_attr
(
test_limit
*
2
),
flush
,
def_pe_est_callback
,
def_pe_callback
,
def_cleaner_callback
,
NULL
);
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
r
=
toku_cachetable_put
(
f1
,
make_blocknum
(
num_entries
+
1
),
num_entries
+
1
,
NULL
,
make_pair_attr
(
test_limit
*
2
),
wc
);
assert
(
r
==
0
);
assert
(
r
==
0
);
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
num_entries
+
1
),
num_entries
+
1
,
CACHETABLE_DIRTY
,
make_pair_attr
(
test_limit
*
2
));
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
num_entries
+
1
),
num_entries
+
1
,
CACHETABLE_DIRTY
,
make_pair_attr
(
test_limit
*
2
));
assert
(
r
==
0
);
assert
(
r
==
0
);
for
(
int64_t
i
=
0
;
i
<
num_entries
;
i
++
)
{
for
(
int64_t
i
=
0
;
i
<
num_entries
;
i
++
)
{
r
=
toku_cachetable_put
(
f1
,
make_blocknum
(
i
),
i
,
NULL
,
make_pair_attr
(
1
),
flush
,
def_pe_est_callback
,
def_pe_callback
,
def_cleaner_callback
,
NULL
);
r
=
toku_cachetable_put
(
f1
,
make_blocknum
(
i
),
i
,
NULL
,
make_pair_attr
(
1
),
wc
);
assert
(
toku_cachefile_count_pinned
(
f1
,
0
)
==
(
i
+
1
));
assert
(
toku_cachefile_count_pinned
(
f1
,
0
)
==
(
i
+
1
));
}
}
for
(
int64_t
i
=
0
;
i
<
num_entries
;
i
++
)
{
for
(
int64_t
i
=
0
;
i
<
num_entries
;
i
++
)
{
...
...
newbrt/tests/cachetable-clock-eviction.c
View file @
19b7090f
...
@@ -63,25 +63,27 @@ cachetable_test (void) {
...
@@ -63,25 +63,27 @@ cachetable_test (void) {
long
s1
,
s2
;
long
s1
,
s2
;
flush_may_occur
=
FALSE
;
flush_may_occur
=
FALSE
;
check_flush
=
TRUE
;
check_flush
=
TRUE
;
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
wc
.
flush_callback
=
flush
;
for
(
int
i
=
0
;
i
<
100000
;
i
++
)
{
for
(
int
i
=
0
;
i
<
100000
;
i
++
)
{
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
,
NULL
,
NULL
);
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
1
),
1
,
&
v1
,
&
s1
,
wc
,
fetch
,
def_pf_req_callback
,
def_pf_callback
,
NULL
);
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
1
),
1
,
CACHETABLE_CLEAN
,
make_pair_attr
(
1
));
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
1
),
1
,
CACHETABLE_CLEAN
,
make_pair_attr
(
1
));
}
}
for
(
int
i
=
0
;
i
<
8
;
i
++
)
{
for
(
int
i
=
0
;
i
<
8
;
i
++
)
{
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
);
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
2
),
2
,
&
v2
,
&
s2
,
wc
,
fetch
,
def_pf_req_callback
,
def_pf_callback
,
NULL
);
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
2
),
2
,
CACHETABLE_CLEAN
,
make_pair_attr
(
1
));
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
2
),
2
,
CACHETABLE_CLEAN
,
make_pair_attr
(
1
));
}
}
for
(
int
i
=
0
;
i
<
4
;
i
++
)
{
for
(
int
i
=
0
;
i
<
4
;
i
++
)
{
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
3
),
3
,
&
v2
,
&
s2
,
flush
,
fetch
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
NULL
,
NULL
);
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
3
),
3
,
&
v2
,
&
s2
,
wc
,
fetch
,
def_pf_req_callback
,
def_pf_callback
,
NULL
);
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
3
),
3
,
CACHETABLE_CLEAN
,
make_pair_attr
(
1
));
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
3
),
3
,
CACHETABLE_CLEAN
,
make_pair_attr
(
1
));
}
}
for
(
int
i
=
0
;
i
<
2
;
i
++
)
{
for
(
int
i
=
0
;
i
<
2
;
i
++
)
{
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
4
),
4
,
&
v2
,
&
s2
,
flush
,
fetch
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
NULL
,
NULL
);
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
4
),
4
,
&
v2
,
&
s2
,
wc
,
fetch
,
def_pf_req_callback
,
def_pf_callback
,
NULL
);
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
4
),
4
,
CACHETABLE_CLEAN
,
make_pair_attr
(
1
));
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
4
),
4
,
CACHETABLE_CLEAN
,
make_pair_attr
(
1
));
}
}
flush_may_occur
=
TRUE
;
flush_may_occur
=
TRUE
;
expected_flushed_key
=
4
;
expected_flushed_key
=
4
;
r
=
toku_cachetable_put
(
f1
,
make_blocknum
(
5
),
5
,
NULL
,
make_pair_attr
(
4
),
flush
,
def_pe_est_callback
,
def_pe_callback
,
def_cleaner_callback
,
NULL
);
r
=
toku_cachetable_put
(
f1
,
make_blocknum
(
5
),
5
,
NULL
,
make_pair_attr
(
4
),
wc
);
flush_may_occur
=
TRUE
;
flush_may_occur
=
TRUE
;
expected_flushed_key
=
5
;
expected_flushed_key
=
5
;
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
5
),
5
,
CACHETABLE_CLEAN
,
make_pair_attr
(
4
));
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
5
),
5
,
CACHETABLE_CLEAN
,
make_pair_attr
(
4
));
...
...
newbrt/tests/cachetable-clock-eviction2.c
View file @
19b7090f
...
@@ -100,24 +100,39 @@ cachetable_test (void) {
...
@@ -100,24 +100,39 @@ cachetable_test (void) {
long
s1
,
s2
;
long
s1
,
s2
;
flush_may_occur
=
FALSE
;
flush_may_occur
=
FALSE
;
for
(
int
i
=
0
;
i
<
100000
;
i
++
)
{
for
(
int
i
=
0
;
i
<
100000
;
i
++
)
{
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
1
),
1
,
&
v1
,
&
s1
,
flush
,
fetch
,
def_pe_est_callback
,
pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
NULL
,
NULL
);
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
wc
.
flush_callback
=
flush
;
wc
.
pe_callback
=
pe_callback
;
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
1
),
1
,
&
v1
,
&
s1
,
wc
,
fetch
,
def_pf_req_callback
,
def_pf_callback
,
NULL
);
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
1
),
1
,
CACHETABLE_CLEAN
,
make_pair_attr
(
4
));
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
1
),
1
,
CACHETABLE_CLEAN
,
make_pair_attr
(
4
));
}
}
for
(
int
i
=
0
;
i
<
8
;
i
++
)
{
for
(
int
i
=
0
;
i
<
8
;
i
++
)
{
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
2
),
2
,
&
v2
,
&
s2
,
flush
,
fetch
,
def_pe_est_callback
,
pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
NULL
,
NULL
);
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
wc
.
flush_callback
=
flush
;
wc
.
pe_callback
=
pe_callback
;
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
2
),
2
,
&
v2
,
&
s2
,
wc
,
fetch
,
def_pf_req_callback
,
def_pf_callback
,
NULL
);
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
2
),
2
,
CACHETABLE_CLEAN
,
make_pair_attr
(
4
));
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
2
),
2
,
CACHETABLE_CLEAN
,
make_pair_attr
(
4
));
}
}
for
(
int
i
=
0
;
i
<
4
;
i
++
)
{
for
(
int
i
=
0
;
i
<
4
;
i
++
)
{
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
3
),
3
,
&
v2
,
&
s2
,
flush
,
fetch
,
def_pe_est_callback
,
pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
NULL
,
NULL
);
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
wc
.
flush_callback
=
flush
;
wc
.
pe_callback
=
pe_callback
;
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
3
),
3
,
&
v2
,
&
s2
,
wc
,
fetch
,
def_pf_req_callback
,
def_pf_callback
,
NULL
);
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
3
),
3
,
CACHETABLE_CLEAN
,
make_pair_attr
(
4
));
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
3
),
3
,
CACHETABLE_CLEAN
,
make_pair_attr
(
4
));
}
}
for
(
int
i
=
0
;
i
<
2
;
i
++
)
{
for
(
int
i
=
0
;
i
<
2
;
i
++
)
{
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
4
),
4
,
&
v2
,
&
s2
,
flush
,
fetch
,
def_pe_est_callback
,
pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
NULL
,
NULL
);
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
wc
.
flush_callback
=
flush
;
wc
.
pe_callback
=
pe_callback
;
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
4
),
4
,
&
v2
,
&
s2
,
wc
,
fetch
,
def_pf_req_callback
,
def_pf_callback
,
NULL
);
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
4
),
4
,
CACHETABLE_CLEAN
,
make_pair_attr
(
4
));
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
4
),
4
,
CACHETABLE_CLEAN
,
make_pair_attr
(
4
));
}
}
flush_may_occur
=
FALSE
;
flush_may_occur
=
FALSE
;
expected_bytes_to_free
=
4
;
expected_bytes_to_free
=
4
;
r
=
toku_cachetable_put
(
f1
,
make_blocknum
(
5
),
5
,
NULL
,
make_pair_attr
(
4
),
other_flush
,
def_pe_est_callback
,
other_pe_callback
,
def_cleaner_callback
,
NULL
);
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
wc
.
flush_callback
=
other_flush
;
wc
.
pe_callback
=
other_pe_callback
;
r
=
toku_cachetable_put
(
f1
,
make_blocknum
(
5
),
5
,
NULL
,
make_pair_attr
(
4
),
wc
);
flush_may_occur
=
TRUE
;
flush_may_occur
=
TRUE
;
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
5
),
5
,
CACHETABLE_CLEAN
,
make_pair_attr
(
4
));
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
5
),
5
,
CACHETABLE_CLEAN
,
make_pair_attr
(
4
));
assert
(
expected_bytes_to_free
==
0
);
assert
(
expected_bytes_to_free
==
0
);
...
...
newbrt/tests/cachetable-clock-eviction3.c
View file @
19b7090f
...
@@ -114,24 +114,44 @@ cachetable_test (void) {
...
@@ -114,24 +114,44 @@ cachetable_test (void) {
long
s1
,
s2
;
long
s1
,
s2
;
flush_may_occur
=
FALSE
;
flush_may_occur
=
FALSE
;
for
(
int
i
=
0
;
i
<
100000
;
i
++
)
{
for
(
int
i
=
0
;
i
<
100000
;
i
++
)
{
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
1
),
1
,
&
v1
,
&
s1
,
flush
,
fetch
,
pe_est_callback
,
pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
NULL
,
NULL
);
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
wc
.
flush_callback
=
flush
;
wc
.
pe_est_callback
=
pe_est_callback
;
wc
.
pe_callback
=
pe_callback
;
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
1
),
1
,
&
v1
,
&
s1
,
wc
,
fetch
,
def_pf_req_callback
,
def_pf_callback
,
NULL
);
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
1
),
1
,
CACHETABLE_CLEAN
,
make_pair_attr
(
4
));
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
1
),
1
,
CACHETABLE_CLEAN
,
make_pair_attr
(
4
));
}
}
for
(
int
i
=
0
;
i
<
8
;
i
++
)
{
for
(
int
i
=
0
;
i
<
8
;
i
++
)
{
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
2
),
2
,
&
v2
,
&
s2
,
flush
,
fetch
,
pe_est_callback
,
pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
NULL
,
NULL
);
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
wc
.
flush_callback
=
flush
;
wc
.
pe_est_callback
=
pe_est_callback
;
wc
.
pe_callback
=
pe_callback
;
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
2
),
2
,
&
v2
,
&
s2
,
wc
,
fetch
,
def_pf_req_callback
,
def_pf_callback
,
NULL
);
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
2
),
2
,
CACHETABLE_CLEAN
,
make_pair_attr
(
4
));
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
2
),
2
,
CACHETABLE_CLEAN
,
make_pair_attr
(
4
));
}
}
for
(
int
i
=
0
;
i
<
4
;
i
++
)
{
for
(
int
i
=
0
;
i
<
4
;
i
++
)
{
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
3
),
3
,
&
v2
,
&
s2
,
flush
,
fetch
,
pe_est_callback
,
pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
NULL
,
NULL
);
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
wc
.
flush_callback
=
flush
;
wc
.
pe_est_callback
=
pe_est_callback
;
wc
.
pe_callback
=
pe_callback
;
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
3
),
3
,
&
v2
,
&
s2
,
wc
,
fetch
,
def_pf_req_callback
,
def_pf_callback
,
NULL
);
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
3
),
3
,
CACHETABLE_CLEAN
,
make_pair_attr
(
4
));
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
3
),
3
,
CACHETABLE_CLEAN
,
make_pair_attr
(
4
));
}
}
for
(
int
i
=
0
;
i
<
2
;
i
++
)
{
for
(
int
i
=
0
;
i
<
2
;
i
++
)
{
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
4
),
4
,
&
v2
,
&
s2
,
flush
,
fetch
,
pe_est_callback
,
pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
NULL
,
NULL
);
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
wc
.
flush_callback
=
flush
;
wc
.
pe_est_callback
=
pe_est_callback
;
wc
.
pe_callback
=
pe_callback
;
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
4
),
4
,
&
v2
,
&
s2
,
wc
,
fetch
,
def_pf_req_callback
,
def_pf_callback
,
NULL
);
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
4
),
4
,
CACHETABLE_CLEAN
,
make_pair_attr
(
4
));
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
4
),
4
,
CACHETABLE_CLEAN
,
make_pair_attr
(
4
));
}
}
flush_may_occur
=
FALSE
;
flush_may_occur
=
FALSE
;
expected_bytes_to_free
=
4
;
expected_bytes_to_free
=
4
;
r
=
toku_cachetable_put
(
f1
,
make_blocknum
(
5
),
5
,
NULL
,
make_pair_attr
(
4
),
other_flush
,
pe_est_callback
,
other_pe_callback
,
def_cleaner_callback
,
NULL
);
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
wc
.
flush_callback
=
other_flush
;
wc
.
pe_est_callback
=
pe_est_callback
;
wc
.
pe_callback
=
other_pe_callback
;
r
=
toku_cachetable_put
(
f1
,
make_blocknum
(
5
),
5
,
NULL
,
make_pair_attr
(
4
),
wc
);
flush_may_occur
=
TRUE
;
flush_may_occur
=
TRUE
;
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
5
),
5
,
CACHETABLE_CLEAN
,
make_pair_attr
(
8
));
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
5
),
5
,
CACHETABLE_CLEAN
,
make_pair_attr
(
8
));
...
...
newbrt/tests/cachetable-clock-eviction4.c
View file @
19b7090f
...
@@ -99,25 +99,29 @@ cachetable_test (void) {
...
@@ -99,25 +99,29 @@ cachetable_test (void) {
long
s1
,
s2
;
long
s1
,
s2
;
flush_may_occur
=
FALSE
;
flush_may_occur
=
FALSE
;
check_flush
=
TRUE
;
check_flush
=
TRUE
;
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
wc
.
flush_callback
=
flush
;
wc
.
pe_est_callback
=
pe_est_callback
;
wc
.
pe_callback
=
pe_callback
;
for
(
int
i
=
0
;
i
<
100000
;
i
++
)
{
for
(
int
i
=
0
;
i
<
100000
;
i
++
)
{
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
1
),
1
,
&
v1
,
&
s1
,
flush
,
fetch
,
pe_est_callback
,
pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
NULL
,
NULL
);
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
1
),
1
,
&
v1
,
&
s1
,
wc
,
fetch
,
def_pf_req_callback
,
def_pf_callback
,
NULL
);
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
1
),
1
,
CACHETABLE_CLEAN
,
make_pair_attr
(
1
));
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
1
),
1
,
CACHETABLE_CLEAN
,
make_pair_attr
(
1
));
}
}
for
(
int
i
=
0
;
i
<
8
;
i
++
)
{
for
(
int
i
=
0
;
i
<
8
;
i
++
)
{
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
2
),
2
,
&
v2
,
&
s2
,
flush
,
fetch
,
pe_est_callback
,
pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
NULL
,
NULL
);
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
2
),
2
,
&
v2
,
&
s2
,
wc
,
fetch
,
def_pf_req_callback
,
def_pf_callback
,
NULL
);
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
2
),
2
,
CACHETABLE_CLEAN
,
make_pair_attr
(
1
));
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
2
),
2
,
CACHETABLE_CLEAN
,
make_pair_attr
(
1
));
}
}
for
(
int
i
=
0
;
i
<
4
;
i
++
)
{
for
(
int
i
=
0
;
i
<
4
;
i
++
)
{
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
3
),
3
,
&
v2
,
&
s2
,
flush
,
fetch
,
pe_est_callback
,
pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
NULL
,
NULL
);
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
3
),
3
,
&
v2
,
&
s2
,
wc
,
fetch
,
def_pf_req_callback
,
def_pf_callback
,
NULL
);
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
3
),
3
,
CACHETABLE_CLEAN
,
make_pair_attr
(
1
));
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
3
),
3
,
CACHETABLE_CLEAN
,
make_pair_attr
(
1
));
}
}
for
(
int
i
=
0
;
i
<
2
;
i
++
)
{
for
(
int
i
=
0
;
i
<
2
;
i
++
)
{
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
4
),
4
,
&
v2
,
&
s2
,
flush
,
fetch
,
pe_est_callback
,
pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
NULL
,
NULL
);
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
4
),
4
,
&
v2
,
&
s2
,
wc
,
fetch
,
def_pf_req_callback
,
def_pf_callback
,
NULL
);
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
4
),
4
,
CACHETABLE_CLEAN
,
make_pair_attr
(
1
));
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
4
),
4
,
CACHETABLE_CLEAN
,
make_pair_attr
(
1
));
}
}
flush_may_occur
=
TRUE
;
flush_may_occur
=
TRUE
;
expected_flushed_key
=
4
;
expected_flushed_key
=
4
;
r
=
toku_cachetable_put
(
f1
,
make_blocknum
(
5
),
5
,
NULL
,
make_pair_attr
(
4
),
flush
,
pe_est_callback
,
pe_callback
,
def_cleaner_callback
,
NULL
);
r
=
toku_cachetable_put
(
f1
,
make_blocknum
(
5
),
5
,
NULL
,
make_pair_attr
(
4
),
wc
);
flush_may_occur
=
TRUE
;
flush_may_occur
=
TRUE
;
expected_flushed_key
=
5
;
expected_flushed_key
=
5
;
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
5
),
5
,
CACHETABLE_CLEAN
,
make_pair_attr
(
4
));
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
5
),
5
,
CACHETABLE_CLEAN
,
make_pair_attr
(
4
));
...
...
newbrt/tests/cachetable-count-pinned-test.c
View file @
19b7090f
...
@@ -18,7 +18,8 @@ cachetable_count_pinned_test (int n) {
...
@@ -18,7 +18,8 @@ cachetable_count_pinned_test (int n) {
for
(
i
=
1
;
i
<=
n
;
i
++
)
{
for
(
i
=
1
;
i
<=
n
;
i
++
)
{
u_int32_t
hi
;
u_int32_t
hi
;
hi
=
toku_cachetable_hash
(
f1
,
make_blocknum
(
i
));
hi
=
toku_cachetable_hash
(
f1
,
make_blocknum
(
i
));
r
=
toku_cachetable_put
(
f1
,
make_blocknum
(
i
),
hi
,
(
void
*
)(
long
)
i
,
make_pair_attr
(
1
),
def_flush
,
def_pe_est_callback
,
def_pe_callback
,
def_cleaner_callback
,
0
);
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
r
=
toku_cachetable_put
(
f1
,
make_blocknum
(
i
),
hi
,
(
void
*
)(
long
)
i
,
make_pair_attr
(
1
),
wc
);
assert
(
r
==
0
);
assert
(
r
==
0
);
assert
(
toku_cachefile_count_pinned
(
f1
,
0
)
==
i
);
assert
(
toku_cachefile_count_pinned
(
f1
,
0
)
==
i
);
...
...
newbrt/tests/cachetable-debug-test.c
View file @
19b7090f
...
@@ -25,7 +25,8 @@ cachetable_debug_test (int n) {
...
@@ -25,7 +25,8 @@ cachetable_debug_test (int n) {
const
int
item_size
=
1
;
const
int
item_size
=
1
;
u_int32_t
hi
;
u_int32_t
hi
;
hi
=
toku_cachetable_hash
(
f1
,
make_blocknum
(
i
));
hi
=
toku_cachetable_hash
(
f1
,
make_blocknum
(
i
));
r
=
toku_cachetable_put
(
f1
,
make_blocknum
(
i
),
hi
,
(
void
*
)(
long
)
i
,
make_pair_attr
(
item_size
),
def_flush
,
def_pe_est_callback
,
def_pe_callback
,
def_cleaner_callback
,
0
);
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
r
=
toku_cachetable_put
(
f1
,
make_blocknum
(
i
),
hi
,
(
void
*
)(
long
)
i
,
make_pair_attr
(
item_size
),
wc
);
assert
(
r
==
0
);
assert
(
r
==
0
);
void
*
v
;
int
dirty
;
long
long
pinned
;
long
pair_size
;
void
*
v
;
int
dirty
;
long
long
pinned
;
long
pair_size
;
...
...
newbrt/tests/cachetable-eviction-close-test.c
View file @
19b7090f
...
@@ -81,6 +81,9 @@ static void cachetable_eviction_full_test (void) {
...
@@ -81,6 +81,9 @@ static void cachetable_eviction_full_test (void) {
// let's pin a node multiple times
// let's pin a node multiple times
// and really bring up its clock count
// and really bring up its clock count
//
//
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
wc
.
flush_callback
=
flush
;
wc
.
pe_est_callback
=
pe_est_callback
;
for
(
int
i
=
0
;
i
<
20
;
i
++
)
{
for
(
int
i
=
0
;
i
<
20
;
i
++
)
{
r
=
toku_cachetable_get_and_pin
(
r
=
toku_cachetable_get_and_pin
(
f1
,
f1
,
...
@@ -88,14 +91,10 @@ static void cachetable_eviction_full_test (void) {
...
@@ -88,14 +91,10 @@ static void cachetable_eviction_full_test (void) {
fullhash
,
fullhash
,
&
value1
,
&
value1
,
&
size1
,
&
size1
,
flush
,
wc
,
fetch
,
fetch
,
pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_pf_callback
,
def_cleaner_callback
,
0
,
0
0
);
);
assert
(
r
==
0
);
assert
(
r
==
0
);
...
@@ -104,20 +103,18 @@ static void cachetable_eviction_full_test (void) {
...
@@ -104,20 +103,18 @@ static void cachetable_eviction_full_test (void) {
}
}
expect_full_flush
=
TRUE
;
expect_full_flush
=
TRUE
;
// now pin a different, causing an eviction
// now pin a different, causing an eviction
wc
.
flush_callback
=
def_flush
;
wc
.
pe_est_callback
=
pe_est_callback
;
r
=
toku_cachetable_get_and_pin
(
r
=
toku_cachetable_get_and_pin
(
f1
,
f1
,
make_blocknum
(
1
),
make_blocknum
(
1
),
1
,
1
,
&
value2
,
&
value2
,
&
size2
,
&
size2
,
def_flush
,
wc
,
fetch
,
fetch
,
pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_pf_callback
,
def_cleaner_callback
,
0
,
0
0
);
);
assert
(
r
==
0
);
assert
(
r
==
0
);
...
...
newbrt/tests/cachetable-eviction-close-test2.c
View file @
19b7090f
...
@@ -94,20 +94,20 @@ static void cachetable_eviction_full_test (void) {
...
@@ -94,20 +94,20 @@ static void cachetable_eviction_full_test (void) {
// and really bring up its clock count
// and really bring up its clock count
//
//
for
(
int
i
=
0
;
i
<
20
;
i
++
)
{
for
(
int
i
=
0
;
i
<
20
;
i
++
)
{
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
wc
.
flush_callback
=
flush
;
wc
.
pe_est_callback
=
pe_est_callback
;
wc
.
pe_callback
=
pe_callback
;
r
=
toku_cachetable_get_and_pin
(
r
=
toku_cachetable_get_and_pin
(
f1
,
f1
,
key
,
key
,
fullhash
,
fullhash
,
&
value1
,
&
value1
,
&
size1
,
&
size1
,
flush
,
wc
,
fetch
,
fetch
,
pe_est_callback
,
pe_callback
,
def_pf_req_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_pf_callback
,
def_cleaner_callback
,
0
,
0
0
);
);
assert
(
r
==
0
);
assert
(
r
==
0
);
...
@@ -116,20 +116,19 @@ static void cachetable_eviction_full_test (void) {
...
@@ -116,20 +116,19 @@ static void cachetable_eviction_full_test (void) {
}
}
expect_full_flush
=
TRUE
;
expect_full_flush
=
TRUE
;
// now pin a different, causing an eviction
// now pin a different, causing an eviction
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
wc
.
pe_est_callback
=
pe_est_callback
;
wc
.
pe_callback
=
pe_callback
;
r
=
toku_cachetable_get_and_pin
(
r
=
toku_cachetable_get_and_pin
(
f1
,
f1
,
make_blocknum
(
1
),
make_blocknum
(
1
),
1
,
1
,
&
value2
,
&
value2
,
&
size2
,
&
size2
,
def_flush
,
wc
,
fetch
,
fetch
,
pe_est_callback
,
pe_callback
,
def_pf_req_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_pf_callback
,
def_cleaner_callback
,
0
,
0
0
);
);
assert
(
r
==
0
);
assert
(
r
==
0
);
...
...
newbrt/tests/cachetable-eviction-getandpin-test.c
View file @
19b7090f
...
@@ -47,20 +47,18 @@ static void cachetable_predef_fetch_maybegetandpin_test (void) {
...
@@ -47,20 +47,18 @@ static void cachetable_predef_fetch_maybegetandpin_test (void) {
for
(
int
i
=
0
;
i
<
20
;
i
++
)
{
for
(
int
i
=
0
;
i
<
20
;
i
++
)
{
void
*
value
;
void
*
value
;
long
size
;
long
size
;
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
wc
.
flush_callback
=
flush
;
r
=
toku_cachetable_get_and_pin
(
r
=
toku_cachetable_get_and_pin
(
f1
,
f1
,
key
,
key
,
fullhash
,
fullhash
,
&
value
,
&
value
,
&
size
,
&
size
,
flush
,
wc
,
def_fetch
,
def_fetch
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_pf_callback
,
def_cleaner_callback
,
0
,
0
0
);
);
assert
(
r
==
0
);
assert
(
r
==
0
);
...
@@ -74,20 +72,17 @@ static void cachetable_predef_fetch_maybegetandpin_test (void) {
...
@@ -74,20 +72,17 @@ static void cachetable_predef_fetch_maybegetandpin_test (void) {
do_sleep
=
TRUE
;
do_sleep
=
TRUE
;
void
*
value2
;
void
*
value2
;
long
size2
;
long
size2
;
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
r
=
toku_cachetable_get_and_pin
(
r
=
toku_cachetable_get_and_pin
(
f1
,
f1
,
make_blocknum
(
1
),
make_blocknum
(
1
),
1
,
1
,
&
value2
,
&
value2
,
&
size2
,
&
size2
,
def_flush
,
wc
,
def_fetch
,
def_fetch
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_pf_callback
,
def_cleaner_callback
,
0
,
0
0
);
);
assert
(
r
==
0
);
assert
(
r
==
0
);
...
@@ -98,9 +93,11 @@ static void cachetable_predef_fetch_maybegetandpin_test (void) {
...
@@ -98,9 +93,11 @@ static void cachetable_predef_fetch_maybegetandpin_test (void) {
void
*
v
=
0
;
void
*
v
=
0
;
long
size
=
0
;
long
size
=
0
;
// now verify that the block we are trying to evict may be pinned
// now verify that the block we are trying to evict may be pinned
r
=
toku_cachetable_get_and_pin_nonblocking
(
f1
,
key
,
fullhash
,
&
v
,
&
size
,
flush
,
def_fetch
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
NULL
,
NULL
,
NULL
);
wc
=
def_write_callback
(
NULL
);
wc
.
flush_callback
=
flush
;
r
=
toku_cachetable_get_and_pin_nonblocking
(
f1
,
key
,
fullhash
,
&
v
,
&
size
,
wc
,
def_fetch
,
def_pf_req_callback
,
def_pf_callback
,
NULL
,
NULL
);
assert
(
r
==
TOKUDB_TRY_AGAIN
);
assert
(
r
==
TOKUDB_TRY_AGAIN
);
r
=
toku_cachetable_get_and_pin
(
f1
,
key
,
fullhash
,
&
v
,
&
size
,
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_get_and_pin
(
f1
,
key
,
fullhash
,
&
v
,
&
size
,
wc
,
def_fetch
,
def_pf_req_callback
,
def_pf_callback
,
NULL
);
assert
(
r
==
0
&&
v
==
0
&&
size
==
8
);
assert
(
r
==
0
&&
v
==
0
&&
size
==
8
);
do_sleep
=
FALSE
;
do_sleep
=
FALSE
;
...
...
newbrt/tests/cachetable-eviction-getandpin-test2.c
View file @
19b7090f
...
@@ -51,6 +51,9 @@ static void cachetable_prefetch_maybegetandpin_test (void) {
...
@@ -51,6 +51,9 @@ static void cachetable_prefetch_maybegetandpin_test (void) {
u_int32_t
fullhash
=
toku_cachetable_hash
(
f1
,
make_blocknum
(
0
));
u_int32_t
fullhash
=
toku_cachetable_hash
(
f1
,
make_blocknum
(
0
));
// let's get and pin this node a bunch of times to drive up the clock count
// let's get and pin this node a bunch of times to drive up the clock count
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
wc
.
pe_est_callback
=
pe_est_callback
;
wc
.
pe_callback
=
pe_callback
;
for
(
int
i
=
0
;
i
<
20
;
i
++
)
{
for
(
int
i
=
0
;
i
<
20
;
i
++
)
{
void
*
value
;
void
*
value
;
long
size
;
long
size
;
...
@@ -60,14 +63,10 @@ static void cachetable_prefetch_maybegetandpin_test (void) {
...
@@ -60,14 +63,10 @@ static void cachetable_prefetch_maybegetandpin_test (void) {
fullhash
,
fullhash
,
&
value
,
&
value
,
&
size
,
&
size
,
def_flush
,
wc
,
def_fetch
,
def_fetch
,
pe_est_callback
,
pe_callback
,
def_pf_req_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_pf_callback
,
def_cleaner_callback
,
0
,
0
0
);
);
assert
(
r
==
0
);
assert
(
r
==
0
);
...
@@ -86,14 +85,10 @@ static void cachetable_prefetch_maybegetandpin_test (void) {
...
@@ -86,14 +85,10 @@ static void cachetable_prefetch_maybegetandpin_test (void) {
1
,
1
,
&
value2
,
&
value2
,
&
size2
,
&
size2
,
def_flush
,
wc
,
def_fetch
,
def_fetch
,
pe_est_callback
,
pe_callback
,
def_pf_req_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_pf_callback
,
def_cleaner_callback
,
0
,
0
0
);
);
assert
(
r
==
0
);
assert
(
r
==
0
);
...
@@ -110,14 +105,10 @@ static void cachetable_prefetch_maybegetandpin_test (void) {
...
@@ -110,14 +105,10 @@ static void cachetable_prefetch_maybegetandpin_test (void) {
fullhash
,
fullhash
,
&
v
,
&
v
,
&
size
,
&
size
,
def_flush
,
wc
,
def_fetch
,
def_fetch
,
pe_est_callback
,
pe_callback
,
def_pf_req_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_pf_callback
,
def_cleaner_callback
,
NULL
,
NULL
,
NULL
,
NULL
NULL
);
);
...
@@ -128,14 +119,10 @@ static void cachetable_prefetch_maybegetandpin_test (void) {
...
@@ -128,14 +119,10 @@ static void cachetable_prefetch_maybegetandpin_test (void) {
fullhash
,
fullhash
,
&
v
,
&
v
,
&
size
,
&
size
,
def_flush
,
wc
,
def_fetch
,
def_fetch
,
pe_est_callback
,
pe_callback
,
def_pf_req_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_pf_callback
,
def_cleaner_callback
,
NULL
,
NULL
NULL
);
);
assert
(
r
==
0
&&
v
==
0
&&
size
==
1
);
assert
(
r
==
0
&&
v
==
0
&&
size
==
1
);
...
...
newbrt/tests/cachetable-flush-during-cleaner.c
View file @
19b7090f
...
@@ -19,40 +19,6 @@ cleaner_callback(
...
@@ -19,40 +19,6 @@ cleaner_callback(
return
0
;
return
0
;
}
}
static
void
flush
(
CACHEFILE
f
__attribute__
((
__unused__
)),
int
UU
(
fd
),
CACHEKEY
k
__attribute__
((
__unused__
)),
void
*
v
__attribute__
((
__unused__
)),
void
*
e
__attribute__
((
__unused__
)),
PAIR_ATTR
s
__attribute__
((
__unused__
)),
PAIR_ATTR
*
new_size
__attribute__
((
__unused__
)),
BOOL
w
__attribute__
((
__unused__
)),
BOOL
keep
__attribute__
((
__unused__
)),
BOOL
c
__attribute__
((
__unused__
))
)
{
/* Do nothing */
if
(
verbose
)
{
printf
(
"FLUSH: %d
\n
"
,
(
int
)
k
.
b
);
}
}
static
int
fetch
(
CACHEFILE
f
__attribute__
((
__unused__
)),
int
UU
(
fd
),
CACHEKEY
k
__attribute__
((
__unused__
)),
u_int32_t
fullhash
__attribute__
((
__unused__
)),
void
**
value
__attribute__
((
__unused__
)),
PAIR_ATTR
*
sizep
__attribute__
((
__unused__
)),
int
*
dirtyp
,
void
*
extraargs
__attribute__
((
__unused__
))
)
{
*
dirtyp
=
0
;
*
value
=
NULL
;
*
sizep
=
make_pair_attr
(
8
);
return
0
;
}
static
void
static
void
cachetable_test
(
void
)
{
cachetable_test
(
void
)
{
const
int
test_limit
=
400
;
const
int
test_limit
=
400
;
...
@@ -71,7 +37,9 @@ cachetable_test (void) {
...
@@ -71,7 +37,9 @@ cachetable_test (void) {
//long s2;
//long s2;
for
(
int
j
=
0
;
j
<
50000
;
j
++
)
{
for
(
int
j
=
0
;
j
<
50000
;
j
++
)
{
for
(
int
i
=
0
;
i
<
10
;
i
++
)
{
for
(
int
i
=
0
;
i
<
10
;
i
++
)
{
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
i
),
i
,
&
v1
,
&
s1
,
flush
,
fetch
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
cleaner_callback
,
NULL
,
NULL
);
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
wc
.
cleaner_callback
=
cleaner_callback
;
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
i
),
i
,
&
v1
,
&
s1
,
wc
,
def_fetch
,
def_pf_req_callback
,
def_pf_callback
,
NULL
);
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
i
),
i
,
CACHETABLE_DIRTY
,
make_pair_attr
(
8
));
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
i
),
i
,
CACHETABLE_DIRTY
,
make_pair_attr
(
8
));
}
}
r
=
toku_cachefile_flush
(
f1
);
r
=
toku_cachefile_flush
(
f1
);
...
...
newbrt/tests/cachetable-flush-test.c
View file @
19b7090f
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
static
void
static
void
test_cachetable_def_flush
(
int
n
)
{
test_cachetable_def_flush
(
int
n
)
{
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
const
int
test_limit
=
2
*
n
;
const
int
test_limit
=
2
*
n
;
int
r
;
int
r
;
CACHETABLE
ct
;
CACHETABLE
ct
;
...
@@ -23,12 +24,12 @@ test_cachetable_def_flush (int n) {
...
@@ -23,12 +24,12 @@ test_cachetable_def_flush (int n) {
for
(
i
=
0
;
i
<
n
;
i
++
)
{
for
(
i
=
0
;
i
<
n
;
i
++
)
{
u_int32_t
hi
;
u_int32_t
hi
;
hi
=
toku_cachetable_hash
(
f1
,
make_blocknum
(
i
));
hi
=
toku_cachetable_hash
(
f1
,
make_blocknum
(
i
));
r
=
toku_cachetable_put
(
f1
,
make_blocknum
(
i
),
hi
,
(
void
*
)(
long
)
i
,
make_pair_attr
(
1
),
def_flush
,
def_pe_est_callback
,
def_pe_callback
,
def_cleaner_callback
,
0
);
r
=
toku_cachetable_put
(
f1
,
make_blocknum
(
i
),
hi
,
(
void
*
)(
long
)
i
,
make_pair_attr
(
1
),
wc
);
assert
(
r
==
0
);
assert
(
r
==
0
);
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
i
),
hi
,
CACHETABLE_CLEAN
,
make_pair_attr
(
1
));
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
i
),
hi
,
CACHETABLE_CLEAN
,
make_pair_attr
(
1
));
assert
(
r
==
0
);
assert
(
r
==
0
);
hi
=
toku_cachetable_hash
(
f2
,
make_blocknum
(
i
));
hi
=
toku_cachetable_hash
(
f2
,
make_blocknum
(
i
));
r
=
toku_cachetable_put
(
f2
,
make_blocknum
(
i
),
hi
,
(
void
*
)(
long
)
i
,
make_pair_attr
(
1
),
def_flush
,
def_pe_est_callback
,
def_pe_callback
,
def_cleaner_callback
,
0
);
r
=
toku_cachetable_put
(
f2
,
make_blocknum
(
i
),
hi
,
(
void
*
)(
long
)
i
,
make_pair_attr
(
1
),
wc
);
assert
(
r
==
0
);
assert
(
r
==
0
);
r
=
toku_cachetable_unpin
(
f2
,
make_blocknum
(
i
),
hi
,
CACHETABLE_CLEAN
,
make_pair_attr
(
1
));
r
=
toku_cachetable_unpin
(
f2
,
make_blocknum
(
i
),
hi
,
CACHETABLE_CLEAN
,
make_pair_attr
(
1
));
assert
(
r
==
0
);
assert
(
r
==
0
);
...
...
newbrt/tests/cachetable-getandpin-test.c
View file @
19b7090f
...
@@ -37,30 +37,6 @@ fetch (
...
@@ -37,30 +37,6 @@ fetch (
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__
)),
PAIR_ATTR
bytes_to_free
__attribute__
((
__unused__
)),
PAIR_ATTR
*
bytes_freed
,
void
*
extraargs
__attribute__
((
__unused__
))
)
{
*
bytes_freed
=
bytes_to_free
;
return
0
;
}
static
void
static
void
cachetable_getandpin_test
(
int
n
)
{
cachetable_getandpin_test
(
int
n
)
{
const
int
test_limit
=
1024
*
1024
;
const
int
test_limit
=
1024
*
1024
;
...
@@ -79,7 +55,9 @@ cachetable_getandpin_test (int n) {
...
@@ -79,7 +55,9 @@ cachetable_getandpin_test (int n) {
u_int32_t
hi
;
u_int32_t
hi
;
hi
=
toku_cachetable_hash
(
f1
,
make_blocknum
(
i
));
hi
=
toku_cachetable_hash
(
f1
,
make_blocknum
(
i
));
void
*
v
;
long
size
;
void
*
v
;
long
size
;
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
i
),
hi
,
&
v
,
&
size
,
flush
,
fetch
,
pe_est_callback
,
pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
0
,
0
);
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
wc
.
flush_callback
=
flush
;
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
i
),
hi
,
&
v
,
&
size
,
wc
,
fetch
,
def_pf_req_callback
,
def_pf_callback
,
0
);
assert
(
r
==
0
);
assert
(
r
==
0
);
assert
(
size
==
i
);
assert
(
size
==
i
);
...
...
newbrt/tests/cachetable-kibbutz_and_flush_cachefile.c
View file @
19b7090f
...
@@ -34,14 +34,15 @@ run_test (void) {
...
@@ -34,14 +34,15 @@ run_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
,
def_flush
,
def_fetch
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
NULL
,
NULL
);
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
1
),
1
,
&
v1
,
&
s1
,
wc
,
def_fetch
,
def_pf_req_callback
,
def_pf_callback
,
NULL
);
foo
=
FALSE
;
foo
=
FALSE
;
cachefile_kibbutz_enq
(
f1
,
kibbutz_work
,
f1
);
cachefile_kibbutz_enq
(
f1
,
kibbutz_work
,
f1
);
r
=
toku_cachefile_flush
(
f1
);
assert
(
r
==
0
);
r
=
toku_cachefile_flush
(
f1
);
assert
(
r
==
0
);
assert
(
foo
);
assert
(
foo
);
assert
(
f1
);
assert
(
f1
);
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
1
),
1
,
&
v1
,
&
s1
,
def_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_get_and_pin
(
f1
,
make_blocknum
(
1
),
1
,
&
v1
,
&
s1
,
wc
,
def_fetch
,
def_pf_req_callback
,
def_pf_callback
,
NULL
);
foo
=
FALSE
;
foo
=
FALSE
;
cachefile_kibbutz_enq
(
f1
,
kibbutz_work
,
f1
);
cachefile_kibbutz_enq
(
f1
,
kibbutz_work
,
f1
);
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
);
...
...
newbrt/tests/cachetable-partial-fetch.c
View file @
19b7090f
...
@@ -11,22 +11,6 @@
...
@@ -11,22 +11,6 @@
u_int32_t
fetch_val
=
0
;
u_int32_t
fetch_val
=
0
;
BOOL
pf_req_called
;
BOOL
pf_req_called
;
static
void
flush
(
CACHEFILE
f
__attribute__
((
__unused__
)),
int
UU
(
fd
),
CACHEKEY
k
__attribute__
((
__unused__
)),
void
*
v
__attribute__
((
__unused__
)),
void
*
e
__attribute__
((
__unused__
)),
PAIR_ATTR
s
__attribute__
((
__unused__
)),
PAIR_ATTR
*
new_size
__attribute__
((
__unused__
)),
BOOL
w
__attribute__
((
__unused__
)),
BOOL
keep
__attribute__
((
__unused__
)),
BOOL
c
__attribute__
((
__unused__
))
)
{
/* Do nothing */
if
(
verbose
)
{
printf
(
"FLUSH: %d
\n
"
,
(
int
)
k
.
b
);
}
}
static
int
static
int
fetch
(
CACHEFILE
f
__attribute__
((
__unused__
)),
fetch
(
CACHEFILE
f
__attribute__
((
__unused__
)),
int
UU
(
fd
),
int
UU
(
fd
),
...
@@ -100,7 +84,8 @@ cachetable_test (void) {
...
@@ -100,7 +84,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
,
def_pe_est_callback
,
def_pe_callback
,
pf_req_callback
,
pf_callback
,
def_cleaner_callback
,
NULL
,
NULL
);
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
1
),
1
,
&
v1
,
&
s1
,
wc
,
fetch
,
pf_req_callback
,
pf_callback
,
NULL
);
assert
(
&
fetch_val
==
v1
);
assert
(
&
fetch_val
==
v1
);
//
//
// verify that a prefetch of this node will fail
// verify that a prefetch of this node will fail
...
@@ -109,14 +94,10 @@ cachetable_test (void) {
...
@@ -109,14 +94,10 @@ cachetable_test (void) {
f1
,
f1
,
make_blocknum
(
1
),
make_blocknum
(
1
),
1
,
1
,
flush
,
wc
,
fetch
,
fetch
,
def_pe_est_callback
,
def_pe_callback
,
pf_req_callback
,
pf_req_callback
,
pf_callback
,
pf_callback
,
def_cleaner_callback
,
NULL
,
NULL
,
NULL
,
&
doing_prefetch
&
doing_prefetch
);
);
...
@@ -127,14 +108,14 @@ cachetable_test (void) {
...
@@ -127,14 +108,14 @@ cachetable_test (void) {
//
//
// now get and pin node again, and make sure that partial fetch and fetch are not called
// now get and pin node again, and make sure that partial fetch and fetch are not called
//
//
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
1
),
1
,
&
v1
,
&
s1
,
flush
,
err_fetch
,
def_pe_est_callback
,
def_pe_callback
,
pf_req_callback
,
err_pf_callback
,
def_cleaner_callback
,
NULL
,
NULL
);
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
1
),
1
,
&
v1
,
&
s1
,
wc
,
err_fetch
,
pf_req_callback
,
err_pf_callback
,
NULL
);
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
1
),
1
,
CACHETABLE_CLEAN
,
make_pair_attr
(
8
));
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
1
),
1
,
CACHETABLE_CLEAN
,
make_pair_attr
(
8
));
//
//
// now make sure that if we say a partial fetch is required, that we get a partial fetch
// now make sure that if we say a partial fetch is required, that we get a partial fetch
// and that read_extraargs properly passed down
// and that read_extraargs properly passed down
//
//
pf_req_called
=
FALSE
;
pf_req_called
=
FALSE
;
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
1
),
1
,
&
v1
,
&
s1
,
flush
,
err_fetch
,
def_pe_est_callback
,
def_pe_callback
,
true_pf_req_callback
,
true_pf_callback
,
def_cleaner_callback
,
&
fetch_val
,
NULL
);
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
1
),
1
,
&
v1
,
&
s1
,
wc
,
err_fetch
,
true_pf_req_callback
,
true_pf_callback
,
&
fetch_val
);
assert
(
pf_req_called
);
assert
(
pf_req_called
);
assert
(
s1
==
sizeof
(
fetch_val
)
+
1
);
assert
(
s1
==
sizeof
(
fetch_val
)
+
1
);
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
1
),
1
,
CACHETABLE_CLEAN
,
make_pair_attr
(
8
));
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
1
),
1
,
CACHETABLE_CLEAN
,
make_pair_attr
(
8
));
...
@@ -149,14 +130,10 @@ cachetable_test (void) {
...
@@ -149,14 +130,10 @@ cachetable_test (void) {
f1
,
f1
,
make_blocknum
(
1
),
make_blocknum
(
1
),
1
,
1
,
flush
,
wc
,
fetch
,
fetch
,
def_pe_est_callback
,
def_pe_callback
,
pf_req_callback
,
pf_req_callback
,
pf_callback
,
pf_callback
,
def_cleaner_callback
,
NULL
,
NULL
,
NULL
,
&
doing_prefetch
&
doing_prefetch
);
);
...
@@ -166,7 +143,7 @@ cachetable_test (void) {
...
@@ -166,7 +143,7 @@ cachetable_test (void) {
//
//
// now verify we can pin it, and NO fetch callback should get called
// now verify we can pin it, and NO fetch callback should get called
//
//
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
1
),
1
,
&
v1
,
&
s1
,
flush
,
err_fetch
,
def_pe_est_callback
,
def_pe_callback
,
pf_req_callback
,
err_pf_callback
,
def_cleaner_callback
,
NULL
,
NULL
);
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
1
),
1
,
&
v1
,
&
s1
,
wc
,
err_fetch
,
pf_req_callback
,
err_pf_callback
,
NULL
);
assert
(
&
fetch_val
==
v1
);
assert
(
&
fetch_val
==
v1
);
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
1
),
1
,
CACHETABLE_CLEAN
,
make_pair_attr
(
8
));
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
1
),
1
,
CACHETABLE_CLEAN
,
make_pair_attr
(
8
));
...
@@ -177,19 +154,15 @@ cachetable_test (void) {
...
@@ -177,19 +154,15 @@ cachetable_test (void) {
f1
,
f1
,
make_blocknum
(
1
),
make_blocknum
(
1
),
1
,
1
,
flush
,
wc
,
fetch
,
fetch
,
def_pe_est_callback
,
def_pe_callback
,
true_pf_req_callback
,
true_pf_req_callback
,
true_pf_callback
,
true_pf_callback
,
def_cleaner_callback
,
&
fetch_val
,
&
fetch_val
,
NULL
,
&
doing_prefetch
&
doing_prefetch
);
);
assert
(
doing_prefetch
);
assert
(
doing_prefetch
);
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
1
),
1
,
&
v1
,
&
s1
,
flush
,
err_fetch
,
def_pe_est_callback
,
def_pe_callback
,
pf_req_callback
,
err_pf_callback
,
def_cleaner_callback
,
NULL
,
NULL
);
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
1
),
1
,
&
v1
,
&
s1
,
wc
,
err_fetch
,
pf_req_callback
,
err_pf_callback
,
NULL
);
assert
(
&
fetch_val
==
v1
);
assert
(
&
fetch_val
==
v1
);
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
1
),
1
,
CACHETABLE_CLEAN
,
make_pair_attr
(
8
));
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
1
),
1
,
CACHETABLE_CLEAN
,
make_pair_attr
(
8
));
...
...
newbrt/tests/cachetable-pin-checkpoint.c
View file @
19b7090f
...
@@ -118,14 +118,15 @@ static void *move_numbers(void *arg) {
...
@@ -118,14 +118,15 @@ static void *move_numbers(void *arg) {
less_key
.
b
=
less
;
less_key
.
b
=
less
;
u_int32_t
less_fullhash
=
less
;
u_int32_t
less_fullhash
=
less
;
enum
cachetable_dirty
less_dirty
=
CACHETABLE_DIRTY
;
enum
cachetable_dirty
less_dirty
=
CACHETABLE_DIRTY
;
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
wc
.
flush_callback
=
flush
;
r
=
toku_cachetable_get_and_pin_with_dep_pairs
(
r
=
toku_cachetable_get_and_pin_with_dep_pairs
(
f1
,
f1
,
less_key
,
less_key
,
less
,
less
,
&
v1
,
&
v1
,
&
s1
,
&
s1
,
flush
,
fetch
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
wc
,
fetch
,
def_pf_req_callback
,
def_pf_callback
,
NULL
,
NULL
,
NULL
,
0
,
//num_dependent_pairs
0
,
//num_dependent_pairs
NULL
,
NULL
,
...
@@ -146,8 +147,7 @@ static void *move_numbers(void *arg) {
...
@@ -146,8 +147,7 @@ static void *move_numbers(void *arg) {
greater
,
greater
,
&
v1
,
&
v1
,
&
s1
,
&
s1
,
flush
,
fetch
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
wc
,
fetch
,
def_pf_req_callback
,
def_pf_callback
,
NULL
,
NULL
,
NULL
,
1
,
//num_dependent_pairs
1
,
//num_dependent_pairs
&
f1
,
&
f1
,
...
@@ -180,8 +180,7 @@ static void *move_numbers(void *arg) {
...
@@ -180,8 +180,7 @@ static void *move_numbers(void *arg) {
third
,
third
,
&
v1
,
&
v1
,
&
s1
,
&
s1
,
flush
,
fetch
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
wc
,
fetch
,
def_pf_req_callback
,
def_pf_callback
,
NULL
,
NULL
,
NULL
,
1
,
//num_dependent_pairs
1
,
//num_dependent_pairs
&
f1
,
&
f1
,
...
@@ -209,14 +208,15 @@ static void *read_random_numbers(void *arg) {
...
@@ -209,14 +208,15 @@ static void *read_random_numbers(void *arg) {
void
*
v1
;
void
*
v1
;
long
s1
;
long
s1
;
int
r1
;
int
r1
;
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
wc
.
flush_callback
=
flush
;
r1
=
toku_cachetable_get_and_pin_nonblocking
(
r1
=
toku_cachetable_get_and_pin_nonblocking
(
f1
,
f1
,
make_blocknum
(
rand_key1
),
make_blocknum
(
rand_key1
),
rand_key1
,
rand_key1
,
&
v1
,
&
v1
,
&
s1
,
&
s1
,
flush
,
fetch
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
wc
,
fetch
,
def_pf_req_callback
,
def_pf_callback
,
NULL
,
NULL
,
NULL
,
NULL
NULL
);
);
...
...
newbrt/tests/cachetable-prefetch-checkpoint-test.c
View file @
19b7090f
...
@@ -66,6 +66,8 @@ static void cachetable_prefetch_checkpoint_test(int n, enum cachetable_dirty dir
...
@@ -66,6 +66,8 @@ static void cachetable_prefetch_checkpoint_test(int n, enum cachetable_dirty dir
const
int
test_limit
=
n
;
const
int
test_limit
=
n
;
int
r
;
int
r
;
CACHETABLE
ct
;
CACHETABLE
ct
;
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
wc
.
flush_callback
=
flush
;
r
=
toku_create_cachetable
(
&
ct
,
test_limit
,
ZERO_LSN
,
NULL_LOGGER
);
assert
(
r
==
0
);
r
=
toku_create_cachetable
(
&
ct
,
test_limit
,
ZERO_LSN
,
NULL_LOGGER
);
assert
(
r
==
0
);
char
fname1
[]
=
__FILE__
"test1.dat"
;
char
fname1
[]
=
__FILE__
"test1.dat"
;
unlink
(
fname1
);
unlink
(
fname1
);
...
@@ -78,7 +80,7 @@ static void cachetable_prefetch_checkpoint_test(int n, enum cachetable_dirty dir
...
@@ -78,7 +80,7 @@ static void cachetable_prefetch_checkpoint_test(int n, enum cachetable_dirty dir
{
{
CACHEKEY
key
=
make_blocknum
(
n
+
1
);
CACHEKEY
key
=
make_blocknum
(
n
+
1
);
u_int32_t
fullhash
=
toku_cachetable_hash
(
f1
,
key
);
u_int32_t
fullhash
=
toku_cachetable_hash
(
f1
,
key
);
r
=
toku_cachefile_prefetch
(
f1
,
key
,
fullhash
,
flush
,
fetch
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
0
,
0
,
NULL
);
r
=
toku_cachefile_prefetch
(
f1
,
key
,
fullhash
,
wc
,
fetch
,
def_pf_req_callback
,
def_pf_callback
,
0
,
NULL
);
toku_cachetable_verify
(
ct
);
toku_cachetable_verify
(
ct
);
}
}
...
@@ -87,7 +89,7 @@ static void cachetable_prefetch_checkpoint_test(int n, enum cachetable_dirty dir
...
@@ -87,7 +89,7 @@ static void cachetable_prefetch_checkpoint_test(int n, enum cachetable_dirty dir
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
,
make_pair_attr
(
1
),
flush
,
def_pe_est_callback
,
def_pe_callback
,
def_cleaner_callback
,
0
);
r
=
toku_cachetable_put
(
f1
,
key
,
hi
,
(
void
*
)(
long
)
i
,
make_pair_attr
(
1
),
wc
);
assert
(
r
==
0
);
assert
(
r
==
0
);
r
=
toku_cachetable_unpin
(
f1
,
key
,
hi
,
dirty
,
make_pair_attr
(
item_size
));
r
=
toku_cachetable_unpin
(
f1
,
key
,
hi
,
dirty
,
make_pair_attr
(
item_size
));
...
...
newbrt/tests/cachetable-prefetch-close-leak-test.c
View file @
19b7090f
...
@@ -58,7 +58,9 @@ static void cachetable_prefetch_close_leak_test (void) {
...
@@ -58,7 +58,9 @@ static void cachetable_prefetch_close_leak_test (void) {
// prefetch block 0. this will take 10 seconds.
// prefetch block 0. this will take 10 seconds.
CACHEKEY
key
=
make_blocknum
(
0
);
CACHEKEY
key
=
make_blocknum
(
0
);
u_int32_t
fullhash
=
toku_cachetable_hash
(
f1
,
make_blocknum
(
0
));
u_int32_t
fullhash
=
toku_cachetable_hash
(
f1
,
make_blocknum
(
0
));
r
=
toku_cachefile_prefetch
(
f1
,
key
,
fullhash
,
flush
,
fetch
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
0
,
0
,
NULL
);
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
wc
.
flush_callback
=
flush
;
r
=
toku_cachefile_prefetch
(
f1
,
key
,
fullhash
,
wc
,
fetch
,
def_pf_req_callback
,
def_pf_callback
,
0
,
NULL
);
toku_cachetable_verify
(
ct
);
toku_cachetable_verify
(
ct
);
// close with the prefetch in progress. the close should block until
// close with the prefetch in progress. the close should block until
...
...
newbrt/tests/cachetable-prefetch-close-test.c
View file @
19b7090f
...
@@ -64,6 +64,8 @@ static void cachetable_prefetch_full_test (BOOL partial_fetch) {
...
@@ -64,6 +64,8 @@ static void cachetable_prefetch_full_test (BOOL partial_fetch) {
// if we want to do a test of partial fetch,
// if we want to do a test of partial fetch,
// we first put the key into the cachefile so that
// we first put the key into the cachefile so that
// the subsequent prefetch does a partial fetch
// the subsequent prefetch does a partial fetch
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
wc
.
flush_callback
=
flush
;
if
(
partial_fetch
)
{
if
(
partial_fetch
)
{
expect_pf
=
TRUE
;
expect_pf
=
TRUE
;
void
*
value
;
void
*
value
;
...
@@ -74,21 +76,17 @@ static void cachetable_prefetch_full_test (BOOL partial_fetch) {
...
@@ -74,21 +76,17 @@ static void cachetable_prefetch_full_test (BOOL partial_fetch) {
fullhash
,
fullhash
,
&
value
,
&
value
,
&
size
,
&
size
,
flush
,
wc
,
fetch
,
fetch
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_pf_callback
,
def_cleaner_callback
,
0
,
0
0
);
);
assert
(
r
==
0
);
assert
(
r
==
0
);
r
=
toku_cachetable_unpin
(
f1
,
key
,
fullhash
,
CACHETABLE_CLEAN
,
make_pair_attr
(
1
));
r
=
toku_cachetable_unpin
(
f1
,
key
,
fullhash
,
CACHETABLE_CLEAN
,
make_pair_attr
(
1
));
}
}
r
=
toku_cachefile_prefetch
(
f1
,
key
,
fullhash
,
flush
,
fetch
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
0
,
0
,
NULL
);
r
=
toku_cachefile_prefetch
(
f1
,
key
,
fullhash
,
wc
,
fetch
,
def_pf_req_callback
,
def_pf_callback
,
0
,
NULL
);
toku_cachetable_verify
(
ct
);
toku_cachetable_verify
(
ct
);
// close with the prefetch in progress. the close should block until
// close with the prefetch in progress. the close should block until
...
...
newbrt/tests/cachetable-prefetch-flowcontrol-test.c
View file @
19b7090f
...
@@ -67,12 +67,14 @@ static void cachetable_prefetch_flowcontrol_test (int cachetable_size_limit) {
...
@@ -67,12 +67,14 @@ static void cachetable_prefetch_flowcontrol_test (int cachetable_size_limit) {
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
);
int
i
;
int
i
;
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
wc
.
flush_callback
=
flush
;
// prefetch keys 0 .. N-1. they should all fit in the cachetable
// prefetch keys 0 .. N-1. they should all fit in the cachetable
for
(
i
=
0
;
i
<
cachetable_size_limit
;
i
++
)
{
for
(
i
=
0
;
i
<
cachetable_size_limit
;
i
++
)
{
CACHEKEY
key
=
make_blocknum
(
i
);
CACHEKEY
key
=
make_blocknum
(
i
);
u_int32_t
fullhash
=
toku_cachetable_hash
(
f1
,
key
);
u_int32_t
fullhash
=
toku_cachetable_hash
(
f1
,
key
);
r
=
toku_cachefile_prefetch
(
f1
,
key
,
fullhash
,
flush
,
fetch
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
0
,
0
,
NULL
);
r
=
toku_cachefile_prefetch
(
f1
,
key
,
fullhash
,
wc
,
fetch
,
def_pf_req_callback
,
def_pf_callback
,
0
,
NULL
);
toku_cachetable_verify
(
ct
);
toku_cachetable_verify
(
ct
);
}
}
...
@@ -83,7 +85,7 @@ static void cachetable_prefetch_flowcontrol_test (int cachetable_size_limit) {
...
@@ -83,7 +85,7 @@ static void cachetable_prefetch_flowcontrol_test (int cachetable_size_limit) {
for
(
i
=
i
;
i
<
2
*
cachetable_size_limit
;
i
++
)
{
for
(
i
=
i
;
i
<
2
*
cachetable_size_limit
;
i
++
)
{
CACHEKEY
key
=
make_blocknum
(
i
);
CACHEKEY
key
=
make_blocknum
(
i
);
u_int32_t
fullhash
=
toku_cachetable_hash
(
f1
,
key
);
u_int32_t
fullhash
=
toku_cachetable_hash
(
f1
,
key
);
r
=
toku_cachefile_prefetch
(
f1
,
key
,
fullhash
,
flush
,
fetch
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
0
,
0
,
NULL
);
r
=
toku_cachefile_prefetch
(
f1
,
key
,
fullhash
,
wc
,
fetch
,
def_pf_req_callback
,
def_pf_callback
,
0
,
NULL
);
toku_cachetable_verify
(
ct
);
toku_cachetable_verify
(
ct
);
// sleep(1);
// sleep(1);
}
}
...
...
newbrt/tests/cachetable-prefetch-getandpin-test.c
View file @
19b7090f
...
@@ -81,6 +81,8 @@ static void cachetable_prefetch_maybegetandpin_test (BOOL do_partial_fetch) {
...
@@ -81,6 +81,8 @@ static void cachetable_prefetch_maybegetandpin_test (BOOL do_partial_fetch) {
do_pf
=
FALSE
;
do_pf
=
FALSE
;
CACHEKEY
key
=
make_blocknum
(
0
);
CACHEKEY
key
=
make_blocknum
(
0
);
u_int32_t
fullhash
=
toku_cachetable_hash
(
f1
,
make_blocknum
(
0
));
u_int32_t
fullhash
=
toku_cachetable_hash
(
f1
,
make_blocknum
(
0
));
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
wc
.
flush_callback
=
flush
;
if
(
do_partial_fetch
)
{
if
(
do_partial_fetch
)
{
expect_pf
=
TRUE
;
expect_pf
=
TRUE
;
void
*
value
;
void
*
value
;
...
@@ -91,14 +93,10 @@ static void cachetable_prefetch_maybegetandpin_test (BOOL do_partial_fetch) {
...
@@ -91,14 +93,10 @@ static void cachetable_prefetch_maybegetandpin_test (BOOL do_partial_fetch) {
fullhash
,
fullhash
,
&
value
,
&
value
,
&
size
,
&
size
,
flush
,
wc
,
fetch
,
fetch
,
def_pe_est_callback
,
def_pe_callback
,
pf_req_callback
,
pf_req_callback
,
pf_callback
,
pf_callback
,
def_cleaner_callback
,
0
,
0
0
);
);
assert
(
r
==
0
);
assert
(
r
==
0
);
...
@@ -110,16 +108,16 @@ static void cachetable_prefetch_maybegetandpin_test (BOOL do_partial_fetch) {
...
@@ -110,16 +108,16 @@ static void cachetable_prefetch_maybegetandpin_test (BOOL do_partial_fetch) {
// prefetch block 0. this will take 2 seconds.
// prefetch block 0. this will take 2 seconds.
do_pf
=
TRUE
;
do_pf
=
TRUE
;
r
=
toku_cachefile_prefetch
(
f1
,
key
,
fullhash
,
flush
,
fetch
,
def_pe_est_callback
,
def_pe_callback
,
pf_req_callback
,
pf_callback
,
def_cleaner_callback
,
0
,
0
,
NULL
);
r
=
toku_cachefile_prefetch
(
f1
,
key
,
fullhash
,
wc
,
fetch
,
pf_req_callback
,
pf_callback
,
0
,
NULL
);
toku_cachetable_verify
(
ct
);
toku_cachetable_verify
(
ct
);
// verify that get_and_pin waits while the prefetch is in progress
// verify that get_and_pin waits while the prefetch is in progress
void
*
v
=
0
;
void
*
v
=
0
;
long
size
=
0
;
long
size
=
0
;
do_pf
=
FALSE
;
do_pf
=
FALSE
;
r
=
toku_cachetable_get_and_pin_nonblocking
(
f1
,
key
,
fullhash
,
&
v
,
&
size
,
flush
,
fetch
,
def_pe_est_callback
,
def_pe_callback
,
pf_req_callback
,
pf_callback
,
def_cleaner_callback
,
NULL
,
NULL
,
NULL
);
r
=
toku_cachetable_get_and_pin_nonblocking
(
f1
,
key
,
fullhash
,
&
v
,
&
size
,
wc
,
fetch
,
pf_req_callback
,
pf_callback
,
NULL
,
NULL
);
assert
(
r
==
TOKUDB_TRY_AGAIN
);
assert
(
r
==
TOKUDB_TRY_AGAIN
);
r
=
toku_cachetable_get_and_pin
(
f1
,
key
,
fullhash
,
&
v
,
&
size
,
flush
,
fetch
,
def_pe_est_callback
,
def_pe_callback
,
pf_req_callback
,
pf_callback
,
def_cleaner_callback
,
NULL
,
NULL
);
r
=
toku_cachetable_get_and_pin
(
f1
,
key
,
fullhash
,
&
v
,
&
size
,
wc
,
fetch
,
pf_req_callback
,
pf_callback
,
NULL
);
assert
(
r
==
0
&&
v
==
0
&&
size
==
2
);
assert
(
r
==
0
&&
v
==
0
&&
size
==
2
);
struct
timeval
tend
;
struct
timeval
tend
;
...
...
newbrt/tests/cachetable-prefetch-maybegetandpin-test.c
View file @
19b7090f
...
@@ -40,7 +40,8 @@ static void cachetable_prefetch_maybegetandpin_test (void) {
...
@@ -40,7 +40,8 @@ static void cachetable_prefetch_maybegetandpin_test (void) {
// prefetch block 0. this will take 10 seconds.
// prefetch block 0. this will take 10 seconds.
CACHEKEY
key
=
make_blocknum
(
0
);
CACHEKEY
key
=
make_blocknum
(
0
);
u_int32_t
fullhash
=
toku_cachetable_hash
(
f1
,
make_blocknum
(
0
));
u_int32_t
fullhash
=
toku_cachetable_hash
(
f1
,
make_blocknum
(
0
));
r
=
toku_cachefile_prefetch
(
f1
,
key
,
fullhash
,
def_flush
,
fetch
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
0
,
0
,
NULL
);
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
r
=
toku_cachefile_prefetch
(
f1
,
key
,
fullhash
,
wc
,
fetch
,
def_pf_req_callback
,
def_pf_callback
,
0
,
NULL
);
toku_cachetable_verify
(
ct
);
toku_cachetable_verify
(
ct
);
// verify that maybe_get_and_pin returns an error while the prefetch is in progress
// verify that maybe_get_and_pin returns an error while the prefetch is in progress
...
...
newbrt/tests/cachetable-prefetch2-test.c
View file @
19b7090f
...
@@ -43,11 +43,12 @@ static void cachetable_prefetch_maybegetandpin_test (void) {
...
@@ -43,11 +43,12 @@ static void cachetable_prefetch_maybegetandpin_test (void) {
// prefetch block 0. this will take 10 seconds.
// prefetch block 0. this will take 10 seconds.
CACHEKEY
key
=
make_blocknum
(
0
);
CACHEKEY
key
=
make_blocknum
(
0
);
u_int32_t
fullhash
=
toku_cachetable_hash
(
f1
,
make_blocknum
(
0
));
u_int32_t
fullhash
=
toku_cachetable_hash
(
f1
,
make_blocknum
(
0
));
r
=
toku_cachefile_prefetch
(
f1
,
key
,
fullhash
,
def_flush
,
fetch
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
0
,
0
,
NULL
);
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
r
=
toku_cachefile_prefetch
(
f1
,
key
,
fullhash
,
wc
,
fetch
,
def_pf_req_callback
,
def_pf_callback
,
0
,
NULL
);
toku_cachetable_verify
(
ct
);
toku_cachetable_verify
(
ct
);
// prefetch again. this should do nothing.
// prefetch again. this should do nothing.
r
=
toku_cachefile_prefetch
(
f1
,
key
,
fullhash
,
def_flush
,
fetch
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
0
,
0
,
NULL
);
r
=
toku_cachefile_prefetch
(
f1
,
key
,
fullhash
,
wc
,
fetch
,
def_pf_req_callback
,
def_pf_callback
,
0
,
NULL
);
toku_cachetable_verify
(
ct
);
toku_cachetable_verify
(
ct
);
// verify that maybe_get_and_pin returns an error while the prefetch is in progress
// verify that maybe_get_and_pin returns an error while the prefetch is in progress
...
...
newbrt/tests/cachetable-put-checkpoint.c
View file @
19b7090f
...
@@ -111,14 +111,15 @@ static void move_number_to_child(
...
@@ -111,14 +111,15 @@ static void move_number_to_child(
CACHEKEY
child_key
;
CACHEKEY
child_key
;
child_key
.
b
=
child
;
child_key
.
b
=
child
;
u_int32_t
child_fullhash
=
toku_cachetable_hash
(
f1
,
child_key
);
u_int32_t
child_fullhash
=
toku_cachetable_hash
(
f1
,
child_key
);
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
wc
.
flush_callback
=
flush
;
r
=
toku_cachetable_get_and_pin_with_dep_pairs
(
r
=
toku_cachetable_get_and_pin_with_dep_pairs
(
f1
,
f1
,
child_key
,
child_key
,
child_fullhash
,
child_fullhash
,
&
v1
,
&
v1
,
&
s1
,
&
s1
,
flush
,
fetch
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
wc
,
fetch
,
def_pf_req_callback
,
def_pf_callback
,
NULL
,
NULL
,
NULL
,
1
,
//num_dependent_pairs
1
,
//num_dependent_pairs
&
f1
,
&
f1
,
...
@@ -155,14 +156,15 @@ static void *move_numbers(void *arg) {
...
@@ -155,14 +156,15 @@ static void *move_numbers(void *arg) {
CACHEKEY
parent_key
;
CACHEKEY
parent_key
;
parent_key
.
b
=
parent
;
parent_key
.
b
=
parent
;
u_int32_t
parent_fullhash
=
toku_cachetable_hash
(
f1
,
parent_key
);
u_int32_t
parent_fullhash
=
toku_cachetable_hash
(
f1
,
parent_key
);
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
wc
.
flush_callback
=
flush
;
r
=
toku_cachetable_get_and_pin_with_dep_pairs
(
r
=
toku_cachetable_get_and_pin_with_dep_pairs
(
f1
,
f1
,
parent_key
,
parent_key
,
parent_fullhash
,
parent_fullhash
,
&
v1
,
&
v1
,
&
s1
,
&
s1
,
flush
,
fetch
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
wc
,
fetch
,
def_pf_req_callback
,
def_pf_callback
,
NULL
,
NULL
,
NULL
,
0
,
//num_dependent_pairs
0
,
//num_dependent_pairs
NULL
,
NULL
,
...
@@ -218,14 +220,15 @@ static void merge_and_split_child(
...
@@ -218,14 +220,15 @@ static void merge_and_split_child(
child_key
.
b
=
child
;
child_key
.
b
=
child
;
u_int32_t
child_fullhash
=
toku_cachetable_hash
(
f1
,
child_key
);
u_int32_t
child_fullhash
=
toku_cachetable_hash
(
f1
,
child_key
);
enum
cachetable_dirty
child_dirty
=
CACHETABLE_CLEAN
;
enum
cachetable_dirty
child_dirty
=
CACHETABLE_CLEAN
;
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
wc
.
flush_callback
=
flush
;
r
=
toku_cachetable_get_and_pin_with_dep_pairs
(
r
=
toku_cachetable_get_and_pin_with_dep_pairs
(
f1
,
f1
,
child_key
,
child_key
,
child_fullhash
,
child_fullhash
,
&
v1
,
&
v1
,
&
s1
,
&
s1
,
flush
,
fetch
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
wc
,
fetch
,
def_pf_req_callback
,
def_pf_callback
,
NULL
,
NULL
,
NULL
,
1
,
//num_dependent_pairs
1
,
//num_dependent_pairs
&
f1
,
&
f1
,
...
@@ -258,8 +261,7 @@ static void merge_and_split_child(
...
@@ -258,8 +261,7 @@ static void merge_and_split_child(
other_child_fullhash
,
other_child_fullhash
,
&
v1
,
&
v1
,
&
s1
,
&
s1
,
flush
,
fetch
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
wc
,
fetch
,
def_pf_req_callback
,
def_pf_callback
,
NULL
,
NULL
,
NULL
,
2
,
//num_dependent_pairs
2
,
//num_dependent_pairs
cfs
,
cfs
,
...
@@ -289,8 +291,7 @@ static void merge_and_split_child(
...
@@ -289,8 +291,7 @@ static void merge_and_split_child(
get_data
,
get_data
,
data_val
,
data_val
,
make_pair_attr
(
8
),
make_pair_attr
(
8
),
flush
,
def_pe_est_callback
,
def_pe_callback
,
def_cleaner_callback
,
wc
,
NULL
,
// parameter for flush_callback, pe_est_callback, pe_callback, and cleaner_callback
&
other_child
,
&
other_child
,
2
,
// number of dependent pairs that we may need to checkpoint
2
,
// number of dependent pairs that we may need to checkpoint
cfs
,
cfs
,
...
@@ -327,14 +328,15 @@ static void *merge_and_split(void *arg) {
...
@@ -327,14 +328,15 @@ static void *merge_and_split(void *arg) {
CACHEKEY
parent_key
;
CACHEKEY
parent_key
;
parent_key
.
b
=
parent
;
parent_key
.
b
=
parent
;
u_int32_t
parent_fullhash
=
toku_cachetable_hash
(
f1
,
parent_key
);
u_int32_t
parent_fullhash
=
toku_cachetable_hash
(
f1
,
parent_key
);
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
wc
.
flush_callback
=
flush
;
r
=
toku_cachetable_get_and_pin_with_dep_pairs
(
r
=
toku_cachetable_get_and_pin_with_dep_pairs
(
f1
,
f1
,
parent_key
,
parent_key
,
parent_fullhash
,
parent_fullhash
,
&
v1
,
&
v1
,
&
s1
,
&
s1
,
flush
,
fetch
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
wc
,
fetch
,
def_pf_req_callback
,
def_pf_callback
,
NULL
,
NULL
,
NULL
,
0
,
//num_dependent_pairs
0
,
//num_dependent_pairs
NULL
,
NULL
,
...
...
newbrt/tests/cachetable-put-test.c
View file @
19b7090f
...
@@ -17,7 +17,8 @@ cachetable_put_test (int n) {
...
@@ -17,7 +17,8 @@ cachetable_put_test (int n) {
for
(
i
=
1
;
i
<=
n
;
i
++
)
{
for
(
i
=
1
;
i
<=
n
;
i
++
)
{
u_int32_t
hi
;
u_int32_t
hi
;
hi
=
toku_cachetable_hash
(
f1
,
make_blocknum
(
i
));
hi
=
toku_cachetable_hash
(
f1
,
make_blocknum
(
i
));
r
=
toku_cachetable_put
(
f1
,
make_blocknum
(
i
),
hi
,
(
void
*
)(
long
)
i
,
make_pair_attr
(
1
),
def_flush
,
def_pe_est_callback
,
def_pe_callback
,
def_cleaner_callback
,
0
);
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
r
=
toku_cachetable_put
(
f1
,
make_blocknum
(
i
),
hi
,
(
void
*
)(
long
)
i
,
make_pair_attr
(
1
),
wc
);
assert
(
r
==
0
);
assert
(
r
==
0
);
assert
(
toku_cachefile_count_pinned
(
f1
,
0
)
==
i
);
assert
(
toku_cachefile_count_pinned
(
f1
,
0
)
==
i
);
...
...
newbrt/tests/cachetable-rename-test.c
View file @
19b7090f
...
@@ -100,9 +100,11 @@ static void test_rename (void) {
...
@@ -100,9 +100,11 @@ static void test_rename (void) {
long
nval
=
random
();
long
nval
=
random
();
if
(
verbose
)
printf
(
"n_keys=%d Insert %08"
PRIx64
"
\n
"
,
n_keys
,
nkey
.
b
);
if
(
verbose
)
printf
(
"n_keys=%d Insert %08"
PRIx64
"
\n
"
,
n_keys
,
nkey
.
b
);
u_int32_t
hnkey
=
toku_cachetable_hash
(
f
,
nkey
);
u_int32_t
hnkey
=
toku_cachetable_hash
(
f
,
nkey
);
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
wc
.
flush_callback
=
r_flush
;
r
=
toku_cachetable_put
(
f
,
nkey
,
hnkey
,
r
=
toku_cachetable_put
(
f
,
nkey
,
hnkey
,
(
void
*
)
nval
,
make_pair_attr
(
1
),
(
void
*
)
nval
,
make_pair_attr
(
1
),
r_flush
,
def_pe_est_callback
,
def_pe_callback
,
def_cleaner_callback
,
0
);
wc
);
assert
(
r
==
0
);
assert
(
r
==
0
);
test_mutex_lock
();
test_mutex_lock
();
while
(
n_keys
>=
KEYLIMIT
)
{
while
(
n_keys
>=
KEYLIMIT
)
{
...
@@ -127,7 +129,9 @@ static void test_rename (void) {
...
@@ -127,7 +129,9 @@ static void test_rename (void) {
void
*
current_value
;
void
*
current_value
;
long
current_size
;
long
current_size
;
if
(
verbose
)
printf
(
"Rename %"
PRIx64
" to %"
PRIx64
"
\n
"
,
okey
.
b
,
nkey
.
b
);
if
(
verbose
)
printf
(
"Rename %"
PRIx64
" to %"
PRIx64
"
\n
"
,
okey
.
b
,
nkey
.
b
);
r
=
toku_cachetable_get_and_pin
(
f
,
okey
,
toku_cachetable_hash
(
f
,
okey
),
&
current_value
,
&
current_size
,
r_flush
,
r_fetch
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
0
,
0
);
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
wc
.
flush_callback
=
r_flush
;
r
=
toku_cachetable_get_and_pin
(
f
,
okey
,
toku_cachetable_hash
(
f
,
okey
),
&
current_value
,
&
current_size
,
wc
,
r_fetch
,
def_pf_req_callback
,
def_pf_callback
,
0
);
if
(
r
==
-
42
)
continue
;
if
(
r
==
-
42
)
continue
;
assert
(
r
==
0
);
assert
(
r
==
0
);
r
=
toku_cachetable_rename
(
f
,
okey
,
nkey
);
r
=
toku_cachetable_rename
(
f
,
okey
,
nkey
);
...
...
newbrt/tests/cachetable-scan.c
View file @
19b7090f
...
@@ -68,7 +68,9 @@ static void writeit (void) {
...
@@ -68,7 +68,9 @@ static void writeit (void) {
u_int32_t
fullhash
=
toku_cachetable_hash
(
f
,
key
);
u_int32_t
fullhash
=
toku_cachetable_hash
(
f
,
key
);
int
j
;
int
j
;
for
(
j
=
0
;
j
<
BLOCKSIZE
;
j
++
)
((
char
*
)
buf
)[
j
]
=
(
char
)((
i
+
j
)
%
256
);
for
(
j
=
0
;
j
<
BLOCKSIZE
;
j
++
)
((
char
*
)
buf
)[
j
]
=
(
char
)((
i
+
j
)
%
256
);
r
=
toku_cachetable_put
(
f
,
key
,
fullhash
,
buf
,
make_pair_attr
(
BLOCKSIZE
),
f_flush
,
def_pe_est_callback
,
def_pe_callback
,
def_cleaner_callback
,
0
);
assert
(
r
==
0
);
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
wc
.
flush_callback
=
f_flush
;
r
=
toku_cachetable_put
(
f
,
key
,
fullhash
,
buf
,
make_pair_attr
(
BLOCKSIZE
),
wc
);
assert
(
r
==
0
);
r
=
toku_cachetable_unpin
(
f
,
key
,
fullhash
,
CACHETABLE_CLEAN
,
make_pair_attr
(
BLOCKSIZE
));
assert
(
r
==
0
);
r
=
toku_cachetable_unpin
(
f
,
key
,
fullhash
,
CACHETABLE_CLEAN
,
make_pair_attr
(
BLOCKSIZE
));
assert
(
r
==
0
);
}
}
gettimeofday
(
&
end
,
0
);
gettimeofday
(
&
end
,
0
);
...
@@ -89,7 +91,9 @@ static void readit (void) {
...
@@ -89,7 +91,9 @@ static void readit (void) {
for
(
i
=
0
;
i
<
N
;
i
++
)
{
for
(
i
=
0
;
i
<
N
;
i
++
)
{
CACHEKEY
key
=
make_blocknum
(
i
*
BLOCKSIZE
);
CACHEKEY
key
=
make_blocknum
(
i
*
BLOCKSIZE
);
u_int32_t
fullhash
=
toku_cachetable_hash
(
f
,
key
);
u_int32_t
fullhash
=
toku_cachetable_hash
(
f
,
key
);
r
=
toku_cachetable_get_and_pin
(
f
,
key
,
fullhash
,
&
block
,
&
current_size
,
f_flush
,
f_fetch
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
0
,
0
);
assert
(
r
==
0
);
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
wc
.
flush_callback
=
f_flush
;
r
=
toku_cachetable_get_and_pin
(
f
,
key
,
fullhash
,
&
block
,
&
current_size
,
wc
,
f_fetch
,
def_pf_req_callback
,
def_pf_callback
,
0
);
assert
(
r
==
0
);
r
=
toku_cachetable_unpin
(
f
,
key
,
fullhash
,
CACHETABLE_CLEAN
,
make_pair_attr
(
BLOCKSIZE
));
assert
(
r
==
0
);
r
=
toku_cachetable_unpin
(
f
,
key
,
fullhash
,
CACHETABLE_CLEAN
,
make_pair_attr
(
BLOCKSIZE
));
assert
(
r
==
0
);
}
}
r
=
toku_cachefile_close
(
&
f
,
0
,
FALSE
,
ZERO_LSN
);
assert
(
r
==
0
);
r
=
toku_cachefile_close
(
&
f
,
0
,
FALSE
,
ZERO_LSN
);
assert
(
r
==
0
);
...
...
newbrt/tests/cachetable-simple-maybe-get-pin.c
View file @
19b7090f
...
@@ -7,39 +7,6 @@
...
@@ -7,39 +7,6 @@
// simple tests for maybe_get_and_pin(_clean)
// simple tests for maybe_get_and_pin(_clean)
//
//
static
void
flush
(
CACHEFILE
f
__attribute__
((
__unused__
)),
int
UU
(
fd
),
CACHEKEY
k
__attribute__
((
__unused__
)),
void
*
v
__attribute__
((
__unused__
)),
void
*
e
__attribute__
((
__unused__
)),
PAIR_ATTR
s
__attribute__
((
__unused__
)),
PAIR_ATTR
*
new_size
__attribute__
((
__unused__
)),
BOOL
w
__attribute__
((
__unused__
)),
BOOL
keep
__attribute__
((
__unused__
)),
BOOL
c
__attribute__
((
__unused__
))
)
{
/* Do nothing */
if
(
verbose
)
{
printf
(
"FLUSH: %d
\n
"
,
(
int
)
k
.
b
);
}
//usleep (5*1024*1024);
}
static
int
fetch
(
CACHEFILE
f
__attribute__
((
__unused__
)),
int
UU
(
fd
),
CACHEKEY
k
__attribute__
((
__unused__
)),
u_int32_t
fullhash
__attribute__
((
__unused__
)),
void
**
value
__attribute__
((
__unused__
)),
PAIR_ATTR
*
sizep
__attribute__
((
__unused__
)),
int
*
dirtyp
,
void
*
extraargs
__attribute__
((
__unused__
))
)
{
*
dirtyp
=
0
;
*
value
=
NULL
;
*
sizep
=
make_pair_attr
(
8
);
return
0
;
}
static
void
static
void
cachetable_test
(
void
)
{
cachetable_test
(
void
)
{
const
int
test_limit
=
12
;
const
int
test_limit
=
12
;
...
@@ -50,13 +17,14 @@ cachetable_test (void) {
...
@@ -50,13 +17,14 @@ cachetable_test (void) {
unlink
(
fname1
);
unlink
(
fname1
);
CACHEFILE
f1
;
CACHEFILE
f1
;
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
);
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
void
*
v1
;
void
*
v1
;
long
s1
;
long
s1
;
// nothing in cachetable, so this should fail
// nothing in cachetable, so this should fail
r
=
toku_cachetable_maybe_get_and_pin
(
f1
,
make_blocknum
(
1
),
1
,
&
v1
);
r
=
toku_cachetable_maybe_get_and_pin
(
f1
,
make_blocknum
(
1
),
1
,
&
v1
);
assert
(
r
==-
1
);
assert
(
r
==-
1
);
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
,
NULL
,
NULL
);
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
1
),
1
,
&
v1
,
&
s1
,
wc
,
def_fetch
,
def_pf_req_callback
,
def_pf_callback
,
NULL
);
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
1
),
1
,
CACHETABLE_CLEAN
,
make_pair_attr
(
8
));
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
1
),
1
,
CACHETABLE_CLEAN
,
make_pair_attr
(
8
));
// maybe_get_and_pin_clean should succeed, maybe_get_and_pin should fail
// maybe_get_and_pin_clean should succeed, maybe_get_and_pin should fail
...
...
newbrt/tests/cachetable-simple-pin-dep-nodes.c
View file @
19b7090f
...
@@ -77,8 +77,12 @@ cachetable_test (BOOL write_first, BOOL write_second, BOOL start_checkpoint) {
...
@@ -77,8 +77,12 @@ cachetable_test (BOOL write_first, BOOL write_second, BOOL start_checkpoint) {
long
s1
;
long
s1
;
long
s2
;
long
s2
;
long
s3
;
long
s3
;
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
,
&
val1
,
NULL
);
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
&
val1
);
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
,
&
val2
,
NULL
);
wc
.
flush_callback
=
flush
;
wc
.
write_extraargs
=
&
val1
;
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
1
),
1
,
&
v1
,
&
s1
,
wc
,
fetch
,
def_pf_req_callback
,
def_pf_callback
,
&
val1
);
wc
.
write_extraargs
=
&
val2
;
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
2
),
2
,
&
v2
,
&
s2
,
wc
,
fetch
,
def_pf_req_callback
,
def_pf_callback
,
&
val2
);
CACHEFILE
dependent_cfs
[
2
];
CACHEFILE
dependent_cfs
[
2
];
dependent_cfs
[
0
]
=
f1
;
dependent_cfs
[
0
]
=
f1
;
...
@@ -105,15 +109,15 @@ cachetable_test (BOOL write_first, BOOL write_second, BOOL start_checkpoint) {
...
@@ -105,15 +109,15 @@ cachetable_test (BOOL write_first, BOOL write_second, BOOL start_checkpoint) {
check_me
=
TRUE
;
check_me
=
TRUE
;
v1_written
=
FALSE
;
v1_written
=
FALSE
;
v2_written
=
FALSE
;
v2_written
=
FALSE
;
wc
.
write_extraargs
=
&
val3
;
r
=
toku_cachetable_get_and_pin_with_dep_pairs
(
r
=
toku_cachetable_get_and_pin_with_dep_pairs
(
f1
,
f1
,
make_blocknum
(
3
),
make_blocknum
(
3
),
3
,
3
,
&
v3
,
&
v3
,
&
s3
,
&
s3
,
flush
,
fetch
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner
_callback
,
wc
,
fetch
,
def_pf_req_callback
,
def_pf
_callback
,
&
val3
,
&
val3
,
NULL
,
2
,
//num_dependent_pairs
2
,
//num_dependent_pairs
dependent_cfs
,
dependent_cfs
,
dependent_keys
,
dependent_keys
,
...
...
newbrt/tests/cachetable-simple-pin-nonblocking.c
View file @
19b7090f
...
@@ -33,22 +33,6 @@ flush (CACHEFILE f __attribute__((__unused__)),
...
@@ -33,22 +33,6 @@ flush (CACHEFILE f __attribute__((__unused__)),
//usleep (5*1024*1024);
//usleep (5*1024*1024);
}
}
static
int
fetch
(
CACHEFILE
f
__attribute__
((
__unused__
)),
int
UU
(
fd
),
CACHEKEY
k
__attribute__
((
__unused__
)),
u_int32_t
fullhash
__attribute__
((
__unused__
)),
void
**
value
__attribute__
((
__unused__
)),
PAIR_ATTR
*
sizep
__attribute__
((
__unused__
)),
int
*
dirtyp
,
void
*
extraargs
__attribute__
((
__unused__
))
)
{
*
dirtyp
=
0
;
*
value
=
NULL
;
*
sizep
=
make_pair_attr
(
8
);
return
0
;
}
static
BOOL
true_def_pf_req_callback
(
void
*
UU
(
brtnode_pv
),
void
*
UU
(
read_extraargs
))
{
static
BOOL
true_def_pf_req_callback
(
void
*
UU
(
brtnode_pv
),
void
*
UU
(
read_extraargs
))
{
return
TRUE
;
return
TRUE
;
}
}
...
@@ -94,38 +78,40 @@ run_test (void) {
...
@@ -94,38 +78,40 @@ run_test (void) {
void
*
v1
;
void
*
v1
;
long
s1
;
long
s1
;
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
wc
.
flush_callback
=
flush
;
//
//
// test that if we are getting a PAIR for the first time that TOKUDB_TRY_AGAIN is returned
// test that if we are getting a PAIR for the first time that TOKUDB_TRY_AGAIN is returned
// because the PAIR was not in the cachetable.
// because the PAIR was not in the cachetable.
//
//
is_fake_locked
=
TRUE
;
is_fake_locked
=
TRUE
;
r
=
toku_cachetable_get_and_pin_nonblocking
(
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
,
NULL
,
NULL
,
NULL
);
r
=
toku_cachetable_get_and_pin_nonblocking
(
f1
,
make_blocknum
(
1
),
1
,
&
v1
,
&
s1
,
wc
,
def_fetch
,
def_pf_req_callback
,
def_pf_callback
,
NULL
,
NULL
);
assert
(
r
==
TOKUDB_TRY_AGAIN
);
assert
(
r
==
TOKUDB_TRY_AGAIN
);
assert
(
is_fake_locked
);
assert
(
is_fake_locked
);
// now it should succeed
// now it should succeed
r
=
toku_cachetable_get_and_pin_nonblocking
(
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
,
NULL
,
NULL
,
NULL
);
r
=
toku_cachetable_get_and_pin_nonblocking
(
f1
,
make_blocknum
(
1
),
1
,
&
v1
,
&
s1
,
wc
,
def_fetch
,
def_pf_req_callback
,
def_pf_callback
,
NULL
,
NULL
);
assert
(
r
==
0
);
assert
(
r
==
0
);
assert
(
is_fake_locked
);
assert
(
is_fake_locked
);
foo
=
FALSE
;
foo
=
FALSE
;
cachefile_kibbutz_enq
(
f1
,
kibbutz_work
,
f1
);
cachefile_kibbutz_enq
(
f1
,
kibbutz_work
,
f1
);
// because node is in use, should return TOKUDB_TRY_AGAIN
// because node is in use, should return TOKUDB_TRY_AGAIN
assert
(
is_fake_locked
);
assert
(
is_fake_locked
);
r
=
toku_cachetable_get_and_pin_nonblocking
(
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
,
NULL
,
NULL
,
NULL
);
r
=
toku_cachetable_get_and_pin_nonblocking
(
f1
,
make_blocknum
(
1
),
1
,
&
v1
,
&
s1
,
wc
,
def_fetch
,
def_pf_req_callback
,
def_pf_callback
,
NULL
,
NULL
);
assert
(
is_fake_locked
);
assert
(
is_fake_locked
);
assert
(
r
==
TOKUDB_TRY_AGAIN
);
assert
(
r
==
TOKUDB_TRY_AGAIN
);
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
,
NULL
,
NULL
);
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
1
),
1
,
&
v1
,
&
s1
,
wc
,
def_fetch
,
def_pf_req_callback
,
def_pf_callback
,
NULL
);
assert
(
foo
);
assert
(
foo
);
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
1
),
1
,
CACHETABLE_CLEAN
,
make_pair_attr
(
8
));
assert
(
r
==
0
);
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
1
),
1
,
CACHETABLE_CLEAN
,
make_pair_attr
(
8
));
assert
(
r
==
0
);
// now make sure we get TOKUDB_TRY_AGAIN when a partial fetch is involved
// now make sure we get TOKUDB_TRY_AGAIN when a partial fetch is involved
assert
(
is_fake_locked
);
assert
(
is_fake_locked
);
// first make sure value is there
// first make sure value is there
r
=
toku_cachetable_get_and_pin_nonblocking
(
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
,
NULL
,
NULL
,
NULL
);
r
=
toku_cachetable_get_and_pin_nonblocking
(
f1
,
make_blocknum
(
1
),
1
,
&
v1
,
&
s1
,
wc
,
def_fetch
,
def_pf_req_callback
,
def_pf_callback
,
NULL
,
NULL
);
assert
(
is_fake_locked
);
assert
(
is_fake_locked
);
assert
(
r
==
0
);
assert
(
r
==
0
);
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
1
),
1
,
CACHETABLE_CLEAN
,
make_pair_attr
(
8
));
assert
(
r
==
0
);
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
1
),
1
,
CACHETABLE_CLEAN
,
make_pair_attr
(
8
));
assert
(
r
==
0
);
// now make sure that we get TOKUDB_TRY_AGAIN for the partial fetch
// now make sure that we get TOKUDB_TRY_AGAIN for the partial fetch
r
=
toku_cachetable_get_and_pin_nonblocking
(
f1
,
make_blocknum
(
1
),
1
,
&
v1
,
&
s1
,
flush
,
fetch
,
def_pe_est_callback
,
def_pe_callback
,
true_def_pf_req_callback
,
true_def_pf_callback
,
def_cleaner_callback
,
NULL
,
NULL
,
NULL
);
r
=
toku_cachetable_get_and_pin_nonblocking
(
f1
,
make_blocknum
(
1
),
1
,
&
v1
,
&
s1
,
wc
,
def_fetch
,
true_def_pf_req_callback
,
true_def_pf_callback
,
NULL
,
NULL
);
assert
(
is_fake_locked
);
assert
(
is_fake_locked
);
assert
(
r
==
TOKUDB_TRY_AGAIN
);
assert
(
r
==
TOKUDB_TRY_AGAIN
);
...
@@ -133,13 +119,13 @@ run_test (void) {
...
@@ -133,13 +119,13 @@ run_test (void) {
// now test that if there is a checkpoint pending,
// now test that if there is a checkpoint pending,
// first pin and unpin with dirty
// first pin and unpin with dirty
//
//
r
=
toku_cachetable_get_and_pin_nonblocking
(
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
,
NULL
,
NULL
,
NULL
);
r
=
toku_cachetable_get_and_pin_nonblocking
(
f1
,
make_blocknum
(
1
),
1
,
&
v1
,
&
s1
,
wc
,
def_fetch
,
def_pf_req_callback
,
def_pf_callback
,
NULL
,
NULL
);
assert
(
is_fake_locked
);
assert
(
is_fake_locked
);
assert
(
r
==
0
);
assert
(
r
==
0
);
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
1
),
1
,
CACHETABLE_DIRTY
,
make_pair_attr
(
8
));
assert
(
r
==
0
);
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
1
),
1
,
CACHETABLE_DIRTY
,
make_pair_attr
(
8
));
assert
(
r
==
0
);
// this should mark the PAIR as pending
// this should mark the PAIR as pending
r
=
toku_cachetable_begin_checkpoint
(
ct
,
NULL
);
assert
(
r
==
0
);
r
=
toku_cachetable_begin_checkpoint
(
ct
,
NULL
);
assert
(
r
==
0
);
r
=
toku_cachetable_get_and_pin_nonblocking
(
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
,
NULL
,
NULL
,
NULL
);
r
=
toku_cachetable_get_and_pin_nonblocking
(
f1
,
make_blocknum
(
1
),
1
,
&
v1
,
&
s1
,
wc
,
def_fetch
,
def_pf_req_callback
,
def_pf_callback
,
NULL
,
NULL
);
assert
(
is_fake_locked
);
assert
(
is_fake_locked
);
assert
(
r
==
TOKUDB_TRY_AGAIN
);
assert
(
r
==
TOKUDB_TRY_AGAIN
);
my_ydb_unlock
();
my_ydb_unlock
();
...
...
newbrt/tests/cachetable-simple-pin.c
View file @
19b7090f
...
@@ -34,22 +34,6 @@ flush (CACHEFILE f __attribute__((__unused__)),
...
@@ -34,22 +34,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__
)),
PAIR_ATTR
*
sizep
__attribute__
((
__unused__
)),
int
*
dirtyp
,
void
*
extraargs
__attribute__
((
__unused__
))
)
{
*
dirtyp
=
0
;
*
value
=
NULL
;
*
sizep
=
make_pair_attr
(
8
);
return
0
;
}
static
void
kibbutz_work
(
void
*
fe_v
)
static
void
kibbutz_work
(
void
*
fe_v
)
{
{
CACHEFILE
f1
=
fe_v
;
CACHEFILE
f1
=
fe_v
;
...
@@ -75,16 +59,18 @@ run_test (void) {
...
@@ -75,16 +59,18 @@ run_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
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
NULL
,
NULL
);
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
wc
.
flush_callback
=
flush
;
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
1
),
1
,
&
v1
,
&
s1
,
wc
,
def_fetch
,
def_pf_req_callback
,
def_pf_callback
,
NULL
);
foo
=
FALSE
;
foo
=
FALSE
;
cachefile_kibbutz_enq
(
f1
,
kibbutz_work
,
f1
);
cachefile_kibbutz_enq
(
f1
,
kibbutz_work
,
f1
);
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
,
NULL
,
NULL
);
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
1
),
1
,
&
v1
,
&
s1
,
wc
,
def_fetch
,
def_pf_req_callback
,
def_pf_callback
,
NULL
);
assert
(
foo
);
assert
(
foo
);
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
1
),
1
,
CACHETABLE_CLEAN
,
make_pair_attr
(
8
));
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
1
),
1
,
CACHETABLE_CLEAN
,
make_pair_attr
(
8
));
//now let's do a simple checkpoint test
//now let's do a simple checkpoint test
// first dirty the PAIR
// first dirty the PAIR
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
,
NULL
,
NULL
);
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
1
),
1
,
&
v1
,
&
s1
,
wc
,
def_fetch
,
def_pf_req_callback
,
def_pf_callback
,
NULL
);
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
1
),
1
,
CACHETABLE_DIRTY
,
make_pair_attr
(
8
));
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
1
),
1
,
CACHETABLE_DIRTY
,
make_pair_attr
(
8
));
// now this should mark the pair for checkpoint
// now this should mark the pair for checkpoint
...
@@ -95,7 +81,7 @@ run_test (void) {
...
@@ -95,7 +81,7 @@ run_test (void) {
//
//
check_me
=
TRUE
;
check_me
=
TRUE
;
flush_called
=
FALSE
;
flush_called
=
FALSE
;
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
,
NULL
,
NULL
);
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
1
),
1
,
&
v1
,
&
s1
,
wc
,
def_fetch
,
def_pf_req_callback
,
def_pf_callback
,
NULL
);
assert
(
flush_called
);
assert
(
flush_called
);
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
1
),
1
,
CACHETABLE_CLEAN
,
make_pair_attr
(
8
));
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
1
),
1
,
CACHETABLE_CLEAN
,
make_pair_attr
(
8
));
...
...
newbrt/tests/cachetable-simple-put-dep-nodes.c
View file @
19b7090f
...
@@ -82,9 +82,11 @@ cachetable_test (BOOL write_first, BOOL write_second, BOOL start_checkpoint) {
...
@@ -82,9 +82,11 @@ cachetable_test (BOOL write_first, BOOL write_second, BOOL start_checkpoint) {
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
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
&
val1
,
NULL
);
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
wc
.
flush_callback
=
flush
;
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
1
),
1
,
&
v1
,
&
s1
,
wc
,
fetch
,
def_pf_req_callback
,
def_pf_callback
,
&
val1
);
assert
(
r
==
0
);
assert
(
r
==
0
);
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
,
&
val2
,
NULL
);
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
2
),
2
,
&
v2
,
&
s2
,
wc
,
fetch
,
def_pf_req_callback
,
def_pf_callback
,
&
val2
);
assert
(
r
==
0
);
assert
(
r
==
0
);
CACHEFILE
dependent_cfs
[
2
];
CACHEFILE
dependent_cfs
[
2
];
...
@@ -120,11 +122,7 @@ cachetable_test (BOOL write_first, BOOL write_second, BOOL start_checkpoint) {
...
@@ -120,11 +122,7 @@ cachetable_test (BOOL write_first, BOOL write_second, BOOL start_checkpoint) {
get_key_and_fullhash
,
get_key_and_fullhash
,
&
val3
,
&
val3
,
make_pair_attr
(
8
),
make_pair_attr
(
8
),
flush
,
wc
,
def_pe_est_callback
,
def_pe_callback
,
def_cleaner_callback
,
NULL
,
NULL
,
NULL
,
2
,
//num_dependent_pairs
2
,
//num_dependent_pairs
dependent_cfs
,
dependent_cfs
,
...
...
newbrt/tests/cachetable-simple-unpin-remove-checkpoint.c
View file @
19b7090f
...
@@ -3,39 +3,6 @@
...
@@ -3,39 +3,6 @@
#include "includes.h"
#include "includes.h"
#include "test.h"
#include "test.h"
static
void
flush
(
CACHEFILE
f
__attribute__
((
__unused__
)),
int
UU
(
fd
),
CACHEKEY
k
__attribute__
((
__unused__
)),
void
*
v
__attribute__
((
__unused__
)),
void
*
e
__attribute__
((
__unused__
)),
PAIR_ATTR
s
__attribute__
((
__unused__
)),
PAIR_ATTR
*
new_size
__attribute__
((
__unused__
)),
BOOL
w
__attribute__
((
__unused__
)),
BOOL
keep
__attribute__
((
__unused__
)),
BOOL
c
__attribute__
((
__unused__
))
)
{
/* Do nothing */
if
(
verbose
)
{
printf
(
"FLUSH: %d
\n
"
,
(
int
)
k
.
b
);
}
//usleep (5*1024*1024);
}
static
int
fetch
(
CACHEFILE
f
__attribute__
((
__unused__
)),
int
UU
(
fd
),
CACHEKEY
k
__attribute__
((
__unused__
)),
u_int32_t
fullhash
__attribute__
((
__unused__
)),
void
**
value
__attribute__
((
__unused__
)),
PAIR_ATTR
*
sizep
__attribute__
((
__unused__
)),
int
*
dirtyp
,
void
*
extraargs
__attribute__
((
__unused__
))
)
{
*
dirtyp
=
0
;
*
value
=
NULL
;
*
sizep
=
make_pair_attr
(
8
);
return
0
;
}
static
void
remove_key_expect_checkpoint
(
static
void
remove_key_expect_checkpoint
(
CACHEKEY
*
UU
(
cachekey
),
CACHEKEY
*
UU
(
cachekey
),
BOOL
for_checkpoint
,
BOOL
for_checkpoint
,
...
@@ -69,7 +36,8 @@ cachetable_test (void) {
...
@@ -69,7 +36,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
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
NULL
,
NULL
);
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
1
),
1
,
&
v1
,
&
s1
,
wc
,
def_fetch
,
def_pf_req_callback
,
def_pf_callback
,
NULL
);
r
=
toku_cachetable_begin_checkpoint
(
ct
,
NULL
);
assert
(
r
==
0
);
r
=
toku_cachetable_begin_checkpoint
(
ct
,
NULL
);
assert
(
r
==
0
);
r
=
toku_cachetable_unpin_and_remove
(
f1
,
make_blocknum
(
1
),
remove_key_expect_checkpoint
,
NULL
);
r
=
toku_cachetable_unpin_and_remove
(
f1
,
make_blocknum
(
1
),
remove_key_expect_checkpoint
,
NULL
);
r
=
toku_cachetable_end_checkpoint
(
r
=
toku_cachetable_end_checkpoint
(
...
@@ -82,7 +50,7 @@ cachetable_test (void) {
...
@@ -82,7 +50,7 @@ cachetable_test (void) {
);
);
assert
(
r
==
0
);
assert
(
r
==
0
);
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
,
NULL
,
NULL
);
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
1
),
1
,
&
v1
,
&
s1
,
wc
,
def_fetch
,
def_pf_req_callback
,
def_pf_callback
,
NULL
);
r
=
toku_cachetable_unpin_and_remove
(
f1
,
make_blocknum
(
1
),
remove_key_expect_no_checkpoint
,
NULL
);
r
=
toku_cachetable_unpin_and_remove
(
f1
,
make_blocknum
(
1
),
remove_key_expect_no_checkpoint
,
NULL
);
...
...
newbrt/tests/cachetable-simple-verify.c
View file @
19b7090f
...
@@ -3,39 +3,6 @@
...
@@ -3,39 +3,6 @@
#include "includes.h"
#include "includes.h"
#include "test.h"
#include "test.h"
static
void
flush
(
CACHEFILE
f
__attribute__
((
__unused__
)),
int
UU
(
fd
),
CACHEKEY
k
__attribute__
((
__unused__
)),
void
*
v
__attribute__
((
__unused__
)),
void
*
e
__attribute__
((
__unused__
)),
PAIR_ATTR
s
__attribute__
((
__unused__
)),
PAIR_ATTR
*
new_size
__attribute__
((
__unused__
)),
BOOL
w
__attribute__
((
__unused__
)),
BOOL
keep
__attribute__
((
__unused__
)),
BOOL
c
__attribute__
((
__unused__
))
)
{
/* Do nothing */
if
(
verbose
)
{
printf
(
"FLUSH: %d
\n
"
,
(
int
)
k
.
b
);
}
//usleep (5*1024*1024);
}
static
int
fetch
(
CACHEFILE
f
__attribute__
((
__unused__
)),
int
UU
(
fd
),
CACHEKEY
k
__attribute__
((
__unused__
)),
u_int32_t
fullhash
__attribute__
((
__unused__
)),
void
**
value
__attribute__
((
__unused__
)),
PAIR_ATTR
*
sizep
__attribute__
((
__unused__
)),
int
*
dirtyp
,
void
*
extraargs
__attribute__
((
__unused__
))
)
{
*
dirtyp
=
0
;
*
value
=
NULL
;
*
sizep
=
make_pair_attr
(
8
);
return
0
;
}
static
void
static
void
cachetable_test
(
void
)
{
cachetable_test
(
void
)
{
const
int
test_limit
=
12
;
const
int
test_limit
=
12
;
...
@@ -51,7 +18,8 @@ cachetable_test (void) {
...
@@ -51,7 +18,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
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
NULL
,
NULL
);
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
1
),
1
,
&
v1
,
&
s1
,
wc
,
def_fetch
,
def_pf_req_callback
,
def_pf_callback
,
NULL
);
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
1
),
1
,
CACHETABLE_DIRTY
,
make_pair_attr
(
8
));
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
1
),
1
,
CACHETABLE_DIRTY
,
make_pair_attr
(
8
));
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
);
...
...
newbrt/tests/cachetable-test.c
View file @
19b7090f
...
@@ -176,28 +176,30 @@ static void test0 (void) {
...
@@ -176,28 +176,30 @@ static void test0 (void) {
u_int32_t
h5
=
toku_cachetable_hash
(
f
,
make_blocknum
(
5
));
u_int32_t
h5
=
toku_cachetable_hash
(
f
,
make_blocknum
(
5
));
u_int32_t
h6
=
toku_cachetable_hash
(
f
,
make_blocknum
(
6
));
u_int32_t
h6
=
toku_cachetable_hash
(
f
,
make_blocknum
(
6
));
u_int32_t
h7
=
toku_cachetable_hash
(
f
,
make_blocknum
(
7
));
u_int32_t
h7
=
toku_cachetable_hash
(
f
,
make_blocknum
(
7
));
r
=
toku_cachetable_put
(
f
,
make_blocknum
(
1
),
h1
,
make_item
(
1
),
make_pair_attr
(
test_object_size
),
flush
,
def_pe_est_callback
,
def_pe_callback
,
def_cleaner_callback
,
t3
);
/* 1P */
/* this is the lru list. 1 is pinned. */
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
t3
);
wc
.
flush_callback
=
flush
;
r
=
toku_cachetable_put
(
f
,
make_blocknum
(
1
),
h1
,
make_item
(
1
),
make_pair_attr
(
test_object_size
),
wc
);
/* 1P */
/* this is the lru list. 1 is pinned. */
assert
(
r
==
0
);
assert
(
r
==
0
);
assert
(
expect_n_flushes
==
0
);
assert
(
expect_n_flushes
==
0
);
expect_init
();
expect_init
();
r
=
toku_cachetable_put
(
f
,
make_blocknum
(
2
),
h2
,
make_item
(
2
),
make_pair_attr
(
test_object_size
),
flush
,
def_pe_est_callback
,
def_pe_callback
,
def_cleaner_callback
,
t3
);
r
=
toku_cachetable_put
(
f
,
make_blocknum
(
2
),
h2
,
make_item
(
2
),
make_pair_attr
(
test_object_size
),
wc
);
assert
(
r
==
0
);
assert
(
r
==
0
);
r
=
toku_cachetable_unpin
(
f
,
make_blocknum
(
2
),
h2
,
CACHETABLE_DIRTY
,
make_pair_attr
(
1
));
/* 2U 1P */
r
=
toku_cachetable_unpin
(
f
,
make_blocknum
(
2
),
h2
,
CACHETABLE_DIRTY
,
make_pair_attr
(
1
));
/* 2U 1P */
assert
(
expect_n_flushes
==
0
);
assert
(
expect_n_flushes
==
0
);
expect_init
();
expect_init
();
r
=
toku_cachetable_put
(
f
,
make_blocknum
(
3
),
h3
,
make_item
(
3
),
make_pair_attr
(
test_object_size
),
flush
,
def_pe_est_callback
,
def_pe_callback
,
def_cleaner_callback
,
t3
);
r
=
toku_cachetable_put
(
f
,
make_blocknum
(
3
),
h3
,
make_item
(
3
),
make_pair_attr
(
test_object_size
),
wc
);
assert
(
r
==
0
);
assert
(
r
==
0
);
assert
(
expect_n_flushes
==
0
);
/* 3P 2U 1P */
/* 3 is most recently used (pinned), 2 is next (unpinned), 1 is least recent (pinned) */
assert
(
expect_n_flushes
==
0
);
/* 3P 2U 1P */
/* 3 is most recently used (pinned), 2 is next (unpinned), 1 is least recent (pinned) */
expect_init
();
expect_init
();
r
=
toku_cachetable_put
(
f
,
make_blocknum
(
4
),
h4
,
make_item
(
4
),
make_pair_attr
(
test_object_size
),
flush
,
def_pe_est_callback
,
def_pe_callback
,
def_cleaner_callback
,
t3
);
r
=
toku_cachetable_put
(
f
,
make_blocknum
(
4
),
h4
,
make_item
(
4
),
make_pair_attr
(
test_object_size
),
wc
);
assert
(
r
==
0
);
assert
(
r
==
0
);
assert
(
expect_n_flushes
==
0
);
/* 4P 3P 2U 1P */
assert
(
expect_n_flushes
==
0
);
/* 4P 3P 2U 1P */
expect_init
();
expect_init
();
r
=
toku_cachetable_put
(
f
,
make_blocknum
(
5
),
h5
,
make_item
(
5
),
make_pair_attr
(
test_object_size
),
flush
,
def_pe_est_callback
,
def_pe_callback
,
def_cleaner_callback
,
t3
);
r
=
toku_cachetable_put
(
f
,
make_blocknum
(
5
),
h5
,
make_item
(
5
),
make_pair_attr
(
test_object_size
),
wc
);
assert
(
r
==
0
);
assert
(
r
==
0
);
r
=
toku_cachetable_unpin
(
f
,
make_blocknum
(
5
),
h5
,
CACHETABLE_DIRTY
,
make_pair_attr
(
test_object_size
));
r
=
toku_cachetable_unpin
(
f
,
make_blocknum
(
5
),
h5
,
CACHETABLE_DIRTY
,
make_pair_attr
(
test_object_size
));
assert
(
r
==
0
);
assert
(
r
==
0
);
...
@@ -206,7 +208,7 @@ static void test0 (void) {
...
@@ -206,7 +208,7 @@ static void test0 (void) {
assert
(
expect_n_flushes
==
0
);
/* 5U 4P 3U 2U 1P */
assert
(
expect_n_flushes
==
0
);
/* 5U 4P 3U 2U 1P */
expect1
(
2
);
/* 2 is the oldest unpinned item. */
expect1
(
2
);
/* 2 is the oldest unpinned item. */
r
=
toku_cachetable_put
(
f
,
make_blocknum
(
6
),
h6
,
make_item
(
6
),
make_pair_attr
(
test_object_size
),
flush
,
def_pe_est_callback
,
def_pe_callback
,
def_cleaner_callback
,
t3
);
/* 6P 5U 4P 3U 1P */
r
=
toku_cachetable_put
(
f
,
make_blocknum
(
6
),
h6
,
make_item
(
6
),
make_pair_attr
(
test_object_size
),
wc
);
/* 6P 5U 4P 3U 1P */
assert
(
r
==
0
);
assert
(
r
==
0
);
test_mutex_lock
();
test_mutex_lock
();
while
(
expect_n_flushes
!=
0
)
{
while
(
expect_n_flushes
!=
0
)
{
...
@@ -216,7 +218,7 @@ static void test0 (void) {
...
@@ -216,7 +218,7 @@ static void test0 (void) {
test_mutex_unlock
();
test_mutex_unlock
();
expect1
(
3
);
expect1
(
3
);
r
=
toku_cachetable_put
(
f
,
make_blocknum
(
7
),
h7
,
make_item
(
7
),
make_pair_attr
(
test_object_size
),
flush
,
def_pe_est_callback
,
def_pe_callback
,
def_cleaner_callback
,
t3
);
r
=
toku_cachetable_put
(
f
,
make_blocknum
(
7
),
h7
,
make_item
(
7
),
make_pair_attr
(
test_object_size
),
wc
);
assert
(
r
==
0
);
assert
(
r
==
0
);
test_mutex_lock
();
test_mutex_lock
();
while
(
expect_n_flushes
!=
0
)
{
while
(
expect_n_flushes
!=
0
)
{
...
@@ -230,7 +232,7 @@ static void test0 (void) {
...
@@ -230,7 +232,7 @@ static void test0 (void) {
{
{
void
*
item_v
=
0
;
void
*
item_v
=
0
;
expect_init
();
expect_init
();
r
=
toku_cachetable_get_and_pin
(
f
,
make_blocknum
(
5
),
toku_cachetable_hash
(
f
,
make_blocknum
(
5
)),
&
item_v
,
NULL
,
flush
,
fetch
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
t3
,
t3
);
/* 5P 7U 6P 4P 1P */
r
=
toku_cachetable_get_and_pin
(
f
,
make_blocknum
(
5
),
toku_cachetable_hash
(
f
,
make_blocknum
(
5
)),
&
item_v
,
NULL
,
wc
,
fetch
,
def_pf_req_callback
,
def_pf_callback
,
t3
);
/* 5P 7U 6P 4P 1P */
assert
(
r
==
0
);
assert
(
r
==
0
);
assert
(((
struct
item
*
)
item_v
)
->
key
.
b
==
5
);
assert
(((
struct
item
*
)
item_v
)
->
key
.
b
==
5
);
assert
(
strcmp
(((
struct
item
*
)
item_v
)
->
something
,
"something"
)
==
0
);
assert
(
strcmp
(((
struct
item
*
)
item_v
)
->
something
,
"something"
)
==
0
);
...
@@ -245,7 +247,9 @@ static void test0 (void) {
...
@@ -245,7 +247,9 @@ static void test0 (void) {
assert
(
r
==
0
);
assert
(
r
==
0
);
expect1
(
4
);
expect1
(
4
);
did_fetch
=
make_blocknum
(
-
1
);
did_fetch
=
make_blocknum
(
-
1
);
r
=
toku_cachetable_get_and_pin
(
f
,
make_blocknum
(
2
),
toku_cachetable_hash
(
f
,
make_blocknum
(
2
)),
&
item_v
,
NULL
,
flush
,
fetch
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
t3
,
t3
);
/* 2p 5P 7U 6P 1P */
CACHETABLE_WRITE_CALLBACK
wc2
=
def_write_callback
(
t3
);
wc2
.
flush_callback
=
flush
;
r
=
toku_cachetable_get_and_pin
(
f
,
make_blocknum
(
2
),
toku_cachetable_hash
(
f
,
make_blocknum
(
2
)),
&
item_v
,
NULL
,
wc2
,
fetch
,
def_pf_req_callback
,
def_pf_callback
,
t3
);
/* 2p 5P 7U 6P 1P */
assert
(
r
==
0
);
assert
(
r
==
0
);
assert
(
did_fetch
.
b
==
2
);
/* Expect that 2 is fetched in. */
assert
(
did_fetch
.
b
==
2
);
/* Expect that 2 is fetched in. */
assert
(((
struct
item
*
)
item_v
)
->
key
.
b
==
2
);
assert
(((
struct
item
*
)
item_v
)
->
key
.
b
==
2
);
...
@@ -324,10 +328,12 @@ static void test_nested_pin (void) {
...
@@ -324,10 +328,12 @@ static void test_nested_pin (void) {
i0
=
0
;
i1
=
0
;
i0
=
0
;
i1
=
0
;
u_int32_t
f1hash
=
toku_cachetable_hash
(
f
,
make_blocknum
(
1
));
u_int32_t
f1hash
=
toku_cachetable_hash
(
f
,
make_blocknum
(
1
));
r
=
toku_cachetable_put
(
f
,
make_blocknum
(
1
),
f1hash
,
&
i0
,
make_pair_attr
(
1
),
flush_n
,
def_pe_est_callback
,
def_pe_callback
,
def_cleaner_callback
,
f2
);
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
f2
);
wc
.
flush_callback
=
flush_n
;
r
=
toku_cachetable_put
(
f
,
make_blocknum
(
1
),
f1hash
,
&
i0
,
make_pair_attr
(
1
),
wc
);
assert
(
r
==
0
);
assert
(
r
==
0
);
r
=
toku_cachetable_unpin
(
f
,
make_blocknum
(
1
),
f1hash
,
CACHETABLE_CLEAN
,
make_pair_attr
(
test_object_size
));
r
=
toku_cachetable_unpin
(
f
,
make_blocknum
(
1
),
f1hash
,
CACHETABLE_CLEAN
,
make_pair_attr
(
test_object_size
));
r
=
toku_cachetable_get_and_pin
(
f
,
make_blocknum
(
1
),
f1hash
,
&
vv
,
NULL
,
flush_n
,
fetch_n
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
f2
,
f2
);
r
=
toku_cachetable_get_and_pin
(
f
,
make_blocknum
(
1
),
f1hash
,
&
vv
,
NULL
,
wc
,
fetch_n
,
def_pf_req_callback
,
def_pf_callback
,
f2
);
assert
(
r
==
0
);
assert
(
r
==
0
);
assert
(
vv
==&
i0
);
assert
(
vv
==&
i0
);
assert
(
i0
==
0
);
assert
(
i0
==
0
);
...
@@ -339,7 +345,7 @@ static void test_nested_pin (void) {
...
@@ -339,7 +345,7 @@ static void test_nested_pin (void) {
r
=
toku_cachetable_unpin
(
f
,
make_blocknum
(
1
),
f1hash
,
CACHETABLE_CLEAN
,
make_pair_attr
(
test_object_size
));
r
=
toku_cachetable_unpin
(
f
,
make_blocknum
(
1
),
f1hash
,
CACHETABLE_CLEAN
,
make_pair_attr
(
test_object_size
));
assert
(
r
==
0
);
assert
(
r
==
0
);
u_int32_t
f2hash
=
toku_cachetable_hash
(
f
,
make_blocknum
(
2
));
u_int32_t
f2hash
=
toku_cachetable_hash
(
f
,
make_blocknum
(
2
));
r
=
toku_cachetable_put
(
f
,
make_blocknum
(
2
),
f2hash
,
&
i1
,
make_pair_attr
(
test_object_size
),
flush_n
,
def_pe_est_callback
,
def_pe_callback
,
def_cleaner_callback
,
f2
);
r
=
toku_cachetable_put
(
f
,
make_blocknum
(
2
),
f2hash
,
&
i1
,
make_pair_attr
(
test_object_size
),
wc
);
assert
(
r
==
0
);
// The other one is pinned, but now the cachetable fails gracefully: It allows the pin to happen
assert
(
r
==
0
);
// The other one is pinned, but now the cachetable fails gracefully: It allows the pin to happen
r
=
toku_cachetable_unpin
(
f
,
make_blocknum
(
2
),
f2hash
,
CACHETABLE_CLEAN
,
make_pair_attr
(
test_object_size
));
r
=
toku_cachetable_unpin
(
f
,
make_blocknum
(
2
),
f2hash
,
CACHETABLE_CLEAN
,
make_pair_attr
(
test_object_size
));
assert
(
r
==
0
);
assert
(
r
==
0
);
...
@@ -401,13 +407,16 @@ static void test_multi_filehandles (void) {
...
@@ -401,13 +407,16 @@ static void test_multi_filehandles (void) {
assert
(
f1
==
f2
);
assert
(
f1
==
f2
);
assert
(
f1
!=
f3
);
assert
(
f1
!=
f3
);
r
=
toku_cachetable_put
(
f1
,
make_blocknum
(
1
),
toku_cachetable_hash
(
f1
,
make_blocknum
(
1
)),
(
void
*
)
124
,
make_pair_attr
(
test_object_size
),
null_flush
,
def_pe_est_callback
,
def_pe_callback
,
def_cleaner_callback
,
(
void
*
)
123
);
assert
(
r
==
0
);
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
((
void
*
)
123
);
wc
.
flush_callback
=
null_flush
;
r
=
toku_cachetable_put
(
f1
,
make_blocknum
(
1
),
toku_cachetable_hash
(
f1
,
make_blocknum
(
1
)),
(
void
*
)
124
,
make_pair_attr
(
test_object_size
),
wc
);
assert
(
r
==
0
);
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
1
),
toku_cachetable_hash
(
f1
,
make_blocknum
(
1
)),
CACHETABLE_DIRTY
,
make_pair_attr
(
0
));
assert
(
r
==
0
);
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
1
),
toku_cachetable_hash
(
f1
,
make_blocknum
(
1
)),
CACHETABLE_DIRTY
,
make_pair_attr
(
0
));
assert
(
r
==
0
);
r
=
toku_cachetable_get_and_pin
(
f2
,
make_blocknum
(
1
),
toku_cachetable_hash
(
f2
,
make_blocknum
(
1
)),
&
v
,
NULL
,
null_flush
,
add123_fetch
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
(
void
*
)
123
,
(
void
*
)
123
);
assert
(
r
==
0
);
r
=
toku_cachetable_get_and_pin
(
f2
,
make_blocknum
(
1
),
toku_cachetable_hash
(
f2
,
make_blocknum
(
1
)),
&
v
,
NULL
,
wc
,
add123_fetch
,
def_pf_req_callback
,
def_pf_callback
,
(
void
*
)
123
);
assert
(
r
==
0
);
assert
((
unsigned
long
)
v
==
124
);
assert
((
unsigned
long
)
v
==
124
);
r
=
toku_cachetable_get_and_pin
(
f2
,
make_blocknum
(
2
),
toku_cachetable_hash
(
f2
,
make_blocknum
(
2
)),
&
v
,
NULL
,
null_flush
,
add123_fetch
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
(
void
*
)
123
,
(
void
*
)
123
);
assert
(
r
==
0
);
r
=
toku_cachetable_get_and_pin
(
f2
,
make_blocknum
(
2
),
toku_cachetable_hash
(
f2
,
make_blocknum
(
2
)),
&
v
,
NULL
,
wc
,
add123_fetch
,
def_pf_req_callback
,
def_pf_callback
,
(
void
*
)
123
);
assert
(
r
==
0
);
assert
((
unsigned
long
)
v
==
125
);
assert
((
unsigned
long
)
v
==
125
);
r
=
toku_cachetable_get_and_pin
(
f3
,
make_blocknum
(
2
),
toku_cachetable_hash
(
f3
,
make_blocknum
(
2
)),
&
v
,
NULL
,
null_flush
,
add222_fetch
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
(
void
*
)
222
,
(
void
*
)
222
);
assert
(
r
==
0
);
wc
.
write_extraargs
=
(
void
*
)
222
;
r
=
toku_cachetable_get_and_pin
(
f3
,
make_blocknum
(
2
),
toku_cachetable_hash
(
f3
,
make_blocknum
(
2
)),
&
v
,
NULL
,
wc
,
add222_fetch
,
def_pf_req_callback
,
def_pf_callback
,
(
void
*
)
222
);
assert
(
r
==
0
);
assert
((
unsigned
long
)
v
==
224
);
assert
((
unsigned
long
)
v
==
224
);
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
1
),
toku_cachetable_hash
(
f1
,
make_blocknum
(
1
)),
CACHETABLE_CLEAN
,
make_pair_attr
(
0
));
assert
(
r
==
0
);
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
1
),
toku_cachetable_hash
(
f1
,
make_blocknum
(
1
)),
CACHETABLE_CLEAN
,
make_pair_attr
(
0
));
assert
(
r
==
0
);
...
@@ -467,7 +476,9 @@ static void test_dirty(void) {
...
@@ -467,7 +476,9 @@ static void test_dirty(void) {
key
=
make_blocknum
(
1
);
value
=
(
void
*
)
1
;
key
=
make_blocknum
(
1
);
value
=
(
void
*
)
1
;
u_int32_t
hkey
=
toku_cachetable_hash
(
f
,
key
);
u_int32_t
hkey
=
toku_cachetable_hash
(
f
,
key
);
r
=
toku_cachetable_put
(
f
,
key
,
hkey
,
value
,
make_pair_attr
(
test_object_size
),
test_dirty_flush
,
def_pe_est_callback
,
def_pe_callback
,
def_cleaner_callback
,
0
);
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
wc
.
flush_callback
=
test_dirty_flush
;
r
=
toku_cachetable_put
(
f
,
key
,
hkey
,
value
,
make_pair_attr
(
test_object_size
),
wc
);
assert
(
r
==
0
);
assert
(
r
==
0
);
// cachetable_print_state(t);
// cachetable_print_state(t);
...
@@ -483,8 +494,8 @@ static void test_dirty(void) {
...
@@ -483,8 +494,8 @@ static void test_dirty(void) {
assert
(
dirty
==
1
);
assert
(
dirty
==
1
);
assert
(
pinned
==
0
);
assert
(
pinned
==
0
);
r
=
toku_cachetable_get_and_pin
(
f
,
key
,
hkey
,
&
value
,
NULL
,
test_dirty_flush
,
r
=
toku_cachetable_get_and_pin
(
f
,
key
,
hkey
,
&
value
,
NULL
,
wc
,
test_dirty_fetch
,
def_p
e_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
0
,
0
);
test_dirty_fetch
,
def_p
f_req_callback
,
def_pf_callback
,
0
);
assert
(
r
==
0
);
assert
(
r
==
0
);
// cachetable_print_state(t);
// cachetable_print_state(t);
...
@@ -505,8 +516,8 @@ static void test_dirty(void) {
...
@@ -505,8 +516,8 @@ static void test_dirty(void) {
key
=
make_blocknum
(
2
);
key
=
make_blocknum
(
2
);
hkey
=
toku_cachetable_hash
(
f
,
key
);
hkey
=
toku_cachetable_hash
(
f
,
key
);
r
=
toku_cachetable_get_and_pin
(
f
,
key
,
hkey
,
r
=
toku_cachetable_get_and_pin
(
f
,
key
,
hkey
,
&
value
,
NULL
,
test_dirty_flush
,
&
value
,
NULL
,
wc
,
test_dirty_fetch
,
def_p
e_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
0
,
0
);
test_dirty_fetch
,
def_p
f_req_callback
,
def_pf_callback
,
0
);
assert
(
r
==
0
);
assert
(
r
==
0
);
// cachetable_print_state(t);
// cachetable_print_state(t);
...
@@ -525,8 +536,8 @@ static void test_dirty(void) {
...
@@ -525,8 +536,8 @@ static void test_dirty(void) {
assert
(
pinned
==
0
);
assert
(
pinned
==
0
);
r
=
toku_cachetable_get_and_pin
(
f
,
key
,
hkey
,
r
=
toku_cachetable_get_and_pin
(
f
,
key
,
hkey
,
&
value
,
NULL
,
test_dirty_flush
,
&
value
,
NULL
,
wc
,
test_dirty_fetch
,
def_p
e_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
0
,
0
);
test_dirty_fetch
,
def_p
f_req_callback
,
def_pf_callback
,
0
);
assert
(
r
==
0
);
assert
(
r
==
0
);
// cachetable_print_state(t);
// cachetable_print_state(t);
...
@@ -598,7 +609,9 @@ static void test_size_resize(void) {
...
@@ -598,7 +609,9 @@ static void test_size_resize(void) {
u_int32_t
hkey
=
toku_cachetable_hash
(
f
,
key
);
u_int32_t
hkey
=
toku_cachetable_hash
(
f
,
key
);
r
=
toku_cachetable_put
(
f
,
key
,
hkey
,
value
,
make_pair_attr
(
size
),
test_size_flush_callback
,
def_pe_est_callback
,
def_pe_callback
,
def_cleaner_callback
,
0
);
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
wc
.
flush_callback
=
test_size_flush_callback
;
r
=
toku_cachetable_put
(
f
,
key
,
hkey
,
value
,
make_pair_attr
(
size
),
wc
);
assert
(
r
==
0
);
assert
(
r
==
0
);
void
*
entry_value
;
int
dirty
;
long
long
pinned
;
long
entry_size
;
void
*
entry_value
;
int
dirty
;
long
long
pinned
;
long
entry_size
;
...
@@ -615,7 +628,7 @@ static void test_size_resize(void) {
...
@@ -615,7 +628,7 @@ static void test_size_resize(void) {
void
*
current_value
;
void
*
current_value
;
long
current_size
;
long
current_size
;
r
=
toku_cachetable_get_and_pin
(
f
,
key
,
hkey
,
&
current_value
,
&
current_size
,
test_size_flush_callback
,
0
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
0
,
0
);
r
=
toku_cachetable_get_and_pin
(
f
,
key
,
hkey
,
&
current_value
,
&
current_size
,
wc
,
0
,
def_pf_req_callback
,
def_pf_callback
,
0
);
assert
(
r
==
0
);
assert
(
r
==
0
);
assert
(
current_value
==
value
);
assert
(
current_value
==
value
);
assert
(
current_size
==
new_size
);
assert
(
current_size
==
new_size
);
...
@@ -661,7 +674,9 @@ static void test_size_flush(void) {
...
@@ -661,7 +674,9 @@ static void test_size_flush(void) {
void
*
value
=
(
void
*
)(
long
)
-
i
;
void
*
value
=
(
void
*
)(
long
)
-
i
;
// printf("test_size put %lld %p %lld\n", key, value, size);
// printf("test_size put %lld %p %lld\n", key, value, size);
u_int32_t
hkey
=
toku_cachetable_hash
(
f
,
key
);
u_int32_t
hkey
=
toku_cachetable_hash
(
f
,
key
);
r
=
toku_cachetable_put
(
f
,
key
,
hkey
,
value
,
make_pair_attr
(
size
),
test_size_flush_callback
,
def_pe_est_callback
,
def_pe_callback
,
def_cleaner_callback
,
0
);
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
wc
.
flush_callback
=
test_size_flush_callback
;
r
=
toku_cachetable_put
(
f
,
key
,
hkey
,
value
,
make_pair_attr
(
size
),
wc
);
assert
(
r
==
0
);
assert
(
r
==
0
);
int
n_entries
,
hash_size
;
long
size_current
,
size_limit
,
size_max
;
int
n_entries
,
hash_size
;
long
size_current
,
size_limit
,
size_max
;
...
...
newbrt/tests/cachetable-test2.c
View file @
19b7090f
...
@@ -163,7 +163,9 @@ static void test_chaining (void) {
...
@@ -163,7 +163,9 @@ static void test_chaining (void) {
int
fnum
=
i
%
N_FILES
;
int
fnum
=
i
%
N_FILES
;
//printf("%s:%d Add %d\n", __FILE__, __LINE__, i);
//printf("%s:%d Add %d\n", __FILE__, __LINE__, i);
u_int32_t
fhash
=
toku_cachetable_hash
(
f
[
fnum
],
make_blocknum
(
i
));
u_int32_t
fhash
=
toku_cachetable_hash
(
f
[
fnum
],
make_blocknum
(
i
));
r
=
toku_cachetable_put
(
f
[
fnum
],
make_blocknum
(
i
),
fhash
,
(
void
*
)
i
,
make_pair_attr
(
test_object_size
),
flush_forchain
,
def_pe_est_callback
,
def_pe_callback
,
def_cleaner_callback
,
(
void
*
)
i
);
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
((
void
*
)
i
);
wc
.
flush_callback
=
flush_forchain
;
r
=
toku_cachetable_put
(
f
[
fnum
],
make_blocknum
(
i
),
fhash
,
(
void
*
)
i
,
make_pair_attr
(
test_object_size
),
wc
);
assert
(
r
==
0
);
assert
(
r
==
0
);
item_becomes_present
(
ct
,
f
[
fnum
],
make_blocknum
(
i
));
item_becomes_present
(
ct
,
f
[
fnum
],
make_blocknum
(
i
));
r
=
toku_cachetable_unpin
(
f
[
fnum
],
make_blocknum
(
i
),
fhash
,
CACHETABLE_CLEAN
,
make_pair_attr
(
test_object_size
));
r
=
toku_cachetable_unpin
(
f
[
fnum
],
make_blocknum
(
i
),
fhash
,
CACHETABLE_CLEAN
,
make_pair_attr
(
test_object_size
));
...
@@ -184,19 +186,17 @@ static void test_chaining (void) {
...
@@ -184,19 +186,17 @@ static void test_chaining (void) {
void
*
value
;
void
*
value
;
//printf("Touching %d (%lld, %p)\n", whichone, whichkey, whichcf);
//printf("Touching %d (%lld, %p)\n", whichone, whichkey, whichcf);
u_int32_t
fhash
=
toku_cachetable_hash
(
whichcf
,
whichkey
);
u_int32_t
fhash
=
toku_cachetable_hash
(
whichcf
,
whichkey
);
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
((
void
*
)(
long
)
whichkey
.
b
);
wc
.
flush_callback
=
flush_forchain
;
r
=
toku_cachetable_get_and_pin
(
whichcf
,
r
=
toku_cachetable_get_and_pin
(
whichcf
,
whichkey
,
whichkey
,
fhash
,
fhash
,
&
value
,
&
value
,
NULL
,
NULL
,
flush_forchain
,
wc
,
fetch_forchain
,
fetch_forchain
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_pf_callback
,
def_cleaner_callback
,
(
void
*
)(
long
)
whichkey
.
b
,
(
void
*
)(
long
)
whichkey
.
b
(
void
*
)(
long
)
whichkey
.
b
);
);
assert
(
r
==
0
);
assert
(
r
==
0
);
...
@@ -213,7 +213,9 @@ static void test_chaining (void) {
...
@@ -213,7 +213,9 @@ static void test_chaining (void) {
// if i is a duplicate, cachetable_put will return -1
// if i is a duplicate, cachetable_put will return -1
// printf("%s:%d Add {%ld,%p}\n", __FILE__, __LINE__, i, f[fnum]);
// printf("%s:%d Add {%ld,%p}\n", __FILE__, __LINE__, i, f[fnum]);
u_int32_t
fhash
=
toku_cachetable_hash
(
f
[
fnum
],
make_blocknum
(
i
));
u_int32_t
fhash
=
toku_cachetable_hash
(
f
[
fnum
],
make_blocknum
(
i
));
r
=
toku_cachetable_put
(
f
[
fnum
],
make_blocknum
(
i
),
fhash
,
(
void
*
)
i
,
make_pair_attr
(
test_object_size
),
flush_forchain
,
def_pe_est_callback
,
def_pe_callback
,
def_cleaner_callback
,
(
void
*
)
i
);
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
((
void
*
)
i
);
wc
.
flush_callback
=
flush_forchain
;
r
=
toku_cachetable_put
(
f
[
fnum
],
make_blocknum
(
i
),
fhash
,
(
void
*
)
i
,
make_pair_attr
(
test_object_size
),
wc
);
assert
(
r
==
0
||
r
==-
1
);
assert
(
r
==
0
||
r
==-
1
);
if
(
r
==
0
)
{
if
(
r
==
0
)
{
item_becomes_present
(
ct
,
f
[
fnum
],
make_blocknum
(
i
));
item_becomes_present
(
ct
,
f
[
fnum
],
make_blocknum
(
i
));
...
...
newbrt/tests/cachetable-unpin-and-remove-test.c
View file @
19b7090f
...
@@ -32,6 +32,7 @@ cachetable_unpin_and_remove_test (int n) {
...
@@ -32,6 +32,7 @@ cachetable_unpin_and_remove_test (int n) {
unlink
(
fname1
);
unlink
(
fname1
);
CACHEFILE
f1
;
CACHEFILE
f1
;
r
=
toku_cachetable_openf
(
&
f1
,
ct
,
fname1
,
O_RDWR
|
O_CREAT
,
0777
);
assert
(
r
==
0
);
r
=
toku_cachetable_openf
(
&
f1
,
ct
,
fname1
,
O_RDWR
|
O_CREAT
,
0777
);
assert
(
r
==
0
);
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
// generate some random keys
// generate some random keys
CACHEKEY
keys
[
n
];
int
nkeys
=
n
;
CACHEKEY
keys
[
n
];
int
nkeys
=
n
;
...
@@ -42,7 +43,7 @@ cachetable_unpin_and_remove_test (int n) {
...
@@ -42,7 +43,7 @@ cachetable_unpin_and_remove_test (int n) {
// put the keys into the cachetable
// put the keys into the cachetable
for
(
i
=
0
;
i
<
n
;
i
++
)
{
for
(
i
=
0
;
i
<
n
;
i
++
)
{
u_int32_t
hi
=
toku_cachetable_hash
(
f1
,
make_blocknum
(
keys
[
i
].
b
));
u_int32_t
hi
=
toku_cachetable_hash
(
f1
,
make_blocknum
(
keys
[
i
].
b
));
r
=
toku_cachetable_put
(
f1
,
make_blocknum
(
keys
[
i
].
b
),
hi
,
(
void
*
)(
long
)
keys
[
i
].
b
,
make_pair_attr
(
1
),
def_flush
,
def_pe_est_callback
,
def_pe_callback
,
def_cleaner_callback
,
0
);
r
=
toku_cachetable_put
(
f1
,
make_blocknum
(
keys
[
i
].
b
),
hi
,
(
void
*
)(
long
)
keys
[
i
].
b
,
make_pair_attr
(
1
),
wc
);
assert
(
r
==
0
);
assert
(
r
==
0
);
}
}
...
@@ -96,6 +97,7 @@ cachetable_put_evict_remove_test (int n) {
...
@@ -96,6 +97,7 @@ cachetable_put_evict_remove_test (int n) {
unlink
(
fname1
);
unlink
(
fname1
);
CACHEFILE
f1
;
CACHEFILE
f1
;
r
=
toku_cachetable_openf
(
&
f1
,
ct
,
fname1
,
O_RDWR
|
O_CREAT
,
0777
);
assert
(
r
==
0
);
r
=
toku_cachetable_openf
(
&
f1
,
ct
,
fname1
,
O_RDWR
|
O_CREAT
,
0777
);
assert
(
r
==
0
);
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
u_int32_t
hi
[
n
];
u_int32_t
hi
[
n
];
for
(
i
=
0
;
i
<
n
;
i
++
)
for
(
i
=
0
;
i
<
n
;
i
++
)
...
@@ -103,7 +105,7 @@ cachetable_put_evict_remove_test (int n) {
...
@@ -103,7 +105,7 @@ cachetable_put_evict_remove_test (int n) {
// put 0, 1, 2, ... should evict 0
// put 0, 1, 2, ... should evict 0
for
(
i
=
0
;
i
<
n
;
i
++
)
{
for
(
i
=
0
;
i
<
n
;
i
++
)
{
r
=
toku_cachetable_put
(
f1
,
make_blocknum
(
i
),
hi
[
i
],
(
void
*
)(
long
)
i
,
make_pair_attr
(
1
),
def_flush
,
def_pe_est_callback
,
def_pe_callback
,
def_cleaner_callback
,
0
);
r
=
toku_cachetable_put
(
f1
,
make_blocknum
(
i
),
hi
[
i
],
(
void
*
)(
long
)
i
,
make_pair_attr
(
1
),
wc
);
assert
(
r
==
0
);
assert
(
r
==
0
);
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
i
),
hi
[
i
],
CACHETABLE_CLEAN
,
make_pair_attr
(
1
));
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
i
),
hi
[
i
],
CACHETABLE_CLEAN
,
make_pair_attr
(
1
));
assert
(
r
==
0
);
assert
(
r
==
0
);
...
@@ -111,7 +113,7 @@ cachetable_put_evict_remove_test (int n) {
...
@@ -111,7 +113,7 @@ cachetable_put_evict_remove_test (int n) {
// get 0
// get 0
void
*
v
;
long
s
;
void
*
v
;
long
s
;
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
0
),
hi
[
0
],
&
v
,
&
s
,
def_flush
,
fetch
,
def_pe_est_callback
,
def_pe_callback
,
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
0
,
0
);
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
0
),
hi
[
0
],
&
v
,
&
s
,
wc
,
fetch
,
def_pf_req_callback
,
def_pf_callback
,
0
);
assert
(
r
==
0
);
assert
(
r
==
0
);
// remove 0
// remove 0
...
...
newbrt/tests/cachetable-unpin-remove-and-checkpoint.c
View file @
19b7090f
...
@@ -34,11 +34,12 @@ run_test (void) {
...
@@ -34,11 +34,12 @@ run_test (void) {
CACHEFILE
f1
;
CACHEFILE
f1
;
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
);
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
void
*
v1
;
void
*
v1
;
//void* v2;
//void* v2;
long
s1
;
long
s1
;
//long s2;
//long s2;
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
1
),
toku_cachetable_hash
(
f1
,
make_blocknum
(
1
)),
&
v1
,
&
s1
,
def_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_get_and_pin
(
f1
,
make_blocknum
(
1
),
toku_cachetable_hash
(
f1
,
make_blocknum
(
1
)),
&
v1
,
&
s1
,
wc
,
def_fetch
,
def_pf_req_callback
,
def_pf_callback
,
NULL
);
toku_cachetable_unpin
(
toku_cachetable_unpin
(
f1
,
f1
,
make_blocknum
(
1
),
make_blocknum
(
1
),
...
@@ -49,7 +50,7 @@ run_test (void) {
...
@@ -49,7 +50,7 @@ run_test (void) {
// now this should mark the pair for checkpoint
// now this should mark the pair for checkpoint
r
=
toku_cachetable_begin_checkpoint
(
ct
,
NULL
);
r
=
toku_cachetable_begin_checkpoint
(
ct
,
NULL
);
r
=
toku_cachetable_get_and_pin
(
f1
,
make_blocknum
(
1
),
toku_cachetable_hash
(
f1
,
make_blocknum
(
1
)),
&
v1
,
&
s1
,
def_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_get_and_pin
(
f1
,
make_blocknum
(
1
),
toku_cachetable_hash
(
f1
,
make_blocknum
(
1
)),
&
v1
,
&
s1
,
wc
,
def_fetch
,
def_pf_req_callback
,
def_pf_callback
,
NULL
);
toku_pthread_t
mytid
;
toku_pthread_t
mytid
;
r
=
toku_pthread_create
(
&
mytid
,
NULL
,
run_end_chkpt
,
NULL
);
r
=
toku_pthread_create
(
&
mytid
,
NULL
,
run_end_chkpt
,
NULL
);
...
...
newbrt/tests/cachetable-unpin-test.c
View file @
19b7090f
...
@@ -17,8 +17,9 @@ cachetable_unpin_test (int n) {
...
@@ -17,8 +17,9 @@ cachetable_unpin_test (int n) {
int
i
;
int
i
;
for
(
i
=
1
;
i
<=
n
;
i
++
)
{
for
(
i
=
1
;
i
<=
n
;
i
++
)
{
u_int32_t
hi
;
u_int32_t
hi
;
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
hi
=
toku_cachetable_hash
(
f1
,
make_blocknum
(
i
));
hi
=
toku_cachetable_hash
(
f1
,
make_blocknum
(
i
));
r
=
toku_cachetable_put
(
f1
,
make_blocknum
(
i
),
hi
,
(
void
*
)(
long
)
i
,
make_pair_attr
(
1
),
def_flush
,
def_pe_est_callback
,
def_pe_callback
,
def_cleaner_callback
,
0
);
r
=
toku_cachetable_put
(
f1
,
make_blocknum
(
i
),
hi
,
(
void
*
)(
long
)
i
,
make_pair_attr
(
1
),
wc
);
assert
(
r
==
0
);
assert
(
r
==
0
);
assert
(
toku_cachefile_count_pinned
(
f1
,
0
)
==
i
);
assert
(
toku_cachefile_count_pinned
(
f1
,
0
)
==
i
);
...
...
newbrt/tests/cachetable-writer-thread-limit.c
View file @
19b7090f
...
@@ -42,7 +42,9 @@ cachetable_test (void) {
...
@@ -42,7 +42,9 @@ 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
);
for
(
int64_t
i
=
0
;
i
<
num_entries
;
i
++
)
{
for
(
int64_t
i
=
0
;
i
<
num_entries
;
i
++
)
{
r
=
toku_cachetable_put
(
f1
,
make_blocknum
(
i
),
i
,
NULL
,
make_pair_attr
(
1
),
flush
,
def_pe_est_callback
,
def_pe_callback
,
def_cleaner_callback
,
NULL
);
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
wc
.
flush_callback
=
flush
;
r
=
toku_cachetable_put
(
f1
,
make_blocknum
(
i
),
i
,
NULL
,
make_pair_attr
(
1
),
wc
);
int
curr_size
=
__sync_fetch_and_add
(
&
total_size
,
1
);
int
curr_size
=
__sync_fetch_and_add
(
&
total_size
,
1
);
assert
(
curr_size
<=
test_limit
+
test_limit
/
2
+
1
);
assert
(
curr_size
<=
test_limit
+
test_limit
/
2
+
1
);
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
i
),
i
,
CACHETABLE_DIRTY
,
make_pair_attr
(
4
));
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
i
),
i
,
CACHETABLE_DIRTY
,
make_pair_attr
(
4
));
...
...
newbrt/tests/test.h
View file @
19b7090f
...
@@ -196,6 +196,16 @@ def_cleaner_callback(
...
@@ -196,6 +196,16 @@ def_cleaner_callback(
return
0
;
return
0
;
}
}
static
UU
()
CACHETABLE_WRITE_CALLBACK
def_write_callback
(
void
*
write_extraargs
)
{
CACHETABLE_WRITE_CALLBACK
wc
;
wc
.
flush_callback
=
def_flush
;
wc
.
pe_est_callback
=
def_pe_est_callback
;
wc
.
pe_callback
=
def_pe_callback
;
wc
.
cleaner_callback
=
def_cleaner_callback
;
wc
.
write_extraargs
=
write_extraargs
;
return
wc
;
}
int
verbose
=
0
;
int
verbose
=
0
;
static
inline
void
static
inline
void
...
...
newbrt/tests/test4302.c
View file @
19b7090f
...
@@ -107,19 +107,20 @@ cachetable_test (void) {
...
@@ -107,19 +107,20 @@ cachetable_test (void) {
long
s1
;
long
s1
;
u_int64_t
val1
=
0
;
u_int64_t
val1
=
0
;
u_int64_t
val2
=
0
;
u_int64_t
val2
=
0
;
CACHETABLE_WRITE_CALLBACK
wc
=
def_write_callback
(
NULL
);
wc
.
flush_callback
=
flush
;
wc
.
pe_est_callback
=
pe_est_callback
;
wc
.
pe_callback
=
pe_callback
;
r
=
toku_cachetable_get_and_pin
(
r
=
toku_cachetable_get_and_pin
(
f1
,
f1
,
make_blocknum
(
1
),
make_blocknum
(
1
),
1
,
1
,
&
v1
,
&
v1
,
&
s1
,
&
s1
,
flush
,
wc
,
fetch
,
fetch
,
pe_est_callback
,
def_pf_req_callback
,
def_pf_callback
,
pe_callback
,
&
val1
def_pf_req_callback
,
def_pf_callback
,
def_cleaner_callback
,
&
val1
,
NULL
);
);
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
1
),
1
,
CACHETABLE_CLEAN
,
make_pair_attr
(
8
));
r
=
toku_cachetable_unpin
(
f1
,
make_blocknum
(
1
),
1
,
CACHETABLE_CLEAN
,
make_pair_attr
(
8
));
CACHEKEY
key
;
CACHEKEY
key
;
...
@@ -130,11 +131,7 @@ cachetable_test (void) {
...
@@ -130,11 +131,7 @@ cachetable_test (void) {
test_get_key_and_fullhash
,
test_get_key_and_fullhash
,
&
val2
,
&
val2
,
make_pair_attr
(
8
),
make_pair_attr
(
8
),
flush
,
wc
,
pe_est_callback
,
pe_callback
,
def_cleaner_callback
,
NULL
,
// parameter for flush_callback, pe_est_callback, pe_callback, and cleaner_callback
NULL
,
NULL
,
0
,
// number of dependent pairs that we may need to checkpoint
0
,
// number of dependent pairs that we may need to checkpoint
NULL
,
// array of cachefiles of dependent pairs
NULL
,
// array of cachefiles of dependent pairs
...
...
src/ydb.c
View file @
19b7090f
...
@@ -4433,10 +4433,10 @@ toku_db_cursor(DB * db, DB_TXN * txn, DBC ** c, u_int32_t flags, int is_temporar
...
@@ -4433,10 +4433,10 @@ toku_db_cursor(DB * db, DB_TXN * txn, DBC ** c, u_int32_t flags, int is_temporar
);
);
}
}
r
=
toku_grab_read_lock_on_directory
(
db
,
txn
);
//
r = toku_grab_read_lock_on_directory(db, txn);
if
(
r
!=
0
)
//
if (r != 0)
return
r
;
//
return r;
r
=
0
;
struct
__toku_dbc_external
*
XMALLOC
(
eresult
);
// so the internal stuff is stuck on the end
struct
__toku_dbc_external
*
XMALLOC
(
eresult
);
// so the internal stuff is stuck on the end
memset
(
eresult
,
0
,
sizeof
(
*
eresult
));
memset
(
eresult
,
0
,
sizeof
(
*
eresult
));
DBC
*
result
=
&
eresult
->
external_part
;
DBC
*
result
=
&
eresult
->
external_part
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment