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

tes

parent 6831b69b
Loading
Loading
Loading
Loading
Loading
+25 −1
Changes for src/cluster.cpp: 25 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -455,6 +455,19 @@ namespace authdb {
                    std::cerr << "Cluster: " << health.nodes_online << "/"
                              << health.nodes_total << " nodes online ("
                              << elapsed << "s/" << timeout_s << "s)" << std::endl;

                    // Also check session_client_ health
                    if (session_client_) {
                        try {
                            std::unique_lock<std::timed_mutex> slock(session_client_mutex_, std::chrono::seconds(2));
                            if (slock.owns_lock()) {
                                auto shealth = session_client_->get_cluster_status();
                                std::cerr << "Cluster: session_client " << shealth.nodes_online << "/"
                                          << shealth.nodes_total << " nodes online" << std::endl;
                            }
                        } catch (...) {}
                    }

                    if (health.nodes_online >= n) {
                        std::cerr << "Cluster: all nodes online" << std::endl;
                        return health.nodes_online;
@@ -588,10 +601,21 @@ namespace authdb {
        std::unique_lock<std::timed_mutex> lock(session_client_mutex_, std::chrono::seconds(2));
        if (!lock.owns_lock())
            throw AuthBackendError("cluster busy — session push timeout");
        try {
            session_client_->store(sgid, data.data(), data.size());
            session_client_->store(sid_gid, data.data(), data.size());
        } catch (const std::exception &e) {
            std::cerr << "[CLUSTER-SESSION] pushSession: store FAILED: " << e.what() << std::endl;
            throw;
        }

        std::cerr << "[CLUSTER-SESSION] pushSession: stored OK" << std::endl;
        // Immediately verify local shard exists
        try {
            auto verify = session_client_->retrieve(sid_gid);
            std::cerr << "[CLUSTER-SESSION] pushSession: stored OK, verify=" << verify.size() << " bytes" << std::endl;
        } catch (const std::exception &e) {
            std::cerr << "[CLUSTER-SESSION] pushSession: stored but verify failed: " << e.what() << std::endl;
        }
    }

    void Cluster::queuePush(const SessionData &sess) {