40 m_identifier(*identifier), m_schema_ptr(schema_ptr),
41 m_start_row(range->start_row), m_end_row(range->end_row),
42 m_ag_name(ag_name), m_need_update(false), m_is_root(false),
43 m_last_nextcsid(0), m_cur_nextcsid(0), m_total_blocks(0) {
53 lock_guard<mutex> lock(
m_mutex);
54 for (
size_t i=0; i<deletes.size(); i++)
65 lock_guard<mutex> lock(
m_mutex);
66 FileRefCountMap::iterator iter;
67 for (
size_t i=0; i<filev.size(); i++) {
82 lock_guard<mutex> lock(
m_mutex);
83 FileRefCountMap::iterator iter;
84 for (
size_t i=0; i<filev.size(); i++) {
87 if (--(*iter).second == 0) {
113 for (
const auto &file :
m_live) {
114 file_list += file +
";\n";
115 printable_list += file +
"; ";
120 if (m_live.count(v.first) == 0) {
121 file_list +=
format(
"#%s;\n", v.first.c_str());
122 printable_list +=
String(
"#") + v.first +
"; ";
155 HT_ERROR_OUT <<
"Problem updating 'Files' column of METADATA, retry count=" << retry_count
157 if (retry_count < 6) {
159 this_thread::sleep_for(chrono::milliseconds(15000));
162 HT_THROW2(e.
code(), e,
"Problem updating 'Files' column of METADATA: ");
172 lock_guard<mutex> lock(
m_mutex);
176 for (
const auto &file :
m_live)
177 file_list += file +
";\n";
179 if (include_blocked) {
182 if (m_live.count(v.first) == 0) {
183 file_list +=
format(
"#%s;\n", v.first.c_str());
193 lock_guard<mutex> lock(
m_mutex);
195 for (
const auto &file :
m_live)
196 file_list += file +
";";
202 return fname.substr(basename_len);
void add_references(const std::vector< String > &filev)
Adds a set of files to the referenced file set.
The FailureInducer simulates errors.
std::string String
A String is simply a typedef to std::string.
TableIdentifierManaged m_identifier
String format(const char *fmt,...)
Returns a String using printf like format facilities Vanilla snprintf is about 1.5x faster than this...
void update_live(const String &add, std::vector< String > &deletes, uint32_t nextcsid, int64_t total_blocks)
Updates the live file set.
FileRefCountMap m_referenced
std::set< String > m_live
LiveFileTracker(const TableIdentifier *identifier, SchemaPtr &schema_ptr, const RangeSpec *range, const String &ag_name)
std::mutex m_update_mutex
void add(const Key &key, uint8_t flag, const void *value, uint32_t value_len, TableMutatorAsync *value_index_mutator, TableMutatorAsync *qualifier_index_mutator)
std::set< String > m_blocked
void get_file_data(String &file_list, int64_t *block_countp, bool include_blocked)
Returns ' ' separated list of files, suitable for writing into the 'Files' column of METADATA...
static std::string toplevel_dir
void remove_references(const std::vector< String > &filev)
Decrements the reference count of each file in the given vector.
Compatibility Macros for C/C++.
void update_files_column()
Updates the 'Files' METADATA column if it needs updating.
void get_file_list(String &file_list)
Populates string with live files separated by ';'.
String strip_basename(const String &fname)
This is a generic exception class for Hypertable.
static const char * END_ROOT_ROW
std::shared_ptr< Schema > SchemaPtr
Smart pointer to Schema.
#define HT_MAYBE_FAIL(_label_)
int code() const
Returns the error code.
#define HT_THROW2(_code_, _ex_, _msg_)