Commit 876f8760 authored by Christian Rober's avatar Christian Rober Committed by Yoni Fogel

refs #5372 Added evictor pointer to checkpointer. This was needed to remove...

refs #5372 Added evictor pointer to checkpointer.  This was needed to remove some of the dependency on the cachetable in checkpointer methods.

git-svn-id: file:///svn/toku/tokudb@47539 c7de825b-a66e-492c-adef-691d508d4ae1
parent 0c86c018
...@@ -311,7 +311,7 @@ public: ...@@ -311,7 +311,7 @@ public:
// //
class checkpointer { class checkpointer {
public: public:
void init(CACHETABLE _ct, TOKULOGGER _logger, cachefile_list *files); void init(CACHETABLE _ct, TOKULOGGER _logger, evictor *_ev, cachefile_list *files);
void destroy(); void destroy();
int set_checkpoint_period(uint32_t new_period); int set_checkpoint_period(uint32_t new_period);
uint32_t get_checkpoint_period(); uint32_t get_checkpoint_period();
...@@ -333,6 +333,7 @@ private: ...@@ -333,6 +333,7 @@ private:
cachefile_list *m_cf_list; cachefile_list *m_cf_list;
// <CER> TEMP? // <CER> TEMP?
CACHETABLE m_ct; CACHETABLE m_ct;
evictor *m_ev;
// variable used by the checkpoint thread to know // variable used by the checkpoint thread to know
// when all work induced by cloning on client threads is done // when all work induced by cloning on client threads is done
......
...@@ -210,7 +210,7 @@ int toku_create_cachetable(CACHETABLE *result, long size_limit, LSN UU(initial_l ...@@ -210,7 +210,7 @@ int toku_create_cachetable(CACHETABLE *result, long size_limit, LSN UU(initial_l
ct->checkpointing_kibbutz = toku_kibbutz_create(checkpointing_nworkers); ct->checkpointing_kibbutz = toku_kibbutz_create(checkpointing_nworkers);
// must be done after creating ct_kibbutz // must be done after creating ct_kibbutz
ct->ev.init(size_limit, &ct->list, ct->ct_kibbutz, EVICTION_PERIOD); ct->ev.init(size_limit, &ct->list, ct->ct_kibbutz, EVICTION_PERIOD);
ct->cp.init(ct, logger, &ct->cf_list); ct->cp.init(ct, logger, &ct->ev, &ct->cf_list);
ct->cl.init(1, &ct->list, ct); // by default, start with one iteration ct->cl.init(1, &ct->list, ct); // by default, start with one iteration
ct->env_dir = toku_xstrdup("."); ct->env_dir = toku_xstrdup(".");
*result = ct; *result = ct;
...@@ -4168,9 +4168,11 @@ ENSURE_POD(checkpointer); ...@@ -4168,9 +4168,11 @@ ENSURE_POD(checkpointer);
// //
void checkpointer::init(CACHETABLE _ct, void checkpointer::init(CACHETABLE _ct,
TOKULOGGER _logger, TOKULOGGER _logger,
evictor *_ev,
cachefile_list *files) { cachefile_list *files) {
m_ct = _ct; m_ct = _ct;
m_logger = _logger; m_logger = _logger;
m_ev = _ev;
m_cf_list = files; m_cf_list = files;
bjm_init(&m_checkpoint_clones_bjm); bjm_init(&m_checkpoint_clones_bjm);
...@@ -4426,7 +4428,7 @@ void checkpointer::checkpoint_pending_pairs() { ...@@ -4426,7 +4428,7 @@ void checkpointer::checkpoint_pending_pairs() {
// if still pending, clear the pending bit and write out the node // if still pending, clear the pending bit and write out the node
pair_lock(p); pair_lock(p);
m_ct->list.read_list_unlock(); m_ct->list.read_list_unlock();
write_pair_for_checkpoint_thread(&m_ct->ev, p); write_pair_for_checkpoint_thread(m_ev, p);
pair_unlock(p); pair_unlock(p);
m_ct->list.read_list_lock(); m_ct->list.read_list_lock();
} }
......
...@@ -82,7 +82,7 @@ void checkpointer_test::test_begin_checkpoint() { ...@@ -82,7 +82,7 @@ void checkpointer_test::test_begin_checkpoint() {
cachetable ctbl; cachetable ctbl;
ctbl.list.init(); ctbl.list.init();
m_cp.init(&ctbl, NULL, &cfl); m_cp.init(&ctbl, NULL, &ctbl.ev, &cfl);
// 1. Call checkpoint with NO cachefiles. // 1. Call checkpoint with NO cachefiles.
r = m_cp.begin_checkpoint(); r = m_cp.begin_checkpoint();
...@@ -289,7 +289,7 @@ void checkpointer_test::test_end_checkpoint() { ...@@ -289,7 +289,7 @@ void checkpointer_test::test_end_checkpoint() {
cf.for_checkpoint = true; cf.for_checkpoint = true;
create_dummy_functions(&cf); create_dummy_functions(&cf);
m_cp.init(&ctbl, NULL, &cfl); m_cp.init(&ctbl, NULL, &ctbl.ev, &cfl);
m_cp.m_cf_list->m_head = &cf; m_cp.m_cf_list->m_head = &cf;
// 2. Add data before running checkpoint. // 2. Add data before running checkpoint.
......
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