Skip to content

Commit

Permalink
Added Hypertable.LoadBalancer.Enable property to allow for disabling …
Browse files Browse the repository at this point in the history
…balancer
  • Loading branch information
Doug Judd committed Jul 17, 2011
1 parent f5502be commit 0dfc235
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/cc/Common/Config.cc
Expand Up @@ -257,6 +257,8 @@ void DefaultPolicy::init_options() {
"Top-level hypertable directory name")
("Hypertable.Monitoring.Interval", i32()->default_value(30000),
"Monitoring statistics gathering interval (in milliseconds)")
("Hypertable.LoadBalancer.Enable", boo()->default_value(true),
"Enable automatic load balancing")
("Hypertable.LoadBalancer.Interval", i32()->default_value(86400000),
"Time interval between LoadBalancer operations")
("Hypertable.LoadBalancer.WindowStart", str()->default_value("00:00:01"),
Expand Down
8 changes: 8 additions & 0 deletions src/cc/Hypertable/Master/LoadBalancerBasic.cc
Expand Up @@ -33,8 +33,16 @@ using namespace boost::posix_time;
using namespace Hypertable;
using namespace std;


LoadBalancerBasic::LoadBalancerBasic(ContextPtr context) : LoadBalancer(context), m_waiting_for_servers(false) {
m_enabled = context->props->get_bool("Hypertable.LoadBalancer.Enable");
}


void LoadBalancerBasic::balance(const String &algorithm) {
BalancePlanPtr plan = new BalancePlan;
if (!m_enabled && algorithm == "")
return;
try {
calculate_balance_plan(algorithm, plan);
if (plan->moves.size()>0) {
Expand Down
3 changes: 2 additions & 1 deletion src/cc/Hypertable/Master/LoadBalancerBasic.h
Expand Up @@ -40,7 +40,7 @@ namespace Hypertable {
BALANCE_MODE_DISTRIBUTE_LOAD = 1,
BALANCE_MODE_DISTRIBUTE_TABLE_RANGES = 2
};
LoadBalancerBasic(ContextPtr context) : LoadBalancer(context), m_waiting_for_servers(false) { }
LoadBalancerBasic(ContextPtr context);

void transfer_monitoring_data(vector<RangeServerStatistics> &stats);
void balance(const String &algorithm=String());
Expand All @@ -56,6 +56,7 @@ namespace Hypertable {
BalancePlanPtr &plan);

Mutex m_data_mutex;
bool m_enabled;
bool m_waiting_for_servers;
std::vector <RangeServerStatistics> m_range_server_stats;
ptime m_wait_time_start;
Expand Down

0 comments on commit 0dfc235

Please sign in to comment.