m_flush_rate_limit.rate(bps);
}
+void
+BeesHashTable::set_create(bool v)
+{
+ m_create = v;
+ BEESLOGINFO("state.create = " << (v ? "yes" : "no") << " [state.create]");
+}
+
+void
+BeesHashTable::set_resize(bool v)
+{
+ m_resize = v;
+ BEESLOGINFO("state.hash.resize = " << (v ? "yes" : "no") << " [state.hash.resize]");
+}
+
+void
+BeesHashTable::set_writeback_fsync(bool v)
+{
+ m_writeback_fsync = v;
+ BEESLOGINFO("state.hash.writeback-fsync = " << (v ? "yes" : "no") << " [state.hash.writeback-fsync]");
+}
+
+void
+BeesHashTable::set_writeback_unreadahead(bool v)
+{
+ m_writeback_unreadahead = v;
+ BEESLOGINFO("state.hash.writeback-unreadahead = " << (v ? "yes" : "no") << " [state.hash.writeback-unreadahead]");
+}
+
+void
+BeesHashTable::set_close_fsync(bool v)
+{
+ m_close_fsync = v;
+ BEESLOGINFO("state.hash.close-fsync = " << (v ? "yes" : "no") << " [state.hash.close-fsync]");
+}
+
void
BeesHashTable::resize_file(off_t new_size)
{
void
BeesRoots::set_persistent(bool v)
{
- BEESLOGINFO("state persistence = " << (v ? "yes" : "no") << " [state.persistent]");
m_roots_persistent = v;
}
// Set up persistent state (hash table and crawl checkpoints)
{
const bool persistent = bc->get_config().get("state.persistent", bees_parse_bool);
+ BEESLOGINFO("state.persistent = " << (persistent ? "yes" : "no") << " [state.persistent]");
// Round up to the next hash table extent boundary (128 KiB).
const auto hash_size_raw = static_cast<off_t>(bc->get_config().get("state.hash.size", [&](const string &s) {
return bees_parse_size(bc->get_config().subst(s));
}));
const auto hash_size = (hash_size_raw + BLOCK_SIZE_HASHTAB_EXTENT - 1)
/ BLOCK_SIZE_HASHTAB_EXTENT * BLOCK_SIZE_HASHTAB_EXTENT;
+ BEESLOGINFO("state.hash.size = " << pretty(hash_size) << " [state.hash.size]");
if (!persistent) {
// Pure in-memory mode: allocate hash table in RAM, skip all file I/O.
ht->set_close_fsync(bc->get_config().get("state.hash.close-fsync", bees_parse_bool));
// Compute effective writeback rate: min(size / writeback-time, writeback-rate-max)
const double writeback_time = bc->get_config().get("state.hash.writeback-time", bees_parse_duration);
+ BEESLOGINFO("state.hash.writeback-time = " << writeback_time << "s [state.hash.writeback-time]");
const double writeback_rate_max = static_cast<double>(bc->get_config().get("state.hash.writeback-rate-max", bees_parse_size));
+ BEESLOGINFO("state.hash.writeback-rate-max = " << pretty(static_cast<uint64_t>(writeback_rate_max)) << " [state.hash.writeback-rate-max]");
const double computed_rate = writeback_time > 0 ? static_cast<double>(hash_size) / writeback_time : writeback_rate_max;
- ht->set_flush_rate(min(computed_rate, writeback_rate_max));
+ const double effective_rate = min(computed_rate, writeback_rate_max);
+ BEESLOGINFO("state.hash: effective writeback rate = " << pretty(static_cast<uint64_t>(effective_rate)) << "/s");
+ ht->set_flush_rate(effective_rate);
}
bc->start_hash_writeback();
/// Set writeback rate in bytes per second.
void set_flush_rate(double bps);
/// If false, throw at startup when beeshash.dat is absent instead of creating it.
- void set_create(bool v) { m_create = v; }
+ void set_create(bool v);
/// If true, rebuild the on-disk table at state.hash.size on startup (reverse-LRU merge).
- void set_resize(bool v) { m_resize = v; }
+ void set_resize(bool v);
/// fsync after each extent write.
- void set_writeback_fsync(bool v) { m_writeback_fsync = v; }
+ void set_writeback_fsync(bool v);
/// Discard hash table pages from VFS page cache after each write.
- void set_writeback_unreadahead(bool v) { m_writeback_unreadahead = v; }
+ void set_writeback_unreadahead(bool v);
/// fsync the hash table on close (at bees termination only).
- void set_close_fsync(bool v) { m_close_fsync = v; }
+ void set_close_fsync(bool v);
private:
string m_filename;