Loading src/backends/cluster.cpp +10 −7 Original line number Diff line number Diff line Loading @@ -153,11 +153,17 @@ namespace authdb { ClusterBackend::ClusterBackend(const char *domain, size_t version, const char *filepath) : _Domain(domain), _Pos(0), _Dirty(false) { // Try to fetch existing data from cluster/store // Try to fetch existing data from cluster/store (retry a few times on startup) for (int attempt = 0; attempt < 3 && _Buffer.empty(); ++attempt) { if (attempt > 0) std::this_thread::sleep_for(std::chrono::seconds(attempt)); fetchFromCluster(); } if (_Buffer.empty()) { // Initialize with a fresh header // Initialize with a fresh header locally. // Do NOT push to cluster — we may have failed to fetch existing data // and pushing an empty header would overwrite real data on other nodes. AuthHeader head; head.Version = version; head.Revesion = 0; Loading @@ -167,10 +173,7 @@ namespace authdb { _Buffer.resize(sizeof(AuthHeader)); std::memcpy(_Buffer.data(), &head, sizeof(AuthHeader)); _Dirty = true; // Push initial header to cluster/store pushToCluster(); _Dirty = false; } } Loading Loading
src/backends/cluster.cpp +10 −7 Original line number Diff line number Diff line Loading @@ -153,11 +153,17 @@ namespace authdb { ClusterBackend::ClusterBackend(const char *domain, size_t version, const char *filepath) : _Domain(domain), _Pos(0), _Dirty(false) { // Try to fetch existing data from cluster/store // Try to fetch existing data from cluster/store (retry a few times on startup) for (int attempt = 0; attempt < 3 && _Buffer.empty(); ++attempt) { if (attempt > 0) std::this_thread::sleep_for(std::chrono::seconds(attempt)); fetchFromCluster(); } if (_Buffer.empty()) { // Initialize with a fresh header // Initialize with a fresh header locally. // Do NOT push to cluster — we may have failed to fetch existing data // and pushing an empty header would overwrite real data on other nodes. AuthHeader head; head.Version = version; head.Revesion = 0; Loading @@ -167,10 +173,7 @@ namespace authdb { _Buffer.resize(sizeof(AuthHeader)); std::memcpy(_Buffer.data(), &head, sizeof(AuthHeader)); _Dirty = true; // Push initial header to cluster/store pushToCluster(); _Dirty = false; } } Loading