Commit c0eb970c authored by jan.koester's avatar jan.koester
Browse files

deb

parent 706bada0
Loading
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
authdb (20260412+13) unstable; urgency=medium

  * Use libparitypp distributed scrub lock to prevent concurrent
    scrub/rebalance across cluster nodes
  * Skip scrub lock group in group listing

 -- Jan Koester <jan.koester@tuxist.de>  Sun, 12 Apr 2026 18:00:00 +0200

authdb (20260412+12) unstable; urgency=medium

  * Fix group distribution imbalance: session_intercepting_store no longer
+13 −1
Original line number Diff line number Diff line
@@ -653,7 +653,8 @@ namespace authdb {
                        healthy_cycles = 0;
                        std::thread([this](){
                            std::unique_lock<std::mutex> lk(scrub_mutex_, std::try_to_lock);
                            if (!lk.owns_lock()) return; // scrub running, skip
                            if (!lk.owns_lock()) return;
                            if (!pclient_->try_scrub_lock()) return;
                            scrub_running_ = true;
                            try {
                                auto rb = pclient_->rebalance();
@@ -664,6 +665,7 @@ namespace authdb {
                                }
                            } catch (...) {}
                            scrub_running_ = false;
                            pclient_->release_scrub_lock();
                        }).detach();
                    }
                } else if (health.nodes_online >= k) {
@@ -1069,6 +1071,13 @@ namespace authdb {
        }
        scrub_running_ = true;

        // Cluster-wide lock: prevent concurrent scrub across nodes
        if (!pclient_->try_scrub_lock()) {
            std::cerr << "[SCRUB] skipped — another node is scrubbing" << std::endl;
            scrub_running_ = false;
            return result;
        }

        size_t n = cfg_.data_blocks + cfg_.parity_blocks;

        // Collect known session group IDs so we can skip them.
@@ -1090,11 +1099,13 @@ namespace authdb {
        }

        // 1. Collect all group IDs from every node
        uint64_t lock_gid = paritypp::client::scrub_lock_group_id();
        std::map<uint64_t, std::set<size_t>> group_nodes;  // group_id -> set of node indices that have it
        for (size_t ni = 0; ni < n; ++ni) {
            std::vector<uint64_t> node_groups;
            if (pclient_->list_groups_on_node(ni, node_groups)) {
                for (uint64_t gid : node_groups) {
                    if (gid == lock_gid) continue;  // skip lock group
                    if (session_gids.count(gid))
                        continue;  // skip session groups
                    group_nodes[gid].insert(ni);
@@ -1153,6 +1164,7 @@ namespace authdb {
                  << " failed=" << result.groups_failed << std::endl;

        scrub_running_ = false;
        pclient_->release_scrub_lock();
        return result;
    }