@@ -41,38 +41,6 @@ const char* to_string(enum checkpoint_state s) {
4141 return " <unknown>" ;
4242}
4343
44- /* *
45- * A listener class to update checkpoint related configs at runtime.
46- */
47- class CheckpointConfigChangeListener : public ValueChangedListener {
48- public:
49- CheckpointConfigChangeListener (CheckpointConfig &c) : config(c) { }
50- virtual ~CheckpointConfigChangeListener () { }
51-
52- virtual void sizeValueChanged (const std::string &key, size_t value) {
53- if (key.compare (" chk_period" ) == 0 ) {
54- config.setCheckpointPeriod (value);
55- } else if (key.compare (" chk_max_items" ) == 0 ) {
56- config.setCheckpointMaxItems (value);
57- } else if (key.compare (" max_checkpoints" ) == 0 ) {
58- config.setMaxCheckpoints (value);
59- }
60- }
61-
62- virtual void booleanValueChanged (const std::string &key, bool value) {
63- if (key.compare (" item_num_based_new_chk" ) == 0 ) {
64- config.allowItemNumBasedNewCheckpoint (value);
65- } else if (key.compare (" keep_closed_chks" ) == 0 ) {
66- config.allowKeepClosedCheckpoints (value);
67- } else if (key.compare (" enable_chk_merge" ) == 0 ) {
68- config.allowCheckpointMerge (value);
69- }
70- }
71-
72- private:
73- CheckpointConfig &config;
74- };
75-
7644void CheckpointCursor::decrOffset (size_t decr) {
7745 if (offset >= decr) {
7846 offset.fetch_sub (decr);
@@ -1925,99 +1893,6 @@ size_t CheckpointManager::getMemoryUsageOfUnrefCheckpoints() {
19251893 return memUsage;
19261894}
19271895
1928- void CheckpointConfig::addConfigChangeListener (
1929- EventuallyPersistentEngine &engine) {
1930- Configuration &configuration = engine.getConfiguration ();
1931- configuration.addValueChangedListener (" chk_period" ,
1932- new CheckpointConfigChangeListener (engine.getCheckpointConfig ()));
1933- configuration.addValueChangedListener (" chk_max_items" ,
1934- new CheckpointConfigChangeListener (engine.getCheckpointConfig ()));
1935- configuration.addValueChangedListener (" max_checkpoints" ,
1936- new CheckpointConfigChangeListener (engine.getCheckpointConfig ()));
1937- configuration.addValueChangedListener (" item_num_based_new_chk" ,
1938- new CheckpointConfigChangeListener (engine.getCheckpointConfig ()));
1939- configuration.addValueChangedListener (" keep_closed_chks" ,
1940- new CheckpointConfigChangeListener (engine.getCheckpointConfig ()));
1941- configuration.addValueChangedListener (" enable_chk_merge" ,
1942- new CheckpointConfigChangeListener (engine.getCheckpointConfig ()));
1943- }
1944-
1945- CheckpointConfig::CheckpointConfig (EventuallyPersistentEngine &e) {
1946- Configuration &config = e.getConfiguration ();
1947- checkpointPeriod = config.getChkPeriod ();
1948- checkpointMaxItems = config.getChkMaxItems ();
1949- maxCheckpoints = config.getMaxCheckpoints ();
1950- itemNumBasedNewCheckpoint = config.isItemNumBasedNewChk ();
1951- keepClosedCheckpoints = config.isKeepClosedChks ();
1952- enableChkMerge = config.isEnableChkMerge ();
1953- persistenceEnabled = config.getBucketType () == " persistent" ;
1954- }
1955-
1956- bool CheckpointConfig::validateCheckpointMaxItemsParam (size_t
1957- checkpoint_max_items) {
1958- if (checkpoint_max_items < MIN_CHECKPOINT_ITEMS ||
1959- checkpoint_max_items > MAX_CHECKPOINT_ITEMS) {
1960- std::stringstream ss;
1961- ss << " New checkpoint_max_items param value " << checkpoint_max_items
1962- << " is not ranged between the min allowed value " <<
1963- MIN_CHECKPOINT_ITEMS
1964- << " and max value " << MAX_CHECKPOINT_ITEMS;
1965- LOG (EXTENSION_LOG_WARNING, " %s" , ss.str ().c_str ());
1966- return false ;
1967- }
1968- return true ;
1969- }
1970-
1971- bool CheckpointConfig::validateCheckpointPeriodParam (
1972- size_t checkpoint_period) {
1973- if (checkpoint_period < MIN_CHECKPOINT_PERIOD ||
1974- checkpoint_period > MAX_CHECKPOINT_PERIOD) {
1975- std::stringstream ss;
1976- ss << " New checkpoint_period param value " << checkpoint_period
1977- << " is not ranged between the min allowed value " <<
1978- MIN_CHECKPOINT_PERIOD
1979- << " and max value " << MAX_CHECKPOINT_PERIOD;
1980- LOG (EXTENSION_LOG_WARNING, " %s\n " , ss.str ().c_str ());
1981- return false ;
1982- }
1983- return true ;
1984- }
1985-
1986- bool CheckpointConfig::validateMaxCheckpointsParam (size_t max_checkpoints) {
1987- if (max_checkpoints < DEFAULT_MAX_CHECKPOINTS ||
1988- max_checkpoints > MAX_CHECKPOINTS_UPPER_BOUND) {
1989- std::stringstream ss;
1990- ss << " New max_checkpoints param value " << max_checkpoints
1991- << " is not ranged between the min allowed value " <<
1992- DEFAULT_MAX_CHECKPOINTS
1993- << " and max value " << MAX_CHECKPOINTS_UPPER_BOUND;
1994- LOG (EXTENSION_LOG_WARNING, " %s\n " , ss.str ().c_str ());
1995- return false ;
1996- }
1997- return true ;
1998- }
1999-
2000- void CheckpointConfig::setCheckpointPeriod (size_t value) {
2001- if (!validateCheckpointPeriodParam (value)) {
2002- value = DEFAULT_CHECKPOINT_PERIOD;
2003- }
2004- checkpointPeriod = static_cast <rel_time_t >(value);
2005- }
2006-
2007- void CheckpointConfig::setCheckpointMaxItems (size_t value) {
2008- if (!validateCheckpointMaxItemsParam (value)) {
2009- value = DEFAULT_CHECKPOINT_ITEMS;
2010- }
2011- checkpointMaxItems = value;
2012- }
2013-
2014- void CheckpointConfig::setMaxCheckpoints (size_t value) {
2015- if (!validateMaxCheckpointsParam (value)) {
2016- value = DEFAULT_MAX_CHECKPOINTS;
2017- }
2018- maxCheckpoints = value;
2019- }
2020-
20211896void CheckpointManager::addStats (ADD_STAT add_stat, const void *cookie) {
20221897 LockHolder lh (queueLock);
20231898 char buf[256 ];
0 commit comments