Commit a242d962 authored by Rich Prohaska's avatar Rich Prohaska Committed by Yoni Fogel

merge serialize.c from 3.0.4 to main refs[t:2371]

git-svn-id: file:///svn/toku/tokudb@18055 c7de825b-a66e-492c-adef-691d508d4ae1
parent 254e5dca
...@@ -288,10 +288,12 @@ static inline int roundup2(int n, int alignment) { ...@@ -288,10 +288,12 @@ static inline int roundup2(int n, int alignment) {
return (n+alignment-1)&~(alignment-1); return (n+alignment-1)&~(alignment-1);
} }
static const int target_sub_block_size = 512*1024;
static const int max_sub_blocks = 8;
// choose the number of sub blocks such that the sub block size // choose the number of sub blocks such that the sub block size
// is around 1 meg. put an upper bound on the number of sub blocks. // is around 1 meg. put an upper bound on the number of sub blocks.
static int choose_sub_block_sizes(int total_size, int maxn, struct sub_block_sizes sizes[]) { static int choose_sub_block_sizes(int total_size, int maxn, struct sub_block_sizes sizes[]) {
const int target_sub_block_size = 512*1024;
const int alignment = 256; const int alignment = 256;
int n, subsize; int n, subsize;
...@@ -518,7 +520,6 @@ int toku_serialize_brtnode_to (int fd, BLOCKNUM blocknum, BRTNODE node, struct b ...@@ -518,7 +520,6 @@ int toku_serialize_brtnode_to (int fd, BLOCKNUM blocknum, BRTNODE node, struct b
// select the number of sub blocks and their sizes. // select the number of sub blocks and their sizes.
// impose an upper bound on the number of sub blocks. // impose an upper bound on the number of sub blocks.
int max_sub_blocks = 4;
struct sub_block_sizes sub_block_sizes[max_sub_blocks]; struct sub_block_sizes sub_block_sizes[max_sub_blocks];
int n_sub_blocks = choose_sub_block_sizes(calculated_size-uncompressed_magic_len, max_sub_blocks, sub_block_sizes); int n_sub_blocks = choose_sub_block_sizes(calculated_size-uncompressed_magic_len, max_sub_blocks, sub_block_sizes);
assert(0 < n_sub_blocks && n_sub_blocks <= max_sub_blocks); assert(0 < n_sub_blocks && n_sub_blocks <= max_sub_blocks);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment