62780e Import etcd-3.4.14-1.el9 in CloudSIG xena

Authored and Committed by amoralej 3 years ago
    Import etcd-3.4.14-1.el9 in CloudSIG xena
    
        
file modified
+1 -2
.etcd.metadata CHANGED
@@ -1,2 +1 @@
1
- 80b405fd01527eea6668fde0186ca6b119c1185c SOURCES/etcd-0.4.6.tar.gz
1
+ 5b748244d62c8aa0578831fedcb39fd9f57449aa SOURCES/etcd-8a03d2e.tar.gz
2
- 924668c26a30bfe65ac88971965b1dad819be630 SOURCES/etcdctl-0.4.6.tar.gz
SOURCES/0001-Convert-int-to-string-using-strconv.Itoa.patch ADDED
@@ -0,0 +1,61 @@
1
+ From 80c8dfe084f44eb660aa1af5b5d49e27e1dfd11e Mon Sep 17 00:00:00 2001
2
+ From: =?UTF-8?q?Robert-Andr=C3=A9=20Mauchin?= <zebob.m@gmail.com>
3
+ Date: Mon, 10 Aug 2020 15:09:08 +0200
4
+ Subject: [PATCH] Convert int to string using strconv.Itoa
5
+ MIME-Version: 1.0
6
+ Content-Type: text/plain; charset=UTF-8
7
+ Content-Transfer-Encoding: 8bit
8
+
9
+ See https://github.com/golang/go/issues/32479
10
+
11
+ Signed-off-by: Robert-André Mauchin <zebob.m@gmail.com>
12
+ ---
13
+ etcdserver/api/v2store/store_test.go | 3 ++-
14
+ wal/wal_test.go | 3 ++-
15
+ 2 files changed, 4 insertions(+), 2 deletions(-)
16
+
17
+ diff --git a/etcdserver/api/v2store/store_test.go b/etcdserver/api/v2store/store_test.go
18
+ index 76ec02d4e..0b1e9dad1 100644
19
+ --- a/etcdserver/api/v2store/store_test.go
20
+ +++ b/etcdserver/api/v2store/store_test.go
21
+ @@ -15,6 +15,7 @@
22
+ package v2store_test
23
+
24
+ import (
25
+ + "strconv"
26
+ "testing"
27
+ "time"
28
+
29
+ @@ -844,7 +845,7 @@ func TestStoreWatchSlowConsumer(t *testing.T) {
30
+ s.Watch("/foo", true, true, 0) // stream must be true
31
+ // Fill watch channel with 100 events
32
+ for i := 1; i <= 100; i++ {
33
+ - s.Set("/foo", false, string(i), v2store.TTLOptionSet{ExpireTime: v2store.Permanent}) // ok
34
+ + s.Set("/foo", false, strconv.Itoa(i), v2store.TTLOptionSet{ExpireTime: v2store.Permanent}) // ok
35
+ }
36
+ // testutil.AssertEqual(t, s.WatcherHub.count, int64(1))
37
+ s.Set("/foo", false, "101", v2store.TTLOptionSet{ExpireTime: v2store.Permanent}) // ok
38
+ diff --git a/wal/wal_test.go b/wal/wal_test.go
39
+ index f457dbf3c..8e8a252a0 100644
40
+ --- a/wal/wal_test.go
41
+ +++ b/wal/wal_test.go
42
+ @@ -25,6 +25,7 @@ import (
43
+ "path/filepath"
44
+ "reflect"
45
+ "regexp"
46
+ + "strconv"
47
+ "testing"
48
+
49
+ "go.etcd.io/etcd/pkg/fileutil"
50
+ @@ -239,7 +240,7 @@ func TestVerify(t *testing.T) {
51
+
52
+ // make 5 separate files
53
+ for i := 0; i < 5; i++ {
54
+ - es := []raftpb.Entry{{Index: uint64(i), Data: []byte("waldata" + string(i+1))}}
55
+ + es := []raftpb.Entry{{Index: uint64(i), Data: []byte("waldata" + strconv.Itoa(i+1))}}
56
+ if err = w.Save(raftpb.HardState{}, es); err != nil {
57
+ t.Fatal(err)
58
+ }
59
+ --
60
+ 2.26.2
61
+
SOURCES/0001-hack-etcdmain-to-generate-etcd.1.patch ADDED
@@ -0,0 +1,265 @@
1
+ diff -up etcd-3.4.13/etcdmain/config.go.orig etcd-3.4.13/etcdmain/config.go
2
+ --- etcd-3.4.13/etcdmain/config.go.orig 2020-08-24 21:11:28.000000000 +0200
3
+ +++ etcd-3.4.13/etcdmain/config.go 2020-09-04 00:12:28.424764763 +0200
4
+ @@ -123,14 +123,15 @@ func newConfig() *config {
5
+ ),
6
+ }
7
+
8
+ - fs := cfg.cf.flagSet
9
+ - fs.Usage = func() {
10
+ + fs := InitFlagSet(cfg.cf.flagSet)
11
+ + cfg.cf.flagSet.Usage = func() {
12
+ fmt.Fprintln(os.Stderr, usageline)
13
+ }
14
+
15
+ fs.StringVar(&cfg.configFile, "config-file", "", "Path to the server configuration file. Note that if a configuration file is provided, other command line flags and environment variables will be ignored.")
16
+
17
+ // member
18
+ + fs.AddGroup("member")
19
+ fs.StringVar(&cfg.ec.Dir, "data-dir", cfg.ec.Dir, "Path to the data directory.")
20
+ fs.StringVar(&cfg.ec.WalDir, "wal-dir", cfg.ec.WalDir, "Path to the dedicated wal directory.")
21
+ fs.Var(
22
+ @@ -163,7 +164,7 @@ func newConfig() *config {
23
+ fs.DurationVar(&cfg.ec.GRPCKeepAliveInterval, "grpc-keepalive-interval", cfg.ec.GRPCKeepAliveInterval, "Frequency duration of server-to-client ping to check if a connection is alive (0 to disable).")
24
+ fs.DurationVar(&cfg.ec.GRPCKeepAliveTimeout, "grpc-keepalive-timeout", cfg.ec.GRPCKeepAliveTimeout, "Additional duration of wait before closing a non-responsive connection (0 to disable).")
25
+
26
+ - // clustering
27
+ + fs.AddGroup("clustering")
28
+ fs.Var(
29
+ flags.NewUniqueURLsWithExceptions(embed.DefaultInitialAdvertisePeerURLs, ""),
30
+ "initial-advertise-peer-urls",
31
+ @@ -188,7 +189,7 @@ func newConfig() *config {
32
+ fs.BoolVar(&cfg.ec.EnableV2, "enable-v2", cfg.ec.EnableV2, "Accept etcd V2 client requests.")
33
+ fs.BoolVar(&cfg.ec.PreVote, "pre-vote", cfg.ec.PreVote, "Enable to run an additional Raft election phase.")
34
+
35
+ - // proxy
36
+ + fs.AddGroup("proxy")
37
+ fs.Var(cfg.cf.proxy, "proxy", fmt.Sprintf("Valid values include %q", cfg.cf.proxy.Valids()))
38
+ fs.UintVar(&cfg.cp.ProxyFailureWaitMs, "proxy-failure-wait", cfg.cp.ProxyFailureWaitMs, "Time (in milliseconds) an endpoint will be held in a failed state.")
39
+ fs.UintVar(&cfg.cp.ProxyRefreshIntervalMs, "proxy-refresh-interval", cfg.cp.ProxyRefreshIntervalMs, "Time (in milliseconds) of the endpoints refresh interval.")
40
+ @@ -196,7 +197,7 @@ func newConfig() *config {
41
+ fs.UintVar(&cfg.cp.ProxyWriteTimeoutMs, "proxy-write-timeout", cfg.cp.ProxyWriteTimeoutMs, "Time (in milliseconds) for a write to timeout.")
42
+ fs.UintVar(&cfg.cp.ProxyReadTimeoutMs, "proxy-read-timeout", cfg.cp.ProxyReadTimeoutMs, "Time (in milliseconds) for a read to timeout.")
43
+
44
+ - // security
45
+ + fs.AddGroup("security")
46
+ fs.StringVar(&cfg.ec.ClientTLSInfo.CertFile, "cert-file", "", "Path to the client server TLS cert file.")
47
+ fs.StringVar(&cfg.ec.ClientTLSInfo.KeyFile, "key-file", "", "Path to the client server TLS key file.")
48
+ fs.BoolVar(&cfg.ec.ClientTLSInfo.ClientCertAuth, "client-cert-auth", false, "Enable client cert authentication.")
49
+ @@ -222,7 +223,7 @@ func newConfig() *config {
50
+ )
51
+ fs.Var(flags.NewUniqueStringsValue("*"), "host-whitelist", "Comma-separated acceptable hostnames from HTTP client requests, if server is not secure (empty means allow all).")
52
+
53
+ - // logging
54
+ + fs.AddGroup("logging")
55
+ fs.StringVar(&cfg.ec.Logger, "logger", "capnslog", "Specify 'zap' for structured logging or 'capnslog'. WARN: 'capnslog' is being deprecated in v3.5.")
56
+ fs.Var(flags.NewUniqueStringsValue(embed.DefaultLogOutput), "log-output", "[TO BE DEPRECATED IN v3.5] use '--log-outputs'.")
57
+ fs.Var(flags.NewUniqueStringsValue(embed.DefaultLogOutput), "log-outputs", "Specify 'stdout' or 'stderr' to skip journald logging even when running under systemd, or list of comma separated output targets.")
58
+ @@ -230,27 +231,27 @@ func newConfig() *config {
59
+ fs.StringVar(&cfg.ec.LogLevel, "log-level", logutil.DefaultLogLevel, "Configures log level. Only supports debug, info, warn, error, panic, or fatal. Default 'info'.")
60
+ fs.StringVar(&cfg.ec.LogPkgLevels, "log-package-levels", "", "[TO BE DEPRECATED IN v3.5] Specify a particular log level for each etcd package (eg: 'etcdmain=CRITICAL,etcdserver=DEBUG').")
61
+
62
+ - // version
63
+ + fs.AddGroup("version")
64
+ fs.BoolVar(&cfg.printVersion, "version", false, "Print the version and exit.")
65
+
66
+ fs.StringVar(&cfg.ec.AutoCompactionRetention, "auto-compaction-retention", "0", "Auto compaction retention for mvcc key value store. 0 means disable auto compaction.")
67
+ fs.StringVar(&cfg.ec.AutoCompactionMode, "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.")
68
+
69
+ - // pprof profiler via HTTP
70
+ + fs.AddGroup("profiling")
71
+ fs.BoolVar(&cfg.ec.EnablePprof, "enable-pprof", false, "Enable runtime profiling data via HTTP server. Address is at client URL + \"/debug/pprof/\"")
72
+
73
+ // additional metrics
74
+ fs.StringVar(&cfg.ec.Metrics, "metrics", cfg.ec.Metrics, "Set level of detail for exported metrics, specify 'extensive' to include histogram metrics")
75
+
76
+ - // auth
77
+ + fs.AddGroup("auth")
78
+ fs.StringVar(&cfg.ec.AuthToken, "auth-token", cfg.ec.AuthToken, "Specify auth token specific options.")
79
+ fs.UintVar(&cfg.ec.BcryptCost, "bcrypt-cost", cfg.ec.BcryptCost, "Specify bcrypt algorithm cost factor for auth password hashing.")
80
+ fs.UintVar(&cfg.ec.AuthTokenTTL, "auth-token-ttl", cfg.ec.AuthTokenTTL, "The lifetime in seconds of the auth token.")
81
+
82
+ - // gateway
83
+ + fs.AddGroup("gateway")
84
+ fs.BoolVar(&cfg.ec.EnableGRPCGateway, "enable-grpc-gateway", true, "Enable GRPC gateway.")
85
+
86
+ - // experimental
87
+ + fs.AddGroup("experimental")
88
+ fs.BoolVar(&cfg.ec.ExperimentalInitialCorruptCheck, "experimental-initial-corrupt-check", cfg.ec.ExperimentalInitialCorruptCheck, "Enable to check data corruption before serving any client/peer traffic.")
89
+ fs.DurationVar(&cfg.ec.ExperimentalCorruptCheckTime, "experimental-corrupt-check-time", cfg.ec.ExperimentalCorruptCheckTime, "Duration of time between cluster corruption check passes.")
90
+ fs.StringVar(&cfg.ec.ExperimentalEnableV2V3, "experimental-enable-v2v3", cfg.ec.ExperimentalEnableV2V3, "v3 prefix for serving emulated v2 state.")
91
+ @@ -259,9 +260,12 @@ func newConfig() *config {
92
+ fs.IntVar(&cfg.ec.ExperimentalCompactionBatchLimit, "experimental-compaction-batch-limit", cfg.ec.ExperimentalCompactionBatchLimit, "Sets the maximum revisions deleted in each compaction batch.")
93
+ fs.DurationVar(&cfg.ec.ExperimentalWatchProgressNotifyInterval, "experimental-watch-progress-notify-interval", cfg.ec.ExperimentalWatchProgressNotifyInterval, "Duration of periodic watch progress notifications.")
94
+
95
+ - // unsafe
96
+ + fs.AddGroup("unsafe")
97
+ fs.BoolVar(&cfg.ec.UnsafeNoFsync, "unsafe-no-fsync", false, "Disables fsync, unsafe, will cause data loss.")
98
+ fs.BoolVar(&cfg.ec.ForceNewCluster, "force-new-cluster", false, "Force to create a new one member cluster.")
99
+ +
100
+ + fs.GenMan()
101
+ + os.Exit(0)
102
+
103
+ // ignored
104
+ for _, f := range cfg.ignored {
105
+ diff -up etcd-3.4.13/etcdmain/fake_flagset.go.orig etcd-3.4.13/etcdmain/fake_flagset.go
106
+ --- etcd-3.4.13/etcdmain/fake_flagset.go.orig 2020-09-04 00:10:11.223684457 +0200
107
+ +++ etcd-3.4.13/etcdmain/fake_flagset.go 2020-09-04 00:10:11.223684457 +0200
108
+ @@ -0,0 +1,157 @@
109
+ +package etcdmain
110
+ +
111
+ +import (
112
+ + "flag"
113
+ + "fmt"
114
+ + "strconv"
115
+ + "strings"
116
+ + "time"
117
+ +)
118
+ +
119
+ +type flagInfo struct {
120
+ + value fmt.Stringer
121
+ + name string
122
+ + usage string
123
+ +}
124
+ +
125
+ +type stringValue string
126
+ +
127
+ +func (s *stringValue) String() string { return string(*s) }
128
+ +
129
+ +type uintValue uint
130
+ +
131
+ +func (i *uintValue) String() string { return strconv.FormatUint(uint64(*i), 10) }
132
+ +
133
+ +type uint64Value uint64
134
+ +
135
+ +func (i *uint64Value) String() string { return strconv.FormatUint(uint64(*i), 10) }
136
+ +
137
+ +type int64Value int64
138
+ +
139
+ +func (i *int64Value) String() string { return strconv.FormatInt(int64(*i), 10) }
140
+ +
141
+ +type durationValue time.Duration
142
+ +
143
+ +func (d *durationValue) String() string { return (*time.Duration)(d).String() }
144
+ +
145
+ +type boolValue bool
146
+ +
147
+ +func (b *boolValue) String() string { return strconv.FormatBool(bool(*b)) }
148
+ +
149
+ +type FakeFlagSet struct {
150
+ + fs *flag.FlagSet
151
+ + flags map[string][]flagInfo
152
+ + groups []string
153
+ + lastGroup string
154
+ +}
155
+ +
156
+ +func InitFlagSet(fs *flag.FlagSet) *FakeFlagSet {
157
+ + return &FakeFlagSet{
158
+ + fs: fs,
159
+ + flags: make(map[string][]flagInfo),
160
+ + }
161
+ +}
162
+ +
163
+ +func (fs *FakeFlagSet) AddGroup(name string) {
164
+ + fs.flags[name] = nil
165
+ + fs.groups = append(fs.groups, name)
166
+ + fs.lastGroup = name
167
+ +}
168
+ +
169
+ +func (fs *FakeFlagSet) Var(value flag.Value, name string, usage string) {
170
+ + fs.flags[fs.lastGroup] = append(fs.flags[fs.lastGroup], flagInfo{
171
+ + value: value,
172
+ + name: name,
173
+ + usage: usage,
174
+ + })
175
+ + fs.fs.Var(value, name, usage)
176
+ +}
177
+ +
178
+ +func (fs *FakeFlagSet) StringVar(p *string, name string, value string, usage string) {
179
+ + fs.flags[fs.lastGroup] = append(fs.flags[fs.lastGroup], flagInfo{
180
+ + value: (*stringValue)(&value),
181
+ + name: name,
182
+ + usage: usage,
183
+ + })
184
+ + fs.fs.StringVar(p, name, value, usage)
185
+ +}
186
+ +
187
+ +// -- int Value
188
+ +type intValue int
189
+ +
190
+ +func (i *intValue) String() string { return strconv.Itoa(int(*i)) }
191
+ +
192
+ +func (fs *FakeFlagSet) UintVar(p *uint, name string, value uint, usage string) {
193
+ + fs.flags[fs.lastGroup] = append(fs.flags[fs.lastGroup], flagInfo{
194
+ + value: (*uintValue)(&value),
195
+ + name: name,
196
+ + usage: usage,
197
+ + })
198
+ + fs.fs.UintVar(p, name, value, usage)
199
+ +}
200
+ +
201
+ +func (fs *FakeFlagSet) Uint64Var(p *uint64, name string, value uint64, usage string) {
202
+ + fs.flags[fs.lastGroup] = append(fs.flags[fs.lastGroup], flagInfo{
203
+ + value: (*uint64Value)(&value),
204
+ + name: name,
205
+ + usage: usage,
206
+ + })
207
+ + fs.fs.Uint64Var(p, name, value, usage)
208
+ +}
209
+ +
210
+ +func (fs *FakeFlagSet) IntVar(p *int, name string, value int, usage string) {
211
+ + fs.flags[fs.lastGroup] = append(fs.flags[fs.lastGroup], flagInfo{
212
+ + value: (*intValue)(&value),
213
+ + name: name,
214
+ + usage: usage,
215
+ + })
216
+ + fs.fs.IntVar(p, name, value, usage)
217
+ +}
218
+ +
219
+ +func (fs *FakeFlagSet) Int64Var(p *int64, name string, value int64, usage string) {
220
+ + fs.flags[fs.lastGroup] = append(fs.flags[fs.lastGroup], flagInfo{
221
+ + value: (*int64Value)(&value),
222
+ + name: name,
223
+ + usage: usage,
224
+ + })
225
+ + fs.fs.Int64Var(p, name, value, usage)
226
+ +}
227
+ +
228
+ +func (fs *FakeFlagSet) DurationVar(p *time.Duration, name string, value time.Duration, usage string) {
229
+ + fs.flags[fs.lastGroup] = append(fs.flags[fs.lastGroup], flagInfo{
230
+ + value: (*durationValue)(&value),
231
+ + name: name,
232
+ + usage: usage,
233
+ + })
234
+ + fs.fs.DurationVar(p, name, value, usage)
235
+ +}
236
+ +
237
+ +func (fs *FakeFlagSet) BoolVar(p *bool, name string, value bool, usage string) {
238
+ + fs.flags[fs.lastGroup] = append(fs.flags[fs.lastGroup], flagInfo{
239
+ + value: (*boolValue)(&value),
240
+ + name: name,
241
+ + usage: usage,
242
+ + })
243
+ + fs.fs.BoolVar(p, name, value, usage)
244
+ +}
245
+ +
246
+ +func (fs *FakeFlagSet) GenMan() {
247
+ + fmt.Printf(".TH \"ETCD\" \"1\" \" etcd User Manuals\" \"Etcd contributors\" \"Nov 2017\" \"\"\n")
248
+ + fmt.Printf(".SH NAME:\netcd - Distributed reliable key-value store for the most critical data of a distributed system\n\n")
249
+ + fmt.Printf(".SH USAGE:\netcd [flags]\n\n")
250
+ + fmt.Printf(".SH DESCRIPTION:\nEtcd is a distributed key-value store designed to reliably and quickly preserve and provide access to critical data. It enables reliable distributed coordination through distributed locking, leader elections, and write barriers. An etcd cluster is intended for high availability and permanent data storage and retrieval.\n\n")
251
+ + fmt.Printf(".SH GENERAL OPTIONS\n\n")
252
+ + for _, group := range fs.groups {
253
+ + fmt.Printf(".I %v flags\n\n", strings.Title(group))
254
+ + for _, flag := range fs.flags[group] {
255
+ + var flagstr string
256
+ + if len(flag.name) == 1 {
257
+ + flagstr = "-" + flag.name
258
+ + } else {
259
+ + flagstr = "--" + flag.name
260
+ + }
261
+ + fmt.Printf(".RS\n\\fB%v %v\\fP\n %v\n\n.RE\n", flagstr, flag.value.String(), flag.usage)
262
+ + }
263
+ + }
264
+ + fmt.Printf(".SH SEE ALSO:\n\\fBetcdctl(1)\\fP, \\fBetcdctl2(1)\\fP, \\fBetcdctl3(1)\\fP\n\n")
265
+ +}
SOURCES/0001-hack-to-generate-man-pages.patch ADDED
@@ -0,0 +1,120 @@
1
+ diff -up etcd-3.4.13/etcdctl/ctlv2/ctl.go.orig2 etcd-3.4.13/etcdctl/ctlv2/ctl.go
2
+ --- etcd-3.4.13/etcdctl/ctlv2/ctl.go.orig2 2020-08-24 21:11:28.000000000 +0200
3
+ +++ etcd-3.4.13/etcdctl/ctlv2/ctl.go 2020-09-04 00:13:47.552811076 +0200
4
+ @@ -36,6 +36,68 @@ func Start() {
5
+ }
6
+ app.Usage = "A simple command line client for etcd."
7
+
8
+ + cli.AppHelpTemplate = `.TH "ETCD" "1" " etcd User Manuals" "Etcd contributors" "Nov 2017" ""
9
+ +.SH NAME:
10
+ +{{.Name}} - {{.Usage}}
11
+ +
12
+ +{{if .Version}}
13
+ +.SH VERSION:
14
+ + {{.Version}}
15
+ +{{end}}
16
+ +
17
+ +.SH USAGE:
18
+ + {{.HelpName}} {{if .VisibleFlags}}[global options]{{end}}{{if .Commands}} command [command options]{{end}} {{if .ArgsUsage}}{{.ArgsUsage}}{{else}}[arguments...]{{end}}
19
+ + {{if .Commands}}
20
+ +
21
+ +.SH COMMANDS:
22
+ +{{range .Commands}}{{if not .HideHelp}}\fB{{ .Name }}\fP{{ "\n\t\t\t" }}{{.Usage}}{{ "\n" }}
23
+ +
24
+ +{{end}}{{end}}{{end}}{{if .VisibleFlags}}
25
+ +
26
+ +.SH GLOBAL OPTIONS:
27
+ +{{range .VisibleFlags}}{{ . }}
28
+ +
29
+ +{{end}}{{end}}
30
+ +
31
+ +.SH SEE ALSO
32
+ +{{range .Commands}}{{if not .HideHelp}}{{if ne .Name "help" }}\fBetcdctl-{{ .Name }}(1)\fP,
33
+ +{{end}}{{end}}{{end}}
34
+ +`
35
+ +
36
+ + cli.CommandHelpTemplate = `.TH "ETCD" "1" " etcd User Manuals" "Etcd contributors" "Nov 2017" ""
37
+ +.SH NAME:
38
+ + {{.HelpName}} - {{.Usage}}
39
+ +
40
+ +.SH USAGE:
41
+ + {{.HelpName}}{{if .VisibleFlags}} [command options]{{end}} {{if .ArgsUsage}}{{.ArgsUsage}}{{else}}[arguments...]{{end}}
42
+ +
43
+ +{{if .VisibleFlags}}
44
+ +.SH OPTIONS:
45
+ + {{range .VisibleFlags}}{{.}}
46
+ + {{end}}{{end}}
47
+ +`
48
+ +
49
+ +
50
+ + cli.SubcommandHelpTemplate = `.TH "ETCD" "1" " etcd User Manuals" "Etcd contributors" "Nov 2017" ""
51
+ +.SH NAME:
52
+ + {{.HelpName}} - {{.Usage}}
53
+ +
54
+ +.SH USAGE:
55
+ + {{.HelpName}} command{{if .VisibleFlags}} [command options]{{end}} {{if .ArgsUsage}}{{.ArgsUsage}}{{else}}[arguments...]{{end}}
56
+ +
57
+ +.SH COMMANDS:
58
+ +{{range .VisibleCategories}}{{if .Name}}
59
+ +{{.Name}}:{{end}}{{range .VisibleCommands}}
60
+ +\fB{{ .Name }}\fP{{"\n\t\t\t"}}{{.Usage}}{{ "\n" }}{{end}}
61
+ +{{end}}
62
+ +
63
+ +{{if .VisibleFlags}}
64
+ +.SH OPTIONS:
65
+ +{{range .VisibleFlags}}{{.}}
66
+ +{{end}}{{end}}
67
+ +`
68
+ +
69
+ +
70
+ app.Flags = []cli.Flag{
71
+ cli.BoolFlag{Name: "debug", Usage: "output cURL commands which can be used to reproduce the request"},
72
+ cli.BoolFlag{Name: "no-sync", Usage: "don't synchronize cluster information before sending request"},
73
+ diff -up etcd-3.4.13/etcdctl/ctlv3/ctl_nocov.go.orig2 etcd-3.4.13/etcdctl/ctlv3/ctl_nocov.go
74
+ --- etcd-3.4.13/etcdctl/ctlv3/ctl_nocov.go.orig2 2020-08-24 21:11:28.000000000 +0200
75
+ +++ etcd-3.4.13/etcdctl/ctlv3/ctl_nocov.go 2020-09-04 00:13:47.553811076 +0200
76
+ @@ -16,13 +16,20 @@
77
+
78
+ package ctlv3
79
+
80
+ -import "go.etcd.io/etcd/etcdctl/ctlv3/command"
81
+ +//import "github.com/coreos/etcd/etcdctl/ctlv3/command"
82
+ +import cobra "github.com/spf13/cobra/doc"
83
+
84
+ func Start() {
85
+ rootCmd.SetUsageFunc(usageFunc)
86
+ // Make help just show the usage
87
+ rootCmd.SetHelpTemplate(`{{.UsageString}}`)
88
+ - if err := rootCmd.Execute(); err != nil {
89
+ - command.ExitWithError(command.ExitError, err)
90
+ + //if err := rootCmd.Execute(); err != nil {
91
+ + // command.ExitWithError(command.ExitError, err)
92
+ + //}
93
+ + header := &cobra.GenManHeader{
94
+ + Title: "etcdctl3",
95
+ + Section: "1",
96
+ }
97
+ +
98
+ + cobra.GenManTree(rootCmd, header, "")
99
+ }
100
+ diff -up etcd-3.4.13/vendor/github.com/urfave/cli/flag.go.orig2 etcd-3.4.13/vendor/github.com/urfave/cli/flag.go
101
+ --- etcd-3.4.13/vendor/github.com/urfave/cli/flag.go.orig2 2020-08-24 21:11:28.000000000 +0200
102
+ +++ etcd-3.4.13/vendor/github.com/urfave/cli/flag.go 2020-09-04 00:13:47.555811078 +0200
103
+ @@ -670,7 +670,7 @@ func prefixedNames(fullName, placeholder
104
+ parts := strings.Split(fullName, ",")
105
+ for i, name := range parts {
106
+ name = strings.Trim(name, " ")
107
+ - prefixed += prefixFor(name) + name
108
+ + prefixed += "\\fB" + prefixFor(name) + name + "\\fP"
109
+ if placeholder != "" {
110
+ prefixed += " " + placeholder
111
+ }
112
+ @@ -745,7 +745,7 @@ func stringifyFlag(f Flag) string {
113
+ usageWithDefault := strings.TrimSpace(fmt.Sprintf("%s%s", usage, defaultValueString))
114
+
115
+ return withEnvHint(fv.FieldByName("EnvVar").String(),
116
+ - fmt.Sprintf("%s\t%s", prefixedNames(fv.FieldByName("Name").String(), placeholder), usageWithDefault))
117
+ + fmt.Sprintf("%s\n\t\t\t%s", prefixedNames(fv.FieldByName("Name").String(), placeholder), usageWithDefault))
118
+ }
119
+
120
+ func stringifyIntSliceFlag(f IntSliceFlag) string {
SOURCES/0001-remove-unknown-field-Etcd.Debug.patch ADDED
@@ -0,0 +1,37 @@
1
+ From 2c95b49b63651ae3e0a3f63c45c05295d1af2c42 Mon Sep 17 00:00:00 2001
2
+ From: lsytj0413 <511121939@qq.com>
3
+ Date: Thu, 19 Sep 2019 09:51:51 +0800
4
+ Subject: [PATCH] test(functional): remove unknown field Etcd.Debug
5
+
6
+ ---
7
+ functional/tester/cluster_test.go | 3 ---
8
+ 1 file changed, 3 deletions(-)
9
+
10
+ diff --git a/functional/tester/cluster_test.go b/functional/tester/cluster_test.go
11
+ index 7c7b25f2ad..2948c00e7f 100644
12
+ --- a/functional/tester/cluster_test.go
13
+ +++ b/functional/tester/cluster_test.go
14
+ @@ -64,7 +64,6 @@ func Test_read(t *testing.T) {
15
+ InitialCorruptCheck: true,
16
+ Logger: "zap",
17
+ LogOutputs: []string{"/tmp/etcd-functional-1/etcd.log"},
18
+ - Debug: true,
19
+ },
20
+ ClientCertData: "",
21
+ ClientCertPath: "",
22
+ @@ -117,7 +116,6 @@ func Test_read(t *testing.T) {
23
+ InitialCorruptCheck: true,
24
+ Logger: "zap",
25
+ LogOutputs: []string{"/tmp/etcd-functional-2/etcd.log"},
26
+ - Debug: true,
27
+ },
28
+ ClientCertData: "",
29
+ ClientCertPath: "",
30
+ @@ -170,7 +168,6 @@ func Test_read(t *testing.T) {
31
+ InitialCorruptCheck: true,
32
+ Logger: "zap",
33
+ LogOutputs: []string{"/tmp/etcd-functional-3/etcd.log"},
34
+ - Debug: true,
35
+ },
36
+ ClientCertData: "",
37
+ ClientCertPath: "",
SOURCES/0001-update-grpc-go-version-to-v1.32.0.patch ADDED
@@ -0,0 +1,412 @@
1
+ From 2859e9f94608b44c9c351c7ccfcff21665573627 Mon Sep 17 00:00:00 2001
2
+ From: Sky Ao <aoxiaojian@gmail.com>
3
+ Date: Thu, 15 Oct 2020 15:34:16 +0800
4
+ Subject: [PATCH 1/4] update grpc-go version to v1.32.0 which has some breaking
5
+ api changes in naming and loadbalancer package
6
+
7
+ ---
8
+ clientv3/balancer/balancer.go | 39 ++-
9
+ clientv3/balancer/picker/err.go | 6 +-
10
+ .../balancer/picker/roundrobin_balanced.go | 7 +-
11
+ clientv3/naming/grpc.go | 27 +-
12
+ clientv3/naming/grpcnaming/naming.go | 73 +++++
13
+ proxy/grpcproxy/cluster.go | 2 +-
14
+ proxy/grpcproxy/register.go | 2 +-
15
+ 7 files changed, 424 insertions(+), 46 deletions(-)
16
+ create mode 100644 clientv3/naming/grpcnaming/naming.go
17
+
18
+ diff --git a/clientv3/balancer/balancer.go b/clientv3/balancer/balancer.go
19
+ index 3eecb9d1d2..d3e672c632 100644
20
+ --- a/clientv3/balancer/balancer.go
21
+ +++ b/clientv3/balancer/balancer.go
22
+ @@ -136,15 +136,34 @@ type baseBalancer struct {
23
+ connectivityRecorder connectivity.Recorder
24
+
25
+ picker picker.Picker
26
+ +
27
+ + resolverErr error // the last error reported by the resolver; cleared on successful resolution
28
+ }
29
+
30
+ -// HandleResolvedAddrs implements "grpc/balancer.Balancer" interface.
31
+ -// gRPC sends initial or updated resolved addresses from "Build".
32
+ -func (bb *baseBalancer) HandleResolvedAddrs(addrs []resolver.Address, err error) {
33
+ - if err != nil {
34
+ - bb.lg.Warn("HandleResolvedAddrs called with error", zap.String("balancer-id", bb.id), zap.Error(err))
35
+ +func (bb *baseBalancer) ResolverError(err error) {
36
+ + bb.resolverErr = err
37
+ + if len(bb.addrToSc) == 0 {
38
+ + bb.connectivityRecorder.RecordTransition(bb.connectivityRecorder.GetCurrentState(), grpcconnectivity.TransientFailure)
39
+ + }
40
+ +
41
+ + if bb.connectivityRecorder.GetCurrentState() != grpcconnectivity.TransientFailure {
42
+ + // The picker will not change since the balancer does not currently
43
+ + // report an error.
44
+ return
45
+ }
46
+ + bb.updatePicker()
47
+ + bb.currentConn.UpdateState(balancer.State{
48
+ + ConnectivityState: bb.connectivityRecorder.GetCurrentState(),
49
+ + Picker: bb.picker,
50
+ + })
51
+ +}
52
+ +
53
+ +// UpdateClientConnState implements "grpc/balancer.Balancer" interface.
54
+ +func (bb *baseBalancer) UpdateClientConnState(state balancer.ClientConnState) error {
55
+ + addrs := state.ResolverState.Addresses
56
+ + // Successful resolution; clear resolver error and ensure we return nil.
57
+ + bb.resolverErr = nil
58
+ +
59
+ bb.lg.Info("resolved",
60
+ zap.String("picker", bb.picker.String()),
61
+ zap.String("balancer-id", bb.id),
62
+ @@ -191,10 +210,14 @@ func (bb *baseBalancer) HandleResolvedAddrs(addrs []resolver.Address, err error)
63
+ // (DO NOT) delete(bb.scToSt, sc)
64
+ }
65
+ }
66
+ +
67
+ + return nil
68
+ }
69
+
70
+ -// HandleSubConnStateChange implements "grpc/balancer.Balancer" interface.
71
+ -func (bb *baseBalancer) HandleSubConnStateChange(sc balancer.SubConn, s grpcconnectivity.State) {
72
+ +// UpdateSubConnState implements "grpc/balancer.Balancer" interface.
73
+ +func (bb *baseBalancer) UpdateSubConnState(sc balancer.SubConn, state balancer.SubConnState) {
74
+ + s := state.ConnectivityState
75
+ +
76
+ bb.mu.Lock()
77
+ defer bb.mu.Unlock()
78
+
79
+ @@ -247,7 +270,7 @@ func (bb *baseBalancer) HandleSubConnStateChange(sc balancer.SubConn, s grpcconn
80
+ bb.updatePicker()
81
+ }
82
+
83
+ - bb.currentConn.UpdateBalancerState(bb.connectivityRecorder.GetCurrentState(), bb.picker)
84
+ + bb.currentConn.UpdateState(balancer.State{ConnectivityState: bb.connectivityRecorder.GetCurrentState(), Picker: bb.picker})
85
+ }
86
+
87
+ func (bb *baseBalancer) updatePicker() {
88
+ diff --git a/clientv3/balancer/picker/err.go b/clientv3/balancer/picker/err.go
89
+ index f4b941d652..a37baa7bd2 100644
90
+ --- a/clientv3/balancer/picker/err.go
91
+ +++ b/clientv3/balancer/picker/err.go
92
+ @@ -15,8 +15,6 @@
93
+ package picker
94
+
95
+ import (
96
+ - "context"
97
+ -
98
+ "google.golang.org/grpc/balancer"
99
+ )
100
+
101
+ @@ -34,6 +32,6 @@ func (ep *errPicker) String() string {
102
+ return ep.p.String()
103
+ }
104
+
105
+ -func (ep *errPicker) Pick(context.Context, balancer.PickInfo) (balancer.SubConn, func(balancer.DoneInfo), error) {
106
+ - return nil, nil, ep.err
107
+ +func (ep *errPicker) Pick(balancer.PickInfo) (balancer.PickResult, error) {
108
+ + return balancer.PickResult{}, ep.err
109
+ }
110
+ diff --git a/clientv3/balancer/picker/roundrobin_balanced.go b/clientv3/balancer/picker/roundrobin_balanced.go
111
+ index e3971ecc42..993c05ec13 100644
112
+ --- a/clientv3/balancer/picker/roundrobin_balanced.go
113
+ +++ b/clientv3/balancer/picker/roundrobin_balanced.go
114
+ @@ -15,7 +15,6 @@
115
+ package picker
116
+
117
+ import (
118
+ - "context"
119
+ "sync"
120
+
121
+ "go.uber.org/zap"
122
+ @@ -52,12 +51,12 @@ type rrBalanced struct {
123
+ func (rb *rrBalanced) String() string { return rb.p.String() }
124
+
125
+ // Pick is called for every client request.
126
+ -func (rb *rrBalanced) Pick(ctx context.Context, opts balancer.PickInfo) (balancer.SubConn, func(balancer.DoneInfo), error) {
127
+ +func (rb *rrBalanced) Pick(opts balancer.PickInfo) (balancer.PickResult, error) {
128
+ rb.mu.RLock()
129
+ n := len(rb.scs)
130
+ rb.mu.RUnlock()
131
+ if n == 0 {
132
+ - return nil, nil, balancer.ErrNoSubConnAvailable
133
+ + return balancer.PickResult{}, balancer.ErrNoSubConnAvailable
134
+ }
135
+
136
+ rb.mu.Lock()
137
+ @@ -91,5 +90,5 @@ func (rb *rrBalanced) Pick(ctx context.Context, opts balancer.PickInfo) (balance
138
+ rb.lg.Warn("balancer failed", fss...)
139
+ }
140
+ }
141
+ - return sc, doneFunc, nil
142
+ + return balancer.PickResult{SubConn: sc, Done: doneFunc}, nil
143
+ }
144
+ diff --git a/clientv3/naming/grpc.go b/clientv3/naming/grpc.go
145
+ index b680274bb3..f7cd2bd8a6 100644
146
+ --- a/clientv3/naming/grpc.go
147
+ +++ b/clientv3/naming/grpc.go
148
+ @@ -20,9 +20,9 @@ import (
149
+ "fmt"
150
+
151
+ etcd "go.etcd.io/etcd/clientv3"
152
+ + gnaming "go.etcd.io/etcd/clientv3/naming/grpcnaming"
153
+
154
+ "google.golang.org/grpc/codes"
155
+ - "google.golang.org/grpc/naming"
156
+ "google.golang.org/grpc/status"
157
+ )
158
+
159
+ @@ -34,15 +33,15 @@ type GRPCResolver struct {
160
+ Client *etcd.Client
161
+ }
162
+
163
+ -func (gr *GRPCResolver) Update(ctx context.Context, target string, nm naming.Update, opts ...etcd.OpOption) (err error) {
164
+ +func (gr *GRPCResolver) Update(ctx context.Context, target string, nm gnaming.Update, opts ...etcd.OpOption) (err error) {
165
+ switch nm.Op {
166
+ - case naming.Add:
167
+ + case gnaming.Add:
168
+ var v []byte
169
+ if v, err = json.Marshal(nm); err != nil {
170
+ return status.Error(codes.InvalidArgument, err.Error())
171
+ }
172
+ _, err = gr.Client.KV.Put(ctx, target+"/"+nm.Addr, string(v), opts...)
173
+ - case naming.Delete:
174
+ + case gnaming.Delete:
175
+ _, err = gr.Client.Delete(ctx, target+"/"+nm.Addr, opts...)
176
+ default:
177
+ return status.Error(codes.InvalidArgument, "naming: bad naming op")
178
+ @@ -50,7 +49,7 @@ func (gr *GRPCResolver) Update(ctx context.Context, target string, nm naming.Upd
179
+ return err
180
+ }
181
+
182
+ -func (gr *GRPCResolver) Resolve(target string) (naming.Watcher, error) {
183
+ +func (gr *GRPCResolver) Resolve(target string) (gnaming.Watcher, error) {
184
+ ctx, cancel := context.WithCancel(context.Background())
185
+ w := &gRPCWatcher{c: gr.Client, target: target + "/", ctx: ctx, cancel: cancel}
186
+ return w, nil
187
+ @@ -68,7 +67,7 @@ type gRPCWatcher struct {
188
+ // Next gets the next set of updates from the etcd resolver.
189
+ // Calls to Next should be serialized; concurrent calls are not safe since
190
+ // there is no way to reconcile the update ordering.
191
+ -func (gw *gRPCWatcher) Next() ([]*naming.Update, error) {
192
+ +func (gw *gRPCWatcher) Next() ([]*gnaming.Update, error) {
193
+ if gw.wch == nil {
194
+ // first Next() returns all addresses
195
+ return gw.firstNext()
196
+ @@ -87,17 +86,17 @@ func (gw *gRPCWatcher) Next() ([]*naming.Update, error) {
197
+ return nil, gw.err
198
+ }
199
+
200
+ - updates := make([]*naming.Update, 0, len(wr.Events))
201
+ + updates := make([]*gnaming.Update, 0, len(wr.Events))
202
+ for _, e := range wr.Events {
203
+ - var jupdate naming.Update
204
+ + var jupdate gnaming.Update
205
+ var err error
206
+ switch e.Type {
207
+ case etcd.EventTypePut:
208
+ err = json.Unmarshal(e.Kv.Value, &jupdate)
209
+ - jupdate.Op = naming.Add
210
+ + jupdate.Op = gnaming.Add
211
+ case etcd.EventTypeDelete:
212
+ err = json.Unmarshal(e.PrevKv.Value, &jupdate)
213
+ - jupdate.Op = naming.Delete
214
+ + jupdate.Op = gnaming.Delete
215
+ default:
216
+ continue
217
+ }
218
+ @@ -108,7 +107,7 @@ func (gw *gRPCWatcher) Next() ([]*naming.Update, error) {
219
+ return updates, nil
220
+ }
221
+
222
+ -func (gw *gRPCWatcher) firstNext() ([]*naming.Update, error) {
223
+ +func (gw *gRPCWatcher) firstNext() ([]*gnaming.Update, error) {
224
+ // Use serialized request so resolution still works if the target etcd
225
+ // server is partitioned away from the quorum.
226
+ resp, err := gw.c.Get(gw.ctx, gw.target, etcd.WithPrefix(), etcd.WithSerializable())
227
+ @@ -116,9 +115,9 @@ func (gw *gRPCWatcher) firstNext() ([]*naming.Update, error) {
228
+ return nil, err
229
+ }
230
+
231
+ - updates := make([]*naming.Update, 0, len(resp.Kvs))
232
+ + updates := make([]*gnaming.Update, 0, len(resp.Kvs))
233
+ for _, kv := range resp.Kvs {
234
+ - var jupdate naming.Update
235
+ + var jupdate gnaming.Update
236
+ if err := json.Unmarshal(kv.Value, &jupdate); err != nil {
237
+ continue
238
+ }
239
+ diff --git a/clientv3/naming/grpcnaming/naming.go b/clientv3/naming/grpcnaming/naming.go
240
+ new file mode 100644
241
+ index 0000000000..9b1f20cc61
242
+ --- /dev/null
243
+ +++ b/clientv3/naming/grpcnaming/naming.go
244
+ @@ -0,0 +1,73 @@
245
+ +/*
246
+ + *
247
+ + * Copyright 2014 gRPC authors.
248
+ + *
249
+ + * Licensed under the Apache License, Version 2.0 (the "License");
250
+ + * you may not use this file except in compliance with the License.
251
+ + * You may obtain a copy of the License at
252
+ + *
253
+ + * http://www.apache.org/licenses/LICENSE-2.0
254
+ + *
255
+ + * Unless required by applicable law or agreed to in writing, software
256
+ + * distributed under the License is distributed on an "AS IS" BASIS,
257
+ + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
258
+ + * See the License for the specific language governing permissions and
259
+ + * limitations under the License.
260
+ + *
261
+ + */
262
+ +
263
+ +// Package naming defines the naming API and related data structures for gRPC.
264
+ +//
265
+ +// This package is deprecated: please use package resolver instead.
266
+ +
267
+ +
268
+ +// Notice: this file is a copy of naming/naming.go from grpc-go v1.29.1.
269
+ +// The package of grpc naming is removed since grpc-go v1.30.0.
270
+ +// This is a work around to make etcd work with grpc new version (>=v1.30.0) without too many code change.
271
+ +package grpcnaming
272
+ +
273
+ +// Operation defines the corresponding operations for a name resolution change.
274
+ +//
275
+ +// Deprecated: please use package resolver.
276
+ +type Operation uint8
277
+ +
278
+ +const (
279
+ + // Add indicates a new address is added.
280
+ + Add Operation = iota
281
+ + // Delete indicates an existing address is deleted.
282
+ + Delete
283
+ +)
284
+ +
285
+ +// Update defines a name resolution update. Notice that it is not valid having both
286
+ +// empty string Addr and nil Metadata in an Update.
287
+ +//
288
+ +// Deprecated: please use package resolver.
289
+ +type Update struct {
290
+ + // Op indicates the operation of the update.
291
+ + Op Operation
292
+ + // Addr is the updated address. It is empty string if there is no address update.
293
+ + Addr string
294
+ + // Metadata is the updated metadata. It is nil if there is no metadata update.
295
+ + // Metadata is not required for a custom naming implementation.
296
+ + Metadata interface{}
297
+ +}
298
+ +
299
+ +// Resolver creates a Watcher for a target to track its resolution changes.
300
+ +//
301
+ +// Deprecated: please use package resolver.
302
+ +type Resolver interface {
303
+ + // Resolve creates a Watcher for target.
304
+ + Resolve(target string) (Watcher, error)
305
+ +}
306
+ +
307
+ +// Watcher watches for the updates on the specified target.
308
+ +//
309
+ +// Deprecated: please use package resolver.
310
+ +type Watcher interface {
311
+ + // Next blocks until an update or error happens. It may return one or more
312
+ + // updates. The first call should get the full set of the results. It should
313
+ + // return an error if and only if Watcher cannot recover.
314
+ + Next() ([]*Update, error)
315
+ + // Close closes the Watcher.
316
+ + Close()
317
+ +}
318
+
319
+ diff --git a/proxy/grpcproxy/cluster.go b/proxy/grpcproxy/cluster.go
320
+ index 5f3ab76584..a786457a6a 100644
321
+ --- a/proxy/grpcproxy/cluster.go
322
+ +++ b/proxy/grpcproxy/cluster.go
323
+ @@ -18,6 +18,7 @@ import (
324
+ "context"
325
+ "errors"
326
+ "fmt"
327
+ + gnaming "go.etcd.io/etcd/clientv3/naming/grpcnaming"
328
+ "os"
329
+ "sync"
330
+
331
+ @@ -27,7 +28,6 @@ import (
332
+ pb "go.etcd.io/etcd/etcdserver/etcdserverpb"
333
+
334
+ "golang.org/x/time/rate"
335
+ - gnaming "google.golang.org/grpc/naming"
336
+ )
337
+
338
+ // allow maximum 1 retry per second
339
+ diff --git a/proxy/grpcproxy/register.go b/proxy/grpcproxy/register.go
340
+ index e74cd5ca90..912e147d77 100644
341
+ --- a/proxy/grpcproxy/register.go
342
+ +++ b/proxy/grpcproxy/register.go
343
+ @@ -16,6 +16,7 @@ package grpcproxy
344
+
345
+ import (
346
+ "encoding/json"
347
+ + gnaming "go.etcd.io/etcd/clientv3/naming/grpcnaming"
348
+ "os"
349
+
350
+ "go.etcd.io/etcd/clientv3"
351
+ @@ -23,7 +24,6 @@ import (
352
+ "go.etcd.io/etcd/clientv3/naming"
353
+
354
+ "golang.org/x/time/rate"
355
+ - gnaming "google.golang.org/grpc/naming"
356
+ )
357
+
358
+ // allow maximum 1 retry per second
359
+ From b1d600ee05737adf6fc2ba3a5c3d92c1037bb6a6 Mon Sep 17 00:00:00 2001
360
+ From: Sky Ao <aoxiaojian@gmail.com>
361
+ Date: Thu, 22 Oct 2020 11:20:17 +0800
362
+ Subject: [PATCH 3/4] add doc for method ResolveError()
363
+
364
+ ---
365
+ clientv3/balancer/balancer.go | 1 +
366
+ 1 file changed, 1 insertion(+)
367
+
368
+ diff --git a/clientv3/balancer/balancer.go b/clientv3/balancer/balancer.go
369
+ index d3e672c632..1488580331 100644
370
+ --- a/clientv3/balancer/balancer.go
371
+ +++ b/clientv3/balancer/balancer.go
372
+ @@ -140,6 +140,7 @@ type baseBalancer struct {
373
+ resolverErr error // the last error reported by the resolver; cleared on successful resolution
374
+ }
375
+
376
+ +// ResolverError implements "grpc/balancer.Balancer" interface.
377
+ func (bb *baseBalancer) ResolverError(err error) {
378
+ bb.resolverErr = err
379
+ if len(bb.addrToSc) == 0 {
380
+
381
+ From 5ba58f2283eda7247f51b4e9dd07c367c4d77235 Mon Sep 17 00:00:00 2001
382
+ From: Sky Ao <aoxiaojian@gmail.com>
383
+ Date: Thu, 22 Oct 2020 11:36:03 +0800
384
+ Subject: [PATCH 4/4] update to pass fmt checking
385
+
386
+ ---
387
+ clientv3/naming/grpcnaming/naming.go | 7 +------
388
+ 1 file changed, 1 insertion(+), 6 deletions(-)
389
+
390
+ diff --git a/clientv3/naming/grpcnaming/naming.go b/clientv3/naming/grpcnaming/naming.go
391
+ index 9b1f20cc61..a4415a6541 100644
392
+ --- a/clientv3/naming/grpcnaming/naming.go
393
+ +++ b/clientv3/naming/grpcnaming/naming.go
394
+ @@ -19,11 +19,6 @@
395
+ // Package naming defines the naming API and related data structures for gRPC.
396
+ //
397
+ // This package is deprecated: please use package resolver instead.
398
+ -
399
+ -
400
+ -// Notice: this file is a copy of naming/naming.go from grpc-go v1.29.1.
401
+ -// The package of grpc naming is removed since grpc-go v1.30.0.
402
+ -// This is a work around to make etcd work with grpc new version (>=v1.30.0) without too many code change.
403
+ package grpcnaming
404
+
405
+ // Operation defines the corresponding operations for a name resolution change.
406
+ @@ -70,4 +65,4 @@ type Watcher interface {
407
+ Next() ([]*Update, error)
408
+ // Close closes the Watcher.
409
+ Close()
410
+ -}
411
+
412
+ +}
file added
+18
SOURCES/README.md ADDED
@@ -0,0 +1,18 @@
1
+ etcdctl*.1 to etcdctl3*.1
2
+
3
+ for line in $(ls *.1); do mv $line $(echo $line | sed "s/etcdctl/etcdctl3/"); done
4
+
5
+ rename refs in man pages
6
+
7
+ sed -i "s/\\\fBetcdctl\\\-/\\\fBetcdctl3\\\-/g" *.1
8
+
9
+ sed -i s"/^etcdctl/ETCDCTL=3 etcdctl/" etcdctl3*.1
10
+
11
+ etcdctl*.1 to etcdctl2*.1
12
+
13
+ for line in $(ls *.1); do mv $line $(echo $line | sed "s/etcdctl/etcdctl3/"); done
14
+
15
+ rename refs in man pages
16
+
17
+ sed -i "s/\\\fBetcdctl-/\\\fBetcdctl2-/g" *.1
18
+
SOURCES/bz1350875-disaster-recovery-with-copies.patch ADDED
@@ -0,0 +1,56 @@
1
+ From 7ad700a716c2122c3b6db6677a6f717919b88926 Mon Sep 17 00:00:00 2001
2
+ From: Jan Chaloupka <jchaloup@redhat.com>
3
+ Date: Tue, 2 May 2017 09:56:02 +0200
4
+ Subject: [PATCH] bz1350875-disaster-recovery-with-copies:
5
+
6
+ ---
7
+ etcdctl/ctlv2/command/backup_command.go | 19 +++++++++++++++++--
8
+ 1 file changed, 17 insertions(+), 2 deletions(-)
9
+
10
+ diff --git a/etcdctl/ctlv2/command/backup_command.go b/etcdctl/ctlv2/command/backup_command.go
11
+ index feda4b1..e77791f 100644
12
+ --- a/etcdctl/ctlv2/command/backup_command.go
13
+ +++ b/etcdctl/ctlv2/command/backup_command.go
14
+ @@ -18,6 +18,7 @@ import (
15
+ "fmt"
16
+ "log"
17
+ "path/filepath"
18
+ + "strconv"
19
+ "time"
20
+
21
+ "github.com/coreos/etcd/etcdserver/etcdserverpb"
22
+ @@ -40,6 +41,9 @@ func NewBackupCommand() cli.Command {
23
+ cli.StringFlag{Name: "wal-dir", Value: "", Usage: "Path to the etcd wal dir"},
24
+ cli.StringFlag{Name: "backup-dir", Value: "", Usage: "Path to the backup dir"},
25
+ cli.StringFlag{Name: "backup-wal-dir", Value: "", Usage: "Path to the backup wal dir"},
26
+ + cli.BoolFlag{Name: "keep-cluster-id", Usage: "Do not rewrite the cluster id"},
27
+ + cli.StringFlag{Name: "node-id", Value: "", Usage: "Use custom node id instead of a random value"},
28
+ +
29
+ },
30
+ Action: handleBackup,
31
+ }
32
+ @@ -99,8 +103,19 @@ func handleBackup(c *cli.Context) error {
33
+ var metadata etcdserverpb.Metadata
34
+ pbutil.MustUnmarshal(&metadata, wmetadata)
35
+ idgen := idutil.NewGenerator(0, time.Now())
36
+ - metadata.NodeID = idgen.Next()
37
+ - metadata.ClusterID = idgen.Next()
38
+ + explicitNodeId := c.String("node-id")
39
+ + if explicitNodeId != "" {
40
+ + metadata.NodeID, err = strconv.ParseUint(explicitNodeId, 16, 64)
41
+ + if err != nil {
42
+ + log.Fatal(err)
43
+ + }
44
+ + } else {
45
+ + metadata.NodeID = idgen.Next()
46
+ + }
47
+ + keepClusterId := c.Bool("keep-cluster-id")
48
+ + if !keepClusterId {
49
+ + metadata.ClusterID = idgen.Next()
50
+ + }
51
+
52
+ neww, err := wal.Create(destWAL, pbutil.MustMarshal(&metadata))
53
+ if err != nil {
54
+ --
55
+ 2.7.4
56
+
file modified
+51 -34
SOURCES/etcd.conf CHANGED
@@ -1,34 +1,51 @@
1
- # This configuration file is written in [TOML](https://github.com/mojombo/toml)
2
-
3
- # addr = "127.0.0.1:4001"
4
- # bind_addr = "127.0.0.1:4001"
5
- # ca_file = ""
6
- # cert_file = ""
7
- # cors = []
8
- # cpu_profile_file = ""
9
- data_dir = "/var/lib/etcd/default.etcd/"
10
- # discovery = "http://etcd.local:4001/v2/keys/_etcd/registry/examplecluster"
11
- # http_read_timeout = 10
12
- # http_write_timeout = 10
13
- # key_file = ""
14
- # peers = []
15
- # peers_file = ""
16
- # max_cluster_size = 9
17
- # max_result_buffer = 1024
18
- # max_retry_attempts = 3
19
- name = "default"
20
- # snapshot = false
21
- # verbose = false
22
- # very_verbose = false
23
-
24
- # [peer]
25
- # addr = "127.0.0.1:7001"
26
- # bind_addr = "127.0.0.1:7001"
27
- # ca_file = ""
28
- # cert_file = ""
29
- # key_file = ""
30
-
31
- # [cluster]
32
- # active_size = 9
33
- # remove_delay = 1800.0
34
- # sync_interval = 5.0
1
+ # [member]
2
+ ETCD_NAME=default
3
+ ETCD_DATA_DIR="/var/lib/etcd/default.etcd"
4
+ #ETCD_WAL_DIR=""
5
+ #ETCD_SNAPSHOT_COUNT="10000"
6
+ #ETCD_HEARTBEAT_INTERVAL="100"
7
+ #ETCD_ELECTION_TIMEOUT="1000"
8
+ #ETCD_LISTEN_PEER_URLS="http://localhost:2380"
9
+ ETCD_LISTEN_CLIENT_URLS="http://localhost:2379"
10
+ #ETCD_MAX_SNAPSHOTS="5"
11
+ #ETCD_MAX_WALS="5"
12
+ #ETCD_CORS=""
13
+ #
14
+ #[cluster]
15
+ #ETCD_INITIAL_ADVERTISE_PEER_URLS="http://localhost:2380"
16
+ # if you use different ETCD_NAME (e.g. test), set ETCD_INITIAL_CLUSTER value for this name, i.e. "test=http://..."
17
+ #ETCD_INITIAL_CLUSTER="default=http://localhost:2380"
18
+ #ETCD_INITIAL_CLUSTER_STATE="new"
19
+ #ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster"
20
+ ETCD_ADVERTISE_CLIENT_URLS="http://localhost:2379"
21
+ #ETCD_DISCOVERY=""
22
+ #ETCD_DISCOVERY_SRV=""
23
+ #ETCD_DISCOVERY_FALLBACK="proxy"
24
+ #ETCD_DISCOVERY_PROXY=""
25
+ #ETCD_STRICT_RECONFIG_CHECK="false"
26
+ #ETCD_AUTO_COMPACTION_RETENTION="0"
27
+ #
28
+ #[proxy]
29
+ #ETCD_PROXY="off"
30
+ #ETCD_PROXY_FAILURE_WAIT="5000"
31
+ #ETCD_PROXY_REFRESH_INTERVAL="30000"
32
+ #ETCD_PROXY_DIAL_TIMEOUT="1000"
33
+ #ETCD_PROXY_WRITE_TIMEOUT="5000"
34
+ #ETCD_PROXY_READ_TIMEOUT="0"
35
+ #
36
+ #[security]
37
+ #ETCD_CERT_FILE=""
38
+ #ETCD_KEY_FILE=""
39
+ #ETCD_CLIENT_CERT_AUTH="false"
40
+ #ETCD_TRUSTED_CA_FILE=""
41
+ #ETCD_AUTO_TLS="false"
42
+ #ETCD_PEER_CERT_FILE=""
43
+ #ETCD_PEER_KEY_FILE=""
44
+ #ETCD_PEER_CLIENT_CERT_AUTH="false"
45
+ #ETCD_PEER_TRUSTED_CA_FILE=""
46
+ #ETCD_PEER_AUTO_TLS="false"
47
+ #
48
+ #[logging]
49
+ #ETCD_DEBUG="false"
50
+ # examples for -log-package-levels etcdserver=WARNING,security=DEBUG
51
+ #ETCD_LOG_PACKAGE_LEVELS=""
file modified
+9 -5
SOURCES/etcd.service CHANGED
@@ -1,14 +1,18 @@
1
1
[Unit]
2
2
Description=Etcd Server
3
3
After=network.target
4
+ After=network-online.target
5
+ Wants=network-online.target
4
6
5
7
[Service]
6
- Type=simple
7
- # etc logs to the journal directly, suppress double logging
8
- StandardOutput=null
8
+ Type=notify
9
+ WorkingDirectory=/var/lib/etcd/
10
+ EnvironmentFile=-/etc/etcd/etcd.conf
9
- WorkingDirectory=/var/lib/etcd
10
11
User=etcd
11
- ExecStart=/usr/bin/etcd
12
+ # set GOMAXPROCS to number of processors
13
+ ExecStart=/bin/bash -c "GOMAXPROCS=$(nproc) /usr/bin/etcd"
14
+ Restart=on-failure
15
+ LimitNOFILE=65536
12
16
13
17
[Install]
14
18
WantedBy=multi-user.target
file added
+25
SOURCES/etcdctl.1 ADDED
@@ -0,0 +1,25 @@
1
+ .TH "ETCD" "1" " etcd User Manuals" "Jan Chaloupka" "Oct 2017" ""
2
+
3
+
4
+ .SH NAME
5
+ .PP
6
+ etcdctl \- A simple command line client for etcd
7
+
8
+
9
+ .SH SYNOPSIS
10
+ .PP
11
+ \fB[ETCDCTL_API=3] etctctl\fP [OPTIONS]
12
+
13
+
14
+ .SH DESCRIPTION
15
+ .PP
16
+ Command line client for etcd.
17
+ Queries to v2 data model are available through \fBetcdtl\fP command (see \fBetcdctl2(1)\fP).
18
+ Queries to v3 data model are available through \fBETCDCTL=3 etcdtl\fP command (see \fBetcdctl3(1)\fP).
19
+
20
+ .PP
21
+ Find more information at
22
+ \[la]https://github.com/coreos/etcd\[ra].
23
+
24
+ .SH SEE ALSO
25
+ \fBetcd(1)\fP, \fBetcdctl2(1)\fP, \fBetcdctl3(1)\fP
empty file added
file modified
+223 -98