diff --git a/CHANGELOG/CHANGELOG-3.6.md b/CHANGELOG/CHANGELOG-3.6.md index 6512442e9..4f52e9054 100644 --- a/CHANGELOG/CHANGELOG-3.6.md +++ b/CHANGELOG/CHANGELOG-3.6.md @@ -63,7 +63,7 @@ See [code changes](https://github.com/etcd-io/etcd/compare/v3.5.0...v3.6.0). - Add [`etcd grpc-proxy --experimental-enable-grpc-logging`](https://github.com/etcd-io/etcd/pull/14266) flag to logging all grpc requests and responses. - Add [`etcd --experimental-compact-hash-check-enabled --experimental-compact-hash-check-time`](https://github.com/etcd-io/etcd/issues/14039) flags to support enabling reliable corruption detection on compacted revisions. - Add [Protection on maintenance request when auth is enabled](https://github.com/etcd-io/etcd/pull/14663). -- Promoted [`--experimental-warning-unary-request-duration` to `--warning-unary-request-duration`](https://github.com/etcd-io/etcd/pull/14414). Note the experimental flag has already been deprecated and will be decommissioned in v3.7. +- Graduated [`--experimental-warning-unary-request-duration` to `--warning-unary-request-duration`](https://github.com/etcd-io/etcd/pull/14414). Note the experimental flag is deprecated and will be decommissioned in v3.7. ### etcd grpc-proxy diff --git a/server/etcdmain/config.go b/server/etcdmain/config.go index 42b0da694..8adc7521f 100644 --- a/server/etcdmain/config.go +++ b/server/etcdmain/config.go @@ -273,7 +273,7 @@ func newConfig() *config { fs.DurationVar(&cfg.ec.ExperimentalDowngradeCheckTime, "experimental-downgrade-check-time", cfg.ec.ExperimentalDowngradeCheckTime, "Duration of time between two downgrade status check.") fs.DurationVar(&cfg.ec.ExperimentalWarningApplyDuration, "experimental-warning-apply-duration", cfg.ec.ExperimentalWarningApplyDuration, "Time duration after which a warning is generated if request takes more time.") fs.DurationVar(&cfg.ec.WarningUnaryRequestDuration, "warning-unary-request-duration", cfg.ec.WarningUnaryRequestDuration, "Time duration after which a warning is generated if a unary request takes more time.") - fs.DurationVar(&cfg.ec.ExperimentalWarningUnaryRequestDuration, "experimental-warning-unary-request-duration", cfg.ec.ExperimentalWarningUnaryRequestDuration, "Time duration after which a warning is generated if a unary request takes more time. It's already deprecated, and will be decommissioned in v3.7. Use --warning-unary-request-duration instead.") + fs.DurationVar(&cfg.ec.ExperimentalWarningUnaryRequestDuration, "experimental-warning-unary-request-duration", cfg.ec.ExperimentalWarningUnaryRequestDuration, "Time duration after which a warning is generated if a unary request takes more time. It's deprecated, and will be decommissioned in v3.7. Use --warning-unary-request-duration instead.") fs.BoolVar(&cfg.ec.ExperimentalMemoryMlock, "experimental-memory-mlock", cfg.ec.ExperimentalMemoryMlock, "Enable to enforce etcd pages (in particular bbolt) to stay in RAM.") fs.BoolVar(&cfg.ec.ExperimentalTxnModeWriteWithSharedBuffer, "experimental-txn-mode-write-with-shared-buffer", true, "Enable the write transaction to use a shared buffer in its readonly check operations.") fs.UintVar(&cfg.ec.ExperimentalBootstrapDefragThresholdMegabytes, "experimental-bootstrap-defrag-threshold-megabytes", 0, "Enable the defrag during etcd server bootstrap on condition that it will free at least the provided threshold of disk space. Needs to be set to non-zero value to take effect.") diff --git a/server/etcdmain/help.go b/server/etcdmain/help.go index 612e9f7cc..fced0130c 100644 --- a/server/etcdmain/help.go +++ b/server/etcdmain/help.go @@ -262,8 +262,8 @@ Experimental feature: Enable the write transaction to use a shared buffer in its readonly check operations. --experimental-bootstrap-defrag-threshold-megabytes Enable the defrag during etcd server bootstrap on condition that it will free at least the provided threshold of disk space. Needs to be set to non-zero value to take effect. - --experimental-warning-unary-request-duration '0s' - Set time duration after which a warning is generated if a unary request takes more than this duration. It's already deprecated, and will be decommissioned in v3.7. Use --warning-unary-request-duration instead. + --experimental-warning-unary-request-duration '300ms' + Set time duration after which a warning is generated if a unary request takes more than this duration. It's deprecated, and will be decommissioned in v3.7. Use --warning-unary-request-duration instead. --experimental-max-learners '1' Set the max number of learner members allowed in the cluster membership. --experimental-wait-cluster-ready-timeout '5s' diff --git a/tests/e2e/warning_logging_test.go b/tests/e2e/promote_experimental_flag_test.go similarity index 73% rename from tests/e2e/warning_logging_test.go rename to tests/e2e/promote_experimental_flag_test.go index 139a6a4af..e794cbc6e 100644 --- a/tests/e2e/warning_logging_test.go +++ b/tests/e2e/promote_experimental_flag_test.go @@ -19,9 +19,9 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/stretchr/testify/assert" "go.etcd.io/etcd/tests/v3/framework/config" "go.etcd.io/etcd/tests/v3/framework/e2e" ) @@ -29,11 +29,10 @@ import ( func TestWarningApplyDuration(t *testing.T) { e2e.BeforeTest(t) - epc, err := e2e.NewEtcdProcessCluster(context.TODO(), t, &e2e.EtcdProcessClusterConfig{ - ClusterSize: 1, - //Set very small duration to trigger warning - WarningUnaryRequestDuration: time.Microsecond, - }) + epc, err := e2e.NewEtcdProcessCluster(context.TODO(), t, + e2e.WithClusterSize(1), + e2e.WithWarningUnaryRequestDuration(time.Microsecond), + ) if err != nil { t.Fatalf("could not start etcd process cluster (%v)", err) } @@ -43,7 +42,7 @@ func TestWarningApplyDuration(t *testing.T) { } }) - cc, err := e2e.NewEtcdctl(epc.Cfg, epc.EndpointsV3()) + cc, err := e2e.NewEtcdctl(epc.Cfg.Client, epc.EndpointsV3()) require.NoError(t, err) err = cc.Put(context.TODO(), "foo", "bar", config.PutOptions{}) assert.NoError(t, err, "error on put") @@ -57,11 +56,10 @@ func TestWarningApplyDuration(t *testing.T) { func TestExperimentalWarningApplyDuration(t *testing.T) { e2e.BeforeTest(t) - epc, err := e2e.NewEtcdProcessCluster(context.TODO(), t, &e2e.EtcdProcessClusterConfig{ - ClusterSize: 1, - //Set very small duration to trigger warning - ExperimentalWarningUnaryRequestDuration: time.Microsecond, - }) + epc, err := e2e.NewEtcdProcessCluster(context.TODO(), t, + e2e.WithClusterSize(1), + e2e.WithExperimentalWarningUnaryRequestDuration(time.Microsecond), + ) if err != nil { t.Fatalf("could not start etcd process cluster (%v)", err) } @@ -71,7 +69,7 @@ func TestExperimentalWarningApplyDuration(t *testing.T) { } }) - cc, err := e2e.NewEtcdctl(epc.Cfg, epc.EndpointsV3()) + cc, err := e2e.NewEtcdctl(epc.Cfg.Client, epc.EndpointsV3()) require.NoError(t, err) err = cc.Put(context.TODO(), "foo", "bar", config.PutOptions{}) assert.NoError(t, err, "error on put") @@ -83,11 +81,11 @@ func TestExperimentalWarningApplyDuration(t *testing.T) { func TestBothWarningApplyDurationFlagsFail(t *testing.T) { e2e.BeforeTest(t) - _, err := e2e.NewEtcdProcessCluster(context.TODO(), t, &e2e.EtcdProcessClusterConfig{ - ClusterSize: 1, - WarningUnaryRequestDuration: time.Second, - ExperimentalWarningUnaryRequestDuration: time.Second, - }) + _, err := e2e.NewEtcdProcessCluster(context.TODO(), t, + e2e.WithClusterSize(1), + e2e.WithWarningUnaryRequestDuration(time.Second), + e2e.WithExperimentalWarningUnaryRequestDuration(time.Second), + ) if err == nil { t.Fatal("Expected process to fail") } diff --git a/tests/framework/e2e/cluster.go b/tests/framework/e2e/cluster.go index 2650e156c..ee46dd6b5 100644 --- a/tests/framework/e2e/cluster.go +++ b/tests/framework/e2e/cluster.go @@ -313,6 +313,16 @@ func WithGoFailEnabled(enabled bool) EPClusterOption { return func(c *EtcdProcessClusterConfig) { c.GoFailEnabled = enabled } } +func WithWarningUnaryRequestDuration(time time.Duration) EPClusterOption { + return func(c *EtcdProcessClusterConfig) { c.WarningUnaryRequestDuration = time } +} + +// WithExperimentalWarningUnaryRequestDuration sets a value for `-experimental-warning-unary-request-duration`. +// TODO(ahrtr): remove this function when the corresponding experimental flag is decommissioned. +func WithExperimentalWarningUnaryRequestDuration(time time.Duration) EPClusterOption { + return func(c *EtcdProcessClusterConfig) { c.ExperimentalWarningUnaryRequestDuration = time } +} + func WithCompactionBatchLimit(limit int) EPClusterOption { return func(c *EtcdProcessClusterConfig) { c.CompactionBatchLimit = limit } }