mirror of
https://github.com/MariaDB/server.git
synced 2025-01-22 14:54:20 +01:00
refs #5372 Merging to main: new cachetable helper functions to simulate CACHEFILE callbacks.
git-svn-id: file:///svn/toku/tokudb@47778 c7de825b-a66e-492c-adef-691d508d4ae1
This commit is contained in:
parent
b3c5f5f458
commit
cb85dc67aa
28 changed files with 122 additions and 97 deletions
|
@ -4,6 +4,7 @@
|
|||
#ident "Copyright (c) 2007-2012 Tokutek Inc. All rights reserved."
|
||||
#include "includes.h"
|
||||
#include "test.h"
|
||||
#include "cachetable-test.h"
|
||||
|
||||
CACHETABLE ct;
|
||||
|
||||
|
@ -27,6 +28,7 @@ run_test (void) {
|
|||
unlink(fname1);
|
||||
f1 = NULL;
|
||||
r = toku_cachetable_openf(&f1, ct, fname1, O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); assert(r == 0);
|
||||
create_dummy_functions(f1);
|
||||
|
||||
void* v1;
|
||||
void* v2;
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "test.h"
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include "cachetable-test.h"
|
||||
#include "checkpoint.h"
|
||||
|
||||
static int N; // how many items in the table
|
||||
|
@ -100,10 +101,6 @@ do_checkpoint (void *UU(v))
|
|||
// make sure that the stuff that was checkpointed includes only the old versions
|
||||
// then do a flush and make sure the new items are written
|
||||
|
||||
static int dummy_pin_unpin(CACHEFILE UU(cfu), void* UU(v)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void checkpoint_pending(void) {
|
||||
if (verbose) { printf("%s:%d n=%d\n", __FUNCTION__, __LINE__, N); fflush(stdout); }
|
||||
const int test_limit = N;
|
||||
|
@ -112,8 +109,7 @@ static void checkpoint_pending(void) {
|
|||
char fname1[] = __SRCFILE__ "test1.dat";
|
||||
r = unlink(fname1); if (r!=0) CKERR2(get_error_errno(), ENOENT);
|
||||
r = toku_cachetable_openf(&cf, ct, fname1, O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); assert(r == 0);
|
||||
toku_cachefile_set_userdata(cf, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
dummy_pin_unpin, dummy_pin_unpin);
|
||||
create_dummy_functions(cf);
|
||||
|
||||
// Insert items into the cachetable. All dirty.
|
||||
int i;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#ident "Copyright (c) 2007-2012 Tokutek Inc. All rights reserved."
|
||||
#include "includes.h"
|
||||
#include "test.h"
|
||||
#include "cachetable-test.h"
|
||||
|
||||
uint64_t clean_val = 0;
|
||||
uint64_t dirty_val = 0;
|
||||
|
@ -72,6 +73,7 @@ cachetable_test (void) {
|
|||
unlink(fname1);
|
||||
CACHEFILE f1;
|
||||
r = toku_cachetable_openf(&f1, ct, fname1, O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); assert(r == 0);
|
||||
create_dummy_functions(f1);
|
||||
|
||||
void* v1;
|
||||
void* v2;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#ident "Copyright (c) 2007-2012 Tokutek Inc. All rights reserved."
|
||||
#include "includes.h"
|
||||
#include "test.h"
|
||||
#include "cachetable-test.h"
|
||||
|
||||
uint64_t clean_val = 0;
|
||||
uint64_t dirty_val = 0;
|
||||
|
@ -74,6 +75,7 @@ cachetable_test (void) {
|
|||
unlink(fname1);
|
||||
CACHEFILE f1;
|
||||
r = toku_cachetable_openf(&f1, ct, fname1, O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); assert(r == 0);
|
||||
create_dummy_functions(f1);
|
||||
|
||||
bool doing_prefetch = false;
|
||||
CACHETABLE_WRITE_CALLBACK wc = def_write_callback(&dirty_val);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#ident "$Id$"
|
||||
#ident "Copyright (c) 2007-2012 Tokutek Inc. All rights reserved."
|
||||
#include "test.h"
|
||||
#include "cachetable-test.h"
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
|
@ -54,10 +55,6 @@ static void checkpoint_callback2(void * extra) {
|
|||
// put n items into the cachetable, maybe mark them dirty, do a checkpoint, and
|
||||
// verify that all of the items have been written and are clean.
|
||||
|
||||
static int dummy_pin_unpin(CACHEFILE UU(cfu), void* UU(v)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void cachetable_checkpoint_test(int n, enum cachetable_dirty dirty) {
|
||||
if (verbose) printf("%s:%d n=%d dirty=%d\n", __FUNCTION__, __LINE__, n, (int) dirty);
|
||||
const int test_limit = n;
|
||||
|
@ -68,8 +65,7 @@ static void cachetable_checkpoint_test(int n, enum cachetable_dirty dirty) {
|
|||
unlink(fname1);
|
||||
CACHEFILE f1;
|
||||
r = toku_cachetable_openf(&f1, ct, fname1, O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); assert(r == 0);
|
||||
toku_cachefile_set_userdata(f1, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
dummy_pin_unpin, dummy_pin_unpin);
|
||||
create_dummy_functions(f1);
|
||||
|
||||
// insert items into the cachetable. all should be dirty
|
||||
int i;
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "includes.h"
|
||||
#include "test.h"
|
||||
#include "cachetable-internal.h"
|
||||
#include "cachetable-test.h"
|
||||
|
||||
//
|
||||
// Wrapper for the checkpointer and necessary
|
||||
|
@ -27,47 +28,6 @@ struct checkpointer_test {
|
|||
uint32_t k);
|
||||
};
|
||||
|
||||
//
|
||||
// Dummy callbacks for checkpointing
|
||||
//
|
||||
static int dummy_log_fassociate(CACHEFILE UU(cf), void* UU(p))
|
||||
{ return 0; }
|
||||
static int dummy_log_rollback(CACHEFILE UU(cf), void* UU(p))
|
||||
{ return 0; }
|
||||
static int dummy_close_usr(CACHEFILE UU(cf), int UU(i), void* UU(p), char** UU(c), bool UU(b), LSN UU(lsn))
|
||||
{ return 0; }
|
||||
static int dummy_chckpnt_usr(CACHEFILE UU(cf), int UU(i), void* UU(p))
|
||||
{ return 0; }
|
||||
static int dummy_begin(LSN UU(lsn), void* UU(p))
|
||||
{ return 0; }
|
||||
static int dummy_end(CACHEFILE UU(cf), int UU(i), void* UU(p))
|
||||
{ return 0; }
|
||||
static int dummy_note_pin(CACHEFILE UU(cf), void* UU(p))
|
||||
{ return 0; }
|
||||
static int dummy_note_unpin(CACHEFILE UU(cf), void* UU(p))
|
||||
{ return 0; }
|
||||
|
||||
|
||||
//
|
||||
// Helper function to set dummy functions in given cachefile.
|
||||
//
|
||||
static void
|
||||
create_dummy_functions(CACHEFILE cf)
|
||||
{
|
||||
void *ud = NULL;
|
||||
toku_cachefile_set_userdata (cf,
|
||||
ud,
|
||||
&dummy_log_fassociate,
|
||||
&dummy_log_rollback,
|
||||
&dummy_close_usr,
|
||||
&dummy_chckpnt_usr,
|
||||
&dummy_begin,
|
||||
&dummy_end,
|
||||
&dummy_note_pin,
|
||||
&dummy_note_unpin);
|
||||
}
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// test_begin_checkpoint() -
|
||||
//
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#ident "Copyright (c) 2007-2012 Tokutek Inc. All rights reserved."
|
||||
#include "includes.h"
|
||||
#include "test.h"
|
||||
#include "cachetable-test.h"
|
||||
|
||||
CACHEFILE f1;
|
||||
|
||||
|
@ -66,6 +67,7 @@ cachetable_test (void) {
|
|||
char fname1[] = __SRCFILE__ "test1.dat";
|
||||
unlink(fname1);
|
||||
r = toku_cachetable_openf(&f1, ct, fname1, O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); assert(r == 0);
|
||||
create_dummy_functions(f1);
|
||||
|
||||
void* v1;
|
||||
//void* v2;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#ident "Copyright (c) 2007-2012 Tokutek Inc. All rights reserved."
|
||||
#include "includes.h"
|
||||
#include "test.h"
|
||||
#include "cachetable-test.h"
|
||||
|
||||
CACHEFILE f1;
|
||||
|
||||
|
@ -66,6 +67,7 @@ cachetable_test (void) {
|
|||
char fname1[] = __SRCFILE__ "test1.dat";
|
||||
unlink(fname1);
|
||||
r = toku_cachetable_openf(&f1, ct, fname1, O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); assert(r == 0);
|
||||
create_dummy_functions(f1);
|
||||
|
||||
void* v1;
|
||||
//void* v2;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#ident "Copyright (c) 2007-2012 Tokutek Inc. All rights reserved."
|
||||
#include "includes.h"
|
||||
#include "test.h"
|
||||
#include "cachetable-test.h"
|
||||
|
||||
//
|
||||
// simple tests for cleaner thread with an empty cachetable
|
||||
|
@ -21,6 +22,7 @@ cachetable_test (void) {
|
|||
unlink(fname1);
|
||||
CACHEFILE f1;
|
||||
r = toku_cachetable_openf(&f1, ct, fname1, O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); assert(r == 0);
|
||||
create_dummy_functions(f1);
|
||||
|
||||
usleep(4000000);
|
||||
CHECKPOINTER cp = toku_cachetable_get_checkpointer(ct);
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#ident "Copyright (c) 2007-2012 Tokutek Inc. All rights reserved."
|
||||
#include "includes.h"
|
||||
#include "test.h"
|
||||
|
||||
#include "cachetable-test.h"
|
||||
|
||||
static void
|
||||
clone_callback(void* UU(value_data), void** cloned_value_data, PAIR_ATTR* new_attr, bool UU(for_checkpoint), void* UU(write_extraargs))
|
||||
|
@ -65,6 +65,7 @@ cachetable_test (void) {
|
|||
unlink(fname1);
|
||||
CACHEFILE f1;
|
||||
r = toku_cachetable_openf(&f1, ct, fname1, O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); assert(r == 0);
|
||||
create_dummy_functions(f1);
|
||||
|
||||
void* v1;
|
||||
long s1;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#ident "Copyright (c) 2007-2012 Tokutek Inc. All rights reserved."
|
||||
#include "includes.h"
|
||||
#include "test.h"
|
||||
|
||||
#include "cachetable-test.h"
|
||||
|
||||
bool flush_completed;
|
||||
bool pf_called;
|
||||
|
@ -58,6 +58,7 @@ cachetable_test (void) {
|
|||
unlink(fname1);
|
||||
CACHEFILE f1;
|
||||
r = toku_cachetable_openf(&f1, ct, fname1, O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); assert(r == 0);
|
||||
create_dummy_functions(f1);
|
||||
|
||||
void* v1;
|
||||
long s1;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#ident "Copyright (c) 2007-2012 Tokutek Inc. All rights reserved."
|
||||
#include "includes.h"
|
||||
#include "test.h"
|
||||
|
||||
#include "cachetable-test.h"
|
||||
|
||||
bool flush_completed;
|
||||
bool pf_called;
|
||||
|
@ -63,6 +63,7 @@ cachetable_test (void) {
|
|||
unlink(fname1);
|
||||
CACHEFILE f1;
|
||||
r = toku_cachetable_openf(&f1, ct, fname1, O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); assert(r == 0);
|
||||
create_dummy_functions(f1);
|
||||
|
||||
void* v1;
|
||||
long s1;
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
#ident "Copyright (c) 2007-2012 Tokutek Inc. All rights reserved."
|
||||
#include "includes.h"
|
||||
#include "test.h"
|
||||
#include "cachetable-test.h"
|
||||
|
||||
|
||||
static void
|
||||
clone_callback(void* UU(value_data), void** cloned_value_data, PAIR_ATTR* new_attr, bool UU(for_checkpoint), void* UU(write_extraargs))
|
||||
|
@ -43,6 +45,7 @@ cachetable_test (enum cachetable_dirty dirty, bool cloneable) {
|
|||
unlink(fname1);
|
||||
CACHEFILE f1;
|
||||
r = toku_cachetable_openf(&f1, ct, fname1, O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); assert(r == 0);
|
||||
create_dummy_functions(f1);
|
||||
|
||||
void* v1;
|
||||
long s1;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#ident "Copyright (c) 2007-2012 Tokutek Inc. All rights reserved."
|
||||
#include "includes.h"
|
||||
#include "test.h"
|
||||
|
||||
#include "cachetable-test.h"
|
||||
|
||||
bool flush_completed;
|
||||
bool evict_called;
|
||||
|
@ -56,6 +56,7 @@ cachetable_test (void) {
|
|||
unlink(fname1);
|
||||
CACHEFILE f1;
|
||||
r = toku_cachetable_openf(&f1, ct, fname1, O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); assert(r == 0);
|
||||
create_dummy_functions(f1);
|
||||
|
||||
void* v1;
|
||||
long s1;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#ident "Copyright (c) 2007-2012 Tokutek Inc. All rights reserved."
|
||||
#include "includes.h"
|
||||
#include "test.h"
|
||||
|
||||
#include "cachetable-test.h"
|
||||
|
||||
//
|
||||
// This test ensures that get_and_pin with dependent nodes works
|
||||
|
@ -344,14 +344,14 @@ cachetable_test (void) {
|
|||
toku_cachefile_set_userdata(
|
||||
f1,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
&dummy_log_fassociate,
|
||||
&dummy_log_rollback,
|
||||
&dummy_close_usr,
|
||||
dummy_int_checkpoint_userdata,
|
||||
test_begin_checkpoint, // called in begin_checkpoint
|
||||
dummy_int_checkpoint_userdata,
|
||||
NULL,
|
||||
NULL
|
||||
&dummy_note_pin,
|
||||
&dummy_note_unpin
|
||||
);
|
||||
|
||||
toku_pthread_t time_tid;
|
||||
|
|
|
@ -4,12 +4,12 @@
|
|||
#ident "Copyright (c) 2007-2012 Tokutek Inc. All rights reserved."
|
||||
#include "includes.h"
|
||||
#include "test.h"
|
||||
#include "cachetable-test.h"
|
||||
|
||||
CACHETABLE ct;
|
||||
|
||||
CACHEFILE f1;
|
||||
|
||||
|
||||
static void
|
||||
run_test (void) {
|
||||
const int test_limit = 20;
|
||||
|
@ -20,6 +20,7 @@ run_test (void) {
|
|||
unlink(fname1);
|
||||
f1 = NULL;
|
||||
r = toku_cachetable_openf(&f1, ct, fname1, O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); assert(r == 0);
|
||||
create_dummy_functions(f1);
|
||||
|
||||
void* v1;
|
||||
void* v2;
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include "test.h"
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "cachetable-test.h"
|
||||
|
||||
#include "checkpoint.h"
|
||||
|
||||
|
@ -59,9 +59,6 @@ static int fetch(
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int dummy_pin_unpin(CACHEFILE UU(cfu), void* UU(v)) {
|
||||
return 0;
|
||||
}
|
||||
// put n items into the cachetable, maybe mark them dirty, do a checkpoint, and
|
||||
// verify that all of the items have been written and are clean.
|
||||
static void cachetable_prefetch_checkpoint_test(int n, enum cachetable_dirty dirty) {
|
||||
|
@ -76,8 +73,7 @@ static void cachetable_prefetch_checkpoint_test(int n, enum cachetable_dirty dir
|
|||
unlink(fname1);
|
||||
CACHEFILE f1;
|
||||
r = toku_cachetable_openf(&f1, ct, fname1, O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); assert(r == 0);
|
||||
toku_cachefile_set_userdata(f1, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
dummy_pin_unpin, dummy_pin_unpin);
|
||||
create_dummy_functions(f1);
|
||||
|
||||
// prefetch block n+1. this will take 10 seconds.
|
||||
{
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#ident "Copyright (c) 2007-2012 Tokutek Inc. All rights reserved."
|
||||
#include "includes.h"
|
||||
#include "test.h"
|
||||
|
||||
#include "cachetable-test.h"
|
||||
|
||||
//
|
||||
// This test ensures that get_and_pin with dependent nodes works
|
||||
|
@ -478,14 +478,14 @@ cachetable_test (void) {
|
|||
toku_cachefile_set_userdata(
|
||||
f1,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
&dummy_log_fassociate,
|
||||
&dummy_log_rollback,
|
||||
&dummy_close_usr,
|
||||
dummy_int_checkpoint_userdata,
|
||||
test_begin_checkpoint, // called in begin_checkpoint
|
||||
dummy_int_checkpoint_userdata,
|
||||
NULL,
|
||||
NULL
|
||||
&dummy_note_pin,
|
||||
&dummy_note_unpin
|
||||
);
|
||||
|
||||
toku_pthread_t time_tid;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#ident "Copyright (c) 2007-2012 Tokutek Inc. All rights reserved."
|
||||
#include "includes.h"
|
||||
#include "test.h"
|
||||
#include "cachetable-test.h"
|
||||
|
||||
bool clone_called;
|
||||
bool check_flush;
|
||||
|
@ -68,6 +69,7 @@ test_clean (enum cachetable_dirty dirty, bool cloneable) {
|
|||
unlink(fname1);
|
||||
CACHEFILE f1;
|
||||
r = toku_cachetable_openf(&f1, ct, fname1, O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); assert(r == 0);
|
||||
create_dummy_functions(f1);
|
||||
|
||||
void* v1;
|
||||
long s1;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#ident "Copyright (c) 2007-2012 Tokutek Inc. All rights reserved."
|
||||
#include "includes.h"
|
||||
#include "test.h"
|
||||
#include "cachetable-test.h"
|
||||
|
||||
bool clone_called;
|
||||
bool check_flush;
|
||||
|
@ -55,6 +56,7 @@ test_clean (enum cachetable_dirty dirty, bool cloneable) {
|
|||
unlink(fname1);
|
||||
CACHEFILE f1;
|
||||
r = toku_cachetable_openf(&f1, ct, fname1, O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); assert(r == 0);
|
||||
create_dummy_functions(f1);
|
||||
check_flush = false;
|
||||
|
||||
void* v1;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#ident "Copyright (c) 2007-2012 Tokutek Inc. All rights reserved."
|
||||
#include "includes.h"
|
||||
#include "test.h"
|
||||
#include "cachetable-test.h"
|
||||
|
||||
//
|
||||
// simple tests for maybe_get_and_pin(_clean)
|
||||
|
@ -19,6 +20,7 @@ cachetable_test (void) {
|
|||
unlink(fname1);
|
||||
CACHEFILE f1;
|
||||
r = toku_cachetable_openf(&f1, ct, fname1, O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); assert(r == 0);
|
||||
create_dummy_functions(f1);
|
||||
CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL);
|
||||
|
||||
void* v1;
|
||||
|
|
|
@ -4,8 +4,7 @@
|
|||
#ident "Copyright (c) 2007-2012 Tokutek Inc. All rights reserved."
|
||||
#include "includes.h"
|
||||
#include "test.h"
|
||||
|
||||
|
||||
#include "cachetable-test.h"
|
||||
|
||||
bool v1_written;
|
||||
uint64_t val1;
|
||||
|
@ -14,7 +13,6 @@ uint64_t val2;
|
|||
uint64_t val3;
|
||||
bool check_me;
|
||||
|
||||
|
||||
static void
|
||||
flush (CACHEFILE f __attribute__((__unused__)),
|
||||
int UU(fd),
|
||||
|
@ -76,6 +74,7 @@ cachetable_test (bool write_first, bool write_second, bool start_checkpoint) {
|
|||
unlink(fname1);
|
||||
CACHEFILE f1;
|
||||
r = toku_cachetable_openf(&f1, ct, fname1, O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); assert(r == 0);
|
||||
create_dummy_functions(f1);
|
||||
|
||||
void* v1;
|
||||
void* v2;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#ident "Copyright (c) 2007-2012 Tokutek Inc. All rights reserved."
|
||||
#include "includes.h"
|
||||
#include "test.h"
|
||||
#include "cachetable-test.h"
|
||||
|
||||
bool foo;
|
||||
|
||||
|
@ -66,7 +67,7 @@ run_test (void) {
|
|||
unlink(fname1);
|
||||
CACHEFILE f1;
|
||||
r = toku_cachetable_openf(&f1, ct, fname1, O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); assert(r == 0);
|
||||
|
||||
create_dummy_functions(f1);
|
||||
|
||||
void* v1;
|
||||
long s1;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#ident "Copyright (c) 2007-2012 Tokutek Inc. All rights reserved."
|
||||
#include "includes.h"
|
||||
#include "test.h"
|
||||
#include "cachetable-test.h"
|
||||
|
||||
bool foo;
|
||||
bool check_me;
|
||||
|
@ -58,6 +59,7 @@ run_test (void) {
|
|||
unlink(fname1);
|
||||
CACHEFILE f1;
|
||||
r = toku_cachetable_openf(&f1, ct, fname1, O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); assert(r == 0);
|
||||
create_dummy_functions(f1);
|
||||
|
||||
void* v1;
|
||||
//void* v2;
|
||||
|
|
|
@ -4,8 +4,7 @@
|
|||
#ident "Copyright (c) 2007-2012 Tokutek Inc. All rights reserved."
|
||||
#include "includes.h"
|
||||
#include "test.h"
|
||||
|
||||
|
||||
#include "cachetable-test.h"
|
||||
|
||||
bool v1_written;
|
||||
uint64_t val1;
|
||||
|
@ -14,7 +13,6 @@ uint64_t val2;
|
|||
uint64_t val3;
|
||||
bool check_me;
|
||||
|
||||
|
||||
static void
|
||||
flush (CACHEFILE f __attribute__((__unused__)),
|
||||
int UU(fd),
|
||||
|
@ -83,6 +81,7 @@ cachetable_test (bool write_first, bool write_second, bool start_checkpoint) {
|
|||
unlink(fname1);
|
||||
CACHEFILE f1;
|
||||
r = toku_cachetable_openf(&f1, ct, fname1, O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); assert(r == 0);
|
||||
create_dummy_functions(f1);//toku_cachefile_set_userdata(ft, NULL, NULL,
|
||||
|
||||
void* v1;
|
||||
void* v2;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#ident "Copyright (c) 2007-2012 Tokutek Inc. All rights reserved."
|
||||
#include "includes.h"
|
||||
#include "test.h"
|
||||
#include "cachetable-test.h"
|
||||
|
||||
static void remove_key_expect_checkpoint(
|
||||
CACHEKEY* UU(cachekey),
|
||||
|
@ -33,6 +34,7 @@ cachetable_test (void) {
|
|||
unlink(fname1);
|
||||
CACHEFILE f1;
|
||||
r = toku_cachetable_openf(&f1, ct, fname1, O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); assert(r == 0);
|
||||
create_dummy_functions(f1);
|
||||
|
||||
void* v1;
|
||||
//void* v2;
|
||||
|
|
46
ft/tests/cachetable-test.h
Normal file
46
ft/tests/cachetable-test.h
Normal file
|
@ -0,0 +1,46 @@
|
|||
/* -*- mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
|
||||
// vim: ft=cpp:expandtab:ts=8:sw=4:softtabstop=4:
|
||||
#ident "$Id: cachetable-checkpointer_test.cc 45903 2012-07-19 13:06:39Z leifwalsh $"
|
||||
#ident "Copyright (c) 2007-2012 Tokutek Inc. All rights reserved."
|
||||
|
||||
#include "includes.h"
|
||||
#include "cachetable-internal.h"
|
||||
|
||||
//
|
||||
// Dummy callbacks for checkpointing
|
||||
//
|
||||
static int dummy_log_fassociate(CACHEFILE UU(cf), void* UU(p))
|
||||
{ return 0; }
|
||||
static int dummy_log_rollback(CACHEFILE UU(cf), void* UU(p))
|
||||
{ return 0; }
|
||||
static int dummy_close_usr(CACHEFILE UU(cf), int UU(i), void* UU(p), char** UU(c), bool UU(b), LSN UU(lsn))
|
||||
{ return 0; }
|
||||
static int dummy_chckpnt_usr(CACHEFILE UU(cf), int UU(i), void* UU(p))
|
||||
{ return 0; }
|
||||
static int dummy_begin(LSN UU(lsn), void* UU(p))
|
||||
{ return 0; }
|
||||
static int dummy_end(CACHEFILE UU(cf), int UU(i), void* UU(p))
|
||||
{ return 0; }
|
||||
static int dummy_note_pin(CACHEFILE UU(cf), void* UU(p))
|
||||
{ return 0; }
|
||||
static int dummy_note_unpin(CACHEFILE UU(cf), void* UU(p))
|
||||
{ return 0; }
|
||||
|
||||
//
|
||||
// Helper function to set dummy functions in given cachefile.
|
||||
//
|
||||
static UU() void
|
||||
create_dummy_functions(CACHEFILE cf)
|
||||
{
|
||||
void *ud = NULL;
|
||||
toku_cachefile_set_userdata (cf,
|
||||
ud,
|
||||
&dummy_log_fassociate,
|
||||
&dummy_log_rollback,
|
||||
&dummy_close_usr,
|
||||
&dummy_chckpnt_usr,
|
||||
&dummy_begin,
|
||||
&dummy_end,
|
||||
&dummy_note_pin,
|
||||
&dummy_note_unpin);
|
||||
};
|
|
@ -4,6 +4,7 @@
|
|||
#ident "Copyright (c) 2007-2012 Tokutek Inc. All rights reserved."
|
||||
#include "includes.h"
|
||||
#include "test.h"
|
||||
#include "cachetable-test.h"
|
||||
|
||||
CACHETABLE ct;
|
||||
|
||||
|
@ -34,6 +35,7 @@ run_test (void) {
|
|||
unlink(fname1);
|
||||
CACHEFILE f1;
|
||||
r = toku_cachetable_openf(&f1, ct, fname1, O_RDWR|O_CREAT, S_IRWXU|S_IRWXG|S_IRWXO); assert(r == 0);
|
||||
create_dummy_functions(f1);
|
||||
|
||||
CACHETABLE_WRITE_CALLBACK wc = def_write_callback(NULL);
|
||||
void* v1;
|
||||
|
|
Loading…
Add table
Reference in a new issue