48 lock_guard<mutex> lock(m_mutex);
49 InfoMap::iterator iter = m_map.find(table_id);
50 if (iter == m_map.end())
52 info = (*iter).second;
57 lock_guard<mutex> lock(m_mutex);
60 InfoMap::iterator iter = m_map.find(table_id);
61 if (iter != m_map.end()) {
62 info = (*iter).second;
69 if (!m_schema_cache->get(table_id, entry))
71 "Unable to locate schema for table %s", table_id.c_str());
87 "Table %s does not exist in hyperspace", table_id.c_str());
92 table.
id = table_id.c_str();
97 m_map[table_id] = info;
103 lock_guard<mutex> lock(m_mutex);
107 InfoMap::iterator iter = m_map.find(table.
id);
110 if (transfer_log && *transfer_log) {
113 if (!commit_log_reader->empty()) {
115 if (range->is_root())
124 range->replay_transfer_log(commit_log_reader.get());
126 commit_log_reader->get_linked_logs(linked_logs);
129 HT_THROWF(error,
"Unable to link transfer log (%s) into commit log(%s)",
130 transfer_log, log->get_log_dir().c_str());
136 linked_logs.insert(transfer_log);
143 std::vector<MetaLog::EntityPtr> entities;
144 entities.push_back(range->metalog_entity());
148 (*iter).second->promote_staged_range(range);
153 lock_guard<mutex> lock(m_mutex);
154 InfoMap::iterator iter = m_map.find(table_id);
155 if (iter == m_map.end())
157 info = (*iter).second;
164 lock_guard<mutex> lock(m_mutex);
165 for (InfoMap::iterator iter = m_map.begin(); iter != m_map.end(); ++iter)
166 tv.push_back((*iter).second);
171 lock_guard<mutex> lock(m_mutex);
175 for (InfoMap::iterator iter = m_map.begin(); iter != m_map.end(); iter++)
176 count += (*iter).second->get_range_count();
177 ranges.
array.reserve(count+10);
179 for (InfoMap::iterator iter = m_map.begin(); iter != m_map.end(); iter++)
180 (*iter).second->get_ranges(ranges);
192 lock_guard<mutex> lock(m_mutex);
197 lock_guard<mutex> lock(m_mutex);
198 return m_map.empty();
203 lock_guard<mutex> lock(m_mutex);
204 merge_unlocked(other);
208 vector<MetaLog::EntityPtr> &entities,
210 lock_guard<mutex> lock(m_mutex);
216 merge_unlocked(other);
222 InfoMap::iterator other_iter, iter;
225 for (other_iter = other->
m_map.begin();
226 other_iter != other->
m_map.end(); ++other_iter) {
228 iter = m_map.find( (*other_iter).first );
230 if (iter == m_map.end()) {
231 m_map[ (*other_iter).first ] = (*other_iter).second;
234 ranges.
array.clear();
235 (*other_iter).second->get_ranges(ranges);
236 for (
auto &rd : ranges.
array)
237 (*iter).second->add_range(rd.range);
std::set< String > StringSet
STL Set managing Strings.
InfoMap m_map
table_id-to-TableInfoPtr map
The FailureInducer simulates errors.
Cache entry for Hyperspace table data.
std::string String
A String is simply a typedef to std::string.
bool remove(const String &table_id, TableInfoPtr &info)
Removes a table from the map.
Declarations for CommitLogReader.
void promote_staged_range(const TableIdentifier &table, RangePtr &range, const char *transfer_log)
Adds a staged range.
A dynamic, resizable and reference counted memory buffer.
static MetaLogEntityRemoveOkLogsPtr remove_ok_logs
std::shared_ptr< CommitLogReader > CommitLogReaderPtr
Smart pointer to CommitLogReader.
void merge_unlocked(TableInfoMap *other)
Merges in another map (without locking mutex).
void get_ranges(Ranges &ranges, StringSet *remove_ok_logs=0)
Gets set of live RangeData objects and corresponding transfer logs that can be safely removed...
Declarations for TableInfoMap.
static Hyperspace::SessionPtr hyperspace
static std::string toplevel_dir
std::vector< RangeData > array
Vector of RangeData objects.
static CommitLogPtr root_log
void merge(TableInfoMap *other)
Merges in another map.
static uint64_t get()
Gets the cluster ID.
static MetaLog::WriterPtr rsml_writer
Compatibility Macros for C/C++.
virtual ~TableInfoMap()
Destructor.
static Schema * new_instance(const std::string &buf)
Creates schema object from XML schema string.
bool empty()
Determines if map is empty.
static CommitLogPtr system_log
void get(const String &table_id, TableInfoPtr &info)
Gets the TableInfo object for a table, creating one if not found.
std::shared_ptr< TableInfo > TableInfoPtr
Smart pointer to TableInfo.
SchemaPtr schema
Smart pointer to Schema object.
#define HT_THROWF(_code_, _fmt_,...)
std::shared_ptr< Range > RangePtr
Smart pointer to Range.
uint8_t * base
Pointer to the allocated memory buffer.
std::shared_ptr< CommitLog > CommitLogPtr
Smart pointer to CommitLog.
bool lookup(const String &table_id, TableInfoPtr &info)
Returns the TableInfo object for a given table.
This is a generic exception class for Hypertable.
static CommitLogPtr user_log
void clear()
Clears the map.
#define HT_MAYBE_FAIL_X(_label_, _exp_)
void get_all(std::vector< TableInfoPtr > &tv)
Gets all TableInfo objects in map.
static Hypertable::FilesystemPtr log_dfs
Declarations for CommitLog.
#define HT_THROW(_code_, _msg_)
Manages live range map and set of log names that can be safely removed.
Declarations for ClusterId.
bool maintenance_disabled
Flag indicating if "maintenance_disabled" attribute is set.
Holds vector of RangeData objects and memory arena.
static CommitLogPtr metadata_log
int code() const
Returns the error code.