0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
MaintenanceScheduler.h
Go to the documentation of this file.
1 /* -*- c++ -*-
2  * Copyright (C) 2007-2015 Hypertable, Inc.
3  *
4  * This file is part of Hypertable.
5  *
6  * Hypertable is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; version 3 of the
9  * License, or any later version.
10  *
11  * Hypertable is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19  * 02110-1301, USA.
20  */
21 
27 
28 #ifndef Hypertable_RangeServer_MaintenanceScheduler_h
29 #define Hypertable_RangeServer_MaintenanceScheduler_h
30 
35 
36 #include <chrono>
37 #include <memory>
38 #include <mutex>
39 #include <set>
40 
41 namespace Hypertable {
42 
45 
48  public:
49 
52  TableInfoMapPtr &live_map);
53 
55  void schedule();
56 
58  void include(const TableIdentifier &table);
59 
61  void exclude(const TableIdentifier &table);
62 
64  void set_low_memory_mode(bool on) {
65  if (on) {
68  }
69  else {
70  if (m_low_memory_mode) {
72  m_last_low_memory = chrono::steady_clock::now();
73  }
74  }
75  m_low_memory_mode = on;
76  }
77 
78  private:
79 
80  int get_level(RangeData &rd);
81 
85 
89  bool debug_signal_file_exists(std::chrono::steady_clock::time_point now);
90 
96  void write_debug_output(std::chrono::steady_clock::time_point now, Ranges &ranges,
97  const String &header_str);
98 
101 
103  std::set<std::string> m_table_blacklist;
104 
111  std::chrono::steady_clock::time_point m_last_low_memory;
112  std::chrono::steady_clock::time_point m_last_check;
121  int32_t m_start_offset {};
122  bool m_initialized {};
125  };
126 
128  typedef std::shared_ptr<MaintenanceScheduler> MaintenanceSchedulerPtr;
129 
131 
132 }
133 
134 #endif // Hypertable_RangeServer_MaintenanceScheduler_h
135 
136 
void exclude(const TableIdentifier &table)
Excludes a table from maintenance scheduling.
static std::mutex mutex
Definition: Logger.cc:43
std::set< std::string > m_table_blacklist
Set of table IDs to exclude from maintenance scheduling.
std::string String
A String is simply a typedef to std::string.
Definition: String.h:44
Schedules range server maintenance.
MaintenancePrioritizerLogCleanup m_prioritizer_log_cleanup
bool low_memory_mode()
Checks if low memory maintenance prioritization is enabled.
MaintenancePrioritizer * m_prioritizer
MaintenancePrioritizerLowMemory m_prioritizer_low_memory
std::chrono::steady_clock::time_point m_last_check
MaintenanceQueuePtr m_queue
Maintenance queue.
Declarations for TableInfoMap.
std::shared_ptr< MaintenanceQueue > MaintenanceQueuePtr
Smart pointer to MaintenanceQueue.
bool debug_signal_file_exists(std::chrono::steady_clock::time_point now)
Checks to see if scheduler debug signal file exists.
void include(const TableIdentifier &table)
Includes a table for maintenance scheduling.
void schedule()
Schedules maintenance.
void write_debug_output(std::chrono::steady_clock::time_point now, Ranges &ranges, const String &header_str)
Writes debugging output and removes signal file.
std::shared_ptr< TableInfoMap > TableInfoMapPtr
Shared smart pointer to TableInfoMap.
Definition: TableInfoMap.h:223
Hypertable definitions
std::chrono::steady_clock::time_point m_last_low_memory
void set_low_memory_mode(bool on)
Sets low memory maintenance prioritization.
MaintenanceScheduler(MaintenanceQueuePtr &queue, TableInfoMapPtr &live_map)
Constructor.
std::shared_ptr< MaintenanceScheduler > MaintenanceSchedulerPtr
Smart pointer to MaintenanceScheduler.
Declarations for LoadStatistics.
Holds pointers to a Range and associated Range::MaintenanceData.
Definition: TableInfo.h:55
std::mutex m_mutex
Mutex to serialize concurrent access
Holds vector of RangeData objects and memory arena.
Definition: TableInfo.h:72