mirror of https://github.com/status-im/consul.git
Merge pull request #3416 from hashicorp/issue_3409
Update raft library for windows snapshot fsync fixes. This fixes #3409
This commit is contained in:
commit
bf54195ab8
|
@ -1,10 +1,13 @@
|
||||||
DEPS = $(go list -f '{{range .TestImports}}{{.}} {{end}}' ./...)
|
DEPS = $(go list -f '{{range .TestImports}}{{.}} {{end}}' ./...)
|
||||||
|
|
||||||
test:
|
test:
|
||||||
go test -timeout=60s ./...
|
go test -timeout=60s .
|
||||||
|
|
||||||
integ: test
|
integ: test
|
||||||
INTEG_TESTS=yes go test -timeout=25s -run=Integ ./...
|
INTEG_TESTS=yes go test -timeout=25s -run=Integ .
|
||||||
|
|
||||||
|
fuzz:
|
||||||
|
go test -timeout=300s ./fuzzy
|
||||||
|
|
||||||
deps:
|
deps:
|
||||||
go get -d -v ./...
|
go get -d -v ./...
|
||||||
|
|
|
@ -12,6 +12,7 @@ import (
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"runtime"
|
||||||
"sort"
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
@ -406,17 +407,18 @@ func (s *FileSnapshotSink) Close() error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// fsync the parent directory, to sync directory edits to disk
|
if runtime.GOOS != "windows" { //skipping fsync for directory entry edits on Windows, only needed for *nix style file systems
|
||||||
parentFH, err := os.Open(s.parentDir)
|
parentFH, err := os.Open(s.parentDir)
|
||||||
defer parentFH.Close()
|
defer parentFH.Close()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.logger.Printf("[ERR] snapshot: Failed to open snapshot parent directory %v, error: %v", s.parentDir, err)
|
s.logger.Printf("[ERR] snapshot: Failed to open snapshot parent directory %v, error: %v", s.parentDir, err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = parentFH.Sync(); err != nil {
|
if err = parentFH.Sync(); err != nil {
|
||||||
s.logger.Printf("[ERR] snapshot: Failed syncing parent directory %v, error: %v", s.parentDir, err)
|
s.logger.Printf("[ERR] snapshot: Failed syncing parent directory %v, error: %v", s.parentDir, err)
|
||||||
return err
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reap any old snapshots
|
// Reap any old snapshots
|
||||||
|
|
|
@ -24,6 +24,12 @@ type FilterFn func(o *Observation) bool
|
||||||
|
|
||||||
// Observer describes what to do with a given observation.
|
// Observer describes what to do with a given observation.
|
||||||
type Observer struct {
|
type Observer struct {
|
||||||
|
// numObserved and numDropped are performance counters for this observer.
|
||||||
|
// 64 bit types must be 64 bit aligned to use with atomic operations on
|
||||||
|
// 32 bit platforms, so keep them at the top of the struct.
|
||||||
|
numObserved uint64
|
||||||
|
numDropped uint64
|
||||||
|
|
||||||
// channel receives observations.
|
// channel receives observations.
|
||||||
channel chan Observation
|
channel chan Observation
|
||||||
|
|
||||||
|
@ -37,10 +43,6 @@ type Observer struct {
|
||||||
|
|
||||||
// id is the ID of this observer in the Raft map.
|
// id is the ID of this observer in the Raft map.
|
||||||
id uint64
|
id uint64
|
||||||
|
|
||||||
// numObserved and numDropped are performance counters for this observer.
|
|
||||||
numObserved uint64
|
|
||||||
numDropped uint64
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewObserver creates a new observer that can be registered
|
// NewObserver creates a new observer that can be registered
|
||||||
|
|
|
@ -42,6 +42,10 @@ func (s RaftState) String() string {
|
||||||
// and provides an interface to set/get the variables in a
|
// and provides an interface to set/get the variables in a
|
||||||
// thread safe manner.
|
// thread safe manner.
|
||||||
type raftState struct {
|
type raftState struct {
|
||||||
|
// currentTerm commitIndex, lastApplied, must be kept at the top of
|
||||||
|
// the struct so they're 64 bit aligned which is a requirement for
|
||||||
|
// atomic ops on 32 bit platforms.
|
||||||
|
|
||||||
// The current term, cache of StableStore
|
// The current term, cache of StableStore
|
||||||
currentTerm uint64
|
currentTerm uint64
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@
|
||||||
{"checksumSHA1":"vt+P9D2yWDO3gdvdgCzwqunlhxU=","path":"github.com/hashicorp/logutils","revision":"0dc08b1671f34c4250ce212759ebd880f743d883","revisionTime":"2015-06-09T07:04:31Z"},
|
{"checksumSHA1":"vt+P9D2yWDO3gdvdgCzwqunlhxU=","path":"github.com/hashicorp/logutils","revision":"0dc08b1671f34c4250ce212759ebd880f743d883","revisionTime":"2015-06-09T07:04:31Z"},
|
||||||
{"checksumSHA1":"ml0MTqOsKTrsqv/mZhy78Vz4SfA=","path":"github.com/hashicorp/memberlist","revision":"d6c1fb0b99c33d0a8e22acea9da9709b369b5d39","revisionTime":"2017-08-15T22:46:17Z"},
|
{"checksumSHA1":"ml0MTqOsKTrsqv/mZhy78Vz4SfA=","path":"github.com/hashicorp/memberlist","revision":"d6c1fb0b99c33d0a8e22acea9da9709b369b5d39","revisionTime":"2017-08-15T22:46:17Z"},
|
||||||
{"checksumSHA1":"qnlqWJYV81ENr61SZk9c65R1mDo=","path":"github.com/hashicorp/net-rpc-msgpackrpc","revision":"a14192a58a694c123d8fe5481d4a4727d6ae82f3","revisionTime":"2015-11-16T02:03:38Z"},
|
{"checksumSHA1":"qnlqWJYV81ENr61SZk9c65R1mDo=","path":"github.com/hashicorp/net-rpc-msgpackrpc","revision":"a14192a58a694c123d8fe5481d4a4727d6ae82f3","revisionTime":"2015-11-16T02:03:38Z"},
|
||||||
{"checksumSHA1":"5GHIYEtOr1rsHOZUac6RA/82d3I=","path":"github.com/hashicorp/raft","revision":"0a6e1b039ba3d8057e9f16c919d2afb813884f74","revisionTime":"2017-08-04T15:11:58Z","version":"library-v2-stage-one","versionExact":"library-v2-stage-one"},
|
{"checksumSHA1":"RVDP6/BNLtrGbyoiGU2GjTun9Kk=","path":"github.com/hashicorp/raft","revision":"2356637a1c1ffe894b753680363ad970480215aa","revisionTime":"2017-08-24T21:39:20Z","version":"library-v2-stage-one","versionExact":"library-v2-stage-one"},
|
||||||
{"checksumSHA1":"QAxukkv54/iIvLfsUP6IK4R0m/A=","path":"github.com/hashicorp/raft-boltdb","revision":"d1e82c1ec3f15ee991f7cc7ffd5b67ff6f5bbaee","revisionTime":"2015-02-01T20:08:39Z"},
|
{"checksumSHA1":"QAxukkv54/iIvLfsUP6IK4R0m/A=","path":"github.com/hashicorp/raft-boltdb","revision":"d1e82c1ec3f15ee991f7cc7ffd5b67ff6f5bbaee","revisionTime":"2015-02-01T20:08:39Z"},
|
||||||
{"checksumSHA1":"/oss17GO4hXGM7QnUdI3VzcAHzA=","comment":"v0.7.0-66-g6c4672d","path":"github.com/hashicorp/serf/coordinate","revision":"c2e4be24cdc9031eb0ad869c5d160775efdf7d7a","revisionTime":"2017-05-25T23:15:04Z"},
|
{"checksumSHA1":"/oss17GO4hXGM7QnUdI3VzcAHzA=","comment":"v0.7.0-66-g6c4672d","path":"github.com/hashicorp/serf/coordinate","revision":"c2e4be24cdc9031eb0ad869c5d160775efdf7d7a","revisionTime":"2017-05-25T23:15:04Z"},
|
||||||
{"checksumSHA1":"3WPnGSL9ZK6EmkAE6tEW5SCxrd8=","comment":"v0.7.0-66-g6c4672d","path":"github.com/hashicorp/serf/serf","revision":"b84a66cc5575994cb672940d244a2404141688c0","revisionTime":"2017-08-17T21:22:02Z"},
|
{"checksumSHA1":"3WPnGSL9ZK6EmkAE6tEW5SCxrd8=","comment":"v0.7.0-66-g6c4672d","path":"github.com/hashicorp/serf/serf","revision":"b84a66cc5575994cb672940d244a2404141688c0","revisionTime":"2017-08-17T21:22:02Z"},
|
||||||
|
|
Loading…
Reference in New Issue