Compare commits
6 Commits
api/v3.5.3
...
etcdctl/v3
Author | SHA1 | Date | |
---|---|---|---|
08407ff760 | |||
c3c908e39a | |||
5c68f2e510 | |||
b872757492 | |||
081b4e2a0f | |||
76564778a9 |
@ -26,7 +26,7 @@ import (
|
||||
var (
|
||||
// MinClusterVersion is the min cluster version this etcd binary is compatible with.
|
||||
MinClusterVersion = "3.0.0"
|
||||
Version = "3.5.3"
|
||||
Version = "3.5.4"
|
||||
APIVersion = "unknown"
|
||||
|
||||
// Git SHA Value will be set during build
|
||||
|
@ -106,10 +106,9 @@ func GetClient(service, domain string, serviceName string) (*SRVClients, error)
|
||||
return err
|
||||
}
|
||||
for _, srv := range addrs {
|
||||
shortHost := strings.TrimSuffix(srv.Target, ".")
|
||||
urls = append(urls, &url.URL{
|
||||
Scheme: scheme,
|
||||
Host: net.JoinHostPort(shortHost, fmt.Sprintf("%d", srv.Port)),
|
||||
Host: net.JoinHostPort(srv.Target, fmt.Sprintf("%d", srv.Port)),
|
||||
})
|
||||
}
|
||||
srvs = append(srvs, addrs...)
|
||||
|
@ -226,12 +226,12 @@ func TestSRVDiscover(t *testing.T) {
|
||||
},
|
||||
{
|
||||
[]*net.SRV{
|
||||
{Target: "a.example.com.", Port: 2480},
|
||||
{Target: "b.example.com.", Port: 2480},
|
||||
{Target: "c.example.com", Port: 2480},
|
||||
{Target: "a.example.com", Port: 2480},
|
||||
{Target: "b.example.com", Port: 2480},
|
||||
{Target: "c.example.com.", Port: 2480},
|
||||
},
|
||||
[]*net.SRV{},
|
||||
[]string{"https://a.example.com:2480", "https://b.example.com:2480", "https://c.example.com:2480"},
|
||||
[]string{"https://a.example.com:2480", "https://b.example.com:2480", "https://c.example.com.:2480"},
|
||||
false,
|
||||
},
|
||||
}
|
||||
|
@ -5,8 +5,8 @@ go 1.16
|
||||
require (
|
||||
github.com/json-iterator/go v1.1.11
|
||||
github.com/modern-go/reflect2 v1.0.1
|
||||
go.etcd.io/etcd/api/v3 v3.5.3
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.3
|
||||
go.etcd.io/etcd/api/v3 v3.5.4
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.4
|
||||
)
|
||||
|
||||
replace (
|
||||
|
@ -6,8 +6,8 @@ require (
|
||||
github.com/dustin/go-humanize v1.0.0
|
||||
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
|
||||
github.com/prometheus/client_golang v1.11.1
|
||||
go.etcd.io/etcd/api/v3 v3.5.3
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.3
|
||||
go.etcd.io/etcd/api/v3 v3.5.4
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.4
|
||||
go.uber.org/zap v1.17.0
|
||||
google.golang.org/grpc v1.38.0
|
||||
sigs.k8s.io/yaml v1.2.0
|
||||
|
@ -9,12 +9,12 @@ require (
|
||||
github.com/spf13/cobra v1.1.3
|
||||
github.com/spf13/pflag v1.0.5
|
||||
github.com/urfave/cli v1.22.4
|
||||
go.etcd.io/etcd/api/v3 v3.5.3
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.3
|
||||
go.etcd.io/etcd/client/v2 v2.305.3
|
||||
go.etcd.io/etcd/client/v3 v3.5.3
|
||||
go.etcd.io/etcd/etcdutl/v3 v3.5.3
|
||||
go.etcd.io/etcd/pkg/v3 v3.5.3
|
||||
go.etcd.io/etcd/api/v3 v3.5.4
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.4
|
||||
go.etcd.io/etcd/client/v2 v2.305.4
|
||||
go.etcd.io/etcd/client/v3 v3.5.4
|
||||
go.etcd.io/etcd/etcdutl/v3 v3.5.4
|
||||
go.etcd.io/etcd/pkg/v3 v3.5.4
|
||||
go.uber.org/zap v1.17.0
|
||||
golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba
|
||||
google.golang.org/grpc v1.38.0
|
||||
|
@ -25,11 +25,11 @@ require (
|
||||
github.com/olekukonko/tablewriter v0.0.5
|
||||
github.com/spf13/cobra v1.1.3
|
||||
go.etcd.io/bbolt v1.3.6
|
||||
go.etcd.io/etcd/api/v3 v3.5.3
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.3
|
||||
go.etcd.io/etcd/client/v3 v3.5.3
|
||||
go.etcd.io/etcd/pkg/v3 v3.5.3
|
||||
go.etcd.io/etcd/raft/v3 v3.5.3
|
||||
go.etcd.io/etcd/server/v3 v3.5.3
|
||||
go.etcd.io/etcd/api/v3 v3.5.4
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.4
|
||||
go.etcd.io/etcd/client/v3 v3.5.4
|
||||
go.etcd.io/etcd/pkg/v3 v3.5.4
|
||||
go.etcd.io/etcd/raft/v3 v3.5.4
|
||||
go.etcd.io/etcd/server/v3 v3.5.4
|
||||
go.uber.org/zap v1.17.0
|
||||
)
|
||||
|
20
go.mod
20
go.mod
@ -20,16 +20,16 @@ require (
|
||||
github.com/dustin/go-humanize v1.0.0
|
||||
github.com/spf13/cobra v1.1.3
|
||||
go.etcd.io/bbolt v1.3.6
|
||||
go.etcd.io/etcd/api/v3 v3.5.3
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.3
|
||||
go.etcd.io/etcd/client/v2 v2.305.3
|
||||
go.etcd.io/etcd/client/v3 v3.5.3
|
||||
go.etcd.io/etcd/etcdctl/v3 v3.5.3
|
||||
go.etcd.io/etcd/etcdutl/v3 v3.5.3
|
||||
go.etcd.io/etcd/pkg/v3 v3.5.3
|
||||
go.etcd.io/etcd/raft/v3 v3.5.3
|
||||
go.etcd.io/etcd/server/v3 v3.5.3
|
||||
go.etcd.io/etcd/tests/v3 v3.5.3
|
||||
go.etcd.io/etcd/api/v3 v3.5.4
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.4
|
||||
go.etcd.io/etcd/client/v2 v2.305.4
|
||||
go.etcd.io/etcd/client/v3 v3.5.4
|
||||
go.etcd.io/etcd/etcdctl/v3 v3.5.4
|
||||
go.etcd.io/etcd/etcdutl/v3 v3.5.4
|
||||
go.etcd.io/etcd/pkg/v3 v3.5.4
|
||||
go.etcd.io/etcd/raft/v3 v3.5.4
|
||||
go.etcd.io/etcd/server/v3 v3.5.4
|
||||
go.etcd.io/etcd/tests/v3 v3.5.4
|
||||
go.uber.org/zap v1.17.0
|
||||
golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba
|
||||
google.golang.org/grpc v1.38.0
|
||||
|
@ -9,7 +9,7 @@ require (
|
||||
github.com/spf13/cobra v1.1.3
|
||||
github.com/spf13/pflag v1.0.5
|
||||
github.com/stretchr/testify v1.7.0
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.3
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.4
|
||||
go.uber.org/zap v1.17.0
|
||||
google.golang.org/grpc v1.38.0
|
||||
)
|
||||
|
@ -8,7 +8,7 @@ require (
|
||||
github.com/gogo/protobuf v1.3.2
|
||||
github.com/golang/protobuf v1.5.2
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.3
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.4
|
||||
)
|
||||
|
||||
// Bad imports are sometimes causing attempts to pull that code.
|
||||
|
@ -2167,18 +2167,19 @@ func (s *EtcdServer) apply(
|
||||
func (s *EtcdServer) applyEntryNormal(e *raftpb.Entry) {
|
||||
shouldApplyV3 := membership.ApplyV2storeOnly
|
||||
applyV3Performed := false
|
||||
defer func() {
|
||||
// The txPostLock callback will not get called in this case,
|
||||
// so we should set the consistent index directly.
|
||||
if s.consistIndex != nil && !applyV3Performed && membership.ApplyBoth == shouldApplyV3 {
|
||||
s.consistIndex.SetConsistentIndex(e.Index, e.Term)
|
||||
}
|
||||
}()
|
||||
var ar *applyResult
|
||||
index := s.consistIndex.ConsistentIndex()
|
||||
if e.Index > index {
|
||||
// set the consistent index of current executing entry
|
||||
s.consistIndex.SetConsistentApplyingIndex(e.Index, e.Term)
|
||||
shouldApplyV3 = membership.ApplyBoth
|
||||
defer func() {
|
||||
// The txPostLockInsideApplyHook will not get called in some cases,
|
||||
// in which we should move the consistent index forward directly.
|
||||
if !applyV3Performed || (ar != nil && ar.err != nil) {
|
||||
s.consistIndex.SetConsistentIndex(e.Index, e.Term)
|
||||
}
|
||||
}()
|
||||
}
|
||||
s.lg.Debug("apply entry normal",
|
||||
zap.Uint64("consistent-index", index),
|
||||
@ -2220,7 +2221,6 @@ func (s *EtcdServer) applyEntryNormal(e *raftpb.Entry) {
|
||||
id = raftReq.Header.ID
|
||||
}
|
||||
|
||||
var ar *applyResult
|
||||
needResult := s.w.IsRegistered(id)
|
||||
if needResult || !noSideEffect(&raftReq) {
|
||||
if !needResult && raftReq.Txn != nil {
|
||||
|
@ -25,12 +25,12 @@ require (
|
||||
github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802
|
||||
github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2
|
||||
go.etcd.io/bbolt v1.3.6
|
||||
go.etcd.io/etcd/api/v3 v3.5.3
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.3
|
||||
go.etcd.io/etcd/client/v2 v2.305.3
|
||||
go.etcd.io/etcd/client/v3 v3.5.3
|
||||
go.etcd.io/etcd/pkg/v3 v3.5.3
|
||||
go.etcd.io/etcd/raft/v3 v3.5.3
|
||||
go.etcd.io/etcd/api/v3 v3.5.4
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.4
|
||||
go.etcd.io/etcd/client/v2 v2.305.4
|
||||
go.etcd.io/etcd/client/v3 v3.5.4
|
||||
go.etcd.io/etcd/pkg/v3 v3.5.4
|
||||
go.etcd.io/etcd/raft/v3 v3.5.4
|
||||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.20.0
|
||||
go.opentelemetry.io/otel v0.20.0
|
||||
go.opentelemetry.io/otel/exporters/otlp v0.20.0
|
||||
|
16
tests/go.mod
16
tests/go.mod
@ -28,14 +28,14 @@ require (
|
||||
github.com/spf13/pflag v1.0.5
|
||||
github.com/stretchr/testify v1.7.0
|
||||
go.etcd.io/bbolt v1.3.6
|
||||
go.etcd.io/etcd/api/v3 v3.5.3
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.3
|
||||
go.etcd.io/etcd/client/v2 v2.305.3
|
||||
go.etcd.io/etcd/client/v3 v3.5.3
|
||||
go.etcd.io/etcd/etcdutl/v3 v3.5.3
|
||||
go.etcd.io/etcd/pkg/v3 v3.5.3
|
||||
go.etcd.io/etcd/raft/v3 v3.5.3
|
||||
go.etcd.io/etcd/server/v3 v3.5.3
|
||||
go.etcd.io/etcd/api/v3 v3.5.4
|
||||
go.etcd.io/etcd/client/pkg/v3 v3.5.4
|
||||
go.etcd.io/etcd/client/v2 v2.305.4
|
||||
go.etcd.io/etcd/client/v3 v3.5.4
|
||||
go.etcd.io/etcd/etcdutl/v3 v3.5.4
|
||||
go.etcd.io/etcd/pkg/v3 v3.5.4
|
||||
go.etcd.io/etcd/raft/v3 v3.5.4
|
||||
go.etcd.io/etcd/server/v3 v3.5.4
|
||||
go.uber.org/zap v1.17.0
|
||||
golang.org/x/crypto v0.0.0-20220131195533-30dcbda58838
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
|
||||
|
@ -46,6 +46,33 @@ func TestV3AuthEmptyUserGet(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestV3AuthEmptyUserPut ensures that a put with an empty user will return an empty user error,
|
||||
// and the consistent_index should be moved forward even the apply-->Put fails.
|
||||
func TestV3AuthEmptyUserPut(t *testing.T) {
|
||||
BeforeTest(t)
|
||||
clus := NewClusterV3(t, &ClusterConfig{
|
||||
Size: 1,
|
||||
SnapshotCount: 3,
|
||||
})
|
||||
defer clus.Terminate(t)
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.TODO(), 30*time.Second)
|
||||
defer cancel()
|
||||
|
||||
api := toGRPC(clus.Client(0))
|
||||
authSetupRoot(t, api.Auth)
|
||||
|
||||
// The SnapshotCount is 3, so there must be at least 3 new snapshot files being created.
|
||||
// The VERIFY logic will check whether the consistent_index >= last snapshot index on
|
||||
// cluster terminating.
|
||||
for i := 0; i < 10; i++ {
|
||||
_, err := api.KV.Put(ctx, &pb.PutRequest{Key: []byte("foo"), Value: []byte("bar")})
|
||||
if !eqErrGRPC(err, rpctypes.ErrUserEmpty) {
|
||||
t.Fatalf("got %v, expected %v", err, rpctypes.ErrUserEmpty)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TestV3AuthTokenWithDisable tests that auth won't crash if
|
||||
// given a valid token when authentication is disabled
|
||||
func TestV3AuthTokenWithDisable(t *testing.T) {
|
||||
|
Reference in New Issue
Block a user