Commit edc2a9c2 authored by Zardosht Kasheff's avatar Zardosht Kasheff Committed by Yoni Fogel

refs #5737, merge to main

git-svn-id: file:///svn/toku/tokudb@53577 c7de825b-a66e-492c-adef-691d508d4ae1
parent eb0a7bc7
...@@ -884,6 +884,7 @@ static void ...@@ -884,6 +884,7 @@ static void
clone_pair(evictor* ev, PAIR p) { clone_pair(evictor* ev, PAIR p) {
PAIR_ATTR old_attr = p->attr; PAIR_ATTR old_attr = p->attr;
PAIR_ATTR new_attr; PAIR_ATTR new_attr;
long clone_size = 0;
// act of cloning should be fast, // act of cloning should be fast,
// not sure if we have to release // not sure if we have to release
...@@ -892,6 +893,7 @@ clone_pair(evictor* ev, PAIR p) { ...@@ -892,6 +893,7 @@ clone_pair(evictor* ev, PAIR p) {
p->clone_callback( p->clone_callback(
p->value_data, p->value_data,
&p->cloned_value_data, &p->cloned_value_data,
&clone_size,
&new_attr, &new_attr,
true, true,
p->write_extraargs p->write_extraargs
...@@ -909,7 +911,7 @@ clone_pair(evictor* ev, PAIR p) { ...@@ -909,7 +911,7 @@ clone_pair(evictor* ev, PAIR p) {
p->attr = new_attr; p->attr = new_attr;
ev->change_pair_attr(old_attr, new_attr); ev->change_pair_attr(old_attr, new_attr);
} }
p->cloned_value_size = p->attr.size; p->cloned_value_size = clone_size;
ev->add_to_size_current(p->cloned_value_size); ev->add_to_size_current(p->cloned_value_size);
} }
......
...@@ -171,7 +171,7 @@ typedef void (*CACHETABLE_PUT_CALLBACK)(CACHEKEY key, void *value_data, PAIR p); ...@@ -171,7 +171,7 @@ typedef void (*CACHETABLE_PUT_CALLBACK)(CACHEKEY key, void *value_data, PAIR p);
// TODO(leif) XXX TODO XXX // TODO(leif) XXX TODO XXX
typedef int (*CACHETABLE_CLEANER_CALLBACK)(void *ftnode_pv, BLOCKNUM blocknum, uint32_t fullhash, void *write_extraargs); typedef int (*CACHETABLE_CLEANER_CALLBACK)(void *ftnode_pv, BLOCKNUM blocknum, uint32_t fullhash, void *write_extraargs);
typedef void (*CACHETABLE_CLONE_CALLBACK)(void* value_data, void** cloned_value_data, PAIR_ATTR* new_attr, bool for_checkpoint, void* write_extraargs); typedef void (*CACHETABLE_CLONE_CALLBACK)(void* value_data, void** cloned_value_data, long* clone_size, PAIR_ATTR* new_attr, bool for_checkpoint, void* write_extraargs);
typedef void (*CACHETABLE_CHECKPOINT_COMPLETE_CALLBACK)(void *value_data); typedef void (*CACHETABLE_CHECKPOINT_COMPLETE_CALLBACK)(void *value_data);
......
...@@ -639,7 +639,7 @@ void toku_ft_status_update_flush_reason(FTNODE node, uint64_t uncompressed_bytes ...@@ -639,7 +639,7 @@ void toku_ft_status_update_flush_reason(FTNODE node, uint64_t uncompressed_bytes
void toku_ft_status_update_serialize_times(FTNODE node, tokutime_t serialize_time, tokutime_t compress_time); void toku_ft_status_update_serialize_times(FTNODE node, tokutime_t serialize_time, tokutime_t compress_time);
void toku_ft_status_update_deserialize_times(FTNODE node, tokutime_t deserialize_time, tokutime_t decompress_time); void toku_ft_status_update_deserialize_times(FTNODE node, tokutime_t deserialize_time, tokutime_t decompress_time);
void toku_ftnode_clone_callback(void* value_data, void** cloned_value_data, PAIR_ATTR* new_attr, bool for_checkpoint, void* write_extraargs); void toku_ftnode_clone_callback(void* value_data, void** cloned_value_data, long* clone_size, PAIR_ATTR* new_attr, bool for_checkpoint, void* write_extraargs);
void toku_ftnode_checkpoint_complete_callback(void *value_data); void toku_ftnode_checkpoint_complete_callback(void *value_data);
void toku_ftnode_flush_callback (CACHEFILE cachefile, int fd, BLOCKNUM nodename, void *ftnode_v, void** UU(disk_data), void *extraargs, PAIR_ATTR size, PAIR_ATTR* new_size, bool write_me, bool keep_me, bool for_checkpoint, bool is_clone); void toku_ftnode_flush_callback (CACHEFILE cachefile, int fd, BLOCKNUM nodename, void *ftnode_v, void** UU(disk_data), void *extraargs, PAIR_ATTR size, PAIR_ATTR* new_size, bool write_me, bool keep_me, bool for_checkpoint, bool is_clone);
int toku_ftnode_fetch_callback (CACHEFILE cachefile, PAIR p, int fd, BLOCKNUM nodename, uint32_t fullhash, void **ftnode_pv, void** UU(disk_data), PAIR_ATTR *sizep, int*dirty, void*extraargs); int toku_ftnode_fetch_callback (CACHEFILE cachefile, PAIR p, int fd, BLOCKNUM nodename, uint32_t fullhash, void **ftnode_pv, void** UU(disk_data), PAIR_ATTR *sizep, int*dirty, void*extraargs);
......
...@@ -746,6 +746,7 @@ void toku_ftnode_checkpoint_complete_callback(void *value_data) { ...@@ -746,6 +746,7 @@ void toku_ftnode_checkpoint_complete_callback(void *value_data) {
void toku_ftnode_clone_callback( void toku_ftnode_clone_callback(
void* value_data, void* value_data,
void** cloned_value_data, void** cloned_value_data,
long* clone_size,
PAIR_ATTR* new_attr, PAIR_ATTR* new_attr,
bool for_checkpoint, bool for_checkpoint,
void* write_extraargs void* write_extraargs
...@@ -796,6 +797,7 @@ void toku_ftnode_clone_callback( ...@@ -796,6 +797,7 @@ void toku_ftnode_clone_callback(
else { else {
new_attr->is_valid = false; new_attr->is_valid = false;
} }
*clone_size = ftnode_memory_size(cloned_node);
*cloned_value_data = cloned_node; *cloned_value_data = cloned_node;
} }
......
...@@ -202,6 +202,7 @@ int toku_rollback_cleaner_callback ( ...@@ -202,6 +202,7 @@ int toku_rollback_cleaner_callback (
void toku_rollback_clone_callback( void toku_rollback_clone_callback(
void* value_data, void* value_data,
void** cloned_value_data, void** cloned_value_data,
long* clone_size,
PAIR_ATTR* new_attr, PAIR_ATTR* new_attr,
bool UU(for_checkpoint), bool UU(for_checkpoint),
void* UU(write_extraargs) void* UU(write_extraargs)
...@@ -213,9 +214,11 @@ void toku_rollback_clone_callback( ...@@ -213,9 +214,11 @@ void toku_rollback_clone_callback(
XMALLOC(serialized); XMALLOC(serialized);
toku_serialize_rollback_log_to_memory_uncompressed(log, serialized); toku_serialize_rollback_log_to_memory_uncompressed(log, serialized);
*cloned_value_data = serialized; *cloned_value_data = serialized;
*clone_size = sizeof(struct serialized_rollback_log_node) + serialized->len;
} }
else { else {
*cloned_value_data = &cloned_rollback; *cloned_value_data = &cloned_rollback;
*clone_size = sizeof(cloned_rollback);
} }
// clear the dirty bit, because the node has been cloned // clear the dirty bit, because the node has been cloned
log->dirty = 0; log->dirty = 0;
......
...@@ -28,7 +28,7 @@ int toku_rollback_pe_callback ( ...@@ -28,7 +28,7 @@ int toku_rollback_pe_callback (
) ; ) ;
bool toku_rollback_pf_req_callback(void* UU(ftnode_pv), void* UU(read_extraargs)) ; bool toku_rollback_pf_req_callback(void* UU(ftnode_pv), void* UU(read_extraargs)) ;
int toku_rollback_pf_callback(void* UU(ftnode_pv), void* UU(disk_data), void* UU(read_extraargs), int UU(fd), PAIR_ATTR* UU(sizep)); int toku_rollback_pf_callback(void* UU(ftnode_pv), void* UU(disk_data), void* UU(read_extraargs), int UU(fd), PAIR_ATTR* UU(sizep));
void toku_rollback_clone_callback(void* value_data, void** cloned_value_data, PAIR_ATTR* new_attr, bool for_checkpoint, void* write_extraargs); void toku_rollback_clone_callback(void* value_data, void** cloned_value_data, long* clone_size, PAIR_ATTR* new_attr, bool for_checkpoint, void* write_extraargs);
int toku_rollback_cleaner_callback ( int toku_rollback_cleaner_callback (
void* UU(ftnode_pv), void* UU(ftnode_pv),
......
...@@ -7,9 +7,10 @@ ...@@ -7,9 +7,10 @@
#include "cachetable-test.h" #include "cachetable-test.h"
static void static void
clone_callback(void* UU(value_data), void** cloned_value_data, PAIR_ATTR* new_attr, bool UU(for_checkpoint), void* UU(write_extraargs)) clone_callback(void* UU(value_data), void** cloned_value_data, long* clone_size, PAIR_ATTR* new_attr, bool UU(for_checkpoint), void* UU(write_extraargs))
{ {
*cloned_value_data = (void *)1; *cloned_value_data = (void *)1;
*clone_size = 8;
new_attr->is_valid = false; new_attr->is_valid = false;
} }
......
...@@ -10,9 +10,10 @@ bool flush_completed; ...@@ -10,9 +10,10 @@ bool flush_completed;
bool pf_called; bool pf_called;
static void static void
clone_callback(void* UU(value_data), void** cloned_value_data, PAIR_ATTR* new_attr, bool UU(for_checkpoint), void* UU(write_extraargs)) clone_callback(void* UU(value_data), void** cloned_value_data, long* clone_size, PAIR_ATTR* new_attr, bool UU(for_checkpoint), void* UU(write_extraargs))
{ {
*cloned_value_data = (void *)1; *cloned_value_data = (void *)1;
*clone_size = 8;
new_attr->is_valid = false; new_attr->is_valid = false;
} }
......
...@@ -10,9 +10,10 @@ bool flush_completed; ...@@ -10,9 +10,10 @@ bool flush_completed;
bool pf_called; bool pf_called;
static void static void
clone_callback(void* UU(value_data), void** cloned_value_data, PAIR_ATTR* new_attr, bool UU(for_checkpoint), void* UU(write_extraargs)) clone_callback(void* UU(value_data), void** cloned_value_data, long* clone_size, PAIR_ATTR* new_attr, bool UU(for_checkpoint), void* UU(write_extraargs))
{ {
*cloned_value_data = (void *)1; *cloned_value_data = (void *)1;
*clone_size = 8;
new_attr->is_valid = false; new_attr->is_valid = false;
} }
......
...@@ -8,9 +8,10 @@ ...@@ -8,9 +8,10 @@
static void static void
clone_callback(void* UU(value_data), void** cloned_value_data, PAIR_ATTR* new_attr, bool UU(for_checkpoint), void* UU(write_extraargs)) clone_callback(void* UU(value_data), void** cloned_value_data, long* clone_size, PAIR_ATTR* new_attr, bool UU(for_checkpoint), void* UU(write_extraargs))
{ {
*cloned_value_data = (void *)1; *cloned_value_data = (void *)1;
*clone_size = 8;
new_attr->is_valid = false; new_attr->is_valid = false;
} }
......
...@@ -10,9 +10,10 @@ bool flush_completed; ...@@ -10,9 +10,10 @@ bool flush_completed;
bool evict_called; bool evict_called;
static void static void
clone_callback(void* UU(value_data), void** cloned_value_data, PAIR_ATTR* new_attr, bool UU(for_checkpoint), void* UU(write_extraargs)) clone_callback(void* UU(value_data), void** cloned_value_data, long* clone_size, PAIR_ATTR* new_attr, bool UU(for_checkpoint), void* UU(write_extraargs))
{ {
*cloned_value_data = (void *)1; *cloned_value_data = (void *)1;
*clone_size = 8;
new_attr->is_valid = false; new_attr->is_valid = false;
} }
......
...@@ -29,6 +29,7 @@ static void ...@@ -29,6 +29,7 @@ static void
clone_callback( clone_callback(
void* value_data, void* value_data,
void** cloned_value_data, void** cloned_value_data,
long* clone_size,
PAIR_ATTR* new_attr, PAIR_ATTR* new_attr,
bool UU(for_checkpoint), bool UU(for_checkpoint),
void* UU(write_extraargs) void* UU(write_extraargs)
...@@ -37,7 +38,8 @@ clone_callback( ...@@ -37,7 +38,8 @@ clone_callback(
new_attr->is_valid = false; new_attr->is_valid = false;
int64_t* XMALLOC(data_val); int64_t* XMALLOC(data_val);
*data_val = *(int64_t *)value_data; *data_val = *(int64_t *)value_data;
*cloned_value_data = data_val; *cloned_value_data = data_val;
*clone_size = 8;
} }
......
...@@ -42,6 +42,7 @@ static void ...@@ -42,6 +42,7 @@ static void
clone_callback( clone_callback(
void* value_data, void* value_data,
void** cloned_value_data, void** cloned_value_data,
long* clone_size,
PAIR_ATTR* new_attr, PAIR_ATTR* new_attr,
bool UU(for_checkpoint), bool UU(for_checkpoint),
void* UU(write_extraargs) void* UU(write_extraargs)
...@@ -52,6 +53,7 @@ clone_callback( ...@@ -52,6 +53,7 @@ clone_callback(
*data_val = *(int64_t *)value_data; *data_val = *(int64_t *)value_data;
*cloned_value_data = data_val; *cloned_value_data = data_val;
*new_attr = make_pair_attr(8); *new_attr = make_pair_attr(8);
*clone_size = 8;
} }
static void static void
......
...@@ -12,11 +12,12 @@ bool flush_expected; ...@@ -12,11 +12,12 @@ bool flush_expected;
bool flush_called; bool flush_called;
static void static void
clone_callback(void* UU(value_data), void** cloned_value_data, PAIR_ATTR* new_attr, bool UU(for_checkpoint), void* UU(write_extraargs)) clone_callback(void* UU(value_data), void** cloned_value_data, long* clone_size, PAIR_ATTR* new_attr, bool UU(for_checkpoint), void* UU(write_extraargs))
{ {
*cloned_value_data = (void *)1; *cloned_value_data = (void *)1;
new_attr->is_valid = false; new_attr->is_valid = false;
clone_called = true; clone_called = true;
*clone_size = 8;
} }
static void static void
......
...@@ -12,11 +12,12 @@ bool flush_expected; ...@@ -12,11 +12,12 @@ bool flush_expected;
bool flush_called; bool flush_called;
static void static void
clone_callback(void* UU(value_data), void** cloned_value_data, PAIR_ATTR* new_attr, bool UU(for_checkpoint), void* UU(write_extraargs)) clone_callback(void* UU(value_data), void** cloned_value_data, long* clone_size, PAIR_ATTR* new_attr, bool UU(for_checkpoint), void* UU(write_extraargs))
{ {
*cloned_value_data = (void *)1; *cloned_value_data = (void *)1;
new_attr->is_valid = false; new_attr->is_valid = false;
clone_called = true; clone_called = true;
*clone_size = 8;
} }
static void static void
......
...@@ -191,7 +191,8 @@ static void write_sn_to_disk(int fd, FT_HANDLE brt, FTNODE sn, FTNODE_DISK_DATA* ...@@ -191,7 +191,8 @@ static void write_sn_to_disk(int fd, FT_HANDLE brt, FTNODE sn, FTNODE_DISK_DATA*
if (do_clone) { if (do_clone) {
void* cloned_node_v = NULL; void* cloned_node_v = NULL;
PAIR_ATTR attr; PAIR_ATTR attr;
toku_ftnode_clone_callback(sn, &cloned_node_v, &attr, false, brt->ft); long clone_size;
toku_ftnode_clone_callback(sn, &cloned_node_v, &clone_size, &attr, false, brt->ft);
FTNODE CAST_FROM_VOIDP(cloned_node, cloned_node_v); FTNODE CAST_FROM_VOIDP(cloned_node, cloned_node_v);
r = toku_serialize_ftnode_to(fd, make_blocknum(20), cloned_node, src_ndd, false, brt->ft, false); r = toku_serialize_ftnode_to(fd, make_blocknum(20), cloned_node, src_ndd, false, brt->ft, false);
assert(r==0); assert(r==0);
......
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