1
0
Fork 0

Merge pull request #1445 from rqlite/count-snapshot-upgrade

Count Snapshot upgrades
master
Philip O'Toole 10 months ago committed by GitHub
commit 01933cacc9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -53,6 +53,7 @@ When officially released 8.0 will support (mostly) seamless upgrades from the 7.
- [PR #1440](https://github.com/rqlite/rqlite/pull/1440): Add a Compacting WAL rewriter. Thanks @benbjohnson.
- [PR #1441](https://github.com/rqlite/rqlite/pull/1441), [PR #1443](https://github.com/rqlite/rqlite/pull/1443): Integrate Compacting WAL writer
- [PR #1444](https://github.com/rqlite/rqlite/pull/1444): Trivial clean-ups related to backups.
- [PR #1445](https://github.com/rqlite/rqlite/pull/1445): Count Snapshot upgrades.
## 7.21.4 (July 8th 2023)
### Implementation changes and bug fixes

@ -21,6 +21,8 @@ import (
const (
persistSize = "latest_persist_size"
persistDuration = "latest_persist_duration"
upgradeOk = "upgrade_ok"
upgradeFail = "upgrade_fail"
)
const (
@ -41,6 +43,8 @@ func ResetStats() {
stats.Init()
stats.Add(persistSize, 0)
stats.Add(persistDuration, 0)
stats.Add(upgradeOk, 0)
stats.Add(upgradeFail, 0)
}
// LockingSink is a wrapper around a SnapshotSink that ensures that the

@ -21,7 +21,12 @@ const (
// Upgrade writes a copy of the 7.x-format Snapshot dircectory at 'old' to a
// new Snapshot directory at 'new'. If the upgrade is successful, the
// 'old' directory is removed before the function returns.
func Upgrade(old, new string, logger *log.Logger) error {
func Upgrade(old, new string, logger *log.Logger) (retErr error) {
defer func() {
if retErr != nil {
stats.Add(upgradeFail, 1)
}
}()
newTmpDir := tmpName(new)
// If a temporary version of the new snapshot exists, remove it. This implies a
@ -138,6 +143,7 @@ func Upgrade(old, new string, logger *log.Logger) error {
return fmt.Errorf("failed to remove old snapshot directory %s: %s", old, err)
}
logger.Printf("upgraded snapshot directory %s to %s", old, new)
stats.Add(upgradeOk, 1)
return nil
}

Loading…
Cancel
Save