Skip to content

Commit

Permalink
server: --enable-v2 and --enable-v2v3 is decomissioned
Browse files Browse the repository at this point in the history
  • Loading branch information
serathius committed Jan 14, 2022
1 parent e0a0fdc commit ee5ef42
Show file tree
Hide file tree
Showing 27 changed files with 69 additions and 3,333 deletions.
1 change: 0 additions & 1 deletion client/v2/example_keys_test.go

This file was deleted.

3 changes: 0 additions & 3 deletions etcd.conf.yml.sample
Expand Up @@ -69,9 +69,6 @@ initial-cluster-state: 'new'
# Reject reconfiguration requests that would cause quorum loss.
strict-reconfig-check: false

# Accept etcd V2 client requests
enable-v2: true

# Enable runtime profiling data via HTTP server
enable-pprof: true

Expand Down
13 changes: 0 additions & 13 deletions server/embed/config.go
Expand Up @@ -86,9 +86,6 @@ const (
// DefaultStrictReconfigCheck is the default value for "--strict-reconfig-check" flag.
// It's enabled by default.
DefaultStrictReconfigCheck = true
// DefaultEnableV2 is the default value for "--enable-v2" flag.
// v2 API is disabled by default.
DefaultEnableV2 = false

// maxElectionMs specifies the maximum value of election timeout.
// More details are listed in ../Documentation/tuning.md#time-parameters.
Expand Down Expand Up @@ -224,11 +221,6 @@ type Config struct {
InitialClusterToken string `json:"initial-cluster-token"`
StrictReconfigCheck bool `json:"strict-reconfig-check"`

// EnableV2 exposes the deprecated V2 API surface.
// TODO: Delete in 3.6 (https://github.com/etcd-io/etcd/issues/12913)
// Deprecated in 3.5.
EnableV2 bool `json:"enable-v2"`

// AutoCompactionMode is either 'periodic' or 'revision'.
AutoCompactionMode string `json:"auto-compaction-mode"`
// AutoCompactionRetention is either duration string with time unit
Expand Down Expand Up @@ -311,10 +303,6 @@ type Config struct {

ExperimentalInitialCorruptCheck bool `json:"experimental-initial-corrupt-check"`
ExperimentalCorruptCheckTime time.Duration `json:"experimental-corrupt-check-time"`
// ExperimentalEnableV2V3 configures URLs that expose deprecated V2 API working on V3 store.
// Deprecated in v3.5.
// TODO: Delete in v3.6 (https://github.com/etcd-io/etcd/issues/12913)
ExperimentalEnableV2V3 string `json:"experimental-enable-v2v3"`
// ExperimentalEnableLeaseCheckpoint enables leader to send regular checkpoints to other members to prevent reset of remaining TTL on leader change.
ExperimentalEnableLeaseCheckpoint bool `json:"experimental-enable-lease-checkpoint"`
// ExperimentalEnableLeaseCheckpointPersist enables persisting remainingTTL to prevent indefinite auto-renewal of long lived leases. Always enabled in v3.6. Should be used to ensure smooth upgrade from v3.5 clusters with this feature enabled.
Expand Down Expand Up @@ -488,7 +476,6 @@ func NewConfig() *Config {

StrictReconfigCheck: DefaultStrictReconfigCheck,
Metrics: "basic",
EnableV2: DefaultEnableV2,

CORS: map[string]struct{}{"*": {}},
HostWhitelist: map[string]struct{}{"*": {}},
Expand Down
27 changes: 4 additions & 23 deletions server/embed/etcd.go
Expand Up @@ -38,9 +38,6 @@ import (
"go.etcd.io/etcd/server/v3/etcdserver"
"go.etcd.io/etcd/server/v3/etcdserver/api/etcdhttp"
"go.etcd.io/etcd/server/v3/etcdserver/api/rafthttp"
"go.etcd.io/etcd/server/v3/etcdserver/api/v2http"
"go.etcd.io/etcd/server/v3/etcdserver/api/v2v3"
"go.etcd.io/etcd/server/v3/etcdserver/api/v3client"
"go.etcd.io/etcd/server/v3/etcdserver/api/v3rpc"
"go.etcd.io/etcd/server/v3/storage"
"go.etcd.io/etcd/server/v3/verify"
Expand Down Expand Up @@ -695,25 +692,9 @@ func (e *Etcd) serveClients() (err error) {
}

// Start a client server goroutine for each listen address
var h http.Handler
if e.Config().EnableV2 {
if e.Config().V2DeprecationEffective().IsAtLeast(config.V2_DEPR_1_WRITE_ONLY) {
return fmt.Errorf("--enable-v2 and --v2-deprecation=%s are mutually exclusive", e.Config().V2DeprecationEffective())
}
e.cfg.logger.Warn("Flag `enable-v2` is deprecated and will get removed in etcd 3.6.")
if len(e.Config().ExperimentalEnableV2V3) > 0 {
e.cfg.logger.Warn("Flag `experimental-enable-v2v3` is deprecated and will get removed in etcd 3.6.")
srv := v2v3.NewServer(e.cfg.logger, v3client.New(e.Server), e.cfg.ExperimentalEnableV2V3)
h = v2http.NewClientHandler(e.GetLogger(), srv, e.Server.Cfg.ReqTimeout())
} else {
h = v2http.NewClientHandler(e.GetLogger(), e.Server, e.Server.Cfg.ReqTimeout())
}
} else {
mux := http.NewServeMux()
etcdhttp.HandleBasic(e.cfg.logger, mux, e.Server)
etcdhttp.HandleMetricsHealthForV3(e.cfg.logger, mux, e.Server)
h = mux
}
mux := http.NewServeMux()
etcdhttp.HandleBasic(e.cfg.logger, mux, e.Server)
etcdhttp.HandleMetricsHealthForV3(e.cfg.logger, mux, e.Server)

gopts := []grpc.ServerOption{}
if e.cfg.GRPCKeepAliveMinTime > time.Duration(0) {
Expand All @@ -733,7 +714,7 @@ func (e *Etcd) serveClients() (err error) {
// start client servers in each goroutine
for _, sctx := range e.sctxs {
go func(s *serveCtx) {
e.errHandler(s.serve(e.Server, &e.cfg.ClientTLSInfo, h, e.errHandler, gopts...))
e.errHandler(s.serve(e.Server, &e.cfg.ClientTLSInfo, mux, e.errHandler, gopts...))
}(sctx)
}
return nil
Expand Down
2 changes: 0 additions & 2 deletions server/etcdmain/config.go
Expand Up @@ -200,8 +200,6 @@ func newConfig() *config {

fs.BoolVar(&cfg.ec.PreVote, "pre-vote", cfg.ec.PreVote, "Enable to run an additional Raft election phase.")

fs.BoolVar(&cfg.ec.EnableV2, "enable-v2", cfg.ec.EnableV2, "Accept etcd V2 client requests. Deprecated in v3.5. Will be decommission in v3.6.")
fs.StringVar(&cfg.ec.ExperimentalEnableV2V3, "experimental-enable-v2v3", cfg.ec.ExperimentalEnableV2V3, "v3 prefix for serving emulated v2 state. Deprecated in 3.5. Will be decommissioned in 3.6.")
fs.Var(cfg.cf.v2deprecation, "v2-deprecation", fmt.Sprintf("v2store deprecation stage: %q. ", cfg.cf.proxy.Valids()))

// proxy
Expand Down
4 changes: 0 additions & 4 deletions server/etcdmain/help.go
Expand Up @@ -123,8 +123,6 @@ Clustering:
Auto compaction retention length. 0 means disable auto compaction.
--auto-compaction-mode 'periodic'
Interpret 'auto-compaction-retention' one of: periodic|revision. 'periodic' for duration based retention, defaulting to hours if no time unit is provided (e.g. '5m'). 'revision' for revision number based retention.
--enable-v2 '` + strconv.FormatBool(embed.DefaultEnableV2) + `'
Accept etcd V2 client requests. Deprecated and to be decommissioned in v3.6.
--v2-deprecation '` + string(cconfig.V2_DEPR_DEFAULT) + `'
Phase of v2store deprecation. Allows to opt-in for higher compatibility mode.
Supported values:
Expand Down Expand Up @@ -234,8 +232,6 @@ Experimental feature:
Enable to check data corruption before serving any client/peer traffic.
--experimental-corrupt-check-time '0s'
Duration of time between cluster corruption check passes.
--experimental-enable-v2v3 ''
Serve v2 requests through the v3 backend under a given prefix. Deprecated and to be decommissioned in v3.6.
--experimental-enable-lease-checkpoint 'false'
ExperimentalEnableLeaseCheckpoint enables primary lessor to persist lease remainingTTL to prevent indefinite auto-renewal of long lived leases.
--experimental-compaction-batch-limit 1000
Expand Down
31 changes: 0 additions & 31 deletions server/etcdserver/api/v2v3/cluster.go

This file was deleted.

16 changes: 0 additions & 16 deletions server/etcdserver/api/v2v3/doc.go

This file was deleted.

130 changes: 0 additions & 130 deletions server/etcdserver/api/v2v3/server.go

This file was deleted.

0 comments on commit ee5ef42

Please sign in to comment.