Compare commits

...

6 Commits

Author SHA1 Message Date
08407ff760 version: bump up to 3.5.4 2022-04-24 12:44:36 +02:00
c3c908e39a Merge pull request #13946 from ahrtr/move_cindex_on_apply_fail_353
[3.5] Update consitent_index when applying fails
2022-04-21 16:21:24 +02:00
5c68f2e510 Update conssitent_index when applying fails
When clients have no permission to perform whatever operation, then
the applying may fail. We should also move consistent_index forward
in this case, otherwise the consitent_index may smaller than the
snapshot index.
2022-04-20 22:17:49 +08:00
b872757492 Merge pull request #13950 from liggitt/revert-srv-dot-3.5
Revert #13714
2022-04-19 12:23:02 +02:00
081b4e2a0f Add unit test for canonical SRV records 2022-04-15 15:33:31 -04:00
76564778a9 Revert "trim the suffix dot from the srv.Target for etcd-client DNS lookup"
This reverts commit 4f51cc1d9a.
2022-04-15 15:33:16 -04:00
14 changed files with 83 additions and 57 deletions

View File

@ -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

View File

@ -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...)

View File

@ -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,
},
}

View File

@ -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 (

View File

@ -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

View File

@ -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

View File

@ -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
View File

@ -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

View File

@ -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
)

View File

@ -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.

View File

@ -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 {

View File

@ -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

View File

@ -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

View File

@ -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) {