Skip to content

Unified Upgrade Command & Migration System - #112

Merged
paulkczw merged 4 commits into
devfrom
feature/upgrade-and-migrations
Jun 3, 2026
Merged

Unified Upgrade Command & Migration System#112
paulkczw merged 4 commits into
devfrom
feature/upgrade-and-migrations

Conversation

@paulkczw

@paulkczw paulkczw commented Jun 3, 2026

Copy link
Copy Markdown
Member

Replaces the two-step version download + version switch workflow with a single version upgrade command and introduces a database/file migration framework for safe cluster-wide version transitions.

Changes

Upgrade Command

  • Removed version download and version switch subcommands
  • Added version upgrade [channel] [version] — downloads, verifies, and installs in one step
  • Safety confirmations (channel change, downgrade warnings) retained
  • All references in checkupdate, downloaded, and Updater.kt startup messages updated

Cluster-Wide Upgrade

  • version upgrade automatically upgrades all connected cluster nodes via ClusterUpgradePacket
  • Each remote node downloads from GitHub independently and reports success/failure
  • Live status overview with per-node animations (pending → downloading → upgraded/failed)
  • Pre-upgrade node list and post-upgrade summary with cluster shutdown reminder
  • 120s timeout for remote node responses

Migration Framework (migrations/ module)

  • New Gradle subproject with Migration interface (version, type, up()/down())
  • Two migration types:
    • DATABASE — shared Redis changes, executed once per cluster with distributed lock (cloud:migration-lock)
    • LOCAL — file/folder changes, executed on every node independently
  • MigrationRegistry for explicit registration with version-range queries (supports upgrade + downgrade)
  • MigrationRunner handles the full startup flow:
    • Reads cloud:schema-version from Redis, compares with JAR version
    • Acquires distributed lock for DB migrations (5min timeout)
    • Wait-state with 2s polling when another node holds the lock (10min timeout)
    • Tracks local migrations via .local-schema-version file

Auto-Upgrade on Version Mismatch

  • On startup, if cloud:schema-version is ahead of the node's JAR version, the node automatically downloads the correct release, installs it, and shuts down for restart
  • Migrations run before the node registers as connected — no inconsistent cluster state

Startup Flow (NodeService)

Updater.check() → cleanup old JARs, log available updates
MigrationRunner.run() → returns UpgradeRequired or Success
├─ UpgradeRequired → auto-download + switch + shutdown
└─ Success → DB migrations (with lock) + local migrations
nodeRepository.connect() → node registers as connected

@paulkczw
paulkczw merged commit 6c7c203 into dev Jun 3, 2026
1 check failed
@paulkczw
paulkczw deleted the feature/upgrade-and-migrations branch June 4, 2026 11:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant