Merge pull request #3236 from hashicorp/serf_update

Update serf to pull in disk space failure recovery changes
This commit is contained in:
preetapan 2017-07-06 08:59:46 -05:00 committed by GitHub
commit dabd94c73d
2 changed files with 16 additions and 3 deletions

View File

@ -31,6 +31,7 @@ const flushInterval = 500 * time.Millisecond
const clockUpdateInterval = 500 * time.Millisecond
const coordinateUpdateInterval = 60 * time.Second
const tmpExt = ".compact"
const snapshotErrorRecoveryInterval = 30 * time.Second
// Snapshotter is responsible for ingesting events and persisting
// them to disk, and providing a recovery mechanism at start time.
@ -55,6 +56,7 @@ type Snapshotter struct {
rejoinAfterLeave bool
shutdownCh <-chan struct{}
waitCh chan struct{}
lastAttemptedCompaction time.Time
}
// PreviousNode is used to represent the previously known alive nodes
@ -311,6 +313,17 @@ func (s *Snapshotter) processQuery(q *Query) {
func (s *Snapshotter) tryAppend(l string) {
if err := s.appendLine(l); err != nil {
s.logger.Printf("[ERR] serf: Failed to update snapshot: %v", err)
now := time.Now()
if now.Sub(s.lastAttemptedCompaction) > snapshotErrorRecoveryInterval {
s.lastAttemptedCompaction = now
s.logger.Printf("[INFO] serf: Attempting compaction to recover from error...")
err = s.compact()
if err != nil {
s.logger.Printf("[ERR] serf: Compaction failed, will reattempt after %v: %v", snapshotErrorRecoveryInterval, err)
} else {
s.logger.Printf("[INFO] serf: Finished compaction, successfully recovered from error state")
}
}
}
}

6
vendor/vendor.json vendored
View File

@ -681,11 +681,11 @@
"revisionTime": "2017-05-25T23:15:04Z"
},
{
"checksumSHA1": "3LFg00GII0KbMRpqi38MRkMhoyM=",
"checksumSHA1": "ZWsQL8XzWMjRc5rgyJ1QT5kTEr4=",
"comment": "v0.7.0-66-g6c4672d",
"path": "github.com/hashicorp/serf/serf",
"revision": "91fd53b1d3e624389ed9a295a3fa380e5c7b9dfc",
"revisionTime": "2017-06-14T22:59:51Z"
"revision": "ed7ee1a9945337d2ed629967c9a62bea8b508a34",
"revisionTime": "2017-07-06T13:52:27Z"
},
{
"checksumSHA1": "ZhK6IO2XN81Y+3RAjTcVm1Ic7oU=",