'listen tcp 127.0.0.1:2380: bind: address already in use'
errors when running tests.
Address review comments:
- Add Apache copyright to the new file
- Fix typo Confg -> Config
- Move server/embed/testutil/url.go -> server/embed/util_test.go
- Add a new method to apply the test URLs to the config
- Make all config functions private
Signed-off-by: Jonathan Albrecht <jonathan.albrecht@ibm.com>
Before this change, LogWithStepThreshold formatted the log message as
fmt.Sprintf("trace[%d] %s", rand.Int31(), t.operation)
producing a unique string on every invocation (e.g. "trace[12345678] range",
"trace[87654321] range"). In structured logging each unique message value is a
distinct cardinality entry, so a busy etcd instance generated O(ops/s) unique
event names per minute. This made grouping, alerting, and dashboard queries on
slow-trace events impractical.
After this change the message is always the stable string "trace". The random
trace identifier and the operation name are moved to structured zap fields
("trace_id" int32 and "operation" string), preserving full queryability while
reducing message cardinality from O(N) to 1.
The per-step format strings also no longer embed the trace ID inline; the ID
appears once at the top level.
Fixes#21733
Signed-off-by: Andrew Liu <andrewjliu22@gmail.com>
In streamReader.dial(), when the HTTP response has status
StatusPreconditionFailed, the code reads the response body via
io.ReadAll. If io.ReadAll returns an error, the function returns
without closing resp.Body, leaking the underlying TCP connection.
Every other error path in this switch statement properly closes the
response body (via httputil.GracefulClose), but this one was missed.
Add resp.Body.Close() before returning on the io.ReadAll error path
to prevent the connection leak.
Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
google.golang.org/protobuf intentionally varies whitespace in String output
across binaries. Update the etcd-dump-logs raw output test to accept both
snapshot line formats while keeping the rest of the output exact.
Signed-off-by: Wei Fu <fuweid89@gmail.com>
Use the new test functions, simplify generating the coverage files and
merge at a single level by generating less coverage files.
Signed-off-by: Ivan Valdes <ivan@vald.es>
Switch EtcdServer.raftRequestOnce, EtcdServer.raftRequest, and
EtcdServer.processInternalRaftRequestOnce to take *etcdserverpb.InternalRaftRequest.
Signed-off-by: Wei Fu <fuweid89@gmail.com>
switch revKeyValue.kv from mvccpb.KeyValue to *mvccpb.KeyValue and
unmarshal into a newly allocated KeyValue in restoreChunk.
this removes gogopb-by-value usage in restore/index rebuild and keeps
pb handling aligned with pointer-based paths.
Signed-off-by: Wei Fu <fuweid89@gmail.com>
keep WAL snapshot tracking on pointer form as well:
- change WAL.start from walpb.Snapshot to *walpb.Snapshot
- in openAtIndex, normalize nil input to &walpb.Snapshot{} and store pointer start
- keep ReadAll math/error path on getters (GetIndex/GetTerm) for pointer-safe access
- update WAL test fixture to pass start as pointer
Signed-off-by: Wei Fu <fuweid89@gmail.com>
Fixes#18805
On startup, during a rolling deployment of etcd 3.6.0 we see
Host 1: starting etcd server - cluster-version: to_be_decided
Host 1: set cluster version from store - cluster-version: 3.6
...
Host 2: starting etcd server - cluster-version: to_be_decided
Host 2: set cluster version from store - cluster-version: 3.6
...
And so on. However, once the rolling-deploy is complete, we find that
the cluster_version metric is not being emitted:
root@etcd-host-2:/# curl -s localhost:2379/metrics | grep
"server_version"
'server_version' label with current version.
etcd_server_version{server_version="3.6.0"} 1
root@etcd-host-2:/# curl -s localhost:2379/metrics | grep
"cluster_version"
root@etcd-host-2:/#
It appears we are missing the call to actually set the metric once we
determine it in the recover() path, via applySnapshot().
Signed-off-by: Steven Richards <steven.richards@slack-corp.com>
switch ctlv3 command printer/watch paths to pointer-based gogopb response
handling, and read protobuf-backed fields via GetXXX() just in case input
is nil.
In tests/framework/e2e/etcdctl.go, txn output is decoded into
command.TxnResponseJSON and converted with ToProto(), instead of hand-building
ResponseOp variants before json.Unmarshal.
Co-authored-by: Jordan Liggitt <liggitt@google.com>
Signed-off-by: Wei Fu <fuweid89@gmail.com>