diff --git a/vendor/github.com/hashicorp/serf/serf/snapshot.go b/vendor/github.com/hashicorp/serf/serf/snapshot.go index a27fee5e87..8e15f3f31d 100644 --- a/vendor/github.com/hashicorp/serf/serf/snapshot.go +++ b/vendor/github.com/hashicorp/serf/serf/snapshot.go @@ -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") + } + } } } diff --git a/vendor/vendor.json b/vendor/vendor.json index cdfb413c8f..97ea2bd8eb 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -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=",