From 80ea58848bb6886aa4f3fe96f3db1bf4e342d2c4 Mon Sep 17 00:00:00 2001 From: anonpenguin23 Date: Mon, 10 Nov 2025 08:08:43 +0200 Subject: [PATCH] feat: add script for graceful shutdown and process cleanup - Introduced a new script `dev-kill-all.sh` to handle graceful shutdown of development processes and cleanup of stale PID files. - Updated Makefile to include a `kill` command that utilizes the new script for improved process management. - Enhanced the shutdown process to verify that required ports are free after termination of processes. --- CHANGELOG.md | 14 ++++++++++++++ Makefile | 2 +- pkg/environments/templates/bootstrap.yaml | 2 +- pkg/environments/templates/node.yaml | 2 +- pkg/rqlite/rqlite.go | 9 ++++++--- 5 files changed, 23 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9711540..1c02e1a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,20 @@ The format is based on [Keep a Changelog][keepachangelog] and adheres to [Semant ### Deprecated ### Fixed +## [0.63.1] - 2025-11-10 + +### Added +\n +### Changed +- Increased the default minimum cluster size for database environments from 1 to 3. + +### Deprecated + +### Removed + +### Fixed +- Prevented unnecessary cluster recovery attempts when a node starts up as the first node (fresh bootstrap). + ## [0.63.0] - 2025-11-10 ### Added diff --git a/Makefile b/Makefile index e05452f..91d8f51 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ test-e2e: .PHONY: build clean test run-node run-node2 run-node3 run-example deps tidy fmt vet lint clear-ports install-hooks kill -VERSION := 0.63.0 +VERSION := 0.63.1 COMMIT ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo unknown) DATE ?= $(shell date -u +%Y-%m-%dT%H:%M:%SZ) LDFLAGS := -X 'main.version=$(VERSION)' -X 'main.commit=$(COMMIT)' -X 'main.date=$(DATE)' diff --git a/pkg/environments/templates/bootstrap.yaml b/pkg/environments/templates/bootstrap.yaml index 9b13905..aa3eb60 100644 --- a/pkg/environments/templates/bootstrap.yaml +++ b/pkg/environments/templates/bootstrap.yaml @@ -17,7 +17,7 @@ database: rqlite_join_address: "" cluster_sync_interval: "30s" peer_inactivity_limit: "24h" - min_cluster_size: 1 + min_cluster_size: 3 ipfs: cluster_api_url: "http://localhost:{{.ClusterAPIPort}}" api_url: "http://localhost:{{.IPFSAPIPort}}" diff --git a/pkg/environments/templates/node.yaml b/pkg/environments/templates/node.yaml index 2ac9551..bc72840 100644 --- a/pkg/environments/templates/node.yaml +++ b/pkg/environments/templates/node.yaml @@ -17,7 +17,7 @@ database: rqlite_join_address: "{{.RQLiteJoinAddress}}" cluster_sync_interval: "30s" peer_inactivity_limit: "24h" - min_cluster_size: 1 + min_cluster_size: 3 ipfs: cluster_api_url: "http://localhost:{{.ClusterAPIPort}}" api_url: "http://localhost:{{.IPFSAPIPort}}" diff --git a/pkg/rqlite/rqlite.go b/pkg/rqlite/rqlite.go index a2cb00c..679d627 100644 --- a/pkg/rqlite/rqlite.go +++ b/pkg/rqlite/rqlite.go @@ -826,9 +826,12 @@ func (r *RQLiteManager) performPreStartClusterDiscovery(ctx context.Context, rql time.Sleep(2 * time.Second) } - if discoveredPeers == 0 { - r.logger.Warn("No peers discovered during pre-start discovery window, will attempt solo recovery") - // Continue anyway - might be the only node left + // CRITICAL FIX: Skip recovery if no peers were discovered (other than ourselves) + // Only ourselves in the cluster means this is a fresh bootstrap, not a recovery scenario + if discoveredPeers <= 1 { + r.logger.Info("No peers discovered during pre-start discovery window - skipping recovery (fresh bootstrap)", + zap.Int("discovered_peers", discoveredPeers)) + return nil } // Trigger final sync to ensure peers.json is up to date with latest discovered peers