mirror of
https://github.com/MariaDB/server.git
synced 2025-01-22 06:44:16 +01:00
Added mechanism for using checkpoint callback, for testing only.
git-svn-id: file:///svn/toku/tokudb@11314 c7de825b-a66e-492c-adef-691d508d4ae1
This commit is contained in:
parent
f270c379c3
commit
86f1706897
3 changed files with 14 additions and 1 deletions
|
@ -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;
|
||||
|
||||
|
|
13
src/ydb.c
13
src/ydb.c
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue