Skip to content

Feature/rolling update#370

Merged
bootjp merged 10 commits intomainfrom
feature/rolling-update
Mar 20, 2026
Merged

Feature/rolling update#370
bootjp merged 10 commits intomainfrom
feature/rolling-update

Conversation

@bootjp
Copy link
Owner

@bootjp bootjp commented Mar 20, 2026

No description provided.

Base automatically changed from feature/redis-proxy to main March 20, 2026 10:16
@bootjp bootjp requested a review from Copilot March 20, 2026 10:16
@gemini-code-assist
Copy link
Contributor

Warning

Gemini encountered an error creating the summary. You can try again by commenting /gemini summary.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds operational tooling and code to support migrating legacy Raft storage (BoltDB logs.dat/stable.dat) to the newer Pebble-backed raft.db, and provides a rolling update script that can detect/handle legacy storage during container restarts.

Changes:

  • Add internal/raftstore legacy BoltDB → Pebble migration implementation + unit test.
  • Add cmd/raft-migrate offline migration CLI and document migration steps in README.md.
  • Add scripts/rolling-update.sh and an example env file to perform safe rolling container updates with leadership transfer and legacy-storage cleanup.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
scripts/rolling-update.sh New rolling update script that pulls image, transfers Raft leadership when needed, restarts container, and handles legacy BoltDB detection/cleanup.
scripts/rolling-update.env.example Example configuration for the rolling update script.
internal/raftstore/migrate.go Implements legacy BoltDB (logs/conf buckets) migration into the existing Pebble raft store.
internal/raftstore/migrate_test.go Unit test covering migration correctness for logs and stable keys.
cmd/raft-migrate/main.go Adds a small CLI wrapper around MigrateLegacyBoltDB.
README.md Documents when/how to run the offline migrator and required post-move steps.
go.mod Adds go.etcd.io/bbolt dependency for reading legacy BoltDB files.
go.sum Records checksums for the added bbolt dependency.

Comment on lines +627 to +631
sudo mkdir -p "$backup_dir"
for name in logs.dat stable.dat; do
if sudo test -e "$dir/$name"; then
sudo mv "$dir/$name" "$backup_dir/$name"
moved=1
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The remote script uses sudo without non-interactive mode (e.g., sudo mkdir -p ...). Over SSH this can block indefinitely if passwordless sudo isn't configured. Consider using sudo -n (fail fast) and emitting a clear error instructing the operator to configure passwordless sudo (or make sudo usage configurable/optional).

Copilot uses AI. Check for mistakes.
Comment on lines +70 to +74
tempDir := destDir + legacyMigrationSuffix
if err := requireDestinationAbsent(tempDir); err != nil {
return "", err
}
return tempDir, nil
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prepareMigrationPaths builds the temp dir via string concatenation (destDir + ".migrating") without normalizing destDir. If the caller passes a destination with a trailing slash (e.g. /path/raft.db/), the temp dir becomes nested under destDir (e.g. /path/raft.db/.migrating) and os.Rename(tempDir, destDir) will fail after creating partial directories. Consider normalizing destDir with filepath.Clean (and/or explicitly rejecting a trailing path separator) before computing tempDir.

Copilot uses AI. Check for mistakes.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@bootjp
Copy link
Owner Author

bootjp commented Mar 20, 2026

@copilot open a new pull request to apply changes based on the comments in this thread

Copy link
Contributor

Copilot AI commented Mar 20, 2026

@bootjp I've opened a new pull request, #371, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI and others added 2 commits March 20, 2026 10:37
Co-authored-by: bootjp <1306365+bootjp@users.noreply.github.com>
fix: sudo -n, SSH env passthrough, filepath.Clean for destDir
@bootjp bootjp enabled auto-merge March 20, 2026 11:26
@bootjp bootjp merged commit 55074d2 into main Mar 20, 2026
8 checks passed
@bootjp bootjp deleted the feature/rolling-update branch March 20, 2026 11:28
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.

3 participants