mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
commit
cb3ca4f8fb
@ -166,9 +166,9 @@ func decideClusterVersion(vers map[string]*version.Versions) *semver.Version {
|
|||||||
return cv
|
return cv
|
||||||
}
|
}
|
||||||
|
|
||||||
// isCompatibleWithCluster return true if the local member has a compitable version with
|
// isCompatibleWithCluster return true if the local member has a compatible version with
|
||||||
// the current running cluster.
|
// the current running cluster.
|
||||||
// The version is considered as compitable when at least one of the other members in the cluster has a
|
// The version is considered as compatible when at least one of the other members in the cluster has a
|
||||||
// cluster version in the range of [MinClusterVersion, Version] and no known members has a cluster version
|
// cluster version in the range of [MinClusterVersion, Version] and no known members has a cluster version
|
||||||
// out of the range.
|
// out of the range.
|
||||||
// We set this rule since when the local member joins, another member might be offline.
|
// We set this rule since when the local member joins, another member might be offline.
|
||||||
@ -187,7 +187,7 @@ func isCompatibleWithCluster(cl Cluster, local types.ID, rt http.RoundTripper) b
|
|||||||
func isCompatibleWithVers(vers map[string]*version.Versions, local types.ID, minV, maxV *semver.Version) bool {
|
func isCompatibleWithVers(vers map[string]*version.Versions, local types.ID, minV, maxV *semver.Version) bool {
|
||||||
var ok bool
|
var ok bool
|
||||||
for id, v := range vers {
|
for id, v := range vers {
|
||||||
// ignore comparasion with local version
|
// ignore comparison with local version
|
||||||
if id == local.String() {
|
if id == local.String() {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ func TestDecideClusterVersion(t *testing.T) {
|
|||||||
map[string]*version.Versions{"a": {Server: "2.0.0"}},
|
map[string]*version.Versions{"a": {Server: "2.0.0"}},
|
||||||
semver.Must(semver.NewVersion("2.0.0")),
|
semver.Must(semver.NewVersion("2.0.0")),
|
||||||
},
|
},
|
||||||
// unknow
|
// unknown
|
||||||
{
|
{
|
||||||
map[string]*version.Versions{"a": nil},
|
map[string]*version.Versions{"a": nil},
|
||||||
nil,
|
nil,
|
||||||
|
@ -541,7 +541,7 @@ func (s *EtcdServer) run() {
|
|||||||
|
|
||||||
defer func() {
|
defer func() {
|
||||||
s.r.stop()
|
s.r.stop()
|
||||||
// kv and backend can be nil if runing without v3 enabled
|
// kv and backend can be nil if running without v3 enabled
|
||||||
// or running unit tests.
|
// or running unit tests.
|
||||||
if s.kv != nil {
|
if s.kv != nil {
|
||||||
s.kv.Close()
|
s.kv.Close()
|
||||||
@ -856,7 +856,7 @@ func (s *EtcdServer) configure(ctx context.Context, cc raftpb.ConfChange) error
|
|||||||
|
|
||||||
// sync proposes a SYNC request and is non-blocking.
|
// sync proposes a SYNC request and is non-blocking.
|
||||||
// This makes no guarantee that the request will be proposed or performed.
|
// This makes no guarantee that the request will be proposed or performed.
|
||||||
// The request will be cancelled after the given timeout.
|
// The request will be canceled after the given timeout.
|
||||||
func (s *EtcdServer) sync(timeout time.Duration) {
|
func (s *EtcdServer) sync(timeout time.Duration) {
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), timeout)
|
ctx, cancel := context.WithTimeout(context.Background(), timeout)
|
||||||
req := pb.Request{
|
req := pb.Request{
|
||||||
@ -1203,7 +1203,7 @@ func (s *EtcdServer) monitorVersions() {
|
|||||||
|
|
||||||
v := decideClusterVersion(getVersions(s.cluster, s.id, s.versionRt))
|
v := decideClusterVersion(getVersions(s.cluster, s.id, s.versionRt))
|
||||||
if v != nil {
|
if v != nil {
|
||||||
// only keep major.minor version for comparasion
|
// only keep major.minor version for comparison
|
||||||
v = &semver.Version{
|
v = &semver.Version{
|
||||||
Major: v.Major,
|
Major: v.Major,
|
||||||
Minor: v.Minor,
|
Minor: v.Minor,
|
||||||
|
@ -122,7 +122,7 @@ func (s *EtcdServer) processInternalRaftRequest(ctx context.Context, r pb.Intern
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Watcable returns a watchable interface attached to the etcdserver.
|
// Watchable returns a watchable interface attached to the etcdserver.
|
||||||
func (s *EtcdServer) Watchable() dstorage.Watchable {
|
func (s *EtcdServer) Watchable() dstorage.Watchable {
|
||||||
return s.getKV()
|
return s.getKV()
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ func fakeCertificateParserFunc(cert tls.Certificate, err error) func(certPEMBloc
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TestNewListenerTLSInfo tests that NewListener with valid TLSInfo returns
|
// TestNewListenerTLSInfo tests that NewListener with valid TLSInfo returns
|
||||||
// a TLS listerner that accepts TLS connections.
|
// a TLS listener that accepts TLS connections.
|
||||||
func TestNewListenerTLSInfo(t *testing.T) {
|
func TestNewListenerTLSInfo(t *testing.T) {
|
||||||
tmp, err := createTempFile([]byte("XXX"))
|
tmp, err := createTempFile([]byte("XXX"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -80,7 +80,7 @@ type WatchableKV interface {
|
|||||||
// Watchable is the interface that wraps the NewWatchStream function.
|
// Watchable is the interface that wraps the NewWatchStream function.
|
||||||
type Watchable interface {
|
type Watchable interface {
|
||||||
// NewWatchStream returns a WatchStream that can be used to
|
// NewWatchStream returns a WatchStream that can be used to
|
||||||
// watch events happened or happending on the KV.
|
// watch events happened or happening on the KV.
|
||||||
NewWatchStream() WatchStream
|
NewWatchStream() WatchStream
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -294,7 +294,7 @@ func (s *watchableStore) syncWatchers() {
|
|||||||
|
|
||||||
if w.cur < compactionRev {
|
if w.cur < compactionRev {
|
||||||
// TODO: return error compacted to that watcher instead of
|
// TODO: return error compacted to that watcher instead of
|
||||||
// just removing it sliently from unsynced.
|
// just removing it silently from unsynced.
|
||||||
delete(s.unsynced, w)
|
delete(s.unsynced, w)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user