{"record":{"id":"7b9d739c3a2a30dc","repo":"microsoft/FASTER","slug":"hlog-compaction-was-not-successful-retry","errorCode":null,"errorMessage":"Hlog compaction was not successful :( -- retry!","messagePattern":"Hlog compaction was not successful :\\( -- retry!","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"cc/src/core/faster.h","lineNumber":4497,"sourceCode":"    until_address = std::min(until_address, begin_address + hlog_compaction_config_.max_compacted_size);\n    // do not compact in-memory region\n    until_address = std::min(until_address, hlog.safe_head_address.control());\n    // round down address to page bounds\n    until_address = until_address - Address(until_address).offset() + Address::kMaxOffset + 1;\n    assert(until_address <= hlog.safe_read_only_address.control());\n    assert(until_address % hlog.kPageSize == 0);\n\n    // perform log compaction\n    log_info(\"Auto-compaction: [%lu %lu] -> [%lu %lu] {%lu}\",\n             begin_address, hlog.GetTailAddress(),\n             until_address, hlog.GetTailAddress(), Size());\n    StartSession();\n    bool success = CompactWithLookup(until_address, true, hlog_compaction_config_.num_threads);\n    StopSession();\n\n    log_info(\"Auto-compaction: Size: %.3f GB\", static_cast<double>(Size()) / (1 << 30));\n    if (!success) {\n      log_error(\"Hlog compaction was not successful :( -- retry!\");\n    }\n  }\n  // no more auto-compactions\n  auto_compaction_scheduled_.store(false);\n}\n\n#ifdef TOML_CONFIG\ntemplate <class K, class V, class D, class H, class OH>\ninline FasterKv<K, V, D, H, OH> FasterKv<K, V, D, H, OH>::FromConfigString(const std::string& config) {\n  return Config::FromConfigString(config, \"faster\");\n}\n\ntemplate <class K, class V, class D, class H, class OH>\ninline FasterKv<K, V, D, H, OH> FasterKv<K, V, D, H, OH>::FromConfigFile(const std::string& filepath) {\n  std::ifstream t(filepath);\n  std::string config(\n    (std::istreambuf_iterator<char>(t)), std::istreambuf_iterator<char>());\n  return FasterKv<K, V, D, H, OH>::FromConfigString(config);","sourceCodeStart":4479,"sourceCodeEnd":4515,"githubUrl":"https://github.com/microsoft/FASTER/blob/321d872eabda6a0345c8bd76419f89723ed864ae/cc/src/core/faster.h#L4479-L4515","documentation":"The background auto-compaction thread called CompactWithLookup on the hybrid log and it returned false, so the log was not successfully compacted in that cycle. This is informational-ish by design (the library logs it and schedules retries), but persistent occurrences mean the log keeps growing toward its size limit.","triggerScenarios":"The store exceeds hlog_compaction_config_.interval_size_mb / auto-compaction thresholds, the auto-compaction task runs StartSession + CompactWithLookup(until_address, true, num_threads), and the compaction fails — usually due to concurrent mutation of records being folded, too few threads, or transient internal scan errors.","commonSituations":"High write throughput keeping compaction from converging; hlog_compaction_config.num_threads too small for log size; auto-compaction racing with user-triggered checkpoint/compaction; long-running sessions delaying safe truncation addresses.","solutions":["Let the library retry (it re-schedules); if the error recurs every interval, increase hlog_compaction_config.num_threads.","Manually run CompactWithLookup during low-traffic windows to reclaim space.","Reduce the auto-compaction threshold (interval_size_mb) so each cycle has less work to do.","If it never succeeds, disable auto-compaction and drive compaction explicitly with error handling, and investigate with a debug build."],"exampleFix":"// before\nauto cfg = CompactionConfig{}; // defaults, 1 thread\nkv.StartAutoCompaction(cfg); // repeated failures\n// after\nCompactionConfig cfg;\ncfg.num_threads = std::thread::hardware_concurrency();\ncfg.interval_size_mb = 512;\nkv.StartAutoCompaction(cfg);","handlingStrategy":"retry","validationCode":"// tune before enabling auto-compaction\nCompactionConfig cfg;\ncfg.num_threads = std::max(2u, std::thread::hardware_concurrency());\ncfg.interval_size_mb = /* smaller bucket size, e.g. 256 */;","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Give auto-compaction enough threads to converge each cycle.","Lower interval_size_mb so each cycle truncates less.","Avoid overlapping manual compaction/checkpoints with auto-compaction windows.","Alert on repeated occurrences — they mean disk/log growth is outpacing compaction."],"tags":["compaction","auto-compaction","hybridlog","retry"],"backgroundTag":"database-query-failed","analyzedSha":"321d872eabda6a0345c8bd76419f89723ed864ae","analyzedAt":"2026-09-15T22:18:00.693Z","contentChangedAt":"2026-09-15T22:18:00.693Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}