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

bugfix

parent f9544b6e
Loading
Loading
Loading
Loading
Loading
+15 −4
Original line number Diff line number Diff line
@@ -284,14 +284,25 @@ namespace authdb {

        // While scrub/rebuild is running, blocks may not be on all nodes
        // yet — skip the expensive network fetch and use cached data.
        // But only when there IS cached data to fall back on: if a node
        // has never successfully fetched this domain (fresh restart, empty
        // cache), it must still attempt a real fetch even during scrub —
        // otherwise a scrub/rebalance that never settles to idle (e.g.
        // perpetually re-flagging the same groups as incomplete) would
        // permanently block that node from ever getting its first data,
        // stuck showing "cluster data unavailable — waiting for peers".
        if (cluster->isScrubRunning()) {
            auto cache = getDomainCache();
            if (!cache->buffer.empty() && _Buffer.size() <= sizeof(AuthHeader)) {
            if (!cache->buffer.empty()) {
                if (_Buffer.size() <= sizeof(AuthHeader)) {
                    _Buffer = cache->buffer;
                    _ClusterDataExists.store(_Buffer.size() > sizeof(AuthHeader));
                }
                return;
            }
            // No cached data at all yet — fall through and attempt a
            // real fetch below despite scrub running.
        }

        auto cache = getDomainCache();
        auto now = std::chrono::steady_clock::now();