Commit 473d453e authored by jan.koester's avatar jan.koester
Browse files

teest

parent 89e912a5
Loading
Loading
Loading
Loading
Loading
+14 −2
Original line number Diff line number Diff line
@@ -116,10 +116,12 @@ namespace authdb {
            } catch (const std::exception &e) {
                std::cerr << "ClusterBackend::fetchFromCluster: retrieve failed: "
                          << e.what() << std::endl;
                if (std::string(e.what()).find("not enough blocks") != std::string::npos)
                // Mark data as existing when the error indicates shards are present
                // but not enough peers are available
                _ClusterDataExists.store(true);
            } catch (...) {
                std::cerr << "ClusterBackend::fetchFromCluster: retrieve failed (unknown)" << std::endl;
                _ClusterDataExists.store(true);
            }
        }

@@ -176,6 +178,16 @@ namespace authdb {
        if (g_Cluster)
            _lastRecoveryEpoch = g_Cluster->getRecoveryEpoch();

        // Check if the local block store already has shards for this domain.
        // This tells the wizard guard that data exists even before peers are up.
        if (g_Cluster && g_Cluster->isRunning()) {
            uint64_t dgid = domainGroupId();
            auto &store = g_Cluster->getStore();
            auto blocks = store.list_blocks(dgid);
            if (!blocks.empty())
                _ClusterDataExists.store(true);
        }

        // Try to fetch existing data from cluster (single attempt, non-blocking).
        // If peers aren't reachable yet, lock() will fetch on first use.
        fetchFromCluster();