0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Global.cc
Go to the documentation of this file.
1 /*
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 
22 #include "Common/Compat.h"
23 #include <cassert>
24 
25 #include "Global.h"
26 
27 using namespace Hypertable;
28 using namespace Hyperspace;
29 
30 namespace Hypertable {
31 
44  bool Global::verbose = false;
45  bool Global::row_size_unlimited = false;
53  std::string Global::log_dir = "";
55  int64_t Global::range_split_size = 0;
56  int64_t Global::range_maximum_size = 0;
57  int32_t Global::failover_timeout = 0;
59  int32_t Global::access_group_max_mem = 0;
70  int64_t Global::memory_limit = 0;
73  uint64_t Global::access_counter = 0;
74  bool Global::enable_shadow_cache = true;
75  std::string Global::toplevel_dir;
76  int32_t Global::metrics_interval = 0;
80  std::vector<MetaLog::EntityTaskPtr> Global::work_queue;
83 
85  if (entity) {
86  entity->work_queue_add_hook();
87  std::lock_guard<std::mutex> lock(Global::mutex);
88  Global::work_queue.push_back(entity);
89  }
90  }
91 
92  void Global::immovable_range_set_add(const TableIdentifier &table, const RangeSpec &spec) {
93  std::lock_guard<std::mutex> lock(Global::mutex);
94  String name = format("%s[%s..%s]", table.id, spec.start_row, spec.end_row);
95  HT_ASSERT(Global::immovable_range_set.count(name) == 0);
96  Global::immovable_range_set.insert(name);
97  }
98 
100  std::lock_guard<std::mutex> lock(Global::mutex);
101  String name = format("%s[%s..%s]", table.id, spec.start_row, spec.end_row);
102  HT_ASSERT(Global::immovable_range_set.count(name) == 1);
103  Global::immovable_range_set.erase(name);
104  }
105 
107  std::lock_guard<std::mutex> lock(Global::mutex);
108  String name = format("%s[%s..%s]", table.id, spec.start_row, spec.end_row);
109  return Global::immovable_range_set.count(name) > 0;
110  }
111 
113  std::lock_guard<std::mutex> lock(Global::mutex);
114  Global::ranges = r;
115  }
116 
118  std::lock_guard<std::mutex> lock(Global::mutex);
119  return Global::ranges;
120  }
121 
122 }
static bool enable_shadow_cache
Definition: Global.h:107
static LocationInitializerPtr location_initializer
Definition: Global.h:83
std::set< String > StringSet
STL Set managing Strings.
Definition: StringExt.h:42
static std::mutex mutex
Definition: Logger.cc:43
static void set_ranges(RangesPtr &r)
Definition: Global.cc:112
static int32_t merge_cellstore_run_length_threshold
Definition: Global.h:110
Range specification.
Definition: RangeSpec.h:40
static int32_t access_group_garbage_compaction_threshold
Definition: Global.h:87
static TablePtr metadata_table
Definition: Global.h:91
std::shared_ptr< LocationInitializer > LocationInitializerPtr
Shared smart pointer to LocationInitializer.
std::string String
A String is simply a typedef to std::string.
Definition: String.h:44
String format(const char *fmt,...)
Returns a String using printf like format facilities Vanilla snprintf is about 1.5x faster than this...
Definition: String.cc:37
static ConnectionManagerPtr conn_manager
Definition: Global.h:113
std::shared_ptr< RangeLocator > RangeLocatorPtr
Smart pointer to RangeLocator.
Definition: RangeLocator.h:198
Defines a time window.
Definition: TimeWindow.h:61
static int64_t memory_limit_ensure_unused_current
Definition: Global.h:105
static int64_t memory_limit
Definition: Global.h:99
Singleton class holding Schema objects for pseudo tables.
Definition: PseudoTables.h:43
std::shared_ptr< EntityTask > EntityTaskPtr
static void add_to_work_queue(MetaLog::EntityTaskPtr entity)
Definition: Global.cc:84
static MetaLogEntityRemoveOkLogsPtr remove_ok_logs
Definition: Global.h:71
Tracks range server memory used.
Definition: MemoryTracker.h:42
Hyperspace definitions
#define HT_ASSERT(_e_)
Definition: Logger.h:396
std::shared_ptr< LoadStatistics > LoadStatisticsPtr
Shared smart pointer to LoadStatistics.
std::shared_ptr< MaintenanceQueue > MaintenanceQueuePtr
Smart pointer to MaintenanceQueue.
static int64_t memory_limit_ensure_unused
Definition: Global.h:102
static StringSet immovable_range_set
Definition: Global.h:115
static int64_t log_prune_threshold_max
Definition: Global.h:96
static Hypertable::MemoryTracker * memory_tracker
Definition: Global.h:94
const char * end_row
Definition: RangeSpec.h:60
static Hyperspace::SessionPtr hyperspace
Definition: Global.h:63
std::shared_ptr< Session > SessionPtr
Definition: Session.h:734
static RangesPtr ranges
Definition: Global.h:73
static std::vector< MetaLog::EntityTaskPtr > work_queue
Definition: Global.h:114
static std::string toplevel_dir
Definition: Global.h:108
static uint64_t access_counter
Definition: Global.h:106
static Hypertable::Lib::Master::ClientPtr master_client
Definition: Global.h:68
static CommitLogPtr root_log
Definition: Global.h:80
static TablePtr rs_metrics_table
Definition: Global.h:92
static MetaLog::WriterPtr rsml_writer
Definition: Global.h:81
Compatibility Macros for C/C++.
static int64_t log_prune_threshold_min
Definition: Global.h:95
static Hypertable::FilesystemPtr dfs
Definition: Global.h:64
static Hypertable::RangeLocatorPtr range_locator
Definition: Global.h:69
static int64_t cellstore_target_size_min
Definition: Global.h:97
static bool verbose
Definition: Global.h:74
static int64_t range_split_size
Definition: Global.h:84
Hypertable definitions
static void immovable_range_set_add(const TableIdentifier &table, const RangeSpec &spec)
Definition: Global.cc:92
static Hypertable::MaintenanceQueuePtr maintenance_queue
Definition: Global.h:67
static bool ignore_clock_skew_errors
Definition: Global.h:111
static std::string log_dir
Definition: Global.h:82
const char * start_row
Definition: RangeSpec.h:59
static CommitLogPtr system_log
Definition: Global.h:78
std::shared_ptr< Writer > WriterPtr
Smart pointer to Writer.
std::shared_ptr< Filesystem > FilesystemPtr
Smart pointer to Filesystem.
Definition: Filesystem.h:572
static int32_t metrics_interval
Definition: Global.h:109
std::shared_ptr< Client > ClientPtr
Smart pointer to Client.
Definition: Client.h:201
static int32_t failover_timeout
Definition: Global.h:86
static int64_t range_metadata_split_size
Definition: Global.h:93
std::shared_ptr< CommitLog > CommitLogPtr
Smart pointer to CommitLog.
Definition: CommitLog.h:223
static int64_t cellstore_target_size_max
Definition: Global.h:98
static int32_t access_group_max_mem
Definition: Global.h:88
std::shared_ptr< MetaLogEntityRemoveOkLogs > MetaLogEntityRemoveOkLogsPtr
Smart pointer to MetaLogEntityRemoveOkLogs.
static std::mutex mutex
Definition: Global.h:62
static int32_t cell_cache_scanner_cache_size
Definition: Global.h:89
static bool range_initialization_complete
Definition: Global.h:112
static CommitLogPtr user_log
Definition: Global.h:77
static LoadStatisticsPtr load_statistics
Definition: Global.h:72
static Hypertable::FilesystemPtr log_dfs
Definition: Global.h:65
static Hypertable::PseudoTables * pseudo_tables
Definition: Global.h:70
static void immovable_range_set_remove(const TableIdentifier &table, const RangeSpec &spec)
Definition: Global.cc:99
static bool ignore_cells_with_clock_skew
Definition: Global.h:76
static TimeWindow low_activity_time
Definition: Global.h:116
std::shared_ptr< ConnectionManager > ConnectionManagerPtr
Smart pointer to ConnectionManager.
std::shared_ptr< ApplicationQueue > ApplicationQueuePtr
Shared smart pointer to ApplicationQueue object.
static Hypertable::ApplicationQueuePtr app_queue
Definition: Global.h:66
static RangesPtr get_ranges()
Definition: Global.cc:117
static Hypertable::FileBlockCache * block_cache
Definition: Global.h:90
static bool row_size_unlimited
Definition: Global.h:75
std::shared_ptr< Table > TablePtr
Definition: Table.h:53
static int64_t range_maximum_size
Definition: Global.h:85
static CommitLogPtr metadata_log
Definition: Global.h:79
static bool immovable_range_set_contains(const TableIdentifier &table, const RangeSpec &spec)
Definition: Global.cc:106
std::shared_ptr< Ranges > RangesPtr
Smart pointer to Ranges.
Definition: TableInfo.h:91