Loading src/cluster.cpp +23 −3 Original line number Diff line number Diff line Loading @@ -347,7 +347,7 @@ namespace authdb { // Setup local block store — file-backed if path configured, otherwise memory if (!cfg_.store_path.empty()) { std::cerr << "Cluster: using file_block_store at " << cfg_.store_path << std::endl; store_ = std::make_shared<paritypp::file_block_store>(cfg_.store_path); store_ = std::make_shared<paritypp::file_block_store>(cfg_.store_path, 0); } else { std::cerr << "Cluster: using memory_block_store (no PATH configured)" << std::endl; store_ = std::make_shared<paritypp::memory_block_store>(); Loading Loading @@ -469,9 +469,29 @@ namespace authdb { if (running_) return; running_ = true; // Vacuum file store at startup to reclaim space from old session data // that was previously written to blocks.bin instead of session_store_ // Purge old session blocks from file store and vacuum to reclaim space. // Previous versions stored session shards in blocks.bin; identify them // by checking if block 0 of each group starts with the SESB magic // (after the 8-byte parity length header). if (store_) { auto all_groups = store_->list_groups(); int purged = 0; for (uint64_t gid : all_groups) { std::vector<uint8_t> block0; if (store_->fetch(gid, 0, block0) && block0.size() >= 12) { // The parity client prepends an 8-byte length header. // After that, session data starts with 'SESB' magic. if (block0[8] == 'S' && block0[9] == 'E' && block0[10] == 'S' && block0[11] == 'B') { store_->remove_group(gid); ++purged; } } } if (purged > 0) { std::cerr << "Cluster: purged " << purged << " old session groups from file store" << std::endl; } if (store_->vacuum()) { std::cerr << "Cluster: startup vacuum completed" << std::endl; } Loading Loading
src/cluster.cpp +23 −3 Original line number Diff line number Diff line Loading @@ -347,7 +347,7 @@ namespace authdb { // Setup local block store — file-backed if path configured, otherwise memory if (!cfg_.store_path.empty()) { std::cerr << "Cluster: using file_block_store at " << cfg_.store_path << std::endl; store_ = std::make_shared<paritypp::file_block_store>(cfg_.store_path); store_ = std::make_shared<paritypp::file_block_store>(cfg_.store_path, 0); } else { std::cerr << "Cluster: using memory_block_store (no PATH configured)" << std::endl; store_ = std::make_shared<paritypp::memory_block_store>(); Loading Loading @@ -469,9 +469,29 @@ namespace authdb { if (running_) return; running_ = true; // Vacuum file store at startup to reclaim space from old session data // that was previously written to blocks.bin instead of session_store_ // Purge old session blocks from file store and vacuum to reclaim space. // Previous versions stored session shards in blocks.bin; identify them // by checking if block 0 of each group starts with the SESB magic // (after the 8-byte parity length header). if (store_) { auto all_groups = store_->list_groups(); int purged = 0; for (uint64_t gid : all_groups) { std::vector<uint8_t> block0; if (store_->fetch(gid, 0, block0) && block0.size() >= 12) { // The parity client prepends an 8-byte length header. // After that, session data starts with 'SESB' magic. if (block0[8] == 'S' && block0[9] == 'E' && block0[10] == 'S' && block0[11] == 'B') { store_->remove_group(gid); ++purged; } } } if (purged > 0) { std::cerr << "Cluster: purged " << purged << " old session groups from file store" << std::endl; } if (store_->vacuum()) { std::cerr << "Cluster: startup vacuum completed" << std::endl; } Loading