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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
c1c45c65
Commit
c1c45c65
authored
Sep 05, 2012
by
Zardosht Kasheff
Committed by
Yoni Fogel
Apr 17, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refs #5442, merge to main
git-svn-id:
file:///svn/toku/tokudb@47493
c7de825b-a66e-492c-adef-691d508d4ae1
parent
416ecb88
Changes
17
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
135 additions
and
97 deletions
+135
-97
ft/ft-cachetable-wrappers.cc
ft/ft-cachetable-wrappers.cc
+0
-3
ft/ft-flusher.cc
ft/ft-flusher.cc
+30
-31
ft/ft-internal.h
ft/ft-internal.h
+3
-4
ft/ft-node-deserialize.cc
ft/ft-node-deserialize.cc
+1
-1
ft/ft-ops.cc
ft/ft-ops.cc
+13
-16
ft/ft.cc
ft/ft.cc
+1
-1
ft/ft_node-serialize.cc
ft/ft_node-serialize.cc
+3
-3
ft/ftdump.cc
ft/ftdump.cc
+0
-1
ft/ftloader.cc
ft/ftloader.cc
+4
-4
ft/tests/ft-bfe-query.cc
ft/tests/ft-bfe-query.cc
+0
-2
ft/tests/ft-clock-test.cc
ft/tests/ft-clock-test.cc
+0
-4
ft/tests/ft-serialize-benchmark.cc
ft/tests/ft-serialize-benchmark.cc
+0
-4
ft/tests/ft-serialize-test.cc
ft/tests/ft-serialize-test.cc
+0
-13
ft/tests/orthopush-flush.cc
ft/tests/orthopush-flush.cc
+9
-9
ft/tests/test3884.cc
ft/tests/test3884.cc
+0
-1
src/tests/CMakeLists.txt
src/tests/CMakeLists.txt
+1
-0
src/tests/test_db_change_pagesize.cc
src/tests/test_db_change_pagesize.cc
+70
-0
No files found.
ft/ft-cachetable-wrappers.cc
View file @
c1c45c65
...
...
@@ -84,7 +84,6 @@ create_new_ftnode_with_dep_nodes(
&
fullhash
,
result
);
assert
(
ft
->
h
->
nodesize
>
0
);
assert
(
ft
->
h
->
basementnodesize
>
0
);
if
(
height
==
0
)
{
assert
(
n_children
>
0
);
...
...
@@ -96,10 +95,8 @@ create_new_ftnode_with_dep_nodes(
height
,
n_children
,
ft
->
h
->
layout_version
,
ft
->
h
->
nodesize
,
ft
->
h
->
flags
);
assert
((
*
result
)
->
nodesize
>
0
);
(
*
result
)
->
fullhash
=
fullhash
;
}
...
...
ft/ft-flusher.cc
View file @
c1c45c65
...
...
@@ -208,10 +208,19 @@ never_recursively_flush(FTNODE UU(child), void* UU(extra))
return
false
;
}
/**
* Flusher thread ("normal" flushing) implementation.
*/
struct
flush_status_update_extra
{
int
cascades
;
uint32_t
nodesize
;
};
static
bool
recurse_if_child_is_gorged
(
FTNODE
child
,
void
*
UU
(
extra
)
)
recurse_if_child_is_gorged
(
FTNODE
child
,
void
*
extra
)
{
return
toku_ft_nonleaf_is_gorged
(
child
);
struct
flush_status_update_extra
*
fste
=
(
flush_status_update_extra
*
)
extra
;
return
toku_ft_nonleaf_is_gorged
(
child
,
fste
->
nodesize
);
}
int
...
...
@@ -268,13 +277,6 @@ flusher_advice_init(
fa
->
extra
=
extra
;
}
/**
* Flusher thread ("normal" flushing) implementation.
*/
struct
flush_status_update_extra
{
int
cascades
;
};
static
void
flt_update_status
(
FTNODE
child
,
int
UU
(
dirtied
),
...
...
@@ -288,9 +290,10 @@ flt_update_status(FTNODE child,
}
static
void
flt_flusher_advice_init
(
struct
flusher_advice
*
fa
,
struct
flush_status_update_extra
*
fste
)
flt_flusher_advice_init
(
struct
flusher_advice
*
fa
,
struct
flush_status_update_extra
*
fste
,
uint32_t
nodesize
)
{
fste
->
cascades
=
0
;
fste
->
nodesize
=
nodesize
;
flusher_advice_init
(
fa
,
pick_heaviest_child
,
dont_destroy_basement_nodes
,
...
...
@@ -434,9 +437,10 @@ ct_update_status(FTNODE child,
}
static
void
ct_flusher_advice_init
(
struct
flusher_advice
*
fa
,
struct
flush_status_update_extra
*
fste
)
ct_flusher_advice_init
(
struct
flusher_advice
*
fa
,
struct
flush_status_update_extra
*
fste
,
uint32_t
nodesize
)
{
fste
->
cascades
=
0
;
fste
->
nodesize
=
nodesize
;
flusher_advice_init
(
fa
,
pick_heaviest_child
,
do_destroy_basement_nodes
,
...
...
@@ -739,17 +743,12 @@ ftleaf_split(
);
}
//printf("%s:%d splitting leaf %" PRIu64 " which is size %u (targetsize = %u)\n", __FILE__, __LINE__, node->thisnodename.b, toku_serialize_ftnode_size(node), node->nodesize);
assert
(
node
->
height
==
0
);
assert
(
node
->
nodesize
>
0
);
toku_assert_entire_node_in_memory
(
node
);
verify_all_in_mempool
(
node
);
MSN
max_msn_applied_to_node
=
node
->
max_msn_applied_to_node_on_disk
;
//printf("%s:%d A is at %lld\n", __FILE__, __LINE__, A->thisnodename);
//printf("%s:%d B is at %lld nodesize=%d\n", __FILE__, __LINE__, B->thisnodename, B->nodesize);
// variables that say where we will do the split. We do it in the basement node indexed at
// at last_bn_on_left and at the index last_le_on_left_within_bn within that basement node.
int
last_bn_on_left
=
0
;
// last_bn_on_left may or may not be fully included
...
...
@@ -791,9 +790,7 @@ ftleaf_split(
0
,
num_children_in_b
,
h
->
h
->
layout_version
,
h
->
h
->
nodesize
,
h
->
h
->
flags
);
assert
(
B
->
nodesize
>
0
);
B
->
fullhash
=
fullhash
;
}
else
{
...
...
@@ -987,8 +984,6 @@ ft_split_child(
assert
(
toku_bnc_nbytesinbuf
(
BNC
(
node
,
childnum
))
==
0
);
// require that the buffer for this child is empty
FTNODE
nodea
,
nodeb
;
DBT
splitk
;
// printf("%s:%d node %" PRIu64 "->u.n.n_children=%d height=%d\n", __FILE__, __LINE__, node->thisnodename.b, node->u.n.n_children, node->height);
assert
(
h
->
h
->
nodesize
>=
node
->
nodesize
);
/* otherwise we might be in trouble because the nodesize shrank. */
// for test
call_flusher_thread_callback
(
flt_flush_before_split
);
...
...
@@ -1167,7 +1162,9 @@ maybe_merge_pinned_leaf_nodes(
DBT
*
parent_splitk
,
bool
*
did_merge
,
bool
*
did_rebalance
,
DBT
*
splitk
)
DBT
*
splitk
,
uint32_t
nodesize
)
// Effect: Either merge a and b into one one node (merge them into a) and set *did_merge = true.
// (We do this if the resulting node is not fissible)
// or distribute the leafentries evenly between a and b, and set *did_rebalance = true.
...
...
@@ -1175,10 +1172,10 @@ maybe_merge_pinned_leaf_nodes(
{
unsigned
int
sizea
=
toku_serialize_ftnode_size
(
a
);
unsigned
int
sizeb
=
toku_serialize_ftnode_size
(
b
);
if
((
sizea
+
sizeb
)
*
4
>
(
a
->
nodesize
*
3
))
{
if
((
sizea
+
sizeb
)
*
4
>
(
nodesize
*
3
))
{
// the combined size is more than 3/4 of a node, so don't merge them.
*
did_merge
=
false
;
if
(
sizea
*
4
>
a
->
nodesize
&&
sizeb
*
4
>
a
->
nodesize
)
{
if
(
sizea
*
4
>
nodesize
&&
sizeb
*
4
>
nodesize
)
{
// no need to do anything if both are more than 1/4 of a node.
*
did_rebalance
=
false
;
toku_clone_dbt
(
splitk
,
*
parent_splitk
);
...
...
@@ -1248,7 +1245,9 @@ maybe_merge_pinned_nodes(
FTNODE
b
,
bool
*
did_merge
,
bool
*
did_rebalance
,
DBT
*
splitk
)
DBT
*
splitk
,
uint32_t
nodesize
)
// Effect: either merge a and b into one node (merge them into a) and set *did_merge = true.
// (We do this if the resulting node is not fissible)
// or distribute a and b evenly and set *did_merge = false and *did_rebalance = true
...
...
@@ -1282,7 +1281,7 @@ maybe_merge_pinned_nodes(
}
}
if
(
a
->
height
==
0
)
{
maybe_merge_pinned_leaf_nodes
(
a
,
b
,
parent_splitk
,
did_merge
,
did_rebalance
,
splitk
);
maybe_merge_pinned_leaf_nodes
(
a
,
b
,
parent_splitk
,
did_merge
,
did_rebalance
,
splitk
,
nodesize
);
}
else
{
maybe_merge_pinned_nonleaf_nodes
(
parent_splitk
,
a
,
b
,
did_merge
,
did_rebalance
,
splitk
);
}
...
...
@@ -1374,7 +1373,7 @@ ft_merge_child(
toku_init_dbt
(
&
splitk
);
DBT
*
old_split_key
=
&
node
->
childkeys
[
childnuma
];
unsigned
int
deleted_size
=
old_split_key
->
size
;
maybe_merge_pinned_nodes
(
node
,
&
node
->
childkeys
[
childnuma
],
childa
,
childb
,
&
did_merge
,
&
did_rebalance
,
&
splitk
);
maybe_merge_pinned_nodes
(
node
,
&
node
->
childkeys
[
childnuma
],
childa
,
childb
,
&
did_merge
,
&
did_rebalance
,
&
splitk
,
h
->
h
->
nodesize
);
if
(
childa
->
height
>
0
)
{
for
(
int
i
=
0
;
i
+
1
<
childa
->
n_children
;
i
++
)
{
assert
(
childa
->
childkeys
[
i
].
data
);
...
...
@@ -1541,7 +1540,7 @@ flush_some_child(
// we wont be splitting/merging child
// and we have already replaced the bnc
// for the root with a fresh one
enum
reactivity
child_re
=
get_node_reactivity
(
child
);
enum
reactivity
child_re
=
get_node_reactivity
(
child
,
h
->
h
->
nodesize
);
if
(
parent
&&
child_re
==
RE_STABLE
)
{
toku_unpin_ftnode_off_client_thread
(
h
,
parent
);
parent
=
NULL
;
...
...
@@ -1571,7 +1570,7 @@ flush_some_child(
// let's get the reactivity of the child again,
// it is possible that the flush got rid of some values
// and now the parent is no longer reactive
child_re
=
get_node_reactivity
(
child
);
child_re
=
get_node_reactivity
(
child
,
h
->
h
->
nodesize
);
// if the parent has been unpinned above, then
// this is our only option, even if the child is not stable
// if the child is not stable, we'll handle it the next
...
...
@@ -1716,7 +1715,7 @@ toku_ftnode_cleaner_callback(
if
(
toku_bnc_nbytesinbuf
(
BNC
(
node
,
childnum
))
>
0
)
{
struct
flusher_advice
fa
;
struct
flush_status_update_extra
fste
;
ct_flusher_advice_init
(
&
fa
,
&
fste
);
ct_flusher_advice_init
(
&
fa
,
&
fste
,
h
->
h
->
nodesize
);
flush_some_child
(
h
,
node
,
&
fa
);
}
else
{
toku_unpin_ftnode_off_client_thread
(
h
,
node
);
...
...
@@ -1754,7 +1753,7 @@ static void flush_node_fun(void *fe_v)
struct
flusher_advice
fa
;
struct
flush_status_update_extra
fste
;
flt_flusher_advice_init
(
&
fa
,
&
fste
);
flt_flusher_advice_init
(
&
fa
,
&
fste
,
fe
->
h
->
h
->
nodesize
);
if
(
fe
->
bnc
)
{
// In this case, we have a bnc to flush to a node
...
...
@@ -1774,7 +1773,7 @@ static void flush_node_fun(void *fe_v)
// If so, call flush_some_child on the node, and it is the responsibility
// of flush_some_child to unlock the node
// otherwise, we unlock the node here.
if
(
fe
->
node
->
height
>
0
&&
toku_ft_nonleaf_is_gorged
(
fe
->
node
))
{
if
(
fe
->
node
->
height
>
0
&&
toku_ft_nonleaf_is_gorged
(
fe
->
node
,
fe
->
h
->
h
->
nodesize
))
{
flush_some_child
(
fe
->
h
,
fe
->
node
,
&
fa
);
}
else
{
...
...
ft/ft-internal.h
View file @
c1c45c65
...
...
@@ -139,11 +139,11 @@ int toku_bnc_flush_to_child(
FTNODE
child
);
bool
toku_ft_nonleaf_is_gorged
(
FTNODE
node
);
toku_ft_nonleaf_is_gorged
(
FTNODE
node
,
uint32_t
nodesize
);
enum
reactivity
get_nonleaf_reactivity
(
FTNODE
node
);
enum
reactivity
get_node_reactivity
(
FTNODE
node
);
enum
reactivity
get_node_reactivity
(
FTNODE
node
,
uint32_t
nodesize
);
// data of an available partition of a leaf ftnode
...
...
@@ -232,7 +232,6 @@ struct __attribute__((__packed__)) ftnode_partition {
struct
ftnode
{
MSN
max_msn_applied_to_node_on_disk
;
// max_msn_applied that will be written to disk
unsigned
int
nodesize
;
unsigned
int
flags
;
BLOCKNUM
thisnodename
;
// Which block number is this node?
int
layout_version
;
// What version of the data structure?
...
...
@@ -851,7 +850,7 @@ void toku_create_new_ftnode (FT_HANDLE t, FTNODE *result, int height, int n_chil
// Effect: Fill in N as an empty ftnode.
void
toku_initialize_empty_ftnode
(
FTNODE
n
,
BLOCKNUM
nodename
,
int
height
,
int
num_children
,
int
layout_version
,
unsigned
int
nodesize
,
unsigned
int
flags
);
int
layout_version
,
unsigned
int
flags
);
unsigned
int
toku_ftnode_which_child
(
FTNODE
node
,
const
DBT
*
k
,
DESCRIPTOR
desc
,
ft_compare_func
cmp
)
...
...
ft/ft-node-deserialize.cc
View file @
c1c45c65
...
...
@@ -124,7 +124,7 @@ check_node_info_checksum(struct rbuf *rb)
void
read_legacy_node_info
(
FTNODE
node
,
struct
rbuf
*
rb
,
int
version
)
{
node
->
nodesize
=
rbuf_int
(
rb
);
// 1. nodesize
(
void
)
rbuf_int
(
rb
);
// 1. nodesize
node
->
flags
=
rbuf_int
(
rb
);
// 2. flags
node
->
height
=
rbuf_int
(
rb
);
// 3. height
...
...
ft/ft-ops.cc
View file @
c1c45c65
...
...
@@ -244,15 +244,15 @@ get_leaf_num_entries(FTNODE node) {
}
static
enum
reactivity
get_leaf_reactivity
(
FTNODE
node
)
{
get_leaf_reactivity
(
FTNODE
node
,
uint32_t
nodesize
)
{
enum
reactivity
re
=
RE_STABLE
;
toku_assert_entire_node_in_memory
(
node
);
assert
(
node
->
height
==
0
);
unsigned
int
size
=
toku_serialize_ftnode_size
(
node
);
if
(
size
>
node
->
node
size
&&
get_leaf_num_entries
(
node
)
>
1
)
{
if
(
size
>
nodesize
&&
get_leaf_num_entries
(
node
)
>
1
)
{
re
=
RE_FISSIBLE
;
}
else
if
((
size
*
4
)
<
node
->
node
size
&&
!
BLB_SEQINSERT
(
node
,
node
->
n_children
-
1
))
{
else
if
((
size
*
4
)
<
nodesize
&&
!
BLB_SEQINSERT
(
node
,
node
->
n_children
-
1
))
{
re
=
RE_FUSIBLE
;
}
return
re
;
...
...
@@ -268,10 +268,10 @@ get_nonleaf_reactivity (FTNODE node) {
}
enum
reactivity
get_node_reactivity
(
FTNODE
node
)
{
get_node_reactivity
(
FTNODE
node
,
uint32_t
nodesize
)
{
toku_assert_entire_node_in_memory
(
node
);
if
(
node
->
height
==
0
)
return
get_leaf_reactivity
(
node
);
return
get_leaf_reactivity
(
node
,
nodesize
);
else
return
get_nonleaf_reactivity
(
node
);
}
...
...
@@ -284,7 +284,7 @@ toku_bnc_nbytesinbuf(NONLEAF_CHILDINFO bnc)
// return true if the size of the buffers plus the amount of work done is large enough. (But return false if there is nothing to be flushed (the buffers empty)).
bool
toku_ft_nonleaf_is_gorged
(
FTNODE
node
)
{
toku_ft_nonleaf_is_gorged
(
FTNODE
node
,
uint32_t
nodesize
)
{
uint64_t
size
=
toku_serialize_ftnode_size
(
node
);
bool
buffers_are_empty
=
true
;
...
...
@@ -293,7 +293,7 @@ toku_ft_nonleaf_is_gorged (FTNODE node) {
// the nonleaf node is gorged if the following holds true:
// - the buffers are non-empty
// - the total workdone by the buffers PLUS the size of the buffers
// is greater than node
->node
size (which as of Maxwell should be
// is greater than nodesize (which as of Maxwell should be
// 4MB)
//
assert
(
node
->
height
>
0
);
...
...
@@ -306,7 +306,7 @@ toku_ft_nonleaf_is_gorged (FTNODE node) {
break
;
}
}
return
((
size
>
node
->
node
size
)
return
((
size
>
nodesize
)
&&
(
!
buffers_are_empty
));
}
...
...
@@ -662,7 +662,6 @@ void toku_ftnode_clone_callback(
}
cloned_node
->
max_msn_applied_to_node_on_disk
=
node
->
max_msn_applied_to_node_on_disk
;
cloned_node
->
nodesize
=
node
->
nodesize
;
cloned_node
->
flags
=
node
->
flags
;
cloned_node
->
thisnodename
=
node
->
thisnodename
;
cloned_node
->
layout_version
=
node
->
layout_version
;
...
...
@@ -1234,7 +1233,7 @@ void toku_ftnode_free (FTNODE *nodep) {
}
void
toku_initialize_empty_ftnode
(
FTNODE
n
,
BLOCKNUM
nodename
,
int
height
,
int
num_children
,
int
layout_version
,
unsigned
int
nodesize
,
unsigned
int
flags
)
toku_initialize_empty_ftnode
(
FTNODE
n
,
BLOCKNUM
nodename
,
int
height
,
int
num_children
,
int
layout_version
,
unsigned
int
flags
)
// Effect: Fill in N as an empty ftnode.
{
assert
(
layout_version
!=
0
);
...
...
@@ -1246,7 +1245,6 @@ toku_initialize_empty_ftnode (FTNODE n, BLOCKNUM nodename, int height, int num_c
STATUS_VALUE
(
FT_CREATE_NONLEAF
)
++
;
n
->
max_msn_applied_to_node_on_disk
=
ZERO_MSN
;
// correct value for root node, harmless for others
n
->
nodesize
=
nodesize
;
n
->
flags
=
flags
;
n
->
thisnodename
=
nodename
;
n
->
layout_version
=
layout_version
;
...
...
@@ -1312,7 +1310,6 @@ ft_init_new_root(FT ft, FTNODE oldroot, FTNODE *newrootp)
new_height
,
1
,
ft
->
h
->
layout_version
,
ft
->
h
->
nodesize
,
ft
->
h
->
flags
);
MSN
msna
=
oldroot
->
max_msn_applied_to_node_on_disk
;
...
...
@@ -2092,7 +2089,7 @@ static void
ft_process_maybe_reactive_root
(
FT
ft
,
FTNODE
*
nodep
)
{
FTNODE
node
=
*
nodep
;
toku_assert_entire_node_in_memory
(
node
);
enum
reactivity
re
=
get_node_reactivity
(
node
);
enum
reactivity
re
=
get_node_reactivity
(
node
,
ft
->
h
->
nodesize
);
switch
(
re
)
{
case
RE_STABLE
:
return
;
...
...
@@ -2556,7 +2553,7 @@ toku_ft_root_put_cmd (FT ft, FT_MSG_S * cmd)
// if we call flush_some_child, then that function unpins the root
// otherwise, we unpin ourselves
if
(
node
->
height
>
0
&&
toku_ft_nonleaf_is_gorged
(
node
))
{
if
(
node
->
height
>
0
&&
toku_ft_nonleaf_is_gorged
(
node
,
ft
->
h
->
nodesize
))
{
flush_node_on_background_thread
(
ft
,
node
);
}
else
{
...
...
@@ -5478,8 +5475,8 @@ toku_dump_ftnode (FILE *file, FT_HANDLE brt, BLOCKNUM blocknum, int depth, const
assert
(
node
->
fullhash
==
fullhash
);
fprintf
(
file
,
"%*sNode=%p
\n
"
,
depth
,
""
,
node
);
fprintf
(
file
,
"%*sNode %"
PRId64
"
nodesize=%u
height=%d n_children=%d keyrange=%s %s
\n
"
,
depth
,
""
,
blocknum
.
b
,
node
->
nodesize
,
node
->
height
,
node
->
n_children
,
(
char
*
)(
lorange
?
lorange
->
data
:
0
),
(
char
*
)(
hirange
?
hirange
->
data
:
0
));
fprintf
(
file
,
"%*sNode %"
PRId64
" height=%d n_children=%d keyrange=%s %s
\n
"
,
depth
,
""
,
blocknum
.
b
,
node
->
height
,
node
->
n_children
,
(
char
*
)(
lorange
?
lorange
->
data
:
0
),
(
char
*
)(
hirange
?
hirange
->
data
:
0
));
{
int
i
;
for
(
i
=
0
;
i
+
1
<
node
->
n_children
;
i
++
)
{
...
...
ft/ft.cc
View file @
c1c45c65
...
...
@@ -351,7 +351,7 @@ void toku_node_save_ct_pair(void *value_data, PAIR p) {
static
int
setup_initial_ft_root_node
(
FT
ft
,
BLOCKNUM
blocknum
)
{
FTNODE
XMALLOC
(
node
);
toku_initialize_empty_ftnode
(
node
,
blocknum
,
0
,
1
,
ft
->
h
->
layout_version
,
ft
->
h
->
nodesize
,
ft
->
h
->
flags
);
toku_initialize_empty_ftnode
(
node
,
blocknum
,
0
,
1
,
ft
->
h
->
layout_version
,
ft
->
h
->
flags
);
BP_STATE
(
node
,
0
)
=
PT_AVAIL
;
uint32_t
fullhash
=
toku_cachetable_hash
(
ft
->
cf
,
blocknum
);
...
...
ft/ft_node-serialize.cc
View file @
c1c45c65
...
...
@@ -386,7 +386,7 @@ static void serialize_ftnode_info(FTNODE node,
wbuf_init
(
&
wb
,
sb
->
uncompressed_ptr
,
sb
->
uncompressed_size
);
wbuf_MSN
(
&
wb
,
node
->
max_msn_applied_to_node_on_disk
);
wbuf_nocrc_uint
(
&
wb
,
node
->
nodesize
);
wbuf_nocrc_uint
(
&
wb
,
0
);
// write a dummy value for where node->nodesize used to be
wbuf_nocrc_uint
(
&
wb
,
node
->
flags
);
wbuf_nocrc_int
(
&
wb
,
node
->
height
);
// pivot information
...
...
@@ -1259,7 +1259,7 @@ deserialize_ftnode_info(
rbuf_init
(
&
rb
,
(
unsigned
char
*
)
sb
->
uncompressed_ptr
,
data_size
);
node
->
max_msn_applied_to_node_on_disk
=
rbuf_msn
(
&
rb
);
node
->
nodesize
=
rbuf_int
(
&
rb
);
(
void
)
rbuf_int
(
&
rb
);
node
->
flags
=
rbuf_int
(
&
rb
);
node
->
height
=
rbuf_int
(
&
rb
);
if
(
node
->
layout_version_read_from_disk
<
FT_LAYOUT_VERSION_19
)
{
...
...
@@ -2126,7 +2126,7 @@ deserialize_and_upgrade_ftnode(FTNODE node,
// The remaining offsets into the rbuf do not map to the current
// version, so we need to fill in the blanks and ignore older
// fields.
node
->
nodesize
=
rbuf_int
(
&
rb
);
// 1. nodesize
(
void
)
rbuf_int
(
&
rb
);
// 1. nodesize
node
->
flags
=
rbuf_int
(
&
rb
);
// 2. flags
node
->
height
=
rbuf_int
(
&
rb
);
// 3. height
...
...
ft/ftdump.cc
View file @
c1c45c65
...
...
@@ -137,7 +137,6 @@ dump_node (int f, BLOCKNUM blocknum, FT h) {
toku_translate_blocknum_to_offset_size
(
h
->
blocktable
,
blocknum
,
&
diskoffset
,
&
disksize
);
printf
(
" diskoffset =%"
PRId64
"
\n
"
,
diskoffset
);
printf
(
" disksize =%"
PRId64
"
\n
"
,
disksize
);
printf
(
" nodesize =%u
\n
"
,
n
->
nodesize
);
printf
(
" serialize_size =%u
\n
"
,
toku_serialize_ftnode_size
(
n
));
printf
(
" flags =%u
\n
"
,
n
->
flags
);
printf
(
" thisnodename=%"
PRId64
"
\n
"
,
n
->
thisnodename
.
b
);
...
...
ft/ftloader.cc
View file @
c1c45c65
...
...
@@ -2113,7 +2113,7 @@ static void putbuf_int64 (struct dbuf *dbuf, long long v) {
putbuf_int32
(
dbuf
,
v
&
0xFFFFFFFF
);
}
static
struct
leaf_buf
*
start_leaf
(
struct
dbout
*
out
,
const
DESCRIPTOR
UU
(
desc
),
int64_t
lblocknum
,
TXNID
xid
,
uint32_t
target_nodesize
)
{
static
struct
leaf_buf
*
start_leaf
(
struct
dbout
*
out
,
const
DESCRIPTOR
UU
(
desc
),
int64_t
lblocknum
,
TXNID
xid
,
uint32_t
UU
(
target_nodesize
)
)
{
invariant
(
lblocknum
<
out
->
n_translations_limit
);
struct
leaf_buf
*
XMALLOC
(
lbuf
);
...
...
@@ -2132,7 +2132,7 @@ static struct leaf_buf *start_leaf (struct dbout *out, const DESCRIPTOR UU(desc)
}
FTNODE
XMALLOC
(
node
);
toku_initialize_empty_ftnode
(
node
,
lbuf
->
blocknum
,
0
/*height*/
,
1
/*basement nodes*/
,
FT_LAYOUT_VERSION
,
target_nodesize
,
0
);
toku_initialize_empty_ftnode
(
node
,
lbuf
->
blocknum
,
0
/*height*/
,
1
/*basement nodes*/
,
FT_LAYOUT_VERSION
,
0
);
BP_STATE
(
node
,
0
)
=
PT_AVAIL
;
lbuf
->
node
=
node
;
...
...
@@ -2900,7 +2900,7 @@ static int setup_nonleaf_block (int n_children,
static
void
write_nonleaf_node
(
FTLOADER
bl
,
struct
dbout
*
out
,
int64_t
blocknum_of_new_node
,
int
n_children
,
DBT
*
pivots
,
/* must free this array, as well as the things it points t */
struct
subtree_info
*
subtree_info
,
int
height
,
const
DESCRIPTOR
UU
(
desc
),
uint32_t
target_nodesize
,
uint32_t
target_basementnodesize
,
enum
toku_compression_method
target_compression_method
)
struct
subtree_info
*
subtree_info
,
int
height
,
const
DESCRIPTOR
UU
(
desc
),
uint32_t
UU
(
target_nodesize
)
,
uint32_t
target_basementnodesize
,
enum
toku_compression_method
target_compression_method
)
{
//Nodes do not currently touch descriptors
invariant
(
height
>
0
);
...
...
@@ -2909,7 +2909,7 @@ static void write_nonleaf_node (FTLOADER bl, struct dbout *out, int64_t blocknum
FTNODE
XMALLOC
(
node
);
toku_initialize_empty_ftnode
(
node
,
make_blocknum
(
blocknum_of_new_node
),
height
,
n_children
,
FT_LAYOUT_VERSION
,
target_nodesize
,
0
);
FT_LAYOUT_VERSION
,
0
);
node
->
totalchildkeylens
=
0
;
for
(
int
i
=
0
;
i
<
n_children
-
1
;
i
++
)
{
toku_clone_dbt
(
&
node
->
childkeys
[
i
],
pivots
[
i
]);
...
...
ft/tests/ft-bfe-query.cc
View file @
c1c45c65
...
...
@@ -278,7 +278,6 @@ test_subset_read(int fd, FT_HANDLE UU(brt), FT brt_h) {
static
void
test_prefetching
(
void
)
{
// struct ft_handle source_ft;
const
int
nodesize
=
1024
;
struct
ftnode
sn
;
int
fd
=
open
(
__SRCFILE__
".ft_handle"
,
O_RDWR
|
O_CREAT
|
O_BINARY
,
S_IRWXU
|
S_IRWXG
|
S_IRWXO
);
assert
(
fd
>=
0
);
...
...
@@ -287,7 +286,6 @@ test_prefetching(void) {
// source_ft.fd=fd;
sn
.
max_msn_applied_to_node_on_disk
.
msn
=
0
;
sn
.
nodesize
=
nodesize
;
sn
.
flags
=
0x11223344
;
sn
.
thisnodename
.
b
=
20
;
sn
.
layout_version
=
FT_LAYOUT_VERSION
;
...
...
ft/tests/ft-clock-test.cc
View file @
c1c45c65
...
...
@@ -227,7 +227,6 @@ test3_leaf(int fd, FT brt_h, FTNODE *dn) {
static
void
test_serialize_nonleaf
(
void
)
{
// struct ft_handle source_ft;
const
int
nodesize
=
1024
;
struct
ftnode
sn
,
*
dn
;
int
fd
=
open
(
__SRCFILE__
".ft_handle"
,
O_RDWR
|
O_CREAT
|
O_BINARY
,
S_IRWXU
|
S_IRWXG
|
S_IRWXO
);
assert
(
fd
>=
0
);
...
...
@@ -237,7 +236,6 @@ test_serialize_nonleaf(void) {
// source_ft.fd=fd;
sn
.
max_msn_applied_to_node_on_disk
.
msn
=
0
;
char
*
hello_string
;
sn
.
nodesize
=
nodesize
;
sn
.
flags
=
0x11223344
;
sn
.
thisnodename
.
b
=
20
;
sn
.
layout_version
=
FT_LAYOUT_VERSION
;
...
...
@@ -329,7 +327,6 @@ test_serialize_nonleaf(void) {
static
void
test_serialize_leaf
(
void
)
{
// struct ft_handle source_ft;
const
int
nodesize
=
1024
;
struct
ftnode
sn
,
*
dn
;
int
fd
=
open
(
__SRCFILE__
".ft_handle"
,
O_RDWR
|
O_CREAT
|
O_BINARY
,
S_IRWXU
|
S_IRWXG
|
S_IRWXO
);
assert
(
fd
>=
0
);
...
...
@@ -337,7 +334,6 @@ test_serialize_leaf(void) {
int
r
;
sn
.
max_msn_applied_to_node_on_disk
.
msn
=
0
;
sn
.
nodesize
=
nodesize
;
sn
.
flags
=
0x11223344
;
sn
.
thisnodename
.
b
=
20
;
sn
.
layout_version
=
FT_LAYOUT_VERSION
;
...
...
ft/tests/ft-serialize-benchmark.cc
View file @
c1c45c65
...
...
@@ -56,7 +56,6 @@ long_key_cmp(DB *UU(e), const DBT *a, const DBT *b)
static
void
test_serialize_leaf
(
int
valsize
,
int
nelts
,
double
entropy
)
{
// struct ft_handle source_ft;
const
int
nodesize
=
(
1
<<
22
);
struct
ftnode
*
sn
,
*
dn
;
int
fd
=
open
(
__SRCFILE__
".ft"
,
O_RDWR
|
O_CREAT
|
O_BINARY
,
S_IRWXU
|
S_IRWXG
|
S_IRWXO
);
assert
(
fd
>=
0
);
...
...
@@ -66,7 +65,6 @@ test_serialize_leaf(int valsize, int nelts, double entropy) {
XCALLOC
(
sn
);
sn
->
max_msn_applied_to_node_on_disk
.
msn
=
0
;
sn
->
nodesize
=
nodesize
;
sn
->
flags
=
0x11223344
;
sn
->
thisnodename
.
b
=
20
;
sn
->
layout_version
=
FT_LAYOUT_VERSION
;
...
...
@@ -181,7 +179,6 @@ test_serialize_leaf(int valsize, int nelts, double entropy) {
static
void
test_serialize_nonleaf
(
int
valsize
,
int
nelts
,
double
entropy
)
{
// struct ft_handle source_ft;
const
int
nodesize
=
(
1
<<
22
);
struct
ftnode
sn
,
*
dn
;
int
fd
=
open
(
__SRCFILE__
".ft"
,
O_RDWR
|
O_CREAT
|
O_BINARY
,
S_IRWXU
|
S_IRWXG
|
S_IRWXO
);
assert
(
fd
>=
0
);
...
...
@@ -190,7 +187,6 @@ test_serialize_nonleaf(int valsize, int nelts, double entropy) {
// source_ft.fd=fd;
sn
.
max_msn_applied_to_node_on_disk
.
msn
=
0
;
sn
.
nodesize
=
nodesize
;
sn
.
flags
=
0x11223344
;
sn
.
thisnodename
.
b
=
20
;
sn
.
layout_version
=
FT_LAYOUT_VERSION
;
...
...
ft/tests/ft-serialize-test.cc
View file @
c1c45c65
...
...
@@ -204,7 +204,6 @@ static void write_sn_to_disk(int fd, FT_HANDLE brt, FTNODE sn, FTNODE_DISK_DATA*
static
void
test_serialize_leaf_check_msn
(
enum
ftnode_verify_type
bft
,
bool
do_clone
)
{
// struct ft_handle source_ft;
const
int
nodesize
=
1024
;
struct
ftnode
sn
,
*
dn
;
int
fd
=
open
(
__SRCFILE__
".ft_handle"
,
O_RDWR
|
O_CREAT
|
O_BINARY
,
S_IRWXU
|
S_IRWXG
|
S_IRWXO
);
assert
(
fd
>=
0
);
...
...
@@ -215,7 +214,6 @@ test_serialize_leaf_check_msn(enum ftnode_verify_type bft, bool do_clone) {
#define POSTSERIALIZE_MSN_ON_DISK ((MSN) { MIN_MSN.msn + 84 })
sn
.
max_msn_applied_to_node_on_disk
=
PRESERIALIZE_MSN_ON_DISK
;
sn
.
nodesize
=
nodesize
;
sn
.
flags
=
0x11223344
;
sn
.
thisnodename
.
b
=
20
;
sn
.
layout_version
=
FT_LAYOUT_VERSION
;
...
...
@@ -362,7 +360,6 @@ test_serialize_leaf_with_large_pivots(enum ftnode_verify_type bft, bool do_clone
int
fd
=
open
(
__SRCFILE__
".ft_handle"
,
O_RDWR
|
O_CREAT
|
O_BINARY
,
S_IRWXU
|
S_IRWXG
|
S_IRWXO
);
assert
(
fd
>=
0
);
sn
.
max_msn_applied_to_node_on_disk
.
msn
=
0
;
sn
.
nodesize
=
4
*
(
1
<<
20
);
sn
.
flags
=
0x11223344
;
sn
.
thisnodename
.
b
=
20
;
sn
.
layout_version
=
FT_LAYOUT_VERSION
;
...
...
@@ -509,7 +506,6 @@ test_serialize_leaf_with_many_rows(enum ftnode_verify_type bft, bool do_clone) {
int
fd
=
open
(
__SRCFILE__
".ft_handle"
,
O_RDWR
|
O_CREAT
|
O_BINARY
,
S_IRWXU
|
S_IRWXG
|
S_IRWXO
);
assert
(
fd
>=
0
);
sn
.
max_msn_applied_to_node_on_disk
.
msn
=
0
;
sn
.
nodesize
=
4
*
(
1
<<
20
);
sn
.
flags
=
0x11223344
;
sn
.
thisnodename
.
b
=
20
;
sn
.
layout_version
=
FT_LAYOUT_VERSION
;
...
...
@@ -653,7 +649,6 @@ test_serialize_leaf_with_large_rows(enum ftnode_verify_type bft, bool do_clone)
int
fd
=
open
(
__SRCFILE__
".ft_handle"
,
O_RDWR
|
O_CREAT
|
O_BINARY
,
S_IRWXU
|
S_IRWXG
|
S_IRWXO
);
assert
(
fd
>=
0
);
sn
.
max_msn_applied_to_node_on_disk
.
msn
=
0
;
sn
.
nodesize
=
4
*
(
1
<<
20
);
sn
.
flags
=
0x11223344
;
sn
.
thisnodename
.
b
=
20
;
sn
.
layout_version
=
FT_LAYOUT_VERSION
;
...
...
@@ -797,7 +792,6 @@ test_serialize_leaf_with_large_rows(enum ftnode_verify_type bft, bool do_clone)
static
void
test_serialize_leaf_with_empty_basement_nodes
(
enum
ftnode_verify_type
bft
,
bool
do_clone
)
{
const
int
nodesize
=
1024
;
struct
ftnode
sn
,
*
dn
;
int
fd
=
open
(
__SRCFILE__
".ft_handle"
,
O_RDWR
|
O_CREAT
|
O_BINARY
,
S_IRWXU
|
S_IRWXG
|
S_IRWXO
);
assert
(
fd
>=
0
);
...
...
@@ -805,7 +799,6 @@ test_serialize_leaf_with_empty_basement_nodes(enum ftnode_verify_type bft, bool
int
r
;
sn
.
max_msn_applied_to_node_on_disk
.
msn
=
0
;
sn
.
nodesize
=
nodesize
;
sn
.
flags
=
0x11223344
;
sn
.
thisnodename
.
b
=
20
;
sn
.
layout_version
=
FT_LAYOUT_VERSION
;
...
...
@@ -950,7 +943,6 @@ test_serialize_leaf_with_empty_basement_nodes(enum ftnode_verify_type bft, bool
static
void
test_serialize_leaf_with_multiple_empty_basement_nodes
(
enum
ftnode_verify_type
bft
,
bool
do_clone
)
{
const
int
nodesize
=
1024
;
struct
ftnode
sn
,
*
dn
;
int
fd
=
open
(
__SRCFILE__
".ft_handle"
,
O_RDWR
|
O_CREAT
|
O_BINARY
,
S_IRWXU
|
S_IRWXG
|
S_IRWXO
);
assert
(
fd
>=
0
);
...
...
@@ -958,7 +950,6 @@ test_serialize_leaf_with_multiple_empty_basement_nodes(enum ftnode_verify_type b
int
r
;
sn
.
max_msn_applied_to_node_on_disk
.
msn
=
0
;
sn
.
nodesize
=
nodesize
;
sn
.
flags
=
0x11223344
;
sn
.
thisnodename
.
b
=
20
;
sn
.
layout_version
=
FT_LAYOUT_VERSION
;
...
...
@@ -1070,7 +1061,6 @@ test_serialize_leaf_with_multiple_empty_basement_nodes(enum ftnode_verify_type b
static
void
test_serialize_leaf
(
enum
ftnode_verify_type
bft
,
bool
do_clone
)
{
// struct ft_handle source_ft;
const
int
nodesize
=
1024
;
struct
ftnode
sn
,
*
dn
;
int
fd
=
open
(
__SRCFILE__
".ft_handle"
,
O_RDWR
|
O_CREAT
|
O_BINARY
,
S_IRWXU
|
S_IRWXG
|
S_IRWXO
);
assert
(
fd
>=
0
);
...
...
@@ -1080,7 +1070,6 @@ test_serialize_leaf(enum ftnode_verify_type bft, bool do_clone) {
FTNODE_DISK_DATA
dest_ndd
=
NULL
;
sn
.
max_msn_applied_to_node_on_disk
.
msn
=
0
;
sn
.
nodesize
=
nodesize
;
sn
.
flags
=
0x11223344
;
sn
.
thisnodename
.
b
=
20
;
sn
.
layout_version
=
FT_LAYOUT_VERSION
;
...
...
@@ -1214,7 +1203,6 @@ test_serialize_leaf(enum ftnode_verify_type bft, bool do_clone) {
static
void
test_serialize_nonleaf
(
enum
ftnode_verify_type
bft
,
bool
do_clone
)
{
// struct ft_handle source_ft;
const
int
nodesize
=
1024
;
struct
ftnode
sn
,
*
dn
;
int
fd
=
open
(
__SRCFILE__
".ft_handle"
,
O_RDWR
|
O_CREAT
|
O_BINARY
,
S_IRWXU
|
S_IRWXG
|
S_IRWXO
);
assert
(
fd
>=
0
);
...
...
@@ -1224,7 +1212,6 @@ test_serialize_nonleaf(enum ftnode_verify_type bft, bool do_clone) {
// source_ft.fd=fd;
sn
.
max_msn_applied_to_node_on_disk
.
msn
=
0
;
char
*
hello_string
;
sn
.
nodesize
=
nodesize
;
sn
.
flags
=
0x11223344
;
sn
.
thisnodename
.
b
=
20
;
sn
.
layout_version
=
FT_LAYOUT_VERSION
;
...
...
ft/tests/orthopush-flush.cc
View file @
c1c45c65
...
...
@@ -271,7 +271,7 @@ flush_to_internal(FT_HANDLE t) {
FTNODE
XMALLOC
(
child
);
BLOCKNUM
blocknum
=
{
42
};
toku_initialize_empty_ftnode
(
child
,
blocknum
,
1
,
1
,
FT_LAYOUT_VERSION
,
128
*
1024
,
0
);
toku_initialize_empty_ftnode
(
child
,
blocknum
,
1
,
1
,
FT_LAYOUT_VERSION
,
0
);
destroy_nonleaf_childinfo
(
BNC
(
child
,
0
));
set_BNC
(
child
,
0
,
child_bnc
);
BP_STATE
(
child
,
0
)
=
PT_AVAIL
;
...
...
@@ -401,7 +401,7 @@ flush_to_internal_multiple(FT_HANDLE t) {
FTNODE
XMALLOC
(
child
);
BLOCKNUM
blocknum
=
{
42
};
toku_initialize_empty_ftnode
(
child
,
blocknum
,
1
,
8
,
FT_LAYOUT_VERSION
,
128
*
1024
,
0
);
toku_initialize_empty_ftnode
(
child
,
blocknum
,
1
,
8
,
FT_LAYOUT_VERSION
,
0
);
for
(
i
=
0
;
i
<
8
;
++
i
)
{
destroy_nonleaf_childinfo
(
BNC
(
child
,
i
));
set_BNC
(
child
,
i
,
child_bncs
[
i
]);
...
...
@@ -532,7 +532,7 @@ flush_to_leaf(FT_HANDLE t, bool make_leaf_up_to_date, bool use_flush) {
FTNODE
XMALLOC
(
child
);
BLOCKNUM
blocknum
=
{
42
};
toku_initialize_empty_ftnode
(
child
,
blocknum
,
0
,
8
,
FT_LAYOUT_VERSION
,
128
*
1024
,
0
);
toku_initialize_empty_ftnode
(
child
,
blocknum
,
0
,
8
,
FT_LAYOUT_VERSION
,
0
);
for
(
i
=
0
;
i
<
8
;
++
i
)
{
destroy_basement_node
(
BLB
(
child
,
i
));
set_BLB
(
child
,
i
,
child_blbs
[
i
]);
...
...
@@ -608,7 +608,7 @@ flush_to_leaf(FT_HANDLE t, bool make_leaf_up_to_date, bool use_flush) {
}
else
{
FTNODE
XMALLOC
(
parentnode
);
BLOCKNUM
parentblocknum
=
{
17
};
toku_initialize_empty_ftnode
(
parentnode
,
parentblocknum
,
1
,
1
,
FT_LAYOUT_VERSION
,
128
*
1024
,
0
);
toku_initialize_empty_ftnode
(
parentnode
,
parentblocknum
,
1
,
1
,
FT_LAYOUT_VERSION
,
0
);
destroy_nonleaf_childinfo
(
BNC
(
parentnode
,
0
));
set_BNC
(
parentnode
,
0
,
parent_bnc
);
BP_STATE
(
parentnode
,
0
)
=
PT_AVAIL
;
...
...
@@ -758,7 +758,7 @@ flush_to_leaf_with_keyrange(FT_HANDLE t, bool make_leaf_up_to_date) {
FTNODE
XMALLOC
(
child
);
BLOCKNUM
blocknum
=
{
42
};
toku_initialize_empty_ftnode
(
child
,
blocknum
,
0
,
8
,
FT_LAYOUT_VERSION
,
128
*
1024
,
0
);
toku_initialize_empty_ftnode
(
child
,
blocknum
,
0
,
8
,
FT_LAYOUT_VERSION
,
0
);
for
(
i
=
0
;
i
<
8
;
++
i
)
{
destroy_basement_node
(
BLB
(
child
,
i
));
set_BLB
(
child
,
i
,
child_blbs
[
i
]);
...
...
@@ -829,7 +829,7 @@ flush_to_leaf_with_keyrange(FT_HANDLE t, bool make_leaf_up_to_date) {
FTNODE
XMALLOC
(
parentnode
);
BLOCKNUM
parentblocknum
=
{
17
};
toku_initialize_empty_ftnode
(
parentnode
,
parentblocknum
,
1
,
1
,
FT_LAYOUT_VERSION
,
128
*
1024
,
0
);
toku_initialize_empty_ftnode
(
parentnode
,
parentblocknum
,
1
,
1
,
FT_LAYOUT_VERSION
,
0
);
destroy_nonleaf_childinfo
(
BNC
(
parentnode
,
0
));
set_BNC
(
parentnode
,
0
,
parent_bnc
);
BP_STATE
(
parentnode
,
0
)
=
PT_AVAIL
;
...
...
@@ -940,8 +940,8 @@ compare_apply_and_flush(FT_HANDLE t, bool make_leaf_up_to_date) {
FTNODE
XMALLOC
(
child1
),
XMALLOC
(
child2
);
BLOCKNUM
blocknum
=
{
42
};
toku_initialize_empty_ftnode
(
child1
,
blocknum
,
0
,
8
,
FT_LAYOUT_VERSION
,
128
*
1024
,
0
);
toku_initialize_empty_ftnode
(
child2
,
blocknum
,
0
,
8
,
FT_LAYOUT_VERSION
,
128
*
1024
,
0
);
toku_initialize_empty_ftnode
(
child1
,
blocknum
,
0
,
8
,
FT_LAYOUT_VERSION
,
0
);
toku_initialize_empty_ftnode
(
child2
,
blocknum
,
0
,
8
,
FT_LAYOUT_VERSION
,
0
);
for
(
i
=
0
;
i
<
8
;
++
i
)
{
destroy_basement_node
(
BLB
(
child1
,
i
));
set_BLB
(
child1
,
i
,
child1_blbs
[
i
]);
...
...
@@ -1016,7 +1016,7 @@ compare_apply_and_flush(FT_HANDLE t, bool make_leaf_up_to_date) {
FTNODE
XMALLOC
(
parentnode
);
BLOCKNUM
parentblocknum
=
{
17
};
toku_initialize_empty_ftnode
(
parentnode
,
parentblocknum
,
1
,
1
,
FT_LAYOUT_VERSION
,
128
*
1024
,
0
);
toku_initialize_empty_ftnode
(
parentnode
,
parentblocknum
,
1
,
1
,
FT_LAYOUT_VERSION
,
0
);
destroy_nonleaf_childinfo
(
BNC
(
parentnode
,
0
));
set_BNC
(
parentnode
,
0
,
parent_bnc
);
BP_STATE
(
parentnode
,
0
)
=
PT_AVAIL
;
...
...
ft/tests/test3884.cc
View file @
c1c45c65
...
...
@@ -81,7 +81,6 @@ insert_dummy_value(FTNODE node, int bn, long k)
static
void
setup_ftnode_header
(
struct
ftnode
*
node
)
{
node
->
nodesize
=
nodesize
;
node
->
flags
=
0x11223344
;
node
->
thisnodename
.
b
=
20
;
node
->
layout_version
=
FT_LAYOUT_VERSION
;
...
...
src/tests/CMakeLists.txt
View file @
c1c45c65
...
...
@@ -223,6 +223,7 @@ if(BUILD_TESTING)
test_bulk_fetch
test_compression_methods
test_cmp_descriptor
test_db_change_pagesize
test_db_change_xxx
test_cursor_delete_2119
test_db_descriptor
...
...
src/tests/test_db_change_pagesize.cc
0 → 100644
View file @
c1c45c65
/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
// vim: expandtab:ts=8:sw=4:softtabstop=4:
#ident "Copyright (c) 2007 Tokutek Inc. All rights reserved."
#include "test.h"
#include <stdio.h>
#include <db.h>
int
test_main
(
int
argc
,
char
*
const
argv
[])
{
parse_args
(
argc
,
argv
);
DB_ENV
*
env
;
DB
*
db
;
int
r
;
r
=
system
(
"rm -rf "
ENVDIR
);
CKERR
(
r
);
r
=
toku_os_mkdir
(
ENVDIR
,
S_IRWXU
+
S_IRWXG
+
S_IRWXO
);
assert
(
r
==
0
);
r
=
db_env_create
(
&
env
,
0
);
assert
(
r
==
0
);
r
=
env
->
open
(
env
,
ENVDIR
,
DB_INIT_LOCK
|
DB_INIT_LOG
|
DB_INIT_MPOOL
|
DB_INIT_TXN
|
DB_CREATE
|
DB_PRIVATE
|
DB_INIT_LOG
,
S_IRWXU
+
S_IRWXG
+
S_IRWXO
);
assert
(
r
==
0
);
r
=
db_create
(
&
db
,
env
,
0
);
CKERR
(
r
);
r
=
db
->
set_pagesize
(
db
,
10000
);
CKERR
(
r
);
const
char
*
const
fname
=
"test.change_pagesize"
;
r
=
db
->
open
(
db
,
NULL
,
fname
,
"main"
,
DB_BTREE
,
DB_CREATE
,
0666
);
CKERR
(
r
);
DB_TXN
*
txn
;
r
=
env
->
txn_begin
(
env
,
0
,
&
txn
,
0
);
CKERR
(
r
);
for
(
uint64_t
i
=
0
;
i
<
10000
;
i
++
)
{
DBT
key
,
val
;
uint64_t
k
=
i
;
uint64_t
v
=
i
;
dbt_init
(
&
key
,
&
k
,
sizeof
k
);
dbt_init
(
&
val
,
&
v
,
sizeof
v
);
db
->
put
(
db
,
txn
,
&
key
,
&
val
,
DB_PRELOCKED_WRITE
);
// adding DB_PRELOCKED_WRITE just to make the test go faster
}
r
=
txn
->
commit
(
txn
,
0
);
CKERR
(
r
);
// now we change the pagesize. In 6.1.0, this would eventually cause a crash
r
=
db
->
change_pagesize
(
db
,
1024
);
CKERR
(
r
);
r
=
env
->
txn_begin
(
env
,
0
,
&
txn
,
0
);
CKERR
(
r
);
for
(
uint64_t
i
=
0
;
i
<
10000
;
i
++
)
{
DBT
key
,
val
;
uint64_t
k
=
10000
+
i
;
uint64_t
v
=
i
;
dbt_init
(
&
key
,
&
k
,
sizeof
k
);
dbt_init
(
&
val
,
&
v
,
sizeof
v
);
db
->
put
(
db
,
txn
,
&
key
,
&
val
,
DB_PRELOCKED_WRITE
);
// adding DB_PRELOCKED_WRITE just to make the test go faster
}
r
=
txn
->
commit
(
txn
,
0
);
CKERR
(
r
);
r
=
db
->
close
(
db
,
0
);
CKERR
(
r
);
r
=
env
->
close
(
env
,
0
);
assert
(
r
==
0
);
return
0
;
}
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