Commit 18adff95 authored by Barry Perlman's avatar Barry Perlman Committed by Yoni Fogel

Added mechanism for using checkpoint callback, for testing only.

git-svn-id: file:///svn/toku/tokudb@11314 c7de825b-a66e-492c-adef-691d508d4ae1
parent 1270cb18
......@@ -283,6 +283,7 @@ int db_env_set_func_malloc (void *(*)(size_t)) __attribute__((__visibility__("de
int db_env_set_func_pwrite (ssize_t (*)(int, const void *, size_t, toku_off_t)) __attribute__((__visibility__("default")));
int db_env_set_func_write (ssize_t (*)(int, const void *, size_t)) __attribute__((__visibility__("default")));
int db_env_set_func_realloc (void *(*)(void*, size_t)) __attribute__((__visibility__("default")));
void db_env_set_checkpoint_callback (void (*)(void*), void*) __attribute__((__visibility__("default")));
#if defined(__cplusplus)
}
#endif
......
......@@ -11,6 +11,7 @@
db_env_set_func_free;
db_env_set_func_pwrite;
db_env_set_func_write;
db_env_set_checkpoint_callback;
toku_os_get_max_rss;
......
......@@ -694,9 +694,13 @@ static int toku_env_set_verbose(DB_ENV * env, u_int32_t which, int onoff) {
return 1;
}
// For test purposes only.
static void (*checkpoint_callback_f)(void*) = NULL;
static void * checkpoint_callback_extra = NULL;
static int toku_env_txn_checkpoint(DB_ENV * env, u_int32_t kbyte __attribute__((__unused__)), u_int32_t min __attribute__((__unused__)), u_int32_t flags __attribute__((__unused__))) {
char *error_string = NULL;
int r = toku_checkpoint(env->i->cachetable, env->i->logger, &error_string, NULL, NULL);
int r = toku_checkpoint(env->i->cachetable, env->i->logger, &error_string, checkpoint_callback_f, checkpoint_callback_extra);
if (r) {
env->i->is_panicked = r; // Panicking the whole environment may be overkill, but I'm not sure what else to do.
env->i->panic_string = error_string;
......@@ -3810,3 +3814,10 @@ void setup_dlmalloc (void) {
db_env_set_func_realloc(dlrealloc);
db_env_set_func_free(dlfree);
}
// For test purposes only.
// With this interface, all checkpoint users get the same callback and the same extra.
void db_env_set_checkpoint_callback (void (*callback_f)(void*), void* extra) {
checkpoint_callback_f = callback_f;
checkpoint_callback_extra = extra;
}
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