Skip to content

Commit 54a55bb

Browse files
committed
migrate experimental-initial-corrupt-check flag to feature gate.
Signed-off-by: Lan Liang <[email protected]>
1 parent 62e4433 commit 54a55bb

File tree

4 files changed

+16
-3
lines changed

4 files changed

+16
-3
lines changed

server/embed/config_test.go

+6
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ func TestConfigFileFeatureGates(t *testing.T) {
105105
expectedFeatures: map[featuregate.Feature]bool{
106106
features.DistributedTracing: false,
107107
features.StopGRPCServiceOnDefrag: false,
108+
features.InitialCorruptCheck: false,
108109
},
109110
},
110111
{
@@ -120,6 +121,7 @@ func TestConfigFileFeatureGates(t *testing.T) {
120121
expectedFeatures: map[featuregate.Feature]bool{
121122
features.DistributedTracing: true,
122123
features.StopGRPCServiceOnDefrag: true,
124+
features.InitialCorruptCheck: false,
123125
},
124126
},
125127
{
@@ -128,6 +130,7 @@ func TestConfigFileFeatureGates(t *testing.T) {
128130
expectedFeatures: map[featuregate.Feature]bool{
129131
features.StopGRPCServiceOnDefrag: true,
130132
features.DistributedTracing: false,
133+
features.InitialCorruptCheck: false,
131134
},
132135
},
133136
{
@@ -136,6 +139,7 @@ func TestConfigFileFeatureGates(t *testing.T) {
136139
expectedFeatures: map[featuregate.Feature]bool{
137140
features.StopGRPCServiceOnDefrag: false,
138141
features.DistributedTracing: false,
142+
features.InitialCorruptCheck: false,
139143
},
140144
},
141145
{
@@ -144,6 +148,7 @@ func TestConfigFileFeatureGates(t *testing.T) {
144148
expectedFeatures: map[featuregate.Feature]bool{
145149
features.StopGRPCServiceOnDefrag: true,
146150
features.DistributedTracing: false,
151+
features.InitialCorruptCheck: false,
147152
},
148153
},
149154
{
@@ -152,6 +157,7 @@ func TestConfigFileFeatureGates(t *testing.T) {
152157
expectedFeatures: map[featuregate.Feature]bool{
153158
features.StopGRPCServiceOnDefrag: false,
154159
features.DistributedTracing: false,
160+
features.InitialCorruptCheck: false,
155161
},
156162
},
157163
}

server/embed/etcd.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ import (
4848
"go.etcd.io/etcd/server/v3/etcdserver"
4949
"go.etcd.io/etcd/server/v3/etcdserver/api/etcdhttp"
5050
"go.etcd.io/etcd/server/v3/etcdserver/api/rafthttp"
51+
"go.etcd.io/etcd/server/v3/features"
5152
"go.etcd.io/etcd/server/v3/storage"
5253
"go.etcd.io/etcd/server/v3/verify"
5354
)
@@ -203,7 +204,6 @@ func StartEtcd(inCfg *Config) (e *Etcd, err error) {
203204
TokenTTL: cfg.AuthTokenTTL,
204205
CORS: cfg.CORS,
205206
HostWhitelist: cfg.HostWhitelist,
206-
InitialCorruptCheck: cfg.ExperimentalInitialCorruptCheck,
207207
CorruptCheckTime: cfg.ExperimentalCorruptCheckTime,
208208
CompactHashCheckEnabled: cfg.ExperimentalCompactHashCheckEnabled,
209209
CompactHashCheckTime: cfg.ExperimentalCompactHashCheckTime,
@@ -259,7 +259,7 @@ func StartEtcd(inCfg *Config) (e *Etcd, err error) {
259259

260260
// newly started member ("memberInitialized==false")
261261
// does not need corruption check
262-
if memberInitialized && srvcfg.InitialCorruptCheck {
262+
if memberInitialized && srvcfg.ServerFeatureGate.Enabled(features.InitialCorruptCheck) {
263263
if err = e.Server.CorruptionChecker().InitialCheck(); err != nil {
264264
// set "EtcdServer" to nil, so that it does not block on "EtcdServer.Close()"
265265
// (nothing to close since rafthttp transports have not been started)

server/etcdmain/help.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ Experimental distributed tracing:
273273
Number of samples to collect per million spans for distributed tracing. Disabled by default.
274274
275275
Experimental feature:
276-
--experimental-initial-corrupt-check 'false'
276+
--experimental-initial-corrupt-check 'false',It's deprecated, and will be decommissioned in v3.7. Use '--feature-gates=InitialCorruptCheck=true' instead.
277277
Enable to check data corruption before serving any client/peer traffic.
278278
--experimental-corrupt-check-time '0s'
279279
Duration of time between cluster corruption check passes.

server/features/etcd_features.go

+7
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,25 @@ const (
4545
// alpha: v3.6
4646
// main PR: https://github.com/etcd-io/etcd/pull/18279
4747
StopGRPCServiceOnDefrag featuregate.Feature = "StopGRPCServiceOnDefrag"
48+
// InitialCorruptCheck enable to check data corruption before serving any client/peer traffic.
49+
// owner: @
50+
// alpha: v3.6
51+
// main PR: https://github.com/etcd-io/etcd/pull/10524
52+
InitialCorruptCheck featuregate.Feature = "InitialCorruptCheck"
4853
)
4954

5055
var (
5156
DefaultEtcdServerFeatureGates = map[featuregate.Feature]featuregate.FeatureSpec{
5257
DistributedTracing: {Default: false, PreRelease: featuregate.Alpha},
5358
StopGRPCServiceOnDefrag: {Default: false, PreRelease: featuregate.Alpha},
59+
InitialCorruptCheck: {Default: false, PreRelease: featuregate.Alpha},
5460
}
5561
// ExperimentalFlagToFeatureMap is the map from the cmd line flags of experimental features
5662
// to their corresponding feature gates.
5763
// Deprecated: only add existing experimental features here. DO NOT use for new features.
5864
ExperimentalFlagToFeatureMap = map[string]featuregate.Feature{
5965
"experimental-stop-grpc-service-on-defrag": StopGRPCServiceOnDefrag,
66+
"experimental-initial-corrupt-check": InitialCorruptCheck,
6067
}
6168
)
6269

0 commit comments

Comments
 (0)