diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml deleted file mode 100644 index ef9efac08359..000000000000 --- a/.github/workflows/e2e.yaml +++ /dev/null @@ -1,38 +0,0 @@ -name: E2E -on: [push, pull_request] -jobs: - test: - runs-on: ubuntu-latest - strategy: - fail-fast: true - matrix: - target: - - linux-amd64-e2e - - linux-386-e2e - steps: - - uses: actions/checkout@v2 - - id: goversion - run: echo "goversion=$(cat .go-version)" >> "$GITHUB_OUTPUT" - - uses: actions/setup-go@v2 - with: - go-version: ${{ steps.goversion.outputs.goversion }} - - run: date - - env: - TARGET: ${{ matrix.target }} - run: | - set -euo pipefail - - echo "${TARGET}" - case "${TARGET}" in - linux-amd64-e2e) - make install-gofail - CPU='4' EXPECT_DEBUG='true' COVER='false' RACE='true' FAILPOINTS='true' make test-e2e-release - ;; - linux-386-e2e) - GOARCH=386 CPU='4' EXPECT_DEBUG='true' COVER='false' RACE='true' make test-e2e - ;; - *) - echo "Failed to find target" - exit 1 - ;; - esac diff --git a/.github/workflows/functional.yaml b/.github/workflows/functional.yaml deleted file mode 100644 index 176f90aa78bb..000000000000 --- a/.github/workflows/functional.yaml +++ /dev/null @@ -1,33 +0,0 @@ -name: functional-tests -on: [push, pull_request] -jobs: - test: - runs-on: ubuntu-latest - strategy: - fail-fast: true - matrix: - target: - - linux-amd64-functional - steps: - - uses: actions/checkout@v2 - - id: goversion - run: echo "goversion=$(cat .go-version)" >> "$GITHUB_OUTPUT" - - uses: actions/setup-go@v2 - with: - go-version: ${{ steps.goversion.outputs.goversion }} - - run: date - - env: - TARGET: ${{ matrix.target }} - run: | - set -euo pipefail - - echo "${TARGET}" - case "${TARGET}" in - linux-amd64-functional) - GO_BUILD_FLAGS='-v -mod=readonly' ./build && GOARCH=amd64 PASSES='functional' ./test - ;; - *) - echo "Failed to find target" - exit 1 - ;; - esac diff --git a/.github/workflows/govuln.yaml b/.github/workflows/govuln.yaml deleted file mode 100644 index 9ec94d1bab7e..000000000000 --- a/.github/workflows/govuln.yaml +++ /dev/null @@ -1,21 +0,0 @@ ---- -name: Go Vulnerability Checker -on: [push, pull_request] -permissions: read-all -jobs: - test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 - - id: goversion - run: echo "goversion=$(cat .go-version)" >> "$GITHUB_OUTPUT" - - uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 - with: - go-version: ${{ steps.goversion.outputs.goversion }} - - run: date - - run: | - set -euo pipefail - - go install golang.org/x/vuln/cmd/govulncheck@latest - - find . -name go.mod | xargs -I'{}' /bin/bash -c 'echo scanning $(dirname {}); govulncheck -C $(dirname {}) -show verbose ./...' diff --git a/.github/workflows/grpcproxy.yaml b/.github/workflows/grpcproxy.yaml deleted file mode 100644 index c4837eb41fc5..000000000000 --- a/.github/workflows/grpcproxy.yaml +++ /dev/null @@ -1,33 +0,0 @@ -name: grpcProxy-tests -on: [push, pull_request] -jobs: - test: - runs-on: ubuntu-latest - strategy: - fail-fast: true - matrix: - target: - - linux-amd64-grpcproxy - steps: - - uses: actions/checkout@v2 - - id: goversion - run: echo "goversion=$(cat .go-version)" >> "$GITHUB_OUTPUT" - - uses: actions/setup-go@v2 - with: - go-version: ${{ steps.goversion.outputs.goversion }} - - run: date - - env: - TARGET: ${{ matrix.target }} - run: | - set -euo pipefail - - echo "${TARGET}" - case "${TARGET}" in - linux-amd64-grpcproxy) - PASSES='build grpcproxy' CPU='4' COVER='false' RACE='true' ./test.sh - ;; - *) - echo "Failed to find target" - exit 1 - ;; - esac diff --git a/.github/workflows/static-analysis.yaml b/.github/workflows/static-analysis.yaml deleted file mode 100644 index 03e4deb0ffd8..000000000000 --- a/.github/workflows/static-analysis.yaml +++ /dev/null @@ -1,32 +0,0 @@ ---- -name: Static Analysis -on: [push, pull_request] -permissions: read-all -jobs: - run: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 - - id: goversion - run: echo "goversion=$(cat .go-version)" >> "$GITHUB_OUTPUT" - - uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1 - with: - go-version: ${{ steps.goversion.outputs.goversion }} - - run: | - set -euo pipefail - - make verify - - run: | - set -euo pipefail - - make fix - - DIFF=$(git status --porcelain) - - if [ -n "$DIFF" ]; then - echo "These files were modified:" - echo - echo "$DIFF" - echo - exit 1 - fi diff --git a/.github/workflows/tests-template.yaml b/.github/workflows/tests-template.yaml deleted file mode 100644 index 2b5af12c4b8f..000000000000 --- a/.github/workflows/tests-template.yaml +++ /dev/null @@ -1,76 +0,0 @@ ---- -name: Reusable Tests Workflow -on: - workflow_call: - inputs: - arch: - required: true - type: string - runs-on: - required: true - type: string - targets: - required: false - type: string - -jobs: - test: - runs-on: ${{ inputs.runs-on }} - # this is to prevent arm64 jobs from running at forked projects - if: inputs.arch == 'amd64' || github.repository == 'etcd-io/etcd' - strategy: - fail-fast: false - matrix: - target: ${{ fromJSON(inputs.targets) }} - steps: - - uses: actions/checkout@v2 - - id: goversion - run: echo "goversion=$(cat .go-version)" >> "$GITHUB_OUTPUT" - - uses: actions/setup-go@v2 - with: - go-version: ${{ steps.goversion.outputs.goversion }} - - run: date - - env: - TARGET: ${{ matrix.target }} - run: | - set -euo pipefail - - echo "${TARGET}" - case "${TARGET}" in - linux-test-smoke) - GOARCH=${{ inputs.arch }} CPU=4 RACE='false' make test-smoke - ;; - linux-integration-1-cpu) - make install-gofail - GOARCH=${{ inputs.arch }} CPU=1 RACE='false' FAILPOINTS='true' make test-integration - ;; - linux-integration-2-cpu) - make install-gofail - GOARCH=${{ inputs.arch }} CPU=2 RACE='false' FAILPOINTS='true' make test-integration - ;; - linux-integration-4-cpu) - make install-gofail - GOARCH=${{ inputs.arch }} CPU=4 RACE='false' FAILPOINTS='true' make test-integration - ;; - linux-unit-4-cpu-race) - GOARCH=${{ inputs.arch }} RACE='true' CPU='4' GO_TEST_FLAGS='-p=2' make test-unit - ;; - linux-386-unit-1-cpu) - GOOS=linux GOARCH=386 CPU=1 GO_TEST_FLAGS='-p=4' make test-unit - ;; - all-build) - GOARCH=amd64 PASSES='build' ./test.sh - GOARCH=386 PASSES='build' ./test.sh - GO_BUILD_FLAGS='-v -mod=readonly' GOOS=darwin GOARCH=amd64 ./build.sh - GO_BUILD_FLAGS='-v -mod=readonly' GOOS=darwin GOARCH=arm64 ./build.sh - GO_BUILD_FLAGS='-v -mod=readonly' GOOS=windows GOARCH=amd64 ./build.sh - GO_BUILD_FLAGS='-v -mod=readonly' GOARCH=arm ./build.sh - GO_BUILD_FLAGS='-v -mod=readonly' GOARCH=arm64 ./build.sh - GO_BUILD_FLAGS='-v -mod=readonly' GOARCH=ppc64le ./build.sh - GO_BUILD_FLAGS='-v -mod=readonly' GOARCH=s390x ./build.sh - ;; - *) - echo "Failed to find target" - exit 1 - ;; - esac diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml deleted file mode 100644 index 6f9f63985921..000000000000 --- a/.github/workflows/tests.yaml +++ /dev/null @@ -1,15 +0,0 @@ -name: Tests -on: [push, pull_request] -jobs: - amd64: - uses: ./.github/workflows/tests-template.yaml - with: - arch: amd64 - runs-on: ubuntu-latest - targets: "['linux-test-smoke', - 'linux-integration-1-cpu', - 'linux-integration-2-cpu', - 'linux-integration-4-cpu', - 'linux-unit-4-cpu-race', - 'linux-386-unit-1-cpu', - 'all-build']" diff --git a/.gitignore b/.gitignore index 75dbff8e8a33..e1ce57b6f13a 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,8 @@ hack/tls-setup/certs *.tmp *.bak .gobincache/ + +/tools/etcd-dump-db/etcd-dump-db +/tools/etcd-dump-logs/etcd-dump-logs +/tools/etcd-dump-metrics/etcd-dump-metrics +/tools/benchmark/benchmark diff --git a/.go-version b/.go-version index 3dfc2ecf954d..7bdcec52d093 100644 --- a/.go-version +++ b/.go-version @@ -1 +1 @@ -1.22.11 +1.23.12 diff --git a/Makefile b/Makefile index 80f342524723..d17210e121e0 100644 --- a/Makefile +++ b/Makefile @@ -156,7 +156,7 @@ test: test-smoke: $(info log-file: test-$(TEST_SUFFIX).log) - PASSES="fmt bom dep build unit" ./test.sh 2<&1 | tee test-$(TEST_SUFFIX).log + PASSES="dep build unit" ./test.sh 2<&1 | tee test-$(TEST_SUFFIX).log ! grep "FAIL:" test-$(TEST_SUFFIX).log test-full: @@ -175,10 +175,22 @@ test-integration: test-e2e: PASSES="build e2e" ./test.sh $(GO_TEST_FLAGS) +.PHONY: test-grpcproxy-integration +test-grpcproxy-integration: + PASSES='build grpcproxy_integration' RACE='true' ./test.sh $(GO_TEST_FLAGS) + +.PHONY: test-grpcproxy-e2e +test-grpcproxy-e2e: + PASSES='build grpcproxy_e2e' RACE='true' ./test.sh $(GO_TEST_FLAGS) + .PHONY: test-e2e-release test-e2e-release: PASSES="build release e2e" ./test.sh $(GO_TEST_FLAGS) +.PHONY: test-release +test-release: + PASSES="release_tests" ./test.sh $(GO_TEST_FLAGS) + ensure-docker-test-image-exists: make pull-docker-test || ( echo "WARNING: Container Image not found in registry, building locally"; make build-docker-test ) @@ -582,8 +594,61 @@ gofail-enable: install-gofail gofail-disable: install-gofail PASSES="toggle_failpoints" ./test.sh +.PHONY: run-govulncheck +run-govulncheck: +ifeq (, $(shell which govulncheck)) + $(shell go install golang.org/x/vuln/cmd/govulncheck@latest) +endif + PASSES="govuln" ./test.sh + +# Static analysis + .PHONY: verify -verify: verify-go-versions verify-dep +verify: verify-gofmt verify-bom verify-dep verify-shellcheck verify-goword verify-govet verify-revive verify-license-header verify-receiver-name verify-mod-tidy verify-shellws verify-go-versions verify-markdown-marker + +.PHONY: verify-gofmt +verify-gofmt: + PASSES="gofmt" ./test.sh + +.PHONY: verify-bom +verify-bom: + PASSES="bom" ./test.sh + +.PHONY: verify-shellcheck +verify-shellcheck: + PASSES="shellcheck" ./test.sh + +.PHONY: verify-goword +verify-goword: + PASSES="goword" ./test.sh + +.PHONY: verify-govet +verify-govet: + PASSES="govet" ./test.sh + +.PHONY: verify-revive +verify-revive: + PASSES="revive" ./test.sh + +.PHONY: verify-license-header +verify-license-header: + PASSES="license_header" ./test.sh + +.PHONY: verify-receiver-name +verify-receiver-name: + PASSES="receiver_name" ./test.sh + +.PHONY: verify-mod-tidy +verify-mod-tidy: + PASSES="mod_tidy" ./test.sh + +.PHONY: verify-shellws +verify-shellws: + PASSES="shellws" ./test.sh + +.PHONY: verify-markdown-marker +verify-markdown-marker: + PASSES="markdown_marker" ./test.sh .PHONY: verify-go-versions verify-go-versions: diff --git a/api/go.mod b/api/go.mod index ece3ae71b032..6202c45d20c0 100644 --- a/api/go.mod +++ b/api/go.mod @@ -1,16 +1,16 @@ module go.etcd.io/etcd/api/v3 -go 1.22 +go 1.23 -toolchain go1.22.11 +toolchain go1.23.12 require ( github.com/coreos/go-semver v0.3.0 github.com/gogo/protobuf v1.3.2 github.com/golang/protobuf v1.5.4 github.com/grpc-ecosystem/grpc-gateway v1.16.0 - google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d - google.golang.org/grpc v1.59.0 + google.golang.org/genproto/googleapis/api v0.0.0-20250115164207-1a7da9e5054f + google.golang.org/grpc v1.71.1 ) require ( @@ -18,8 +18,8 @@ require ( golang.org/x/sys v0.29.0 // indirect golang.org/x/text v0.21.0 // indirect google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect - google.golang.org/protobuf v1.33.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20250115164207-1a7da9e5054f // indirect + google.golang.org/protobuf v1.36.11 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect ) diff --git a/api/go.sum b/api/go.sum index 05e53dd961cf..8519b76842c2 100644 --- a/api/go.sum +++ b/api/go.sum @@ -12,6 +12,10 @@ github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.m github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= +github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= @@ -23,9 +27,11 @@ github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= @@ -34,6 +40,18 @@ github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1: github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= +go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= +go.opentelemetry.io/otel v1.34.0 h1:zRLXxLCgL1WyKsPVrgbSdMN4c0FMkDAskSTQP+0hdUY= +go.opentelemetry.io/otel v1.34.0/go.mod h1:OWFPOQ+h4G8xpyjgqo4SxJYdDQ/qmRH+wivy7zzx9oI= +go.opentelemetry.io/otel/metric v1.34.0 h1:+eTR3U0MyfWjRDhmFMxe2SsW64QrZ84AOhvqS7Y+PoQ= +go.opentelemetry.io/otel/metric v1.34.0/go.mod h1:CEDrp0fy2D0MvkXE+dPV7cMi8tWZwX3dmaIhwPOaqHE= +go.opentelemetry.io/otel/sdk v1.34.0 h1:95zS4k/2GOy069d321O8jWgYsW3MzVV+KuSPKp7Wr1A= +go.opentelemetry.io/otel/sdk v1.34.0/go.mod h1:0e/pNiaMAqaykJGKbi+tSjWfNNHMTxoC9qANsCzbyxU= +go.opentelemetry.io/otel/sdk/metric v1.34.0 h1:5CeK9ujjbFVL5c1PhLuStg1wxA7vQv7ce1EK0Gyvahk= +go.opentelemetry.io/otel/sdk/metric v1.34.0/go.mod h1:jQ/r8Ze28zRKoNRdkjCZxfs6YvBTG1+YIqyFVFYec5w= +go.opentelemetry.io/otel/trace v1.34.0 h1:+ouXS2V8Rd4hp4580a8q23bg0azF2nI8cqLYnC8mh/k= +go.opentelemetry.io/otel/trace v1.34.0/go.mod h1:Svm7lSjQD7kG7KJ/MUHPVXSDGz2OX4h0M2jHBhmSfRE= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -93,19 +111,19 @@ google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98 google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d h1:VBu5YqKPv6XiJ199exd8Br+Aetz+o08F+PLMnwJQHAY= google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d/go.mod h1:yZTlhN0tQnXo3h00fuXNCxJdLdIdnVFVBaRJ5LWBbw4= -google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d h1:DoPTO70H+bcDXcd39vOqb2viZxgqeBeSGtZ55yZU4/Q= -google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d/go.mod h1:KjSP20unUpOx5kyQUFa7k4OJg0qeJ7DEZflGDu2p6Bk= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d h1:uvYuEyMHKNt+lT4K3bN6fGswmK8qSvcreM3BwjDh+y4= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= +google.golang.org/genproto/googleapis/api v0.0.0-20250115164207-1a7da9e5054f h1:gap6+3Gk41EItBuyi4XX/bp4oqJ3UwuIMl25yGinuAA= +google.golang.org/genproto/googleapis/api v0.0.0-20250115164207-1a7da9e5054f/go.mod h1:Ic02D47M+zbarjYYUlK57y316f2MoN0gjAwI3f2S95o= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250115164207-1a7da9e5054f h1:OxYkA3wjPsZyBylwymxSHa7ViiW1Sml4ToBrncvFehI= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250115164207-1a7da9e5054f/go.mod h1:+2Yz8+CLJbIfL9z73EW45avw8Lmge3xVElCP9zEKi50= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= -google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= -google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= -google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= -google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/grpc v1.71.1 h1:ffsFWr7ygTUscGPI0KKK6TLrGz0476KUvvsbqWK0rPI= +google.golang.org/grpc v1.71.1/go.mod h1:H0GRtasmQOh9LkFoCPDu3ZrwUtD1YGE+b2vYBYd/8Ec= +google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= +google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= diff --git a/api/version/version.go b/api/version/version.go index 15c99a2c282c..d47275b2a25e 100644 --- a/api/version/version.go +++ b/api/version/version.go @@ -26,7 +26,7 @@ import ( var ( // MinClusterVersion is the min cluster version this etcd binary is compatible with. MinClusterVersion = "3.0.0" - Version = "3.5.18" + Version = "3.5.31" APIVersion = "unknown" // Git SHA Value will be set during build diff --git a/bill-of-materials.json b/bill-of-materials.json index 10dd58041734..04b1969d09bf 100644 --- a/bill-of-materials.json +++ b/bill-of-materials.json @@ -161,6 +161,15 @@ } ] }, + { + "project": "github.com/google/uuid", + "licenses": [ + { + "type": "BSD 3-clause \"New\" or \"Revised\" License", + "confidence": 0.9663865546218487 + } + ] + }, { "project": "github.com/gorilla/websocket", "licenses": [ @@ -530,6 +539,15 @@ } ] }, + { + "project": "go.opentelemetry.io/auto/sdk", + "licenses": [ + { + "type": "Apache License 2.0", + "confidence": 1 + } + ] + }, { "project": "go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc", "licenses": [ @@ -544,7 +562,7 @@ "licenses": [ { "type": "Apache License 2.0", - "confidence": 1 + "confidence": 0.9647812166488794 } ] }, @@ -571,7 +589,7 @@ "licenses": [ { "type": "Apache License 2.0", - "confidence": 1 + "confidence": 0.9647812166488794 } ] }, @@ -580,7 +598,7 @@ "licenses": [ { "type": "Apache License 2.0", - "confidence": 1 + "confidence": 0.9647812166488794 } ] }, @@ -589,7 +607,7 @@ "licenses": [ { "type": "Apache License 2.0", - "confidence": 1 + "confidence": 0.9647812166488794 } ] }, diff --git a/build.sh b/build.sh index 7d12a8c7e340..494eec81619a 100755 --- a/build.sh +++ b/build.sh @@ -29,7 +29,7 @@ GOFAIL_VERSION=$(cd tools/mod && go list -m -f '{{.Version}}' go.etcd.io/gofail) toggle_failpoints() { mode="$1" if command -v gofail >/dev/null 2>&1; then - run gofail "$mode" server/etcdserver/ server/lease/leasehttp server/mvcc/ server/wal/ server/mvcc/backend/ + run gofail "$mode" server/etcdserver/ server/lease server/lease/leasehttp server/mvcc/ server/wal/ server/mvcc/backend/ if [[ "$mode" == "enable" ]]; then go get go.etcd.io/gofail@"${GOFAIL_VERSION}" cd ./server && go get go.etcd.io/gofail@"${GOFAIL_VERSION}" diff --git a/client/pkg/fileutil/fileutil_test.go b/client/pkg/fileutil/fileutil_test.go index 1804163823ff..fc1deb62f18b 100644 --- a/client/pkg/fileutil/fileutil_test.go +++ b/client/pkg/fileutil/fileutil_test.go @@ -20,7 +20,6 @@ import ( "io/ioutil" "math/rand" "os" - "os/user" "path/filepath" "runtime" "strings" @@ -42,13 +41,7 @@ func TestIsDirWriteable(t *testing.T) { if err = os.Chmod(tmpdir, 0444); err != nil { t.Fatalf("unexpected os.Chmod error: %v", err) } - me, err := user.Current() - if err != nil { - // err can be non-nil when cross compiled - // http://stackoverflow.com/questions/20609415/cross-compiling-user-current-not-implemented-on-linux-amd64 - t.Skipf("failed to get current user: %v", err) - } - if me.Name == "root" || runtime.GOOS == "windows" { + if os.Getuid() == 0 || runtime.GOOS == "windows" { // ideally we should check CAP_DAC_OVERRIDE. // but it does not matter for tests. // Chmod is not supported under windows. diff --git a/client/pkg/go.mod b/client/pkg/go.mod index dabb14428fa9..e2b6a412b999 100644 --- a/client/pkg/go.mod +++ b/client/pkg/go.mod @@ -6,7 +6,7 @@ toolchain go1.22.11 require ( github.com/coreos/go-systemd/v22 v22.3.2 - github.com/stretchr/testify v1.9.0 + github.com/stretchr/testify v1.11.1 go.uber.org/zap v1.17.0 golang.org/x/sys v0.29.0 ) diff --git a/client/pkg/go.sum b/client/pkg/go.sum index 3cd3c13ed47c..33a0c0fa3ede 100644 --- a/client/pkg/go.sum +++ b/client/pkg/go.sum @@ -11,8 +11,8 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4= diff --git a/client/v2/go.mod b/client/v2/go.mod index 58084b21ecbf..768050002ab5 100644 --- a/client/v2/go.mod +++ b/client/v2/go.mod @@ -1,14 +1,14 @@ module go.etcd.io/etcd/client/v2 -go 1.22 +go 1.23 -toolchain go1.22.11 +toolchain go1.23.12 require ( github.com/json-iterator/go v1.1.11 github.com/modern-go/reflect2 v1.0.1 - go.etcd.io/etcd/api/v3 v3.5.18 - go.etcd.io/etcd/client/pkg/v3 v3.5.18 + go.etcd.io/etcd/api/v3 v3.5.31 + go.etcd.io/etcd/client/pkg/v3 v3.5.31 ) require ( diff --git a/client/v2/go.sum b/client/v2/go.sum index e6e8e38851c9..67eb12594c77 100644 --- a/client/v2/go.sum +++ b/client/v2/go.sum @@ -16,8 +16,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/client/v3/go.mod b/client/v3/go.mod index e1254b7bbc92..9c1549323b94 100644 --- a/client/v3/go.mod +++ b/client/v3/go.mod @@ -1,23 +1,23 @@ module go.etcd.io/etcd/client/v3 -go 1.22 +go 1.23 -toolchain go1.22.11 +toolchain go1.23.12 require ( github.com/dustin/go-humanize v1.0.0 github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 github.com/prometheus/client_golang v1.11.1 - go.etcd.io/etcd/api/v3 v3.5.18 - go.etcd.io/etcd/client/pkg/v3 v3.5.18 + go.etcd.io/etcd/api/v3 v3.5.31 + go.etcd.io/etcd/client/pkg/v3 v3.5.31 go.uber.org/zap v1.17.0 - google.golang.org/grpc v1.59.0 + google.golang.org/grpc v1.71.1 sigs.k8s.io/yaml v1.2.0 ) require ( github.com/beorn7/perks v1.0.1 // indirect - github.com/cespare/xxhash/v2 v2.2.0 // indirect + github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/coreos/go-semver v0.3.0 // indirect github.com/coreos/go-systemd/v22 v22.3.2 // indirect github.com/gogo/protobuf v1.3.2 // indirect @@ -31,10 +31,9 @@ require ( golang.org/x/net v0.34.0 // indirect golang.org/x/sys v0.29.0 // indirect golang.org/x/text v0.21.0 // indirect - google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect - google.golang.org/protobuf v1.33.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20250115164207-1a7da9e5054f // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20250115164207-1a7da9e5054f // indirect + google.golang.org/protobuf v1.36.11 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect ) diff --git a/client/v3/go.sum b/client/v3/go.sum index b5a4e41f8638..1f6fbbef178a 100644 --- a/client/v3/go.sum +++ b/client/v3/go.sum @@ -9,8 +9,8 @@ github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+Ce github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= -github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd/v22 v22.3.2 h1:D9/bQk5vlXQFZ6Kwuu6zaiXJ9oTPe68++AzAJc1DzSI= @@ -26,6 +26,10 @@ github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vb github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= +github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= +github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= @@ -48,9 +52,11 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92BcuyuQ/YW4NSIpoGtfXNho= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= @@ -110,10 +116,22 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= +go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= +go.opentelemetry.io/otel v1.34.0 h1:zRLXxLCgL1WyKsPVrgbSdMN4c0FMkDAskSTQP+0hdUY= +go.opentelemetry.io/otel v1.34.0/go.mod h1:OWFPOQ+h4G8xpyjgqo4SxJYdDQ/qmRH+wivy7zzx9oI= +go.opentelemetry.io/otel/metric v1.34.0 h1:+eTR3U0MyfWjRDhmFMxe2SsW64QrZ84AOhvqS7Y+PoQ= +go.opentelemetry.io/otel/metric v1.34.0/go.mod h1:CEDrp0fy2D0MvkXE+dPV7cMi8tWZwX3dmaIhwPOaqHE= +go.opentelemetry.io/otel/sdk v1.34.0 h1:95zS4k/2GOy069d321O8jWgYsW3MzVV+KuSPKp7Wr1A= +go.opentelemetry.io/otel/sdk v1.34.0/go.mod h1:0e/pNiaMAqaykJGKbi+tSjWfNNHMTxoC9qANsCzbyxU= +go.opentelemetry.io/otel/sdk/metric v1.34.0 h1:5CeK9ujjbFVL5c1PhLuStg1wxA7vQv7ce1EK0Gyvahk= +go.opentelemetry.io/otel/sdk/metric v1.34.0/go.mod h1:jQ/r8Ze28zRKoNRdkjCZxfs6YvBTG1+YIqyFVFYec5w= +go.opentelemetry.io/otel/trace v1.34.0 h1:+ouXS2V8Rd4hp4580a8q23bg0azF2nI8cqLYnC8mh/k= +go.opentelemetry.io/otel/trace v1.34.0/go.mod h1:Svm7lSjQD7kG7KJ/MUHPVXSDGz2OX4h0M2jHBhmSfRE= go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4= @@ -172,14 +190,12 @@ golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d h1:VBu5YqKPv6XiJ199exd8Br+Aetz+o08F+PLMnwJQHAY= -google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d/go.mod h1:yZTlhN0tQnXo3h00fuXNCxJdLdIdnVFVBaRJ5LWBbw4= -google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d h1:DoPTO70H+bcDXcd39vOqb2viZxgqeBeSGtZ55yZU4/Q= -google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d/go.mod h1:KjSP20unUpOx5kyQUFa7k4OJg0qeJ7DEZflGDu2p6Bk= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d h1:uvYuEyMHKNt+lT4K3bN6fGswmK8qSvcreM3BwjDh+y4= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= -google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= -google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= +google.golang.org/genproto/googleapis/api v0.0.0-20250115164207-1a7da9e5054f h1:gap6+3Gk41EItBuyi4XX/bp4oqJ3UwuIMl25yGinuAA= +google.golang.org/genproto/googleapis/api v0.0.0-20250115164207-1a7da9e5054f/go.mod h1:Ic02D47M+zbarjYYUlK57y316f2MoN0gjAwI3f2S95o= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250115164207-1a7da9e5054f h1:OxYkA3wjPsZyBylwymxSHa7ViiW1Sml4ToBrncvFehI= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250115164207-1a7da9e5054f/go.mod h1:+2Yz8+CLJbIfL9z73EW45avw8Lmge3xVElCP9zEKi50= +google.golang.org/grpc v1.71.1 h1:ffsFWr7ygTUscGPI0KKK6TLrGz0476KUvvsbqWK0rPI= +google.golang.org/grpc v1.71.1/go.mod h1:H0GRtasmQOh9LkFoCPDu3ZrwUtD1YGE+b2vYBYd/8Ec= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -187,8 +203,8 @@ google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miE google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= -google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= +google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= diff --git a/client/v3/naming/endpoints/endpoints.go b/client/v3/naming/endpoints/endpoints.go index 72bd22787499..099387094193 100644 --- a/client/v3/naming/endpoints/endpoints.go +++ b/client/v3/naming/endpoints/endpoints.go @@ -15,10 +15,9 @@ type Endpoint struct { // Since etcd 3.1 Addr string - // Metadata is the information associated with Addr, which may be used - // to make load balancing decision. + // Metadata is the information associated with Addr. // Since etcd 3.1 - Metadata interface{} + Metadata any } type Operation uint8 diff --git a/client/v3/retry_interceptor.go b/client/v3/retry_interceptor.go index 8c50dcfa93d7..44e014c5176a 100644 --- a/client/v3/retry_interceptor.go +++ b/client/v3/retry_interceptor.go @@ -29,6 +29,7 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/metadata" + "google.golang.org/grpc/peer" "google.golang.org/grpc/status" ) @@ -41,6 +42,8 @@ func (c *Client) unaryClientInterceptor(optFuncs ...retryOption) grpc.UnaryClien return func(ctx context.Context, method string, req, reply interface{}, cc *grpc.ClientConn, invoker grpc.UnaryInvoker, opts ...grpc.CallOption) error { ctx = withVersion(ctx) grpcOpts, retryOpts := filterCallOptions(opts) + var p peer.Peer + grpcOpts = append(grpcOpts, grpc.Peer(&p)) callOpts := reuseOrNewWithCallOptions(intOpts, retryOpts) // short circuit for simplicity, and avoiding allocations. if callOpts.max == 0 { @@ -63,6 +66,7 @@ func (c *Client) unaryClientInterceptor(optFuncs ...retryOption) grpc.UnaryClien c.GetLogger().Warn( "retrying of unary invoker failed", zap.String("target", cc.Target()), + zap.String("peer", p.String()), zap.Uint("attempt", attempt), zap.Error(lastErr), ) @@ -353,11 +357,11 @@ func isContextError(err error) bool { func contextErrToGrpcErr(err error) error { switch err { case context.DeadlineExceeded: - return status.Errorf(codes.DeadlineExceeded, err.Error()) + return status.Error(codes.DeadlineExceeded, err.Error()) case context.Canceled: - return status.Errorf(codes.Canceled, err.Error()) + return status.Error(codes.Canceled, err.Error()) default: - return status.Errorf(codes.Unknown, err.Error()) + return status.Error(codes.Unknown, err.Error()) } } diff --git a/etcd.conf.yml.sample b/etcd.conf.yml.sample index 423a3fe42a2a..8178ef6e51b9 100644 --- a/etcd.conf.yml.sample +++ b/etcd.conf.yml.sample @@ -18,8 +18,9 @@ heartbeat-interval: 100 # Time (in milliseconds) for an election to timeout. election-timeout: 1000 -# Raise alarms when backend size exceeds the given quota. 0 means use the -# default quota. +# Sets the maximum size (in bytes) that the etcd backend database may consume. +# Exceeding this triggers an alarm and puts etcd in read-only mode. +# Set to 0 to use the default 2GiB limit. quota-backend-bytes: 0 # List of comma separated URLs to listen on for peer traffic. diff --git a/etcdctl/ctlv3/command/ep_command.go b/etcdctl/ctlv3/command/ep_command.go index 5de3a990d939..423a0c71943b 100644 --- a/etcdctl/ctlv3/command/ep_command.go +++ b/etcdctl/ctlv3/command/ep_command.go @@ -246,6 +246,7 @@ func endpointsFromCluster(cmd *cobra.Command) []string { } sec := secureCfgFromCmd(cmd) + au := authCfgFromCmd(cmd) dt := dialTimeoutFromCmd(cmd) ka := keepAliveTimeFromCmd(cmd) kat := keepAliveTimeoutFromCmd(cmd) @@ -255,7 +256,7 @@ func endpointsFromCluster(cmd *cobra.Command) []string { } // exclude auth for not asking needless password (MemberList() doesn't need authentication) - cfg, err := newClientCfg(eps, dt, ka, kat, sec, nil) + cfg, err := newClientCfg(eps, dt, ka, kat, sec, au) if err != nil { cobrautl.ExitWithError(cobrautl.ExitError, err) } diff --git a/etcdctl/ctlv3/command/snapshot_command.go b/etcdctl/ctlv3/command/snapshot_command.go index eb0227d81810..670169fe587a 100644 --- a/etcdctl/ctlv3/command/snapshot_command.go +++ b/etcdctl/ctlv3/command/snapshot_command.go @@ -72,7 +72,7 @@ func newSnapshotStatusCommand() *cobra.Command { Long: `When --write-out is set to simple, this command prints out comma-separated status lists for each endpoint. The items in the lists are hash, revision, total keys, total size. -Moved to 'etcdctl snapshot status ...' +Moved to 'etcdutl snapshot status ...' `, Run: snapshotStatusCommandFunc, } @@ -83,7 +83,7 @@ func NewSnapshotRestoreCommand() *cobra.Command { Use: "restore [options]", Short: "Restores an etcd member snapshot to an etcd directory", Run: snapshotRestoreCommandFunc, - Long: "Moved to `etcdctl snapshot restore ...`\n", + Long: "Moved to `etcdutl snapshot restore ...`\n", } cmd.Flags().StringVar(&restoreDataDir, "data-dir", "", "Path to the data directory") cmd.Flags().StringVar(&restoreWalDir, "wal-dir", "", "Path to the WAL directory (use --data-dir if none given)") diff --git a/etcdctl/ctlv3/command/util.go b/etcdctl/ctlv3/command/util.go index cd15fd339521..524b12ea1423 100644 --- a/etcdctl/ctlv3/command/util.go +++ b/etcdctl/ctlv3/command/util.go @@ -65,7 +65,7 @@ func argify(s string) []string { } if args[i][0] == '\'' { // 'single-quoted string' - args[i] = args[i][1 : len(args)-1] + args[i] = args[i][1 : len(args[i])-1] } else if args[i][0] == '"' { // "double quoted string" if _, err := fmt.Sscanf(args[i], "%q", &args[i]); err != nil { diff --git a/etcdctl/ctlv3/command/util_test.go b/etcdctl/ctlv3/command/util_test.go new file mode 100644 index 000000000000..6bc92989b4fa --- /dev/null +++ b/etcdctl/ctlv3/command/util_test.go @@ -0,0 +1,78 @@ +// Copyright 2026 The etcd Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package command + +import ( + "reflect" + "testing" +) + +func TestArgify(t *testing.T) { + tests := []struct { + name string + input string + expected []string + }{ + { + name: "empty string", + input: "", + expected: nil, + }, + { + name: "simple args", + input: "foo bar baz", + expected: []string{"foo", "bar", "baz"}, + }, + { + name: "single-quoted string", + input: "'hello world'", + expected: []string{"hello world"}, + }, + { + name: "double-quoted string", + input: `"hello world"`, + expected: []string{"hello world"}, + }, + { + name: "mixed args", + input: "put 'my key' 'my value'", + expected: []string{"put", "my key", "my value"}, + }, + { + name: "empty single-quoted string", + input: "''", + expected: []string{""}, + }, + { + name: "empty double-quoted string", + input: `""`, + expected: []string{""}, + }, + { + name: "double-quoted with escape", + input: `"hello\"world"`, + expected: []string{`hello"world`}, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + result := argify(tt.input) + if !reflect.DeepEqual(result, tt.expected) { + t.Errorf("argify(%q) = %v, want %v", tt.input, result, tt.expected) + } + }) + } +} diff --git a/etcdctl/go.mod b/etcdctl/go.mod index ef19c42eaa33..7ade29583c24 100644 --- a/etcdctl/go.mod +++ b/etcdctl/go.mod @@ -1,8 +1,8 @@ module go.etcd.io/etcd/etcdctl/v3 -go 1.22 +go 1.23 -toolchain go1.22.11 +toolchain go1.23.12 require ( github.com/bgentry/speakeasy v0.1.0 @@ -11,25 +11,26 @@ require ( github.com/spf13/cobra v1.1.3 github.com/spf13/pflag v1.0.5 github.com/urfave/cli v1.22.4 - go.etcd.io/etcd/api/v3 v3.5.18 - go.etcd.io/etcd/client/pkg/v3 v3.5.18 - go.etcd.io/etcd/client/v2 v2.305.18 - go.etcd.io/etcd/client/v3 v3.5.18 - go.etcd.io/etcd/etcdutl/v3 v3.5.18 - go.etcd.io/etcd/pkg/v3 v3.5.18 + go.etcd.io/etcd/api/v3 v3.5.31 + go.etcd.io/etcd/client/pkg/v3 v3.5.31 + go.etcd.io/etcd/client/v2 v2.305.31 + go.etcd.io/etcd/client/v3 v3.5.31 + go.etcd.io/etcd/etcdutl/v3 v3.5.31 + go.etcd.io/etcd/pkg/v3 v3.5.31 go.uber.org/zap v1.17.0 golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba - google.golang.org/grpc v1.59.0 + google.golang.org/grpc v1.71.1 gopkg.in/cheggaaa/pb.v1 v1.0.28 ) require ( + cloud.google.com/go/compute/metadata v0.6.0 // indirect github.com/beorn7/perks v1.0.1 // indirect - github.com/cespare/xxhash/v2 v2.2.0 // indirect + github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/coreos/go-semver v0.3.0 // indirect github.com/coreos/go-systemd/v22 v22.3.2 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect - github.com/go-logr/logr v1.3.0 // indirect + github.com/go-logr/logr v1.4.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang-jwt/jwt/v4 v4.5.1 // indirect @@ -50,22 +51,22 @@ require ( github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 // indirect go.etcd.io/bbolt v1.3.11 // indirect - go.etcd.io/etcd/raft/v3 v3.5.18 // indirect - go.etcd.io/etcd/server/v3 v3.5.18 // indirect + go.etcd.io/etcd/raft/v3 v3.5.31 // indirect + go.etcd.io/etcd/server/v3 v3.5.31 // indirect + go.opentelemetry.io/auto/sdk v1.1.0 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.0 // indirect - go.opentelemetry.io/otel v1.20.0 // indirect - go.opentelemetry.io/otel/metric v1.20.0 // indirect - go.opentelemetry.io/otel/trace v1.20.0 // indirect + go.opentelemetry.io/otel v1.34.0 // indirect + go.opentelemetry.io/otel/metric v1.34.0 // indirect + go.opentelemetry.io/otel/trace v1.34.0 // indirect go.uber.org/atomic v1.7.0 // indirect go.uber.org/multierr v1.6.0 // indirect golang.org/x/crypto v0.32.0 // indirect golang.org/x/net v0.34.0 // indirect golang.org/x/sys v0.29.0 // indirect golang.org/x/text v0.21.0 // indirect - google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect - google.golang.org/protobuf v1.33.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20250115164207-1a7da9e5054f // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20250115164207-1a7da9e5054f // indirect + google.golang.org/protobuf v1.36.11 // indirect ) replace ( diff --git a/etcdctl/go.sum b/etcdctl/go.sum index 2afdd56ec400..d5ee127dbb20 100644 --- a/etcdctl/go.sum +++ b/etcdctl/go.sum @@ -5,12 +5,9 @@ cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6A cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= -cloud.google.com/go v0.110.7 h1:rJyC7nWRg2jWGZ4wSJ5nY65GTdYJkg0cd/uXb+ACI6o= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= -cloud.google.com/go/compute v1.23.0 h1:tP41Zoavr8ptEqaW6j+LQOnyBBhO7OkOMAGrgLopTwY= -cloud.google.com/go/compute v1.23.0/go.mod h1:4tCnrn48xsqlwSAiLf1HXMQk8CONslYbdiEZc9FEIbM= -cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= -cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= +cloud.google.com/go/compute/metadata v0.6.0 h1:A6hENjEsCDtC1k8byVsgwvVcioamEHvZ4j01OwKxG9I= +cloud.google.com/go/compute/metadata v0.6.0/go.mod h1:FjyFAW1MW0C203CEOMDTu3Dk1FlqW3Rga40jzHL4hfg= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= @@ -36,11 +33,11 @@ github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kB github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= -github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4 h1:/inchEIKaYC1Akx+H+gqO04wryn5h75LSazbRlnya1k= -github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20241223141626-cff3c89139a3 h1:boJj011Hh+874zpIySeApCX4GeOjPl9qhRF3QuIZq+Q= +github.com/cncf/xds/go v0.0.0-20241223141626-cff3c89139a3/go.mod h1:W+zGtBO5Y1IgJhy4+A9GOqVhqLpfZi+vwmdNXUehLA8= github.com/cockroachdb/datadriven v1.0.2 h1:H9MtNqVoVhvd9nCBwOyDjUEdZCREqbIdCJD93PBm/jA= github.com/cockroachdb/datadriven v1.0.2/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= @@ -61,8 +58,8 @@ github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZm github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/envoyproxy/protoc-gen-validate v1.0.2 h1:QkIBuU5k+x7/QXPvPPnWXWlCdaBFApVqftFV6k087DA= -github.com/envoyproxy/protoc-gen-validate v1.0.2/go.mod h1:GpiZQP3dDbg4JouG/NNS7QWXpgx6x8QiMKdmN72jogE= +github.com/envoyproxy/protoc-gen-validate v1.2.1 h1:DEo3O99U8j4hBFwbJfrz9VtgcDfUKS7KJ7spH3d86P8= +github.com/envoyproxy/protoc-gen-validate v1.2.1/go.mod h1:d/C80l/jxXLdfEIhX1W2TmLfsJ31lvEjwamM4DxlWXU= github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= @@ -75,8 +72,8 @@ github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9 github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= -github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= +github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= @@ -114,13 +111,15 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= -github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= @@ -263,8 +262,8 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/urfave/cli v1.22.4 h1:u7tSpNPPswAFymm8IehJhy4uJMlUuU/GmqSkvJ1InXA= @@ -278,14 +277,20 @@ go.etcd.io/bbolt v1.3.11 h1:yGEzV1wPz2yVCLsD8ZAiGHhHVlczyC9d1rP43/VCRJ0= go.etcd.io/bbolt v1.3.11/go.mod h1:dksAq7YMXoljX0xu6VF5DMZGbhYYoLUalEiSySYAS4I= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= +go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.0 h1:PzIubN4/sjByhDRHLviCjJuweBXWFZWhghjg7cS28+M= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.0/go.mod h1:Ct6zzQEuGK3WpJs2n4dn+wfJYzd/+hNnxMRTWjGn30M= -go.opentelemetry.io/otel v1.20.0 h1:vsb/ggIY+hUjD/zCAQHpzTmndPqv/ml2ArbsbfBYTAc= -go.opentelemetry.io/otel v1.20.0/go.mod h1:oUIGj3D77RwJdM6PPZImDpSZGDvkD9fhesHny69JFrs= -go.opentelemetry.io/otel/metric v1.20.0 h1:ZlrO8Hu9+GAhnepmRGhSU7/VkpjrNowxRN9GyKR4wzA= -go.opentelemetry.io/otel/metric v1.20.0/go.mod h1:90DRw3nfK4D7Sm/75yQ00gTJxtkBxX+wu6YaNymbpVM= -go.opentelemetry.io/otel/trace v1.20.0 h1:+yxVAPZPbQhbC3OfAkeIVTky6iTFpcr4SiY9om7mXSQ= -go.opentelemetry.io/otel/trace v1.20.0/go.mod h1:HJSK7F/hA5RlzpZ0zKDCHCDHm556LCDtKaAo6JmBFUU= +go.opentelemetry.io/otel v1.34.0 h1:zRLXxLCgL1WyKsPVrgbSdMN4c0FMkDAskSTQP+0hdUY= +go.opentelemetry.io/otel v1.34.0/go.mod h1:OWFPOQ+h4G8xpyjgqo4SxJYdDQ/qmRH+wivy7zzx9oI= +go.opentelemetry.io/otel/metric v1.34.0 h1:+eTR3U0MyfWjRDhmFMxe2SsW64QrZ84AOhvqS7Y+PoQ= +go.opentelemetry.io/otel/metric v1.34.0/go.mod h1:CEDrp0fy2D0MvkXE+dPV7cMi8tWZwX3dmaIhwPOaqHE= +go.opentelemetry.io/otel/sdk v1.34.0 h1:95zS4k/2GOy069d321O8jWgYsW3MzVV+KuSPKp7Wr1A= +go.opentelemetry.io/otel/sdk v1.34.0/go.mod h1:0e/pNiaMAqaykJGKbi+tSjWfNNHMTxoC9qANsCzbyxU= +go.opentelemetry.io/otel/sdk/metric v1.34.0 h1:5CeK9ujjbFVL5c1PhLuStg1wxA7vQv7ce1EK0Gyvahk= +go.opentelemetry.io/otel/sdk/metric v1.34.0/go.mod h1:jQ/r8Ze28zRKoNRdkjCZxfs6YvBTG1+YIqyFVFYec5w= +go.opentelemetry.io/otel/trace v1.34.0 h1:+ouXS2V8Rd4hp4580a8q23bg0azF2nI8cqLYnC8mh/k= +go.opentelemetry.io/otel/trace v1.34.0/go.mod h1:Svm7lSjQD7kG7KJ/MUHPVXSDGz2OX4h0M2jHBhmSfRE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= @@ -347,8 +352,8 @@ golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.11.0 h1:vPL4xzxBM4niKCW6g9whtaWVXTJf1U5e4aZxxFx/gbU= -golang.org/x/oauth2 v0.11.0/go.mod h1:LdF7O/8bLR/qWK9DrpXmbHLTouvRHK0SgJl0GmDBchk= +golang.org/x/oauth2 v0.25.0 h1:CY4y7XT9v0cRI9oupztF8AgiIu99L/ksR/Xp/6jrZ70= +golang.org/x/oauth2 v0.25.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -425,8 +430,6 @@ google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9Ywl google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= -google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= -google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= @@ -436,17 +439,15 @@ google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98 google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d h1:VBu5YqKPv6XiJ199exd8Br+Aetz+o08F+PLMnwJQHAY= -google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d/go.mod h1:yZTlhN0tQnXo3h00fuXNCxJdLdIdnVFVBaRJ5LWBbw4= -google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d h1:DoPTO70H+bcDXcd39vOqb2viZxgqeBeSGtZ55yZU4/Q= -google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d/go.mod h1:KjSP20unUpOx5kyQUFa7k4OJg0qeJ7DEZflGDu2p6Bk= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d h1:uvYuEyMHKNt+lT4K3bN6fGswmK8qSvcreM3BwjDh+y4= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= +google.golang.org/genproto/googleapis/api v0.0.0-20250115164207-1a7da9e5054f h1:gap6+3Gk41EItBuyi4XX/bp4oqJ3UwuIMl25yGinuAA= +google.golang.org/genproto/googleapis/api v0.0.0-20250115164207-1a7da9e5054f/go.mod h1:Ic02D47M+zbarjYYUlK57y316f2MoN0gjAwI3f2S95o= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250115164207-1a7da9e5054f h1:OxYkA3wjPsZyBylwymxSHa7ViiW1Sml4ToBrncvFehI= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250115164207-1a7da9e5054f/go.mod h1:+2Yz8+CLJbIfL9z73EW45avw8Lmge3xVElCP9zEKi50= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= -google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= +google.golang.org/grpc v1.71.1 h1:ffsFWr7ygTUscGPI0KKK6TLrGz0476KUvvsbqWK0rPI= +google.golang.org/grpc v1.71.1/go.mod h1:H0GRtasmQOh9LkFoCPDu3ZrwUtD1YGE+b2vYBYd/8Ec= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -454,8 +455,8 @@ google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miE google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= -google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= +google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/etcdutl/etcdutl/backup_command.go b/etcdutl/etcdutl/backup_command.go index 0fa1879ed4f9..ffd3a81854fa 100644 --- a/etcdutl/etcdutl/backup_command.go +++ b/etcdutl/etcdutl/backup_command.go @@ -24,6 +24,7 @@ import ( "go.etcd.io/etcd/api/v3/etcdserverpb" "go.etcd.io/etcd/client/pkg/v3/fileutil" "go.etcd.io/etcd/client/pkg/v3/types" + "go.etcd.io/etcd/pkg/v3/cobrautl" "go.etcd.io/etcd/pkg/v3/idutil" "go.etcd.io/etcd/pkg/v3/pbutil" "go.etcd.io/etcd/raft/v3/raftpb" @@ -68,7 +69,9 @@ func NewBackupCommand() *cobra.Command { } func doBackup(cmd *cobra.Command, args []string) { - HandleBackup(withV3, dataDir, backupDir, walDir, backupWalDir) + if err := HandleBackup(withV3, dataDir, backupDir, walDir, backupWalDir); err != nil { + cobrautl.ExitWithError(cobrautl.ExitError, err) + } } type desiredCluster struct { @@ -103,6 +106,10 @@ func newDesiredCluster() desiredCluster { func HandleBackup(withV3 bool, srcDir string, destDir string, srcWAL string, destWAL string) error { lg := GetLogger() + if err := validateDataDir(srcDir); err != nil { + return err + } + srcSnap := datadir.ToSnapDir(srcDir) destSnap := datadir.ToSnapDir(destDir) diff --git a/etcdutl/etcdutl/check_command.go b/etcdutl/etcdutl/check_command.go index 2ea6fb29ae24..308431341ad5 100644 --- a/etcdutl/etcdutl/check_command.go +++ b/etcdutl/etcdutl/check_command.go @@ -41,6 +41,7 @@ func NewCheckCommand() *cobra.Command { var ( argCheckV2StoreDataDir string + argCheckV2StoreWALDir string ) // NewCheckV2StoreCommand returns the cobra command for "check v2store". @@ -51,25 +52,27 @@ func NewCheckV2StoreCommand() *cobra.Command { Run: checkV2StoreRunFunc, } cmd.Flags().StringVar(&argCheckV2StoreDataDir, "data-dir", "", "Required. A data directory not in use by etcd.") + cmd.Flags().StringVar(&argCheckV2StoreWALDir, "wal-dir", "", "Optional. A dedicated WAL directory.") cmd.MarkFlagRequired("data-dir") return cmd } func checkV2StoreRunFunc(_ *cobra.Command, _ []string) { - err := checkV2StoreDataDir(argCheckV2StoreDataDir) + snapDir := datadir.ToSnapDir(argCheckV2StoreDataDir) + walDir := datadir.ToWalDir(argCheckV2StoreDataDir) + if argCheckV2StoreWALDir != "" { + walDir = argCheckV2StoreWALDir + } + + err := checkV2StoreDataDir(snapDir, walDir) if err != nil { cobrautl.ExitWithError(cobrautl.ExitError, err) } fmt.Println("No custom content found in v2store.") } -func checkV2StoreDataDir(dataDir string) error { - var ( - lg = GetLogger() - - walDir = datadir.ToWalDir(dataDir) - snapDir = datadir.ToSnapDir(dataDir) - ) +func checkV2StoreDataDir(snapDir string, walDir string) error { + var lg = GetLogger() walSnaps, err := wal.ValidSnapshotEntries(lg, walDir) if err != nil { diff --git a/etcdutl/etcdutl/common.go b/etcdutl/etcdutl/common.go index 281058bc24e9..1394ef396dc1 100644 --- a/etcdutl/etcdutl/common.go +++ b/etcdutl/etcdutl/common.go @@ -15,12 +15,28 @@ package etcdutl import ( + "os" + "go.etcd.io/etcd/client/pkg/v3/logutil" "go.etcd.io/etcd/pkg/v3/cobrautl" + "go.etcd.io/etcd/server/v3/datadir" "go.uber.org/zap" "go.uber.org/zap/zapcore" ) +// validateDataDir checks if the data directory's backend database file exists. +func validateDataDir(dataDir string) error { + dbPath := datadir.ToBackendFileName(dataDir) + return validateFilePath(dbPath) +} + +// validateFilePath checks if the specified file exists. +// It returns an error encountered by os.Stat, such as os.ErrNotExist, os.ErrPermission, etc. +func validateFilePath(filePath string) error { + _, err := os.Stat(filePath) + return err +} + func GetLogger() *zap.Logger { config := logutil.DefaultZapLoggerConfig config.Encoding = "console" diff --git a/etcdutl/etcdutl/defrag_command.go b/etcdutl/etcdutl/defrag_command.go index 1660dd7071a2..d47b41362b7f 100644 --- a/etcdutl/etcdutl/defrag_command.go +++ b/etcdutl/etcdutl/defrag_command.go @@ -50,8 +50,13 @@ func defragCommandFunc(cmd *cobra.Command, args []string) { } func DefragData(dataDir string) error { - var be backend.Backend - lg := GetLogger() + var ( + be backend.Backend + lg = GetLogger() + ) + if err := validateDataDir(dataDir); err != nil { + return err + } bch := make(chan struct{}) dbDir := datadir.ToBackendFileName(dataDir) go func() { diff --git a/etcdutl/etcdutl/snapshot_command.go b/etcdutl/etcdutl/snapshot_command.go index a7d9397bccc1..27249a59696e 100644 --- a/etcdutl/etcdutl/snapshot_command.go +++ b/etcdutl/etcdutl/snapshot_command.go @@ -109,6 +109,9 @@ func SnapshotStatusCommandFunc(cmd *cobra.Command, args []string) { err := fmt.Errorf("snapshot status requires exactly one argument") cobrautl.ExitWithError(cobrautl.ExitBadArgs, err) } + if err := validateFilePath(args[0]); err != nil { + cobrautl.ExitWithError(cobrautl.ExitError, err) + } printer := initPrinterFromCmd(cmd) lg := GetLogger() diff --git a/etcdutl/go.mod b/etcdutl/go.mod index 43fccd4403c3..483ea1b40169 100644 --- a/etcdutl/go.mod +++ b/etcdutl/go.mod @@ -1,8 +1,8 @@ module go.etcd.io/etcd/etcdutl/v3 -go 1.22 +go 1.23 -toolchain go1.22.11 +toolchain go1.23.12 replace ( go.etcd.io/etcd/api/v3 => ../api @@ -27,21 +27,22 @@ require ( github.com/olekukonko/tablewriter v0.0.5 github.com/spf13/cobra v1.1.3 go.etcd.io/bbolt v1.3.11 - go.etcd.io/etcd/api/v3 v3.5.18 - go.etcd.io/etcd/client/pkg/v3 v3.5.18 - go.etcd.io/etcd/client/v3 v3.5.18 - go.etcd.io/etcd/pkg/v3 v3.5.18 - go.etcd.io/etcd/raft/v3 v3.5.18 - go.etcd.io/etcd/server/v3 v3.5.18 + go.etcd.io/etcd/api/v3 v3.5.31 + go.etcd.io/etcd/client/pkg/v3 v3.5.31 + go.etcd.io/etcd/client/v3 v3.5.31 + go.etcd.io/etcd/pkg/v3 v3.5.31 + go.etcd.io/etcd/raft/v3 v3.5.31 + go.etcd.io/etcd/server/v3 v3.5.31 go.uber.org/zap v1.17.0 ) require ( + cloud.google.com/go/compute/metadata v0.6.0 // indirect github.com/beorn7/perks v1.0.1 // indirect - github.com/cespare/xxhash/v2 v2.2.0 // indirect + github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/coreos/go-semver v0.3.0 // indirect github.com/coreos/go-systemd/v22 v22.3.2 // indirect - github.com/go-logr/logr v1.3.0 // indirect + github.com/go-logr/logr v1.4.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang-jwt/jwt/v4 v4.5.1 // indirect @@ -60,11 +61,12 @@ require ( github.com/prometheus/procfs v0.6.0 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 // indirect - go.etcd.io/etcd/client/v2 v2.305.18 // indirect + go.etcd.io/etcd/client/v2 v2.305.31 // indirect + go.opentelemetry.io/auto/sdk v1.1.0 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.0 // indirect - go.opentelemetry.io/otel v1.20.0 // indirect - go.opentelemetry.io/otel/metric v1.20.0 // indirect - go.opentelemetry.io/otel/trace v1.20.0 // indirect + go.opentelemetry.io/otel v1.34.0 // indirect + go.opentelemetry.io/otel/metric v1.34.0 // indirect + go.opentelemetry.io/otel/trace v1.34.0 // indirect go.uber.org/atomic v1.7.0 // indirect go.uber.org/multierr v1.6.0 // indirect golang.org/x/crypto v0.32.0 // indirect @@ -72,9 +74,8 @@ require ( golang.org/x/sys v0.29.0 // indirect golang.org/x/text v0.21.0 // indirect golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba // indirect - google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect - google.golang.org/grpc v1.59.0 // indirect - google.golang.org/protobuf v1.33.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20250115164207-1a7da9e5054f // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20250115164207-1a7da9e5054f // indirect + google.golang.org/grpc v1.71.1 // indirect + google.golang.org/protobuf v1.36.11 // indirect ) diff --git a/etcdutl/go.sum b/etcdutl/go.sum index f024e624eae1..041af65d1e8e 100644 --- a/etcdutl/go.sum +++ b/etcdutl/go.sum @@ -5,12 +5,9 @@ cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6A cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= -cloud.google.com/go v0.110.7 h1:rJyC7nWRg2jWGZ4wSJ5nY65GTdYJkg0cd/uXb+ACI6o= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= -cloud.google.com/go/compute v1.23.0 h1:tP41Zoavr8ptEqaW6j+LQOnyBBhO7OkOMAGrgLopTwY= -cloud.google.com/go/compute v1.23.0/go.mod h1:4tCnrn48xsqlwSAiLf1HXMQk8CONslYbdiEZc9FEIbM= -cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= -cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= +cloud.google.com/go/compute/metadata v0.6.0 h1:A6hENjEsCDtC1k8byVsgwvVcioamEHvZ4j01OwKxG9I= +cloud.google.com/go/compute/metadata v0.6.0/go.mod h1:FjyFAW1MW0C203CEOMDTu3Dk1FlqW3Rga40jzHL4hfg= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= @@ -35,11 +32,11 @@ github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kB github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= -github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4 h1:/inchEIKaYC1Akx+H+gqO04wryn5h75LSazbRlnya1k= -github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20241223141626-cff3c89139a3 h1:boJj011Hh+874zpIySeApCX4GeOjPl9qhRF3QuIZq+Q= +github.com/cncf/xds/go v0.0.0-20241223141626-cff3c89139a3/go.mod h1:W+zGtBO5Y1IgJhy4+A9GOqVhqLpfZi+vwmdNXUehLA8= github.com/cockroachdb/datadriven v1.0.2 h1:H9MtNqVoVhvd9nCBwOyDjUEdZCREqbIdCJD93PBm/jA= github.com/cockroachdb/datadriven v1.0.2/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= @@ -58,8 +55,8 @@ github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZm github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/envoyproxy/protoc-gen-validate v1.0.2 h1:QkIBuU5k+x7/QXPvPPnWXWlCdaBFApVqftFV6k087DA= -github.com/envoyproxy/protoc-gen-validate v1.0.2/go.mod h1:GpiZQP3dDbg4JouG/NNS7QWXpgx6x8QiMKdmN72jogE= +github.com/envoyproxy/protoc-gen-validate v1.2.1 h1:DEo3O99U8j4hBFwbJfrz9VtgcDfUKS7KJ7spH3d86P8= +github.com/envoyproxy/protoc-gen-validate v1.2.1/go.mod h1:d/C80l/jxXLdfEIhX1W2TmLfsJ31lvEjwamM4DxlWXU= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= @@ -71,8 +68,8 @@ github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9 github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= -github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= +github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= @@ -110,13 +107,15 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= -github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= @@ -255,8 +254,8 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 h1:eY9dn8+vbi4tKz5Qo6v2eYzo7kUS51QINcR5jNpbZS8= @@ -268,14 +267,20 @@ go.etcd.io/bbolt v1.3.11 h1:yGEzV1wPz2yVCLsD8ZAiGHhHVlczyC9d1rP43/VCRJ0= go.etcd.io/bbolt v1.3.11/go.mod h1:dksAq7YMXoljX0xu6VF5DMZGbhYYoLUalEiSySYAS4I= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= +go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.0 h1:PzIubN4/sjByhDRHLviCjJuweBXWFZWhghjg7cS28+M= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.0/go.mod h1:Ct6zzQEuGK3WpJs2n4dn+wfJYzd/+hNnxMRTWjGn30M= -go.opentelemetry.io/otel v1.20.0 h1:vsb/ggIY+hUjD/zCAQHpzTmndPqv/ml2ArbsbfBYTAc= -go.opentelemetry.io/otel v1.20.0/go.mod h1:oUIGj3D77RwJdM6PPZImDpSZGDvkD9fhesHny69JFrs= -go.opentelemetry.io/otel/metric v1.20.0 h1:ZlrO8Hu9+GAhnepmRGhSU7/VkpjrNowxRN9GyKR4wzA= -go.opentelemetry.io/otel/metric v1.20.0/go.mod h1:90DRw3nfK4D7Sm/75yQ00gTJxtkBxX+wu6YaNymbpVM= -go.opentelemetry.io/otel/trace v1.20.0 h1:+yxVAPZPbQhbC3OfAkeIVTky6iTFpcr4SiY9om7mXSQ= -go.opentelemetry.io/otel/trace v1.20.0/go.mod h1:HJSK7F/hA5RlzpZ0zKDCHCDHm556LCDtKaAo6JmBFUU= +go.opentelemetry.io/otel v1.34.0 h1:zRLXxLCgL1WyKsPVrgbSdMN4c0FMkDAskSTQP+0hdUY= +go.opentelemetry.io/otel v1.34.0/go.mod h1:OWFPOQ+h4G8xpyjgqo4SxJYdDQ/qmRH+wivy7zzx9oI= +go.opentelemetry.io/otel/metric v1.34.0 h1:+eTR3U0MyfWjRDhmFMxe2SsW64QrZ84AOhvqS7Y+PoQ= +go.opentelemetry.io/otel/metric v1.34.0/go.mod h1:CEDrp0fy2D0MvkXE+dPV7cMi8tWZwX3dmaIhwPOaqHE= +go.opentelemetry.io/otel/sdk v1.34.0 h1:95zS4k/2GOy069d321O8jWgYsW3MzVV+KuSPKp7Wr1A= +go.opentelemetry.io/otel/sdk v1.34.0/go.mod h1:0e/pNiaMAqaykJGKbi+tSjWfNNHMTxoC9qANsCzbyxU= +go.opentelemetry.io/otel/sdk/metric v1.34.0 h1:5CeK9ujjbFVL5c1PhLuStg1wxA7vQv7ce1EK0Gyvahk= +go.opentelemetry.io/otel/sdk/metric v1.34.0/go.mod h1:jQ/r8Ze28zRKoNRdkjCZxfs6YvBTG1+YIqyFVFYec5w= +go.opentelemetry.io/otel/trace v1.34.0 h1:+ouXS2V8Rd4hp4580a8q23bg0azF2nI8cqLYnC8mh/k= +go.opentelemetry.io/otel/trace v1.34.0/go.mod h1:Svm7lSjQD7kG7KJ/MUHPVXSDGz2OX4h0M2jHBhmSfRE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= @@ -337,8 +342,8 @@ golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.11.0 h1:vPL4xzxBM4niKCW6g9whtaWVXTJf1U5e4aZxxFx/gbU= -golang.org/x/oauth2 v0.11.0/go.mod h1:LdF7O/8bLR/qWK9DrpXmbHLTouvRHK0SgJl0GmDBchk= +golang.org/x/oauth2 v0.25.0 h1:CY4y7XT9v0cRI9oupztF8AgiIu99L/ksR/Xp/6jrZ70= +golang.org/x/oauth2 v0.25.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -415,8 +420,6 @@ google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9Ywl google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= -google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= -google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= @@ -426,17 +429,15 @@ google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98 google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d h1:VBu5YqKPv6XiJ199exd8Br+Aetz+o08F+PLMnwJQHAY= -google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d/go.mod h1:yZTlhN0tQnXo3h00fuXNCxJdLdIdnVFVBaRJ5LWBbw4= -google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d h1:DoPTO70H+bcDXcd39vOqb2viZxgqeBeSGtZ55yZU4/Q= -google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d/go.mod h1:KjSP20unUpOx5kyQUFa7k4OJg0qeJ7DEZflGDu2p6Bk= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d h1:uvYuEyMHKNt+lT4K3bN6fGswmK8qSvcreM3BwjDh+y4= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= +google.golang.org/genproto/googleapis/api v0.0.0-20250115164207-1a7da9e5054f h1:gap6+3Gk41EItBuyi4XX/bp4oqJ3UwuIMl25yGinuAA= +google.golang.org/genproto/googleapis/api v0.0.0-20250115164207-1a7da9e5054f/go.mod h1:Ic02D47M+zbarjYYUlK57y316f2MoN0gjAwI3f2S95o= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250115164207-1a7da9e5054f h1:OxYkA3wjPsZyBylwymxSHa7ViiW1Sml4ToBrncvFehI= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250115164207-1a7da9e5054f/go.mod h1:+2Yz8+CLJbIfL9z73EW45avw8Lmge3xVElCP9zEKi50= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= -google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= +google.golang.org/grpc v1.71.1 h1:ffsFWr7ygTUscGPI0KKK6TLrGz0476KUvvsbqWK0rPI= +google.golang.org/grpc v1.71.1/go.mod h1:H0GRtasmQOh9LkFoCPDu3ZrwUtD1YGE+b2vYBYd/8Ec= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -444,8 +445,8 @@ google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miE google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= -google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= +google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/go.mod b/go.mod index 0d882a968c3d..cb6e981d9b8e 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,8 @@ module go.etcd.io/etcd/v3 -go 1.22 +go 1.23 -toolchain go1.22.11 +toolchain go1.23.12 replace ( go.etcd.io/etcd/api/v3 => ./api @@ -23,35 +23,36 @@ require ( github.com/spf13/cobra v1.1.3 github.com/spf13/pflag v1.0.5 go.etcd.io/bbolt v1.3.11 - go.etcd.io/etcd/api/v3 v3.5.18 - go.etcd.io/etcd/client/pkg/v3 v3.5.18 - go.etcd.io/etcd/client/v2 v2.305.18 - go.etcd.io/etcd/client/v3 v3.5.18 - go.etcd.io/etcd/etcdctl/v3 v3.5.18 - go.etcd.io/etcd/etcdutl/v3 v3.5.18 - go.etcd.io/etcd/pkg/v3 v3.5.18 - go.etcd.io/etcd/raft/v3 v3.5.18 - go.etcd.io/etcd/server/v3 v3.5.18 - go.etcd.io/etcd/tests/v3 v3.5.18 + go.etcd.io/etcd/api/v3 v3.5.31 + go.etcd.io/etcd/client/pkg/v3 v3.5.31 + go.etcd.io/etcd/client/v2 v2.305.31 + go.etcd.io/etcd/client/v3 v3.5.31 + go.etcd.io/etcd/etcdctl/v3 v3.5.31 + go.etcd.io/etcd/etcdutl/v3 v3.5.31 + go.etcd.io/etcd/pkg/v3 v3.5.31 + go.etcd.io/etcd/raft/v3 v3.5.31 + go.etcd.io/etcd/server/v3 v3.5.31 + go.etcd.io/etcd/tests/v3 v3.5.31 go.uber.org/zap v1.17.0 golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba - google.golang.org/grpc v1.59.0 + google.golang.org/grpc v1.71.1 gopkg.in/cheggaaa/pb.v1 v1.0.28 ) require ( github.com/beorn7/perks v1.0.1 // indirect github.com/cenkalti/backoff/v4 v4.2.1 // indirect - github.com/cespare/xxhash/v2 v2.2.0 // indirect + github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/coreos/go-semver v0.3.0 // indirect github.com/coreos/go-systemd/v22 v22.3.2 // indirect - github.com/go-logr/logr v1.3.0 // indirect + github.com/go-logr/logr v1.4.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang-jwt/jwt/v4 v4.5.1 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.4 // indirect github.com/google/btree v1.0.1 // indirect + github.com/google/uuid v1.6.0 // indirect github.com/gorilla/websocket v1.4.2 // indirect github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect @@ -74,13 +75,14 @@ require ( github.com/soheilhy/cmux v0.1.5 // indirect github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802 // indirect github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 // indirect + go.opentelemetry.io/auto/sdk v1.1.0 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.0 // indirect - go.opentelemetry.io/otel v1.20.0 // indirect + go.opentelemetry.io/otel v1.34.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.20.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.20.0 // indirect - go.opentelemetry.io/otel/metric v1.20.0 // indirect - go.opentelemetry.io/otel/sdk v1.20.0 // indirect - go.opentelemetry.io/otel/trace v1.20.0 // indirect + go.opentelemetry.io/otel/metric v1.34.0 // indirect + go.opentelemetry.io/otel/sdk v1.34.0 // indirect + go.opentelemetry.io/otel/trace v1.34.0 // indirect go.opentelemetry.io/proto/otlp v1.0.0 // indirect go.uber.org/atomic v1.7.0 // indirect go.uber.org/multierr v1.6.0 // indirect @@ -89,15 +91,10 @@ require ( golang.org/x/sys v0.29.0 // indirect golang.org/x/text v0.21.0 // indirect google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect - google.golang.org/protobuf v1.33.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20250115164207-1a7da9e5054f // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20250115164207-1a7da9e5054f // indirect + google.golang.org/protobuf v1.36.11 // indirect gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect sigs.k8s.io/yaml v1.2.0 // indirect - go.etcd.io/gofail v0.2.0 // indirect - github.com/urfave/cli v1.22.4 // indirect - github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect - github.com/russross/blackfriday/v2 v2.0.1 //indirect - github.com/shurcooL/sanitized_anchor_name v1.0.0 //indirect ) diff --git a/go.sum b/go.sum index eb92b00d7f57..4104a4764e15 100644 --- a/go.sum +++ b/go.sum @@ -8,9 +8,8 @@ cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg cloud.google.com/go v0.110.7 h1:rJyC7nWRg2jWGZ4wSJ5nY65GTdYJkg0cd/uXb+ACI6o= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/compute v1.23.0 h1:tP41Zoavr8ptEqaW6j+LQOnyBBhO7OkOMAGrgLopTwY= -cloud.google.com/go/compute v1.23.0/go.mod h1:4tCnrn48xsqlwSAiLf1HXMQk8CONslYbdiEZc9FEIbM= -cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= -cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= +cloud.google.com/go/compute/metadata v0.6.0 h1:A6hENjEsCDtC1k8byVsgwvVcioamEHvZ4j01OwKxG9I= +cloud.google.com/go/compute/metadata v0.6.0/go.mod h1:FjyFAW1MW0C203CEOMDTu3Dk1FlqW3Rga40jzHL4hfg= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= @@ -41,12 +40,12 @@ github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyY github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= -github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4 h1:/inchEIKaYC1Akx+H+gqO04wryn5h75LSazbRlnya1k= -github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20241223141626-cff3c89139a3 h1:boJj011Hh+874zpIySeApCX4GeOjPl9qhRF3QuIZq+Q= +github.com/cncf/xds/go v0.0.0-20241223141626-cff3c89139a3/go.mod h1:W+zGtBO5Y1IgJhy4+A9GOqVhqLpfZi+vwmdNXUehLA8= github.com/cockroachdb/datadriven v1.0.2 h1:H9MtNqVoVhvd9nCBwOyDjUEdZCREqbIdCJD93PBm/jA= github.com/cockroachdb/datadriven v1.0.2/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= @@ -57,7 +56,6 @@ github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7 github.com/coreos/go-systemd/v22 v22.3.2 h1:D9/bQk5vlXQFZ6Kwuu6zaiXJ9oTPe68++AzAJc1DzSI= github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= -github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -70,8 +68,8 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/envoyproxy/protoc-gen-validate v1.0.2 h1:QkIBuU5k+x7/QXPvPPnWXWlCdaBFApVqftFV6k087DA= -github.com/envoyproxy/protoc-gen-validate v1.0.2/go.mod h1:GpiZQP3dDbg4JouG/NNS7QWXpgx6x8QiMKdmN72jogE= +github.com/envoyproxy/protoc-gen-validate v1.2.1 h1:DEo3O99U8j4hBFwbJfrz9VtgcDfUKS7KJ7spH3d86P8= +github.com/envoyproxy/protoc-gen-validate v1.2.1/go.mod h1:d/C80l/jxXLdfEIhX1W2TmLfsJ31lvEjwamM4DxlWXU= github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= @@ -84,8 +82,8 @@ github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9 github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= -github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= +github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= @@ -97,8 +95,8 @@ github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69 github.com/golang-jwt/jwt/v4 v4.5.1 h1:JdqV9zKUdtaa9gdPlywC3aeoEsR681PlKC+4F5gQgeo= github.com/golang-jwt/jwt/v4 v4.5.1/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.1.2 h1:DVjP2PbBOzHyzA+dn3WhHIq4NdVu3Q+pvivFICf/7fo= -github.com/golang/glog v1.1.2/go.mod h1:zR+okUeTbrL6EL3xHUDxZuEtGv04p5shwip1+mL/rLQ= +github.com/golang/glog v1.2.4 h1:CNNw5U8lSiiBk7druxtSHHTsRWcxKoac6kZKm2peBBc= +github.com/golang/glog v1.2.4/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -128,14 +126,16 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= -github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= @@ -266,8 +266,8 @@ github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40T github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= -github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= +github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= +github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= @@ -298,13 +298,12 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802 h1:uruHq4dN7GR16kFc5fp3d1RIYzJW5onx8Ybykw2YQFA= github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/urfave/cli v1.22.4/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 h1:eY9dn8+vbi4tKz5Qo6v2eYzo7kUS51QINcR5jNpbZS8= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -316,20 +315,24 @@ go.etcd.io/gofail v0.2.0 h1:p19drv16FKK345a09a1iubchlw/vmRuksmRzgBIGjcA= go.etcd.io/gofail v0.2.0/go.mod h1:nL3ILMGfkXTekKI3clMBNazKnjUZjYLKmBHzsVAnC1o= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= +go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.0 h1:PzIubN4/sjByhDRHLviCjJuweBXWFZWhghjg7cS28+M= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.0/go.mod h1:Ct6zzQEuGK3WpJs2n4dn+wfJYzd/+hNnxMRTWjGn30M= -go.opentelemetry.io/otel v1.20.0 h1:vsb/ggIY+hUjD/zCAQHpzTmndPqv/ml2ArbsbfBYTAc= -go.opentelemetry.io/otel v1.20.0/go.mod h1:oUIGj3D77RwJdM6PPZImDpSZGDvkD9fhesHny69JFrs= +go.opentelemetry.io/otel v1.34.0 h1:zRLXxLCgL1WyKsPVrgbSdMN4c0FMkDAskSTQP+0hdUY= +go.opentelemetry.io/otel v1.34.0/go.mod h1:OWFPOQ+h4G8xpyjgqo4SxJYdDQ/qmRH+wivy7zzx9oI= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.20.0 h1:DeFD0VgTZ+Cj6hxravYYZE2W4GlneVH81iAOPjZkzk8= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.20.0/go.mod h1:GijYcYmNpX1KazD5JmWGsi4P7dDTTTnfv1UbGn84MnU= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.20.0 h1:gvmNvqrPYovvyRmCSygkUDyL8lC5Tl845MLEwqpxhEU= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.20.0/go.mod h1:vNUq47TGFioo+ffTSnKNdob241vePmtNZnAODKapKd0= -go.opentelemetry.io/otel/metric v1.20.0 h1:ZlrO8Hu9+GAhnepmRGhSU7/VkpjrNowxRN9GyKR4wzA= -go.opentelemetry.io/otel/metric v1.20.0/go.mod h1:90DRw3nfK4D7Sm/75yQ00gTJxtkBxX+wu6YaNymbpVM= -go.opentelemetry.io/otel/sdk v1.20.0 h1:5Jf6imeFZlZtKv9Qbo6qt2ZkmWtdWx/wzcCbNUlAWGM= -go.opentelemetry.io/otel/sdk v1.20.0/go.mod h1:rmkSx1cZCm/tn16iWDn1GQbLtsW/LvsdEEFzCSRM6V0= -go.opentelemetry.io/otel/trace v1.20.0 h1:+yxVAPZPbQhbC3OfAkeIVTky6iTFpcr4SiY9om7mXSQ= -go.opentelemetry.io/otel/trace v1.20.0/go.mod h1:HJSK7F/hA5RlzpZ0zKDCHCDHm556LCDtKaAo6JmBFUU= +go.opentelemetry.io/otel/metric v1.34.0 h1:+eTR3U0MyfWjRDhmFMxe2SsW64QrZ84AOhvqS7Y+PoQ= +go.opentelemetry.io/otel/metric v1.34.0/go.mod h1:CEDrp0fy2D0MvkXE+dPV7cMi8tWZwX3dmaIhwPOaqHE= +go.opentelemetry.io/otel/sdk v1.34.0 h1:95zS4k/2GOy069d321O8jWgYsW3MzVV+KuSPKp7Wr1A= +go.opentelemetry.io/otel/sdk v1.34.0/go.mod h1:0e/pNiaMAqaykJGKbi+tSjWfNNHMTxoC9qANsCzbyxU= +go.opentelemetry.io/otel/sdk/metric v1.34.0 h1:5CeK9ujjbFVL5c1PhLuStg1wxA7vQv7ce1EK0Gyvahk= +go.opentelemetry.io/otel/sdk/metric v1.34.0/go.mod h1:jQ/r8Ze28zRKoNRdkjCZxfs6YvBTG1+YIqyFVFYec5w= +go.opentelemetry.io/otel/trace v1.34.0 h1:+ouXS2V8Rd4hp4580a8q23bg0azF2nI8cqLYnC8mh/k= +go.opentelemetry.io/otel/trace v1.34.0/go.mod h1:Svm7lSjQD7kG7KJ/MUHPVXSDGz2OX4h0M2jHBhmSfRE= go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= @@ -398,8 +401,8 @@ golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAG golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.11.0 h1:vPL4xzxBM4niKCW6g9whtaWVXTJf1U5e4aZxxFx/gbU= -golang.org/x/oauth2 v0.11.0/go.mod h1:LdF7O/8bLR/qWK9DrpXmbHLTouvRHK0SgJl0GmDBchk= +golang.org/x/oauth2 v0.25.0 h1:CY4y7XT9v0cRI9oupztF8AgiIu99L/ksR/Xp/6jrZ70= +golang.org/x/oauth2 v0.25.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -480,8 +483,6 @@ google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9Ywl google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= -google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= -google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= @@ -495,10 +496,10 @@ google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfG google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d h1:VBu5YqKPv6XiJ199exd8Br+Aetz+o08F+PLMnwJQHAY= google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d/go.mod h1:yZTlhN0tQnXo3h00fuXNCxJdLdIdnVFVBaRJ5LWBbw4= -google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d h1:DoPTO70H+bcDXcd39vOqb2viZxgqeBeSGtZ55yZU4/Q= -google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d/go.mod h1:KjSP20unUpOx5kyQUFa7k4OJg0qeJ7DEZflGDu2p6Bk= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d h1:uvYuEyMHKNt+lT4K3bN6fGswmK8qSvcreM3BwjDh+y4= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= +google.golang.org/genproto/googleapis/api v0.0.0-20250115164207-1a7da9e5054f h1:gap6+3Gk41EItBuyi4XX/bp4oqJ3UwuIMl25yGinuAA= +google.golang.org/genproto/googleapis/api v0.0.0-20250115164207-1a7da9e5054f/go.mod h1:Ic02D47M+zbarjYYUlK57y316f2MoN0gjAwI3f2S95o= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250115164207-1a7da9e5054f h1:OxYkA3wjPsZyBylwymxSHa7ViiW1Sml4ToBrncvFehI= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250115164207-1a7da9e5054f/go.mod h1:+2Yz8+CLJbIfL9z73EW45avw8Lmge3xVElCP9zEKi50= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -507,8 +508,8 @@ google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= -google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= -google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= +google.golang.org/grpc v1.71.1 h1:ffsFWr7ygTUscGPI0KKK6TLrGz0476KUvvsbqWK0rPI= +google.golang.org/grpc v1.71.1/go.mod h1:H0GRtasmQOh9LkFoCPDu3ZrwUtD1YGE+b2vYBYd/8Ec= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -516,8 +517,8 @@ google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miE google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= -google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= +google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/pkg/go.mod b/pkg/go.mod index f146e432aa81..87de7d60e3b1 100644 --- a/pkg/go.mod +++ b/pkg/go.mod @@ -1,23 +1,22 @@ module go.etcd.io/etcd/pkg/v3 -go 1.22 +go 1.23 -toolchain go1.22.11 +toolchain go1.23.12 require ( github.com/creack/pty v1.1.11 github.com/dustin/go-humanize v1.0.0 github.com/spf13/cobra v1.1.3 github.com/spf13/pflag v1.0.5 - github.com/stretchr/testify v1.9.0 - go.etcd.io/etcd/client/pkg/v3 v3.5.18 + github.com/stretchr/testify v1.11.1 + go.etcd.io/etcd/client/pkg/v3 v3.5.31 go.uber.org/zap v1.17.0 - google.golang.org/grpc v1.59.0 + google.golang.org/grpc v1.71.1 ) require ( github.com/davecgh/go-spew v1.1.1 // indirect - github.com/golang/protobuf v1.5.4 // indirect github.com/inconshreveable/mousetrap v1.0.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect go.uber.org/atomic v1.7.0 // indirect @@ -25,8 +24,8 @@ require ( golang.org/x/net v0.34.0 // indirect golang.org/x/sys v0.29.0 // indirect golang.org/x/text v0.21.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect - google.golang.org/protobuf v1.33.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20250115164207-1a7da9e5054f // indirect + google.golang.org/protobuf v1.36.11 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/pkg/go.sum b/pkg/go.sum index 8d27fafd5d91..0f09bc690d69 100644 --- a/pkg/go.sum +++ b/pkg/go.sum @@ -47,6 +47,10 @@ github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9 github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= +github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= @@ -64,12 +68,14 @@ github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Z github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= @@ -172,14 +178,26 @@ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= +go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= +go.opentelemetry.io/otel v1.34.0 h1:zRLXxLCgL1WyKsPVrgbSdMN4c0FMkDAskSTQP+0hdUY= +go.opentelemetry.io/otel v1.34.0/go.mod h1:OWFPOQ+h4G8xpyjgqo4SxJYdDQ/qmRH+wivy7zzx9oI= +go.opentelemetry.io/otel/metric v1.34.0 h1:+eTR3U0MyfWjRDhmFMxe2SsW64QrZ84AOhvqS7Y+PoQ= +go.opentelemetry.io/otel/metric v1.34.0/go.mod h1:CEDrp0fy2D0MvkXE+dPV7cMi8tWZwX3dmaIhwPOaqHE= +go.opentelemetry.io/otel/sdk v1.34.0 h1:95zS4k/2GOy069d321O8jWgYsW3MzVV+KuSPKp7Wr1A= +go.opentelemetry.io/otel/sdk v1.34.0/go.mod h1:0e/pNiaMAqaykJGKbi+tSjWfNNHMTxoC9qANsCzbyxU= +go.opentelemetry.io/otel/sdk/metric v1.34.0 h1:5CeK9ujjbFVL5c1PhLuStg1wxA7vQv7ce1EK0Gyvahk= +go.opentelemetry.io/otel/sdk/metric v1.34.0/go.mod h1:jQ/r8Ze28zRKoNRdkjCZxfs6YvBTG1+YIqyFVFYec5w= +go.opentelemetry.io/otel/trace v1.34.0 h1:+ouXS2V8Rd4hp4580a8q23bg0azF2nI8cqLYnC8mh/k= +go.opentelemetry.io/otel/trace v1.34.0/go.mod h1:Svm7lSjQD7kG7KJ/MUHPVXSDGz2OX4h0M2jHBhmSfRE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= @@ -294,15 +312,15 @@ google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98 google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d h1:uvYuEyMHKNt+lT4K3bN6fGswmK8qSvcreM3BwjDh+y4= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250115164207-1a7da9e5054f h1:OxYkA3wjPsZyBylwymxSHa7ViiW1Sml4ToBrncvFehI= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250115164207-1a7da9e5054f/go.mod h1:+2Yz8+CLJbIfL9z73EW45avw8Lmge3xVElCP9zEKi50= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= -google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= -google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= -google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/grpc v1.71.1 h1:ffsFWr7ygTUscGPI0KKK6TLrGz0476KUvvsbqWK0rPI= +google.golang.org/grpc v1.71.1/go.mod h1:H0GRtasmQOh9LkFoCPDu3ZrwUtD1YGE+b2vYBYd/8Ec= +google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= +google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= diff --git a/raft/go.mod b/raft/go.mod index 16296cb87baf..abe15402e167 100644 --- a/raft/go.mod +++ b/raft/go.mod @@ -1,20 +1,19 @@ module go.etcd.io/etcd/raft/v3 -go 1.22 +go 1.23 -toolchain go1.22.11 +toolchain go1.23.12 require ( github.com/cockroachdb/datadriven v1.0.2 github.com/gogo/protobuf v1.3.2 github.com/golang/protobuf v1.5.4 - go.etcd.io/etcd/client/pkg/v3 v3.5.18 + go.etcd.io/etcd/client/pkg/v3 v3.5.31 ) require ( - github.com/google/go-cmp v0.6.0 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - google.golang.org/protobuf v1.33.0 // indirect + google.golang.org/protobuf v1.36.11 // indirect ) // Bad imports are sometimes causing attempts to pull that code. diff --git a/raft/go.sum b/raft/go.sum index ec8b9fbfe3e9..685f781e197e 100644 --- a/raft/go.sum +++ b/raft/go.sum @@ -4,9 +4,8 @@ github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= -github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= @@ -38,5 +37,5 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= -google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= +google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= diff --git a/scripts/release.sh b/scripts/release.sh index 635fbfc1248a..379b1bfb164e 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -183,7 +183,7 @@ main() { fi # Tag release. - if [ "$(git tag --list | grep -c "${RELEASE_VERSION}")" -gt 0 ]; then + if git tag --list | grep --quiet "^${RELEASE_VERSION}$"; then log_callout "Skipping tag step. git tag ${RELEASE_VERSION} already exists." else log_callout "Tagging release..." diff --git a/scripts/release_notes.tpl.txt b/scripts/release_notes.tpl.txt index 67701d9886e6..3fe1284fdea6 100644 --- a/scripts/release_notes.tpl.txt +++ b/scripts/release_notes.tpl.txt @@ -16,7 +16,7 @@ rm -f /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz rm -rf /tmp/etcd-download-test && mkdir -p /tmp/etcd-download-test curl -L ${DOWNLOAD_URL}/${ETCD_VER}/etcd-${ETCD_VER}-linux-amd64.tar.gz -o /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz -tar xzvf /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz -C /tmp/etcd-download-test --strip-components=1 +tar xzvf /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz -C /tmp/etcd-download-test --strip-components=1 --no-same-owner rm -f /tmp/etcd-${ETCD_VER}-linux-amd64.tar.gz /tmp/etcd-download-test/etcd --version diff --git a/scripts/test_images.sh b/scripts/test_images.sh index 00b23ac18931..28269400ee77 100755 --- a/scripts/test_images.sh +++ b/scripts/test_images.sh @@ -8,14 +8,14 @@ source ./scripts/test_lib.sh function startContainer { # run docker in the background - docker run -d --rm --name "${RUN_NAME}" "${IMAGE}" + docker run -d --rm --name "${RUN_NAME}" "${TEST_IMAGE}" # wait for etcd daemon to bootstrap sleep 5 } function runVersionCheck { - Out=$(docker run --rm "${IMAGE}" "${@}") + Out=$(docker run --rm "${TEST_IMAGE}" "${@}") foundVersion=$(echo "$Out" | head -1 | rev | cut -d" " -f 1 | rev ) if [[ "${foundVersion}" != "${VERSION}" ]]; then echo "error: Invalid Version. Got $foundVersion, expected $VERSION. Error: $Out" @@ -45,15 +45,15 @@ else echo "Terminating test, VERSION not supplied" exit 1 fi -IMAGE=${IMAGE:-"${REPOSITARY}:${TAG}"} +TEST_IMAGE=${TEST_IMAGE:-"${REPOSITARY}:${TAG}"} # ETCD related values RUN_NAME="test_etcd" KEY="foo" VALUE="bar" -if [[ "$(docker images -q "${IMAGE}" 2> /dev/null)" == "" ]]; then - echo "${IMAGE} not present locally" +if [[ "$(docker images -q "${TEST_IMAGE}" 2> /dev/null)" == "" ]]; then + echo "${TEST_IMAGE} not present locally" exit 1 fi diff --git a/server/auth/jwt.go b/server/auth/jwt.go index a797794494bd..65df66b317e5 100644 --- a/server/auth/jwt.go +++ b/server/auth/jwt.go @@ -114,12 +114,12 @@ func (t *tokenJWT) assign(ctx context.Context, username string, revision uint64) return "", err } - t.lg.Debug( - "created/assigned a new JWT token", - zap.String("user-name", username), - zap.Uint64("revision", revision), - zap.String("token", token), - ) + if ce := t.lg.Check(zap.DebugLevel, "created/assigned a new JWT token"); ce != nil { + tokenFingerprint := redactToken(token) + ce.Write(zap.String("user-name", username), + zap.Uint64("revision", revision), + zap.String("token-fingerprint", tokenFingerprint)) + } return token, err } diff --git a/server/auth/simple_token.go b/server/auth/simple_token.go index a657d9daefc8..7f6fbcac5107 100644 --- a/server/auth/simple_token.go +++ b/server/auth/simple_token.go @@ -130,10 +130,11 @@ func (t *tokenSimple) assignSimpleTokenToUser(username, token string) { _, ok := t.simpleTokens[token] if ok { + tokenFingerprint := redactToken(token) t.lg.Panic( "failed to assign already-used simple token to a user", zap.String("user-name", username), - zap.String("token", token), + zap.String("token-fingerprint", tokenFingerprint), ) } diff --git a/server/auth/store.go b/server/auth/store.go index 67c5694cde31..1230df059da0 100644 --- a/server/auth/store.go +++ b/server/auth/store.go @@ -17,8 +17,10 @@ package auth import ( "bytes" "context" + "crypto/sha256" "encoding/base64" "encoding/binary" + "encoding/hex" "errors" "sort" "strings" @@ -314,11 +316,10 @@ func (as *authStore) Authenticate(ctx context.Context, username, password string return nil, err } - as.lg.Debug( - "authenticated a user", - zap.String("user-name", username), - zap.String("token", token), - ) + if ce := as.lg.Check(zap.DebugLevel, "authenticated a user"); ce != nil { + tokenFingerprint := redactToken(token) + ce.Write(zap.String("user-name", username), zap.String("token-fingerprint", tokenFingerprint)) + } return &pb.AuthenticateResponse{Token: token}, nil } @@ -1180,7 +1181,8 @@ func (as *authStore) AuthInfoFromCtx(ctx context.Context) (*AuthInfo, error) { token := ts[0] authInfo, uok := as.authInfoFromToken(ctx, token) if !uok { - as.lg.Warn("invalid auth token", zap.String("token", token)) + tokenFingerprint := redactToken(token) + as.lg.Warn("invalid auth token", zap.String("token-fingerprint", tokenFingerprint)) return nil, ErrInvalidAuthToken } @@ -1334,3 +1336,8 @@ func (as *authStore) setupMetricsReporter() { } reportCurrentAuthRevMu.Unlock() } + +func redactToken(token string) string { + sum := sha256.Sum256([]byte(token)) + return hex.EncodeToString(sum[:])[:12] +} diff --git a/server/embed/config_logging.go b/server/embed/config_logging.go index 1b363897b53c..4237dfa7ce61 100644 --- a/server/embed/config_logging.go +++ b/server/embed/config_logging.go @@ -19,6 +19,7 @@ import ( "encoding/json" "errors" "fmt" + "io" "io/ioutil" "net/url" "os" @@ -149,6 +150,12 @@ func (cfg *Config) setupLogging() error { logTLSHandshakeFailureFunc := func(msg string) func(conn *tls.Conn, err error) { return func(conn *tls.Conn, err error) { + // Log EOF errors on DEBUG not to spam logs too much. + logFunc := cfg.logger.Warn + if errors.Is(err, io.EOF) { + logFunc = cfg.logger.Debug + } + state := conn.ConnectionState() remoteAddr := conn.RemoteAddr().String() serverName := state.ServerName @@ -158,7 +165,7 @@ func (cfg *Config) setupLogging() error { for i := range cert.IPAddresses { ips[i] = cert.IPAddresses[i].String() } - cfg.logger.Warn( + logFunc( msg, zap.String("remote-addr", remoteAddr), zap.String("server-name", serverName), @@ -167,7 +174,7 @@ func (cfg *Config) setupLogging() error { zap.Error(err), ) } else { - cfg.logger.Warn( + logFunc( msg, zap.String("remote-addr", remoteAddr), zap.String("server-name", serverName), diff --git a/server/embed/config_test.go b/server/embed/config_test.go index 7307aa9c8fd0..07375fab9752 100644 --- a/server/embed/config_test.go +++ b/server/embed/config_test.go @@ -415,7 +415,7 @@ func TestLogRotation(t *testing.T) { logOutputs: []string{"/tmp/path"}, logRotationConfig: `{"maxsize": true}`, wantErr: true, - wantErrMsg: errors.New("invalid log rotation config: json: cannot unmarshal bool into Go struct field logRotationConfig.maxsize of type int"), + wantErrMsg: errors.New("invalid log rotation config: json: cannot unmarshal bool into Go struct field logRotationConfig.Logger.maxsize of type int"), }, { name: "improperly formatted logger config", diff --git a/server/etcdmain/config.go b/server/etcdmain/config.go index 349590ccfdc9..03ff688fcd21 100644 --- a/server/etcdmain/config.go +++ b/server/etcdmain/config.go @@ -178,7 +178,7 @@ func newConfig() *config { fs.UintVar(&cfg.ec.TickMs, "heartbeat-interval", cfg.ec.TickMs, "Time (in milliseconds) of a heartbeat interval.") fs.UintVar(&cfg.ec.ElectionMs, "election-timeout", cfg.ec.ElectionMs, "Time (in milliseconds) for an election to timeout.") fs.BoolVar(&cfg.ec.InitialElectionTickAdvance, "initial-election-tick-advance", cfg.ec.InitialElectionTickAdvance, "Whether to fast-forward initial election ticks on boot for faster election.") - fs.Int64Var(&cfg.ec.QuotaBackendBytes, "quota-backend-bytes", cfg.ec.QuotaBackendBytes, "Raise alarms when backend size exceeds the given quota. 0 means use the default quota.") + fs.Int64Var(&cfg.ec.QuotaBackendBytes, "quota-backend-bytes", cfg.ec.QuotaBackendBytes, "Sets the maximum size (in bytes) that the etcd backend database may consume. Exceeding this triggers an alarm and puts etcd in read-only mode. Set to 0 to use the default 2GiB limit.") fs.StringVar(&cfg.ec.BackendFreelistType, "backend-bbolt-freelist-type", cfg.ec.BackendFreelistType, "BackendFreelistType specifies the type of freelist that boltdb backend uses(array and map are supported types)") fs.DurationVar(&cfg.ec.BackendBatchInterval, "backend-batch-interval", cfg.ec.BackendBatchInterval, "BackendBatchInterval is the maximum time before commit the backend transaction.") fs.IntVar(&cfg.ec.BackendBatchLimit, "backend-batch-limit", cfg.ec.BackendBatchLimit, "BackendBatchLimit is the maximum operations before commit the backend transaction.") diff --git a/server/etcdmain/grpc_proxy.go b/server/etcdmain/grpc_proxy.go index a684d0b5e55a..a56a9570d512 100644 --- a/server/etcdmain/grpc_proxy.go +++ b/server/etcdmain/grpc_proxy.go @@ -239,50 +239,42 @@ func startGRPCProxy(cmd *cobra.Command, args []string) { m := mustListenCMux(lg, tlsInfo) grpcl := m.Match(cmux.HTTP2()) + httpl := mustMatchHTTPListener(m, tlsInfo) defer func() { grpcl.Close() lg.Info("stop listening gRPC proxy client requests", zap.String("address", grpcProxyListenAddr)) }() client := mustNewClient(lg) + grpcServer := newGRPCProxyServer(lg, client) + + errc := make(chan error, 3) + + // NOTE: + // Start gRPC + cmux before creating proxyClient. + // + // proxyClient dials the proxy endpoint with a 5-second timeout. If cmux is not + // serving yet, the self-dial can time out because the gRPC path is not being + // accepted/dispatched. + // + // It is safe to start cmux before the HTTP server goroutine: HTTP has already + // been matched/registered with cmux, so accepted HTTP connections are queued + // and served once http.Serve starts. + startServe(errc, func() error { return grpcServer.Serve(grpcl) }) + startServe(errc, m.Serve) // The proxy client is used for self-healthchecking. // TODO: The mechanism should be refactored to use internal connection. - var proxyClient *clientv3.Client - if grpcProxyAdvertiseClientURL != "" { - proxyClient = mustNewProxyClient(lg, tlsInfo) - } - httpClient := mustNewHTTPClient(lg) + // + // Create it after gRPC/cmux serving goroutines have started + proxyClient := newProxyHealthClient(lg, tlsInfo) - srvhttp, httpl := mustHTTPListener(lg, m, tlsInfo, client, proxyClient) + httpClient := mustNewHTTPClient() + srvhttp := mustHTTPServer(lg, tlsInfo, httpClient, client, proxyClient) - if err := http2.ConfigureServer(srvhttp, &http2.Server{ - MaxConcurrentStreams: maxConcurrentStreams, - }); err != nil { - lg.Fatal("Failed to configure the http server", zap.Error(err)) - } + startServe(errc, func() error { return srvhttp.Serve(httpl) }) - errc := make(chan error, 3) - go func() { errc <- newGRPCProxyServer(lg, client).Serve(grpcl) }() - go func() { errc <- srvhttp.Serve(httpl) }() - go func() { errc <- m.Serve() }() - if len(grpcProxyMetricsListenAddr) > 0 { - mhttpl := mustMetricsListener(lg, tlsInfo) - go func() { - mux := http.NewServeMux() - grpcproxy.HandleMetrics(mux, httpClient, client.Endpoints()) - grpcproxy.HandleHealth(lg, mux, client) - grpcproxy.HandleProxyMetrics(mux) - grpcproxy.HandleProxyHealth(lg, mux, proxyClient) - lg.Info("gRPC proxy server metrics URL serving") - herr := http.Serve(mhttpl, mux) - if herr != nil { - lg.Fatal("gRPC proxy server metrics URL returned", zap.Error(herr)) - } else { - lg.Info("gRPC proxy server metrics URL returned") - } - }() - } + maybeServeMetrics(lg, tlsInfo, httpClient, client, proxyClient) lg.Info("started gRPC proxy", zap.String("address", grpcProxyListenAddr)) @@ -375,11 +367,21 @@ func mustNewProxyClient(lg *zap.Logger, tls *transport.TLSInfo) *clientv3.Client return client } +func newProxyHealthClient(lg *zap.Logger, tls *transport.TLSInfo) *clientv3.Client { + if grpcProxyAdvertiseClientURL == "" { + return nil + } + return mustNewProxyClient(lg, tls) +} + func newProxyClientCfg(lg *zap.Logger, eps []string, tls *transport.TLSInfo) (*clientv3.Config, error) { cfg := clientv3.Config{ Endpoints: eps, DialTimeout: 5 * time.Second, Logger: lg, + DialOptions: []grpc.DialOption{ + grpc.WithBlock(), //nolint:staticcheck // TODO: remove for a supported version + }, } if tls != nil { clientTLS, err := tls.ClientConfig() @@ -532,14 +534,20 @@ func newGRPCProxyServer(lg *zap.Logger, client *clientv3.Client) *grpc.Server { return server } -func mustHTTPListener(lg *zap.Logger, m cmux.CMux, tlsinfo *transport.TLSInfo, c *clientv3.Client, proxy *clientv3.Client) (*http.Server, net.Listener) { - httpClient := mustNewHTTPClient(lg) +func mustMatchHTTPListener(m cmux.CMux, tlsinfo *transport.TLSInfo) net.Listener { + if tlsinfo == nil { + return m.Match(cmux.HTTP1()) + } + return m.Match(cmux.Any()) +} + +func mustHTTPServer(lg *zap.Logger, tlsinfo *transport.TLSInfo, httpClient *http.Client, c *clientv3.Client, proxyClient *clientv3.Client) *http.Server { httpmux := http.NewServeMux() httpmux.HandleFunc("/", http.NotFound) grpcproxy.HandleMetrics(httpmux, httpClient, c.Endpoints()) grpcproxy.HandleHealth(lg, httpmux, c) grpcproxy.HandleProxyMetrics(httpmux) - grpcproxy.HandleProxyHealth(lg, httpmux, proxy) + grpcproxy.HandleProxyHealth(lg, httpmux, proxyClient) if grpcProxyEnablePprof { for p, h := range debugutil.PProfHandlers() { httpmux.Handle(p, h) @@ -550,9 +558,14 @@ func mustHTTPListener(lg *zap.Logger, m cmux.CMux, tlsinfo *transport.TLSInfo, c Handler: httpmux, ErrorLog: log.New(ioutil.Discard, "net/http", 0), } + if err := http2.ConfigureServer(srvhttp, &http2.Server{ + MaxConcurrentStreams: maxConcurrentStreams, + }); err != nil { + lg.Fatal("Failed to configure the http server", zap.Error(err)) + } if tlsinfo == nil { - return srvhttp, m.Match(cmux.HTTP1()) + return srvhttp } srvTLS, err := tlsinfo.ServerConfig() @@ -560,10 +573,35 @@ func mustHTTPListener(lg *zap.Logger, m cmux.CMux, tlsinfo *transport.TLSInfo, c lg.Fatal("failed to set up TLS", zap.Error(err)) } srvhttp.TLSConfig = srvTLS - return srvhttp, m.Match(cmux.Any()) + return srvhttp +} + +func maybeServeMetrics(lg *zap.Logger, tlsinfo *transport.TLSInfo, httpClient *http.Client, c *clientv3.Client, proxyClient *clientv3.Client) { + if len(grpcProxyMetricsListenAddr) == 0 { + return + } + mhttpl := mustMetricsListener(lg, tlsinfo) + go func() { + mux := http.NewServeMux() + grpcproxy.HandleMetrics(mux, httpClient, c.Endpoints()) + grpcproxy.HandleHealth(lg, mux, c) + grpcproxy.HandleProxyMetrics(mux) + grpcproxy.HandleProxyHealth(lg, mux, proxyClient) + lg.Info("gRPC proxy server metrics URL serving") + herr := http.Serve(mhttpl, mux) + if herr != nil { + lg.Fatal("gRPC proxy server metrics URL returned", zap.Error(herr)) + } else { + lg.Info("gRPC proxy server metrics URL returned") + } + }() +} + +func startServe(errc chan<- error, serve func() error) { + go func() { errc <- serve() }() } -func mustNewHTTPClient(lg *zap.Logger) *http.Client { +func mustNewHTTPClient() *http.Client { transport, err := newHTTPTransport(grpcProxyCA, grpcProxyCert, grpcProxyKey) if err != nil { fmt.Fprintln(os.Stderr, err) diff --git a/server/etcdmain/help.go b/server/etcdmain/help.go index cd6e2195873d..9284beb507dc 100644 --- a/server/etcdmain/help.go +++ b/server/etcdmain/help.go @@ -72,7 +72,7 @@ Member: --max-wals '` + strconv.Itoa(embed.DefaultMaxWALs) + `' Maximum number of wal files to retain (0 is unlimited). --quota-backend-bytes '0' - Raise alarms when backend size exceeds the given quota (0 defaults to low space quota). + Sets the maximum size (in bytes) that the etcd backend database may consume. Exceeding this triggers an alarm and puts etcd in read-only mode. Set to 0 to use the default 2GiB limit. --backend-bbolt-freelist-type 'map' BackendFreelistType specifies the type of freelist that boltdb backend uses(array and map are supported types). --backend-batch-interval '' diff --git a/server/etcdserver/api/etcdhttp/peer.go b/server/etcdserver/api/etcdhttp/peer.go index badc98634b1f..a71e70d5ad28 100644 --- a/server/etcdserver/api/etcdhttp/peer.go +++ b/server/etcdserver/api/etcdhttp/peer.go @@ -21,12 +21,14 @@ import ( "strconv" "strings" + "go.etcd.io/etcd/api/v3/v3rpc/rpctypes" "go.etcd.io/etcd/client/pkg/v3/types" "go.etcd.io/etcd/server/v3/etcdserver" "go.etcd.io/etcd/server/v3/etcdserver/api" "go.etcd.io/etcd/server/v3/etcdserver/api/membership" "go.etcd.io/etcd/server/v3/etcdserver/api/rafthttp" "go.etcd.io/etcd/server/v3/lease/leasehttp" + "google.golang.org/grpc/metadata" "go.uber.org/zap" ) @@ -135,7 +137,14 @@ func (h *peerMemberPromoteHandler) ServeHTTP(w http.ResponseWriter, r *http.Requ return } - resp, err := h.server.PromoteMember(r.Context(), id) + // reconstruct gRPC metadata from HTTP header (if present) so admin check can pass + ctx := r.Context() + if token := r.Header.Get("Authorization"); token != "" { + md := metadata.New(map[string]string{rpctypes.TokenFieldNameGRPC: token}) + ctx = metadata.NewIncomingContext(ctx, md) + } + + resp, err := h.server.PromoteMember(ctx, id) if err != nil { switch err { case membership.ErrIDNotFound: diff --git a/server/etcdserver/api/membership/cluster.go b/server/etcdserver/api/membership/cluster.go index 63732807d080..9f94e8349cc3 100644 --- a/server/etcdserver/api/membership/cluster.go +++ b/server/etcdserver/api/membership/cluster.go @@ -499,6 +499,15 @@ func (c *RaftCluster) UpdateAttributes(id types.ID, attr Attributes, shouldApply } if c.be != nil && shouldApplyV3 { unsafeSaveMemberToBackend(c.lg, c.be, m) + + // Ideally, each member only updates its own attributes + // once before serving requests. Since this happens only + // on startup and at a low frequency, it should be safe + // to clean up zombie members in this request. + if id == c.localID && c.v2store != nil { + c.lg.Info("checking and cleaning up zombie members after attribute update") + CleanupZombieMembersIfNeeded(c.lg, c.be, c.v2store) + } } return } @@ -545,12 +554,29 @@ func (c *RaftCluster) UpdateRaftAttributes(id types.ID, raftAttr RaftAttributes, c.Lock() defer c.Unlock() - c.members[id].RaftAttributes = raftAttr + var ( + m *Member + ok bool + ) + if m, ok = c.members[id]; !ok { + c.lg.Info("Skipped updating non-existent member in v2store", + zap.String("cluster-id", c.cid.String()), + zap.String("local-member-id", c.localID.String()), + zap.String("updated-remote-peer-id", id.String()), + zap.Strings("updated-remote-peer-urls", raftAttr.PeerURLs), + zap.Bool("updated-remote-peer-is-learner", raftAttr.IsLearner), + zap.Bool("should-apply-v3", bool(shouldApplyV3)), + ) + return + } + // `MemberUpdateRequest` only supports updating PeerURLs. + m.RaftAttributes.PeerURLs = raftAttr.PeerURLs + if c.v2store != nil { - mustUpdateMemberInStore(c.lg, c.v2store, c.members[id]) + mustUpdateMemberInStore(c.lg, c.v2store, m) } if c.be != nil && shouldApplyV3 { - unsafeSaveMemberToBackend(c.lg, c.be, c.members[id]) + unsafeSaveMemberToBackend(c.lg, c.be, m) } c.lg.Info( @@ -563,6 +589,15 @@ func (c *RaftCluster) UpdateRaftAttributes(id types.ID, raftAttr RaftAttributes, ) } +func (c *RaftCluster) CleanupZombieMembersIfNeeded(shouldApplyV3 ShouldApplyV3) { + c.Lock() + defer c.Unlock() + + if c.v2store != nil && c.be != nil && shouldApplyV3 { + CleanupZombieMembersIfNeeded(c.lg, c.be, c.v2store) + } +} + func (c *RaftCluster) Version() *semver.Version { c.Lock() defer c.Unlock() @@ -736,6 +771,43 @@ func membersFromBackend(lg *zap.Logger, be backend.Backend) (map[types.ID]*Membe return mustReadMembersFromBackend(lg, be) } +func SyncLearnerPromotionIfNeeded(lg *zap.Logger, be backend.Backend, st v2store.Store) error { + v2Members, _ := membersFromStore(lg, st) + v3Members, _ := membersFromBackend(lg, be) + + for id, v3Member := range v3Members { + v2Member, ok := v2Members[id] + if !ok { + return fmt.Errorf("detected member only in v3store but missing in v2store, member: %+v", *v3Member) + } + + if !v2Member.IsLearner && v3Member.IsLearner { + syncedV3Member := v3Member.Clone() + syncedV3Member.IsLearner = false + lg.Warn("Syncing member in v3store", zap.String("member", fmt.Sprintf("%+v", *syncedV3Member))) + if err := unsafeSaveMemberToBackend(lg, be, syncedV3Member); err != nil { + return fmt.Errorf("failed to save synced member to backend, member: %+v, error:%w", *syncedV3Member, err) + } + } + } + return nil +} + +func CleanupZombieMembersIfNeeded(lg *zap.Logger, be backend.Backend, st v2store.Store) { + v2Members, _ := membersFromStore(lg, st) + v3Members, _ := membersFromBackend(lg, be) + + for id, v3Member := range v3Members { + _, ok := v2Members[id] + if !ok { + lg.Warn("Removing zombie member from v3store", zap.String("member", fmt.Sprintf("%+v", *v3Member))) + if err := unsafeDeleteMemberFromBackend(be, id); err != nil { + lg.Warn("failed to delete zombie member from backend", zap.String("member-id", id.String()), zap.Error(err)) + } + } + } +} + func clusterVersionFromStore(lg *zap.Logger, st v2store.Store) *semver.Version { e, err := st.Get(path.Join(storePrefix, "version"), false, false) if err != nil { diff --git a/server/etcdserver/api/membership/cluster_test.go b/server/etcdserver/api/membership/cluster_test.go index e152e06a1fad..77fa0a621993 100644 --- a/server/etcdserver/api/membership/cluster_test.go +++ b/server/etcdserver/api/membership/cluster_test.go @@ -24,6 +24,7 @@ import ( "github.com/coreos/go-semver/semver" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" betesting "go.etcd.io/etcd/server/v3/mvcc/backend/testing" "go.uber.org/zap" "go.uber.org/zap/zaptest" @@ -280,6 +281,179 @@ func TestClusterValidateAndAssignIDs(t *testing.T) { } } +// TestSyncLearnerPromotionIfNeeded verified that etcd can automatically +// correct member's IsLearner attribute in v3store based on v2store when +// applying a snapshot. +// See https://github.com/etcd-io/etcd/issues/20793 +func TestSyncLearnerPromotionIfNeeded(t *testing.T) { + members := []*Member{ + { + ID: types.ID(1), + RaftAttributes: RaftAttributes{PeerURLs: []string{"http://10.200.6.180:2380"}}, + Attributes: Attributes{Name: "foo", ClientURLs: []string{"http://10.200.6.180:2379"}}, + }, + { + ID: types.ID(2), + RaftAttributes: RaftAttributes{PeerURLs: []string{"http://10.200.6.181:2380"}}, + Attributes: Attributes{Name: "foo", ClientURLs: []string{"http://10.200.6.181:2379"}}, + }, + { + ID: types.ID(3), + RaftAttributes: RaftAttributes{PeerURLs: []string{"http://10.200.6.182:2380"}}, + Attributes: Attributes{Name: "foo", ClientURLs: []string{"http://10.200.6.182:2379"}}, + }, + } + + genMember := func(m *Member, isLearner bool, attr *Attributes) *Member { + newMember := m.Clone() + newMember.IsLearner = isLearner + if attr != nil { + newMember.Attributes = *attr + } + return newMember + } + + testCases := []struct { + name string + v2Members []*Member + v3Members []*Member + expectedSyncedMembers map[types.ID]*Member + }{ + { + name: "no learners in both v2store and v3store", + v2Members: []*Member{ + genMember(members[0], false, nil), + genMember(members[1], false, nil), + genMember(members[2], false, nil), + }, + v3Members: []*Member{ + genMember(members[0], false, &Attributes{Name: "foo1", ClientURLs: []string{"http://10.200.6.190:2380"}}), + genMember(members[1], false, &Attributes{Name: "foo2", ClientURLs: []string{"http://10.200.6.191:2380"}}), + genMember(members[2], false, &Attributes{Name: "foo3", ClientURLs: []string{"http://10.200.6.192:2380"}}), + }, + expectedSyncedMembers: map[types.ID]*Member{ + members[0].ID: genMember(members[0], false, &Attributes{Name: "foo1", ClientURLs: []string{"http://10.200.6.190:2380"}}), + members[1].ID: genMember(members[1], false, &Attributes{Name: "foo2", ClientURLs: []string{"http://10.200.6.191:2380"}}), + members[2].ID: genMember(members[2], false, &Attributes{Name: "foo3", ClientURLs: []string{"http://10.200.6.192:2380"}}), + }, + }, + { + name: "all learners in both v2store and v3store", + v2Members: []*Member{ + genMember(members[0], true, nil), + genMember(members[1], true, nil), + genMember(members[2], true, nil), + }, + v3Members: []*Member{ + genMember(members[0], true, &Attributes{Name: "foo1", ClientURLs: []string{"http://10.200.6.190:2380"}}), + genMember(members[1], true, &Attributes{Name: "foo2", ClientURLs: []string{"http://10.200.6.191:2380"}}), + genMember(members[2], true, &Attributes{Name: "foo3", ClientURLs: []string{"http://10.200.6.192:2380"}}), + }, + expectedSyncedMembers: map[types.ID]*Member{ + members[0].ID: genMember(members[0], true, &Attributes{Name: "foo1", ClientURLs: []string{"http://10.200.6.190:2380"}}), + members[1].ID: genMember(members[1], true, &Attributes{Name: "foo2", ClientURLs: []string{"http://10.200.6.191:2380"}}), + members[2].ID: genMember(members[2], true, &Attributes{Name: "foo3", ClientURLs: []string{"http://10.200.6.192:2380"}}), + }, + }, + { + name: "no learners in v2store, all learners in v3store", + v2Members: []*Member{ + genMember(members[0], false, nil), + genMember(members[1], false, nil), + genMember(members[2], false, nil), + }, + v3Members: []*Member{ + genMember(members[0], true, &Attributes{Name: "foo1", ClientURLs: []string{"http://10.200.6.170:2380"}}), + genMember(members[1], true, &Attributes{Name: "foo2", ClientURLs: []string{"http://10.200.6.171:2380"}}), + genMember(members[2], true, &Attributes{Name: "foo3", ClientURLs: []string{"http://10.200.6.172:2380"}}), + }, + expectedSyncedMembers: map[types.ID]*Member{ + members[0].ID: genMember(members[0], false, &Attributes{Name: "foo1", ClientURLs: []string{"http://10.200.6.170:2380"}}), + members[1].ID: genMember(members[1], false, &Attributes{Name: "foo2", ClientURLs: []string{"http://10.200.6.171:2380"}}), + members[2].ID: genMember(members[2], false, &Attributes{Name: "foo3", ClientURLs: []string{"http://10.200.6.172:2380"}}), + }, + }, + { + name: "all learners in v2store, no learners in v3store", + v2Members: []*Member{ + genMember(members[0], true, nil), + genMember(members[1], true, nil), + genMember(members[2], true, nil), + }, + v3Members: []*Member{ + genMember(members[0], false, &Attributes{Name: "foo1", ClientURLs: []string{"http://10.200.6.190:2380"}}), + genMember(members[1], false, &Attributes{Name: "foo2", ClientURLs: []string{"http://10.200.6.191:2380"}}), + genMember(members[2], false, &Attributes{Name: "foo3", ClientURLs: []string{"http://10.200.6.192:2380"}}), + }, + expectedSyncedMembers: map[types.ID]*Member{ + members[0].ID: genMember(members[0], false, &Attributes{Name: "foo1", ClientURLs: []string{"http://10.200.6.190:2380"}}), + members[1].ID: genMember(members[1], false, &Attributes{Name: "foo2", ClientURLs: []string{"http://10.200.6.191:2380"}}), + members[2].ID: genMember(members[2], false, &Attributes{Name: "foo3", ClientURLs: []string{"http://10.200.6.192:2380"}}), + }, + }, + { + name: "same learners in v2store and v3store", + v2Members: []*Member{ + genMember(members[0], false, nil), + genMember(members[1], true, nil), + genMember(members[2], true, nil), + }, + v3Members: []*Member{ + genMember(members[0], false, &Attributes{Name: "foo1", ClientURLs: []string{"http://10.200.6.160:2380"}}), + genMember(members[1], true, &Attributes{Name: "foo2", ClientURLs: []string{"http://10.200.6.161:2380"}}), + genMember(members[2], true, &Attributes{Name: "foo3", ClientURLs: []string{"http://10.200.6.162:2380"}}), + }, + expectedSyncedMembers: map[types.ID]*Member{ + members[0].ID: genMember(members[0], false, &Attributes{Name: "foo1", ClientURLs: []string{"http://10.200.6.160:2380"}}), + members[1].ID: genMember(members[1], true, &Attributes{Name: "foo2", ClientURLs: []string{"http://10.200.6.161:2380"}}), + members[2].ID: genMember(members[2], true, &Attributes{Name: "foo3", ClientURLs: []string{"http://10.200.6.162:2380"}}), + }, + }, + { + name: "different learners in v2store and v3store", + v2Members: []*Member{ + genMember(members[0], true, nil), + genMember(members[1], true, nil), + genMember(members[2], false, nil), + }, + v3Members: []*Member{ + genMember(members[0], false, &Attributes{Name: "foo1", ClientURLs: []string{"http://10.200.6.160:2380"}}), + genMember(members[1], true, &Attributes{Name: "foo2", ClientURLs: []string{"http://10.200.6.161:2380"}}), + genMember(members[2], true, &Attributes{Name: "foo3", ClientURLs: []string{"http://10.200.6.162:2380"}}), + }, + expectedSyncedMembers: map[types.ID]*Member{ + members[0].ID: genMember(members[0], false, &Attributes{Name: "foo1", ClientURLs: []string{"http://10.200.6.160:2380"}}), + members[1].ID: genMember(members[1], true, &Attributes{Name: "foo2", ClientURLs: []string{"http://10.200.6.161:2380"}}), + members[2].ID: genMember(members[2], false, &Attributes{Name: "foo3", ClientURLs: []string{"http://10.200.6.162:2380"}}), + }, + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + lg := zaptest.NewLogger(t) + + st := v2store.New() + for _, m := range tc.v2Members { + mustSaveMemberToStore(lg, st, m) + } + + be, _ := betesting.NewDefaultTmpBackend(t) + mustCreateBackendBuckets(be) + defer be.Close() + + for _, m := range tc.v3Members { + require.NoError(t, unsafeSaveMemberToBackend(lg, be, m)) + } + + require.NoError(t, SyncLearnerPromotionIfNeeded(lg, be, st)) + + syncedMembers, _ := membersFromBackend(lg, be) + require.Equal(t, tc.expectedSyncedMembers, syncedMembers) + }) + } +} + func TestClusterValidateConfigurationChange(t *testing.T) { cl := NewCluster(zaptest.NewLogger(t), WithMaxLearners(1)) cl.SetStore(v2store.New()) @@ -1242,3 +1416,72 @@ func TestRemoveMemberSyncsBackendAndStoreV2(t *testing.T) { }) } } + +func TestUpdateRaftAttributes(t *testing.T) { + clientURLs := []string{"http://127.0.0.1:2379"} + oldPeerURLs := []string{"http://127.0.0.1:2380"} + newPeerURLs := []string{"http://127.0.0.1:2382"} + testCases := []struct { + name string + members []*Member + updateMemberID types.ID + wantMembers map[types.ID]*Member + }{ + { + name: "update an existing voting member", + members: []*Member{ + newTestMember(1, oldPeerURLs, "1", clientURLs), + newTestMember(2, oldPeerURLs, "2", clientURLs), + }, + updateMemberID: 2, + wantMembers: map[types.ID]*Member{ + 1: newTestMember(1, oldPeerURLs, "1", clientURLs), + 2: newTestMember(2, newPeerURLs, "2", clientURLs), + }, + }, + { + name: "update an existing learner member", + members: []*Member{ + newTestMember(1, oldPeerURLs, "1", clientURLs), + newTestMemberAsLearner(2, oldPeerURLs, "2", clientURLs), + }, + updateMemberID: 2, + wantMembers: map[types.ID]*Member{ + 1: newTestMember(1, oldPeerURLs, "1", clientURLs), + 2: newTestMemberAsLearner(2, newPeerURLs, "2", clientURLs), + }, + }, + { + name: "update a non-exist member", + members: []*Member{ + newTestMember(1, oldPeerURLs, "1", clientURLs), + newTestMember(2, oldPeerURLs, "2", clientURLs), + }, + updateMemberID: 3, + wantMembers: map[types.ID]*Member{ + 1: newTestMember(1, oldPeerURLs, "1", clientURLs), + 2: newTestMember(2, oldPeerURLs, "2", clientURLs), + }, + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + lg := zaptest.NewLogger(t) + c := newTestCluster(t, tc.members) + be, _ := betesting.NewDefaultTmpBackend(t) + defer betesting.Close(t, be) + c.SetBackend(be) + for _, m := range tc.members { + unsafeSaveMemberToBackend(lg, be, m) + } + be.ForceCommit() + + c.UpdateRaftAttributes(tc.updateMemberID, RaftAttributes{PeerURLs: newPeerURLs}, true) + + mst, _ := mustReadMembersFromBackend(lg, c.be) + require.Equal(t, tc.wantMembers, mst, tc.name) + require.Equal(t, tc.wantMembers, c.members) + }) + } +} diff --git a/server/etcdserver/api/membership/storev2.go b/server/etcdserver/api/membership/storev2.go index 8505c63f367b..906aed9b9bae 100644 --- a/server/etcdserver/api/membership/storev2.go +++ b/server/etcdserver/api/membership/storev2.go @@ -26,8 +26,66 @@ func IsMetaStoreOnly(store v2store.Store) (bool, error) { if err != nil { return false, err } + + // storePermsPrefix is the internal prefix of the storage layer dedicated to storing user data. + // refer to https://github.com/etcd-io/etcd/blob/v3.5.21/server/etcdserver/api/v2auth/auth.go#L40 + storePermsPrefix := "/2" for _, n := range event.Node.Nodes { - if n.Key != storePrefix && n.Nodes.Len() > 0 { + if n.Key == storePrefix { + continue + } + + // For auth data, even after we remove all users and roles, the node + // "/2/roles" and "/2/users" are still present in the tree. We need + // to exclude such case. See an example below, + // Refer to https://github.com/etcd-io/etcd/discussions/20231#discussioncomment-13791940 + /* + "2": { + "Path": "/2", + "CreatedIndex": 204749, + "ModifiedIndex": 204749, + "ExpireTime": "0001-01-01T00:00:00Z", + "Value": "", + "Children": { + "enabled": { + "Path": "/2/enabled", + "CreatedIndex": 204752, + "ModifiedIndex": 16546016, + "ExpireTime": "0001-01-01T00:00:00Z", + "Value": "false", + "Children": null + }, + "roles": { + "Path": "/2/roles", + "CreatedIndex": 204751, + "ModifiedIndex": 204751, + "ExpireTime": "0001-01-01T00:00:00Z", + "Value": "", + "Children": {} + }, + "users": { + "Path": "/2/users", + "CreatedIndex": 204750, + "ModifiedIndex": 204750, + "ExpireTime": "0001-01-01T00:00:00Z", + "Value": "", + "Children": {} + } + } + } + */ + if n.Key == storePermsPrefix { + if n.Nodes.Len() > 0 { + for _, child := range n.Nodes { + if child.Nodes.Len() > 0 { + return false, nil + } + } + } + continue + } + + if n.Nodes.Len() > 0 { return false, nil } } diff --git a/server/etcdserver/api/rafthttp/stream_test.go b/server/etcdserver/api/rafthttp/stream_test.go index 5006bd0898a3..0cbb6457c2f0 100644 --- a/server/etcdserver/api/rafthttp/stream_test.go +++ b/server/etcdserver/api/rafthttp/stream_test.go @@ -127,7 +127,7 @@ func TestStreamReaderDialRequest(t *testing.T) { } req := act[0].Params[0].(*http.Request) - wurl := fmt.Sprintf("http://localhost:2380" + tt.endpoint(zap.NewExample()) + "/1") + wurl := fmt.Sprintf("http://localhost:2380%s/1", tt.endpoint(zap.NewExample())) if req.URL.String() != wurl { t.Errorf("#%d: url = %s, want %s", i, req.URL.String(), wurl) } diff --git a/server/etcdserver/api/v3rpc/auth.go b/server/etcdserver/api/v3rpc/auth.go index d986037a1b4c..c5c28a8f9594 100644 --- a/server/etcdserver/api/v3rpc/auth.go +++ b/server/etcdserver/api/v3rpc/auth.go @@ -164,3 +164,18 @@ func (as *AuthServer) UserChangePassword(ctx context.Context, r *pb.AuthUserChan } return resp, nil } + +type AuthAdmin struct { + ag AuthGetter +} + +// isPermitted verifies the user has admin privilege. +// Only users with "root" role are permitted. +func (aa *AuthAdmin) isPermitted(ctx context.Context) error { + authInfo, err := aa.ag.AuthInfoFromCtx(ctx) + if err != nil { + return err + } + + return aa.ag.AuthStore().IsAdminPermitted(authInfo) +} diff --git a/server/etcdserver/api/v3rpc/grpc.go b/server/etcdserver/api/v3rpc/grpc.go index 6947903a3865..28e1e4422e3a 100644 --- a/server/etcdserver/api/v3rpc/grpc.go +++ b/server/etcdserver/api/v3rpc/grpc.go @@ -44,16 +44,16 @@ func Server(s *etcdserver.EtcdServer, tls *tls.Config, interceptor grpc.UnarySer } chainUnaryInterceptors := []grpc.UnaryServerInterceptor{ newLogUnaryInterceptor(s), - newUnaryInterceptor(s), grpc_prometheus.UnaryServerInterceptor, + newUnaryInterceptor(s), } if interceptor != nil { chainUnaryInterceptors = append(chainUnaryInterceptors, interceptor) } chainStreamInterceptors := []grpc.StreamServerInterceptor{ - newStreamInterceptor(s), grpc_prometheus.StreamServerInterceptor, + newStreamInterceptor(s), } if s.Cfg.ExperimentalEnableDistributedTracing { diff --git a/server/etcdserver/api/v3rpc/key.go b/server/etcdserver/api/v3rpc/key.go index d1a7ee633455..2354f211aa89 100644 --- a/server/etcdserver/api/v3rpc/key.go +++ b/server/etcdserver/api/v3rpc/key.go @@ -27,6 +27,7 @@ import ( type kvServer struct { hdr header kv etcdserver.RaftKV + aa *AuthAdmin // maxTxnOps is the max operations per txn. // e.g suppose maxTxnOps = 128. // Txn.Success can have at most 128 operations, @@ -35,7 +36,7 @@ type kvServer struct { } func NewKVServer(s *etcdserver.EtcdServer) pb.KVServer { - return &kvServer{hdr: newHeader(s), kv: s, maxTxnOps: s.Cfg.MaxTxnOps} + return &kvServer{hdr: newHeader(s), kv: s, aa: &AuthAdmin{s}, maxTxnOps: s.Cfg.MaxTxnOps} } func (s *kvServer) Range(ctx context.Context, r *pb.RangeRequest) (*pb.RangeResponse, error) { @@ -102,6 +103,10 @@ func (s *kvServer) Txn(ctx context.Context, r *pb.TxnRequest) (*pb.TxnResponse, } func (s *kvServer) Compact(ctx context.Context, r *pb.CompactionRequest) (*pb.CompactionResponse, error) { + if err := s.aa.isPermitted(ctx); err != nil { + return nil, togRPCError(err) + } + resp, err := s.kv.Compact(ctx, r) if err != nil { return nil, togRPCError(err) diff --git a/server/etcdserver/api/v3rpc/maintenance.go b/server/etcdserver/api/v3rpc/maintenance.go index 7db17e1a0025..0876d257571c 100644 --- a/server/etcdserver/api/v3rpc/maintenance.go +++ b/server/etcdserver/api/v3rpc/maintenance.go @@ -41,6 +41,10 @@ type BackendGetter interface { Backend() backend.Backend } +type Defrager interface { + Defragment() error +} + type Alarmer interface { // Alarms is implemented in Server interface located in etcdserver/server.go // It returns a list of alarms present in the AlarmStore @@ -71,6 +75,7 @@ type maintenanceServer struct { hasher mvcc.HashStorage kg KVGetter bg BackendGetter + defrag Defrager a Alarmer lt LeaderTransferrer hdr header @@ -81,7 +86,7 @@ type maintenanceServer struct { } func NewMaintenanceServer(s *etcdserver.EtcdServer, healthNotifier notifier) pb.MaintenanceServer { - srv := &maintenanceServer{lg: s.Cfg.Logger, rg: s, hasher: s.KV().HashStorage(), kg: s, bg: s, a: s, lt: s, hdr: newHeader(s), cs: s, d: s, healthNotifier: healthNotifier} + srv := &maintenanceServer{lg: s.Cfg.Logger, rg: s, hasher: s.KV().HashStorage(), kg: s, bg: s, defrag: s, a: s, lt: s, hdr: newHeader(s), cs: s, d: s, healthNotifier: healthNotifier} if srv.lg == nil { srv.lg = zap.NewNop() } @@ -92,7 +97,7 @@ func (ms *maintenanceServer) Defragment(ctx context.Context, sr *pb.DefragmentRe ms.lg.Info("starting defragment") ms.healthNotifier.defragStarted() defer ms.healthNotifier.defragFinished() - err := ms.bg.Backend().Defrag() + err := ms.defrag.Defragment() if err != nil { ms.lg.Warn("failed to defragment", zap.Error(err)) return nil, err @@ -275,6 +280,22 @@ func (ams *authMaintenanceServer) isAuthenticated(ctx context.Context) error { return ams.ag.AuthStore().IsAdminPermitted(authInfo) } +func (ams *authMaintenanceServer) requireAuthInfo(ctx context.Context) error { + if !ams.ag.AuthStore().IsAuthEnabled() { + return nil + } + + authInfo, err := ams.ag.AuthInfoFromCtx(ctx) + if err != nil { + return err + } + + if authInfo == nil { + return auth.ErrUserEmpty + } + return nil +} + func (ams *authMaintenanceServer) Defragment(ctx context.Context, sr *pb.DefragmentRequest) (*pb.DefragmentResponse, error) { if err := ams.isAuthenticated(ctx); err != nil { return nil, err @@ -306,14 +327,37 @@ func (ams *authMaintenanceServer) HashKV(ctx context.Context, r *pb.HashKVReques return ams.maintenanceServer.HashKV(ctx, r) } +func (ams *authMaintenanceServer) Alarm(ctx context.Context, ar *pb.AlarmRequest) (*pb.AlarmResponse, error) { + switch ar.GetAction() { + case pb.AlarmRequest_GET: + if err := ams.requireAuthInfo(ctx); err != nil { + return nil, togRPCError(err) + } + default: + if err := ams.isAuthenticated(ctx); err != nil { + return nil, togRPCError(err) + } + } + return ams.maintenanceServer.Alarm(ctx, ar) +} + func (ams *authMaintenanceServer) Status(ctx context.Context, ar *pb.StatusRequest) (*pb.StatusResponse, error) { + if err := ams.isAuthenticated(ctx); err != nil { + return nil, togRPCError(err) + } return ams.maintenanceServer.Status(ctx, ar) } func (ams *authMaintenanceServer) MoveLeader(ctx context.Context, tr *pb.MoveLeaderRequest) (*pb.MoveLeaderResponse, error) { + if err := ams.isAuthenticated(ctx); err != nil { + return nil, togRPCError(err) + } return ams.maintenanceServer.MoveLeader(ctx, tr) } func (ams *authMaintenanceServer) Downgrade(ctx context.Context, r *pb.DowngradeRequest) (*pb.DowngradeResponse, error) { + if err := ams.isAuthenticated(ctx); err != nil { + return nil, togRPCError(err) + } return ams.maintenanceServer.Downgrade(ctx, r) } diff --git a/server/etcdserver/api/v3rpc/member.go b/server/etcdserver/api/v3rpc/member.go index 54fcc24843d4..2d1fe27d81b2 100644 --- a/server/etcdserver/api/v3rpc/member.go +++ b/server/etcdserver/api/v3rpc/member.go @@ -88,12 +88,12 @@ func (cs *ClusterServer) MemberUpdate(ctx context.Context, r *pb.MemberUpdateReq } func (cs *ClusterServer) MemberList(ctx context.Context, r *pb.MemberListRequest) (*pb.MemberListResponse, error) { - if r.Linearizable { - if err := cs.server.LinearizableReadNotify(ctx); err != nil { - return nil, togRPCError(err) - } + members, err := cs.server.MemberList(ctx, r) + if err != nil { + return nil, togRPCError(err) } - membs := membersToProtoMembers(cs.cluster.Members()) + + membs := membersToProtoMembers(members) return &pb.MemberListResponse{Header: cs.header(), Members: membs}, nil } diff --git a/server/etcdserver/api/v3rpc/watch.go b/server/etcdserver/api/v3rpc/watch.go index 0b0284ec3e03..2efe9d1f24bb 100644 --- a/server/etcdserver/api/v3rpc/watch.go +++ b/server/etcdserver/api/v3rpc/watch.go @@ -267,6 +267,22 @@ func (sws *serverWatchStream) recvLoop() error { // support >= key queries creq.RangeEnd = []byte{} } + if creq.StartRevision < 0 { + wr := &pb.WatchResponse{ + Header: sws.newResponseHeader(sws.watchStream.Rev()), + WatchId: clientv3.InvalidWatchID, + Canceled: true, + Created: true, + CancelReason: rpctypes.ErrCompacted.Error(), + } + + select { + case sws.ctrlStream <- wr: + continue + case <-sws.closec: + return nil + } + } err := sws.isWatchPermitted(creq) if err != nil { @@ -303,12 +319,7 @@ func (sws *serverWatchStream) recvLoop() error { filters := FiltersFromRequest(creq) - wsrev := sws.watchStream.Rev() - rev := creq.StartRevision - if rev == 0 { - rev = wsrev + 1 - } - id, err := sws.watchStream.Watch(mvcc.WatchID(creq.WatchId), creq.Key, creq.RangeEnd, rev, filters...) + id, err := sws.watchStream.Watch(mvcc.WatchID(creq.WatchId), creq.Key, creq.RangeEnd, creq.StartRevision, filters...) if err == nil { sws.mu.Lock() if creq.ProgressNotify { @@ -326,7 +337,7 @@ func (sws *serverWatchStream) recvLoop() error { } wr := &pb.WatchResponse{ - Header: sws.newResponseHeader(wsrev), + Header: sws.newResponseHeader(sws.watchStream.Rev()), WatchId: int64(id), Created: true, Canceled: err != nil, diff --git a/server/etcdserver/apply_auth.go b/server/etcdserver/apply_auth.go index beafa967ba95..2f90b14f3c10 100644 --- a/server/etcdserver/apply_auth.go +++ b/server/etcdserver/apply_auth.go @@ -65,25 +65,34 @@ func (aa *authApplierV3) Apply(r *pb.InternalRaftRequest, shouldApplyV3 membersh } func (aa *authApplierV3) Put(ctx context.Context, txn mvcc.TxnWrite, r *pb.PutRequest) (*pb.PutResponse, *traceutil.Trace, error) { - if err := aa.as.IsPutPermitted(&aa.authInfo, r.Key); err != nil { + if err := checkPutAuth(aa.as, &aa.authInfo, aa.lessor, r); err != nil { return nil, nil, err } - if err := aa.checkLeasePuts(lease.LeaseID(r.Lease)); err != nil { + return aa.applierV3.Put(ctx, txn, r) +} + +func checkPutAuth(as auth.AuthStore, ai *auth.AuthInfo, lessor lease.Lessor, r *pb.PutRequest) error { + if err := as.IsPutPermitted(ai, r.Key); err != nil { + return err + } + + if err := checkLeasePuts(as, ai, lessor, lease.LeaseID(r.Lease)); err != nil { // The specified lease is already attached with a key that cannot // be written by this user. It means the user cannot revoke the // lease so attaching the lease to the newly written key should // be forbidden. - return nil, nil, err + return err } if r.PrevKv { - err := aa.as.IsRangePermitted(&aa.authInfo, r.Key, nil) + err := as.IsRangePermitted(ai, r.Key, nil) if err != nil { - return nil, nil, err + return err } } - return aa.applierV3.Put(ctx, txn, r) + + return nil } func (aa *authApplierV3) Range(ctx context.Context, txn mvcc.TxnRead, r *pb.RangeRequest) (*pb.RangeResponse, error) { @@ -107,7 +116,7 @@ func (aa *authApplierV3) DeleteRange(txn mvcc.TxnWrite, r *pb.DeleteRangeRequest return aa.applierV3.DeleteRange(txn, r) } -func checkTxnReqsPermission(as auth.AuthStore, ai *auth.AuthInfo, reqs []*pb.RequestOp) error { +func checkTxnReqsPermission(as auth.AuthStore, ai *auth.AuthInfo, lessor lease.Lessor, reqs []*pb.RequestOp) error { for _, requ := range reqs { switch tv := requ.Request.(type) { case *pb.RequestOp_RequestRange: @@ -124,10 +133,9 @@ func checkTxnReqsPermission(as auth.AuthStore, ai *auth.AuthInfo, reqs []*pb.Req continue } - if err := as.IsPutPermitted(ai, tv.RequestPut.Key); err != nil { + if err := checkPutAuth(as, ai, lessor, tv.RequestPut); err != nil { return err } - case *pb.RequestOp_RequestDeleteRange: if tv.RequestDeleteRange == nil { continue @@ -144,56 +152,65 @@ func checkTxnReqsPermission(as auth.AuthStore, ai *auth.AuthInfo, reqs []*pb.Req if err != nil { return err } + case *pb.RequestOp_RequestTxn: + if tv.RequestTxn == nil { + continue + } + + err := checkTxnAuth(as, ai, lessor, tv.RequestTxn) + if err != nil { + return err + } } } return nil } -func checkTxnAuth(as auth.AuthStore, ai *auth.AuthInfo, rt *pb.TxnRequest) error { +func checkTxnAuth(as auth.AuthStore, ai *auth.AuthInfo, lessor lease.Lessor, rt *pb.TxnRequest) error { for _, c := range rt.Compare { if err := as.IsRangePermitted(ai, c.Key, c.RangeEnd); err != nil { return err } } - if err := checkTxnReqsPermission(as, ai, rt.Success); err != nil { + if err := checkTxnReqsPermission(as, ai, lessor, rt.Success); err != nil { return err } - return checkTxnReqsPermission(as, ai, rt.Failure) + return checkTxnReqsPermission(as, ai, lessor, rt.Failure) } func (aa *authApplierV3) Txn(ctx context.Context, rt *pb.TxnRequest) (*pb.TxnResponse, *traceutil.Trace, error) { - if err := checkTxnAuth(aa.as, &aa.authInfo, rt); err != nil { + if err := checkTxnAuth(aa.as, &aa.authInfo, aa.lessor, rt); err != nil { return nil, nil, err } return aa.applierV3.Txn(ctx, rt) } func (aa *authApplierV3) LeaseRevoke(lc *pb.LeaseRevokeRequest) (*pb.LeaseRevokeResponse, error) { - if err := aa.checkLeasePuts(lease.LeaseID(lc.ID)); err != nil { + if err := checkLeasePuts(aa.as, &aa.authInfo, aa.lessor, lease.LeaseID(lc.ID)); err != nil { return nil, err } return aa.applierV3.LeaseRevoke(lc) } -func (aa *authApplierV3) checkLeasePuts(leaseID lease.LeaseID) error { - l := aa.lessor.Lookup(leaseID) +func checkLeasePuts(as auth.AuthStore, ai *auth.AuthInfo, lessor lease.Lessor, leaseID lease.LeaseID) error { + l := lessor.Lookup(leaseID) if l != nil { - return aa.checkLeasePutsKeys(l) + return checkLeasePutsKeys(as, ai, l) } return nil } -func (aa *authApplierV3) checkLeasePutsKeys(l *lease.Lease) error { +func checkLeasePutsKeys(as auth.AuthStore, ai *auth.AuthInfo, l *lease.Lease) error { // early return for most-common scenario of either disabled auth or admin user. // IsAdminPermitted also checks whether auth is enabled - if err := aa.as.IsAdminPermitted(&aa.authInfo); err == nil { + if err := as.IsAdminPermitted(ai); err == nil { return nil } for _, key := range l.Keys() { - if err := aa.as.IsPutPermitted(&aa.authInfo, []byte(key)); err != nil { + if err := as.IsPutPermitted(ai, []byte(key)); err != nil { return err } } diff --git a/server/etcdserver/apply_auth_test.go b/server/etcdserver/apply_auth_test.go index 68681c7f1bec..1acd704f2a2b 100644 --- a/server/etcdserver/apply_auth_test.go +++ b/server/etcdserver/apply_auth_test.go @@ -53,24 +53,24 @@ func TestCheckLeasePutsKeys(t *testing.T) { defer as.AuthDisable() aa := authApplierV3{as: as} - assert.NoError(t, aa.checkLeasePutsKeys(lease.NewLease(lease.LeaseID(1), 3600)), "auth is disabled, should allow puts") + assert.NoError(t, checkLeasePutsKeys(aa.as, &aa.authInfo, lease.NewLease(lease.LeaseID(1), 3600)), "auth is disabled, should allow puts") assert.NoError(t, enableAuthAndCreateRoot(aa.as), "error while enabling auth") aa.authInfo = auth.AuthInfo{Username: "root"} - assert.NoError(t, aa.checkLeasePutsKeys(lease.NewLease(lease.LeaseID(1), 3600)), "auth is enabled, should allow puts for root") + assert.NoError(t, checkLeasePutsKeys(aa.as, &aa.authInfo, lease.NewLease(lease.LeaseID(1), 3600)), "auth is enabled, should allow puts for root") l := lease.NewLease(lease.LeaseID(1), 3600) l.SetLeaseItem(lease.LeaseItem{Key: "a"}) aa.authInfo = auth.AuthInfo{Username: "bob", Revision: 0} - assert.ErrorIs(t, aa.checkLeasePutsKeys(l), auth.ErrUserEmpty, "auth is enabled, should not allow bob, non existing at rev 0") + assert.ErrorIs(t, checkLeasePutsKeys(aa.as, &aa.authInfo, l), auth.ErrUserEmpty, "auth is enabled, should not allow bob, non existing at rev 0") aa.authInfo = auth.AuthInfo{Username: "bob", Revision: 1} - assert.ErrorIs(t, aa.checkLeasePutsKeys(l), auth.ErrAuthOldRevision, "auth is enabled, old revision") + assert.ErrorIs(t, checkLeasePutsKeys(aa.as, &aa.authInfo, l), auth.ErrAuthOldRevision, "auth is enabled, old revision") aa.authInfo = auth.AuthInfo{Username: "bob", Revision: aa.as.Revision()} - assert.ErrorIs(t, aa.checkLeasePutsKeys(l), auth.ErrPermissionDenied, "auth is enabled, bob does not have permissions, bob does not exist") + assert.ErrorIs(t, checkLeasePutsKeys(aa.as, &aa.authInfo, l), auth.ErrPermissionDenied, "auth is enabled, bob does not have permissions, bob does not exist") _, err := aa.as.UserAdd(&pb.AuthUserAddRequest{Name: "bob", Options: &authpb.UserAddOptions{NoPassword: true}}) assert.NoError(t, err, "bob should be added without error") aa.authInfo = auth.AuthInfo{Username: "bob", Revision: aa.as.Revision()} - assert.ErrorIs(t, aa.checkLeasePutsKeys(l), auth.ErrPermissionDenied, "auth is enabled, bob exists yet does not have permissions") + assert.ErrorIs(t, checkLeasePutsKeys(aa.as, &aa.authInfo, l), auth.ErrPermissionDenied, "auth is enabled, bob exists yet does not have permissions") // allow bob to access "a" _, err = aa.as.RoleAdd(&pb.AuthRoleAddRequest{Name: "bobsrole"}) @@ -91,7 +91,7 @@ func TestCheckLeasePutsKeys(t *testing.T) { assert.NoError(t, err, "bob should be granted bobsrole without error") aa.authInfo = auth.AuthInfo{Username: "bob", Revision: aa.as.Revision()} - assert.NoError(t, aa.checkLeasePutsKeys(l), "bob should be able to access key 'a'") + assert.NoError(t, checkLeasePutsKeys(aa.as, &aa.authInfo, l), "bob should be able to access key 'a'") } diff --git a/server/etcdserver/apply_auth_txn_test.go b/server/etcdserver/apply_auth_txn_test.go new file mode 100644 index 000000000000..b352a523fb44 --- /dev/null +++ b/server/etcdserver/apply_auth_txn_test.go @@ -0,0 +1,394 @@ +// Copyright 2022 The etcd Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package etcdserver + +import ( + "testing" + "time" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "go.uber.org/zap/zaptest" + + "go.etcd.io/etcd/api/v3/authpb" + pb "go.etcd.io/etcd/api/v3/etcdserverpb" + "go.etcd.io/etcd/server/v3/auth" + "go.etcd.io/etcd/server/v3/lease" + "go.etcd.io/etcd/server/v3/mvcc/backend" + betesting "go.etcd.io/etcd/server/v3/mvcc/backend/testing" +) + +// checkTxnAuth variables setup. +var ( + inRangeCompare = &pb.Compare{ + Key: []byte("foo"), + RangeEnd: []byte("zoo"), + } + outOfRangeCompare = &pb.Compare{ + Key: []byte("boo"), + RangeEnd: []byte("zoo"), + } + nilRequestPut = &pb.RequestOp{ + Request: &pb.RequestOp_RequestPut{ + RequestPut: nil, + }, + } + inRangeRequestPut = &pb.RequestOp{ + Request: &pb.RequestOp_RequestPut{ + RequestPut: &pb.PutRequest{ + Key: []byte("foo"), + }, + }, + } + outOfRangeRequestPut = &pb.RequestOp{ + Request: &pb.RequestOp_RequestPut{ + RequestPut: &pb.PutRequest{ + Key: []byte("boo"), + }, + }, + } + nilRequestRange = &pb.RequestOp{ + Request: &pb.RequestOp_RequestRange{ + RequestRange: nil, + }, + } + inRangeRequestRange = &pb.RequestOp{ + Request: &pb.RequestOp_RequestRange{ + RequestRange: &pb.RangeRequest{ + Key: []byte("foo"), + RangeEnd: []byte("zoo"), + }, + }, + } + outOfRangeRequestRange = &pb.RequestOp{ + Request: &pb.RequestOp_RequestRange{ + RequestRange: &pb.RangeRequest{ + Key: []byte("boo"), + RangeEnd: []byte("zoo"), + }, + }, + } + nilRequestDeleteRange = &pb.RequestOp{ + Request: &pb.RequestOp_RequestDeleteRange{ + RequestDeleteRange: nil, + }, + } + inRangeRequestDeleteRange = &pb.RequestOp{ + Request: &pb.RequestOp_RequestDeleteRange{ + RequestDeleteRange: &pb.DeleteRangeRequest{ + Key: []byte("foo"), + RangeEnd: []byte("zoo"), + PrevKv: true, + }, + }, + } + outOfRangeRequestDeleteRange = &pb.RequestOp{ + Request: &pb.RequestOp_RequestDeleteRange{ + RequestDeleteRange: &pb.DeleteRangeRequest{ + Key: []byte("boo"), + RangeEnd: []byte("zoo"), + PrevKv: true, + }, + }, + } + outOfRangeRequestDeleteRangeKvFalse = &pb.RequestOp{ + Request: &pb.RequestOp_RequestDeleteRange{ + RequestDeleteRange: &pb.DeleteRangeRequest{ + Key: []byte("boo"), + RangeEnd: []byte("zoo"), + PrevKv: false, + }, + }, + } +) + +func setupAuth(t *testing.T, be backend.Backend) auth.AuthStore { + lg := zaptest.NewLogger(t) + + simpleTokenTTLDefault := 300 * time.Second + tokenTypeSimple := "simple" + dummyIndexWaiter := func(index uint64) <-chan struct{} { + ch := make(chan struct{}, 1) + go func() { + ch <- struct{}{} + }() + return ch + } + + tp, _ := auth.NewTokenProvider(zaptest.NewLogger(t), tokenTypeSimple, dummyIndexWaiter, simpleTokenTTLDefault) + + as := auth.NewAuthStore(lg, be, tp, 4) + + // create "root" user and "foo" user with limited range + _, err := as.RoleAdd(&pb.AuthRoleAddRequest{Name: "root"}) + require.NoError(t, err) + + _, err = as.RoleAdd(&pb.AuthRoleAddRequest{Name: "rw"}) + require.NoError(t, err) + + _, err = as.RoleGrantPermission(&pb.AuthRoleGrantPermissionRequest{ + Name: "rw", + Perm: &authpb.Permission{ + PermType: authpb.READWRITE, + Key: []byte("foo"), + RangeEnd: []byte("zoo"), + }, + }) + require.NoError(t, err) + + _, err = as.UserAdd(&pb.AuthUserAddRequest{Name: "root", Password: "foo"}) + require.NoError(t, err) + + _, err = as.UserAdd(&pb.AuthUserAddRequest{Name: "foo", Password: "foo"}) + require.NoError(t, err) + + _, err = as.UserGrantRole(&pb.AuthUserGrantRoleRequest{User: "root", Role: "root"}) + require.NoError(t, err) + + _, err = as.UserGrantRole(&pb.AuthUserGrantRoleRequest{User: "foo", Role: "rw"}) + require.NoError(t, err) + + err = as.AuthEnable() + require.NoError(t, err) + + return as +} + +func TestCheckTxnAuth(t *testing.T) { + be, _ := betesting.NewDefaultTmpBackend(t) + defer betesting.Close(t, be) + as := setupAuth(t, be) + + tests := []struct { + name string + txnRequest *pb.TxnRequest + err error + }{ + { + name: "Out of range compare is unauthorized", + txnRequest: &pb.TxnRequest{ + Compare: []*pb.Compare{outOfRangeCompare}, + }, + err: auth.ErrPermissionDenied, + }, + { + name: "In range compare is authorized", + txnRequest: &pb.TxnRequest{ + Compare: []*pb.Compare{inRangeCompare}, + }, + err: nil, + }, + { + name: "Nil request range is always authorized", + txnRequest: &pb.TxnRequest{ + Success: []*pb.RequestOp{nilRequestRange}, + }, + err: nil, + }, + { + name: "Range request in range is authorized", + txnRequest: &pb.TxnRequest{ + Success: []*pb.RequestOp{inRangeRequestRange}, + Failure: []*pb.RequestOp{inRangeRequestRange}, + }, + err: nil, + }, + { + name: "Range request out of range success case is unauthorized", + txnRequest: &pb.TxnRequest{ + Success: []*pb.RequestOp{outOfRangeRequestRange}, + Failure: []*pb.RequestOp{inRangeRequestRange}, + }, + err: auth.ErrPermissionDenied, + }, + { + name: "Range request out of range failure case is unauthorized", + txnRequest: &pb.TxnRequest{ + Success: []*pb.RequestOp{inRangeRequestRange}, + Failure: []*pb.RequestOp{outOfRangeRequestRange}, + }, + err: auth.ErrPermissionDenied, + }, + { + name: "Nil Put request is always authorized", + txnRequest: &pb.TxnRequest{ + Success: []*pb.RequestOp{nilRequestPut}, + }, + err: nil, + }, + { + name: "Put request in range in authorized", + txnRequest: &pb.TxnRequest{ + Success: []*pb.RequestOp{inRangeRequestPut}, + Failure: []*pb.RequestOp{inRangeRequestPut}, + }, + err: nil, + }, + { + name: "Put request out of range success case is unauthorized", + txnRequest: &pb.TxnRequest{ + Success: []*pb.RequestOp{outOfRangeRequestPut}, + Failure: []*pb.RequestOp{inRangeRequestPut}, + }, + err: auth.ErrPermissionDenied, + }, + { + name: "Put request out of range failure case is unauthorized", + txnRequest: &pb.TxnRequest{ + Success: []*pb.RequestOp{inRangeRequestPut}, + Failure: []*pb.RequestOp{outOfRangeRequestPut}, + }, + err: auth.ErrPermissionDenied, + }, + { + name: "Nil delete request is authorized", + txnRequest: &pb.TxnRequest{ + Success: []*pb.RequestOp{nilRequestDeleteRange}, + }, + err: nil, + }, + { + name: "Delete range request in range is authorized", + txnRequest: &pb.TxnRequest{ + Success: []*pb.RequestOp{inRangeRequestDeleteRange}, + Failure: []*pb.RequestOp{inRangeRequestDeleteRange}, + }, + err: nil, + }, + { + name: "Delete range request out of range success case is unauthorized", + txnRequest: &pb.TxnRequest{ + Success: []*pb.RequestOp{outOfRangeRequestDeleteRange}, + Failure: []*pb.RequestOp{inRangeRequestDeleteRange}, + }, + err: auth.ErrPermissionDenied, + }, + { + name: "Delete range request out of range failure case is unauthorized", + txnRequest: &pb.TxnRequest{ + Success: []*pb.RequestOp{inRangeRequestDeleteRange}, + Failure: []*pb.RequestOp{outOfRangeRequestDeleteRange}, + }, + err: auth.ErrPermissionDenied, + }, + { + name: "Delete range request out of range and PrevKv false success case is unauthorized", + txnRequest: &pb.TxnRequest{ + Success: []*pb.RequestOp{outOfRangeRequestDeleteRangeKvFalse}, + Failure: []*pb.RequestOp{inRangeRequestDeleteRange}, + }, + err: auth.ErrPermissionDenied, + }, + { + name: "Delete range request out of range and PrevKv false failure case is unauthorized", + txnRequest: &pb.TxnRequest{ + Success: []*pb.RequestOp{inRangeRequestDeleteRange}, + Failure: []*pb.RequestOp{outOfRangeRequestDeleteRangeKvFalse}, + }, + err: auth.ErrPermissionDenied, + }, + { + name: "Nested txn request in range is authorized", + txnRequest: &pb.TxnRequest{ + Success: []*pb.RequestOp{ + { + Request: &pb.RequestOp_RequestTxn{ + RequestTxn: &pb.TxnRequest{ + Success: []*pb.RequestOp{inRangeRequestRange, inRangeRequestPut}, + Failure: []*pb.RequestOp{inRangeRequestDeleteRange}, + }, + }, + }, + }, + }, + err: nil, + }, + { + name: "Nested txn request out of range success case is unauthorized", + txnRequest: &pb.TxnRequest{ + Success: []*pb.RequestOp{ + { + Request: &pb.RequestOp_RequestTxn{ + RequestTxn: &pb.TxnRequest{ + Success: []*pb.RequestOp{outOfRangeRequestRange}, + }, + }, + }, + }, + }, + err: auth.ErrPermissionDenied, + }, + { + name: "Nested txn request out of range failure case is unauthorized", + txnRequest: &pb.TxnRequest{ + Failure: []*pb.RequestOp{ + { + Request: &pb.RequestOp_RequestTxn{ + RequestTxn: &pb.TxnRequest{ + Failure: []*pb.RequestOp{outOfRangeRequestPut}, + }, + }, + }, + }, + }, + err: auth.ErrPermissionDenied, + }, + { + name: "Nested txn request out of range delete is unauthorized", + txnRequest: &pb.TxnRequest{ + Success: []*pb.RequestOp{ + { + Request: &pb.RequestOp_RequestTxn{ + RequestTxn: &pb.TxnRequest{ + Success: []*pb.RequestOp{outOfRangeRequestDeleteRange}, + }, + }, + }, + }, + }, + err: auth.ErrPermissionDenied, + }, + { + name: "Two level nested txn request out of range delete is unauthorized", + txnRequest: &pb.TxnRequest{ + Success: []*pb.RequestOp{ + { + Request: &pb.RequestOp_RequestTxn{ + RequestTxn: &pb.TxnRequest{ + Failure: []*pb.RequestOp{ + { + Request: &pb.RequestOp_RequestTxn{ + RequestTxn: &pb.TxnRequest{ + Success: []*pb.RequestOp{outOfRangeRequestDeleteRange}, + }, + }, + }, + }, + }, + }, + }, + }, + }, + err: auth.ErrPermissionDenied, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := checkTxnAuth(as, &auth.AuthInfo{Username: "foo", Revision: 8}, &lease.FakeLessor{}, tt.txnRequest) + assert.Equal(t, tt.err, err) + }) + } +} diff --git a/server/etcdserver/cluster_util.go b/server/etcdserver/cluster_util.go index eace8f69afc4..dde84e01e168 100644 --- a/server/etcdserver/cluster_util.go +++ b/server/etcdserver/cluster_util.go @@ -25,9 +25,11 @@ import ( "strings" "time" + "go.etcd.io/etcd/api/v3/v3rpc/rpctypes" "go.etcd.io/etcd/api/v3/version" "go.etcd.io/etcd/client/pkg/v3/types" "go.etcd.io/etcd/server/v3/etcdserver/api/membership" + "google.golang.org/grpc/metadata" "github.com/coreos/go-semver/semver" "go.uber.org/zap" @@ -340,6 +342,20 @@ func promoteMemberHTTP(ctx context.Context, url string, id uint64, peerRt http.R if err != nil { return nil, err } + + // add the auth token via HTTP header if present in gRPC metadata + if md, ok := metadata.FromIncomingContext(ctx); ok { + ts, ok := md[rpctypes.TokenFieldNameGRPC] + if !ok { + ts, ok = md[rpctypes.TokenFieldNameSwagger] + } + + if ok && len(ts) > 0 { + token := ts[0] + req.Header.Set("Authorization", token) + } + } + req = req.WithContext(ctx) resp, err := cc.Do(req) if err != nil { diff --git a/server/etcdserver/raft.go b/server/etcdserver/raft.go index b022c68fb04d..cc7d1e35e091 100644 --- a/server/etcdserver/raft.go +++ b/server/etcdserver/raft.go @@ -33,6 +33,7 @@ import ( "go.etcd.io/etcd/server/v3/config" "go.etcd.io/etcd/server/v3/etcdserver/api/membership" "go.etcd.io/etcd/server/v3/etcdserver/api/rafthttp" + "go.etcd.io/etcd/server/v3/etcdserver/cindex" "go.etcd.io/etcd/server/v3/mvcc/backend" "go.etcd.io/etcd/server/v3/revbump" "go.etcd.io/etcd/server/v3/wal" @@ -572,14 +573,26 @@ func restartNode(cfg config.ServerConfig, snapshot *raftpb.Snapshot) (types.ID, return id, cl, n, s, w } -func restartAsStandaloneNode(cfg config.ServerConfig, snapshot *raftpb.Snapshot, be backend.Backend) (types.ID, - *membership.RaftCluster, raft.Node, *raft.MemoryStorage, *wal.WAL) { +func restartAsStandaloneNode(cfg config.ServerConfig, snapshot *raftpb.Snapshot, ci cindex.ConsistentIndexer, be backend.Backend) (types.ID, *membership.RaftCluster, raft.Node, *raft.MemoryStorage, *wal.WAL) { var walsnap walpb.Snapshot if snapshot != nil { walsnap.Index, walsnap.Term = snapshot.Metadata.Index, snapshot.Metadata.Term } w, id, cid, st, ents := readWAL(cfg.Logger, cfg.WALDir(), walsnap, cfg.UnsafeNoFsync) + consistentIndex := ci.ConsistentIndex() + oldCommitIndex := st.Commit + // If only `HardState.Commit` increases, HardState won't be persisted + // to disk, even though the committed entries might have already been + // applied. This can result in consistent_index > CommitIndex. + // + // When restarting etcd with `--force-new-cluster`, all uncommitted + // entries are dropped. To avoid losing entries that were actually + // committed, we reset Commit to max(HardState.Commit, consistent_index). + // + // See: https://github.com/etcd-io/raft/pull/300 for more details. + st.Commit = max(oldCommitIndex, consistentIndex) + // discard the previously uncommitted entries for i, ent := range ents { if ent.Index > st.Commit { @@ -624,6 +637,7 @@ func restartAsStandaloneNode(cfg config.ServerConfig, snapshot *raftpb.Snapshot, "forcing restart member", zap.String("cluster-id", cid.String()), zap.String("local-member-id", id.String()), + zap.Uint64("wal-commit-index", oldCommitIndex), zap.Uint64("commit-index", st.Commit), ) @@ -664,6 +678,9 @@ func getIDs(lg *zap.Logger, snap *raftpb.Snapshot, ents []raftpb.Entry) []uint64 for _, id := range snap.Metadata.ConfState.Voters { ids[id] = true } + for _, id := range snap.Metadata.ConfState.Learners { + ids[id] = true + } } for _, e := range ents { if e.Type != raftpb.EntryConfChange { diff --git a/server/etcdserver/server.go b/server/etcdserver/server.go index 6d8097de9d32..0a96d7c2c270 100644 --- a/server/etcdserver/server.go +++ b/server/etcdserver/server.go @@ -538,7 +538,7 @@ func NewServer(cfg config.ServerConfig) (srv *EtcdServer, err error) { if !cfg.ForceNewCluster { id, cl, n, s, w = restartNode(cfg, snapshot) } else { - id, cl, n, s, w = restartAsStandaloneNode(cfg, snapshot, be) + id, cl, n, s, w = restartAsStandaloneNode(cfg, snapshot, ci, be) } cl.SetStore(st) @@ -1341,10 +1341,38 @@ func (s *EtcdServer) applySnapshot(ep *etcdProgress, apply *apply) { // wait for raftNode to persist snapshot onto the disk <-apply.notifyc + bemuUnlocked := false + s.bemu.Lock() + defer func() { + if !bemuUnlocked { + s.bemu.Unlock() + } + }() + + // gofail: var applyBeforeOpenSnapshot struct{} newbe, err := openSnapshotBackend(s.Cfg, s.snapshotter, apply.snapshot, s.beHooks) if err != nil { lg.Panic("failed to open snapshot backend", zap.Error(err)) } + lg.Info("applySnapshot: opened snapshot backend") + // gofail: var applyAfterOpenSnapshot struct{} + + lg.Info("restoring v2 store") + if err := s.v2store.Recovery(apply.snapshot.Data); err != nil { + lg.Panic("failed to restore v2 store", zap.Error(err)) + } + + if err := assertNoV2StoreContent(lg, s.v2store, s.Cfg.V2Deprecation); err != nil { + lg.Panic("illegal v2store content", zap.Error(err)) + } + + lg.Info("restored v2 store") + + lg.Info("checking and cleaning up zombie members during snapshot restore") + membership.CleanupZombieMembersIfNeeded(lg, newbe, s.v2store) + if err = membership.SyncLearnerPromotionIfNeeded(lg, newbe, s.v2store); err != nil { + lg.Error("Failed to sync learner promotion for v3store", zap.Error(err)) + } // We need to set the backend to consistIndex before recovering the lessor, // because lessor.Recover will commit the boltDB transaction, accordingly it @@ -1372,11 +1400,14 @@ func (s *EtcdServer) applySnapshot(ep *etcdProgress, apply *apply) { newbe.SetTxPostLockInsideApplyHook(s.getTxPostLockInsideApplyHook()) lg.Info("restored mvcc store", zap.Uint64("consistent-index", s.consistIndex.ConsistentIndex())) + oldbe := s.be + s.be = newbe + s.bemu.Unlock() + bemuUnlocked = true + // Closing old backend might block until all the txns // on the backend are finished. // We do not want to wait on closing the old backend. - s.bemu.Lock() - oldbe := s.be go func() { lg.Info("closing old backend file") defer func() { @@ -1387,9 +1418,6 @@ func (s *EtcdServer) applySnapshot(ep *etcdProgress, apply *apply) { } }() - s.be = newbe - s.bemu.Unlock() - lg.Info("restoring alarm store") if err := s.restoreAlarms(); err != nil { @@ -1406,17 +1434,6 @@ func (s *EtcdServer) applySnapshot(ep *etcdProgress, apply *apply) { lg.Info("restored auth store") } - lg.Info("restoring v2 store") - if err := s.v2store.Recovery(apply.snapshot.Data); err != nil { - lg.Panic("failed to restore v2 store", zap.Error(err)) - } - - if err := assertNoV2StoreContent(lg, s.v2store, s.Cfg.V2Deprecation); err != nil { - lg.Panic("illegal v2store content", zap.Error(err)) - } - - lg.Info("restored v2 store") - s.cluster.SetBackend(newbe) lg.Info("restoring cluster configuration") @@ -1695,9 +1712,10 @@ func (s *EtcdServer) mayAddMember(memb membership.Member) error { return ErrNotEnoughStartedMembers } - if !isConnectedFullySince(s.r.transport, time.Now().Add(-HealthInterval), s.ID(), s.cluster.VotingMembers()) { + // Treat the new member as unavailable when checking quorum safety. + if !isConnectedToQuorumAfterAddingNewMemberSince(s.r.transport, time.Now().Add(-HealthInterval), s.ID(), s.cluster.VotingMembers()) { lg.Warn( - "rejecting member add request; local member has not been connected to all peers, reconfigure breaks active quorum", + "rejecting member add request; local member has not been connected to majority peers, reconfigure breaks active quorum", zap.String("local-member-id", s.ID().String()), zap.String("requested-member-add", fmt.Sprintf("%+v", memb)), zap.Error(ErrUnhealthy), @@ -1930,6 +1948,19 @@ func (s *EtcdServer) UpdateMember(ctx context.Context, memb membership.Member) ( return s.configure(ctx, cc) } +func (s *EtcdServer) MemberList(ctx context.Context, r *pb.MemberListRequest) ([]*membership.Member, error) { + if r.Linearizable { + if err := s.LinearizableReadNotify(ctx); err != nil { + return nil, err + } + } + + if err := s.requireAuthInfo(ctx); err != nil { + return nil, err + } + return s.cluster.Members(), nil +} + func (s *EtcdServer) setCommittedIndex(v uint64) { atomic.StoreUint64(&s.committedIndex, v) } @@ -2258,6 +2289,12 @@ func (s *EtcdServer) apply( s.setAppliedIndex(e.Index) s.setTerm(e.Term) shouldStop = shouldStop || removedSelf + + if shouldApplyV3 { + s.lg.Info("checking and cleaning up zombie members if needed after confState changed") + s.cluster.CleanupZombieMembersIfNeeded(shouldApplyV3) + } + s.w.Trigger(cc.ID, &confChangeResponse{s.cluster.Members(), err}) default: @@ -2895,3 +2932,9 @@ func maybeDefragBackend(cfg config.ServerConfig, be backend.Backend) error { func (s *EtcdServer) CorruptionChecker() CorruptionChecker { return s.corruptionChecker } + +func (s *EtcdServer) Defragment() error { + s.bemu.Lock() + defer s.bemu.Unlock() + return s.be.Defrag() +} diff --git a/server/etcdserver/server_test.go b/server/etcdserver/server_test.go index 66fc200d7a65..47eb699937c1 100644 --- a/server/etcdserver/server_test.go +++ b/server/etcdserver/server_test.go @@ -16,6 +16,7 @@ package etcdserver import ( "context" + "encoding/binary" "encoding/json" "fmt" "io/ioutil" @@ -2205,3 +2206,216 @@ func TestIsActive(t *testing.T) { require.Equal(t, tc.expectActive, s.isActive()) } } + +func TestRequestCurrentIndex_LeaderChangedRace(t *testing.T) { + s, _ := setupTestRequestCurrentIndex(t) + + for i := 0; i < 100; i++ { + s.r.readStateC <- raft.ReadState{Index: 100} + + s.leaderChangedMu.Lock() + leaderChangedNotifier := s.leaderChanged + close(leaderChangedNotifier) + s.leaderChanged = make(chan struct{}) + s.leaderChangedMu.Unlock() + + index, err := s.requestCurrentIndex(leaderChangedNotifier) + require.ErrorIs(t, err, ErrLeaderChanged) + require.Equal(t, uint64(0), index) + + // Clear the readStateC channel for the next iteration, + select { + case <-s.r.readStateC: + default: + } + } +} + +func TestRequestCurrentIndex_UniqueRequestID(t *testing.T) { + s, mockRaft := setupTestRequestCurrentIndex(t) + + wg := sync.WaitGroup{} + wg.Add(1) + go func() { + defer wg.Done() + s.leaderChangedMu.Lock() + leaderChanged := s.leaderChanged + s.leaderChangedMu.Unlock() + s.requestCurrentIndex(leaderChanged) + }() + + require.Eventually(t, func() bool { + return len(mockRaft.getRequests()) >= 2 + }, time.Second, 100*time.Millisecond) + + s.leaderChangedMu.Lock() + close(s.leaderChanged) + s.leaderChangedMu.Unlock() + wg.Wait() + + seen := make(map[uint64]bool) + for _, id := range mockRaft.getRequests() { + require.Falsef(t, seen[id], "Found duplicate request ID: %d", id) + seen[id] = true + } +} + +func TestRequestCurrentIndex_Success(t *testing.T) { + s, mockRaft := setupTestRequestCurrentIndex(t) + + wg := sync.WaitGroup{} + wg.Add(1) + var index uint64 + var err error + go func() { + defer wg.Done() + s.leaderChangedMu.Lock() + leaderChanged := s.leaderChanged + s.leaderChangedMu.Unlock() + index, err = s.requestCurrentIndex(leaderChanged) + }() + + require.Eventually(t, func() bool { + return len(mockRaft.getRequests()) == 1 + }, time.Second, 100*time.Millisecond) + + reqID := mockRaft.getRequests()[0] + reqIDBytes := make([]byte, 8) + binary.BigEndian.PutUint64(reqIDBytes, reqID) + + s.r.readStateC <- raft.ReadState{ + Index: 100, + RequestCtx: reqIDBytes, + } + + wg.Wait() + + require.NoError(t, err) + require.Equal(t, uint64(100), index) + require.Lenf(t, mockRaft.getRequests(), 1, "Expected exactly 1 ReadIndex request") +} + +func TestRequestCurrentIndex_WrongRequestID(t *testing.T) { + s, mockRaft := setupTestRequestCurrentIndex(t) + + wg := sync.WaitGroup{} + wg.Add(1) + var index uint64 + var err error + go func() { + defer wg.Done() + s.leaderChangedMu.Lock() + leaderChanged := s.leaderChanged + s.leaderChangedMu.Unlock() + index, err = s.requestCurrentIndex(leaderChanged) + }() + + require.Eventually(t, func() bool { + return len(mockRaft.getRequests()) == 1 + }, time.Second, 10*time.Millisecond) + + wrongReqIDBytes := make([]byte, 8) + binary.BigEndian.PutUint64(wrongReqIDBytes, 99999) + + s.r.readStateC <- raft.ReadState{ + Index: 100, + RequestCtx: wrongReqIDBytes, + } + + time.Sleep(100 * time.Millisecond) + requests := mockRaft.getRequests() + require.Lenf(t, requests, 1, "Expected exactly 1 ReadIndex request") + + reqID := requests[0] + reqIDBytes := make([]byte, 8) + binary.BigEndian.PutUint64(reqIDBytes, reqID) + + s.r.readStateC <- raft.ReadState{ + Index: 99, + RequestCtx: reqIDBytes, + } + wg.Wait() + + require.NoError(t, err) + require.Equal(t, uint64(99), index) + require.Lenf(t, mockRaft.getRequests(), 1, "Expected exactly 1 ReadIndex request") +} + +func TestRequestCurrentIndex_DelayedResponse(t *testing.T) { + s, mockRaft := setupTestRequestCurrentIndex(t) + + wg := sync.WaitGroup{} + wg.Add(1) + var index uint64 + var err error + go func() { + defer wg.Done() + s.leaderChangedMu.Lock() + leaderChanged := s.leaderChanged + s.leaderChangedMu.Unlock() + index, err = s.requestCurrentIndex(leaderChanged) + }() + + require.Eventually(t, func() bool { + return len(mockRaft.getRequests()) >= 3 + }, 2*time.Second, 100*time.Millisecond) + requests := mockRaft.getRequests() + + reqID := requests[1] + reqIDBytes := make([]byte, 8) + binary.BigEndian.PutUint64(reqIDBytes, reqID) + + select { + case s.r.readStateC <- raft.ReadState{ + Index: 100, + RequestCtx: reqIDBytes, + }: + case <-time.After(time.Second): + t.Fatal("timed out sending read state") + } + wg.Wait() + + require.NoError(t, err) + require.Equal(t, uint64(100), index) +} + +func setupTestRequestCurrentIndex(t *testing.T) (*EtcdServer, *testRaftNode) { + mockRaft := &testRaftNode{} + s := &EtcdServer{ + lgMu: new(sync.RWMutex), + lg: zaptest.NewLogger(t), + reqIDGen: idutil.NewGenerator(0, time.Time{}), + firstCommitInTermC: make(chan struct{}), + leaderChanged: make(chan struct{}), + r: raftNode{ + raftNodeConfig: raftNodeConfig{ + Node: mockRaft, + }, + readStateC: make(chan raft.ReadState, 1), + }, + } + return s, mockRaft +} + +type testRaftNode struct { + raft.Node + mu sync.Mutex + readIndexRequests []uint64 +} + +func (m *testRaftNode) ReadIndex(ctx context.Context, rctx []byte) error { + m.mu.Lock() + defer m.mu.Unlock() + if len(rctx) == 8 { + m.readIndexRequests = append(m.readIndexRequests, binary.BigEndian.Uint64(rctx)) + } + return nil +} + +func (m *testRaftNode) getRequests() []uint64 { + m.mu.Lock() + defer m.mu.Unlock() + res := make([]uint64, len(m.readIndexRequests)) + copy(res, m.readIndexRequests) + return res +} diff --git a/server/etcdserver/util.go b/server/etcdserver/util.go index b048b86416e2..7f115829e8f5 100644 --- a/server/etcdserver/util.go +++ b/server/etcdserver/util.go @@ -21,6 +21,7 @@ import ( "time" "github.com/golang/protobuf/proto" + pb "go.etcd.io/etcd/api/v3/etcdserverpb" "go.etcd.io/etcd/client/pkg/v3/types" "go.etcd.io/etcd/server/v3/etcdserver/api/membership" @@ -29,12 +30,30 @@ import ( "go.uber.org/zap" ) -// isConnectedToQuorumSince checks whether the local member is connected to the -// quorum of the cluster since the given time. +// isConnectedToQuorumSince reports whether the local member has been connected +// to a quorum of the current cluster continuously since the given time. func isConnectedToQuorumSince(transport rafthttp.Transporter, since time.Time, self types.ID, members []*membership.Member) bool { return numConnectedSince(transport, since, self, members) >= (len(members)/2)+1 } +// isConnectedToQuorumAfterAddingNewMemberSince reports whether the local member +// has been connected to a quorum continuously since the given time, assuming a +// new member is being added to the cluster. +// +// For a single-member cluster, it always returns true to allow membership +// expansion. +func isConnectedToQuorumAfterAddingNewMemberSince(transport rafthttp.Transporter, since time.Time, self types.ID, members []*membership.Member) bool { + if len(members) == 1 { + // If it's a single member cluster, we should allow adding a new member + return true + } + return numConnectedSince(transport, since, self, members) >= quorum(len(members)+1) +} + +func quorum(num int) int { + return num/2 + 1 +} + // isConnectedSince checks whether the local member is connected to the // remote member since the given time. func isConnectedSince(transport rafthttp.Transporter, since time.Time, remote types.ID) bool { @@ -42,12 +61,6 @@ func isConnectedSince(transport rafthttp.Transporter, since time.Time, remote ty return !t.IsZero() && t.Before(since) } -// isConnectedFullySince checks whether the local member is connected to all -// members in the cluster since the given time. -func isConnectedFullySince(transport rafthttp.Transporter, since time.Time, self types.ID, members []*membership.Member) bool { - return numConnectedSince(transport, since, self, members) == len(members) -} - // numConnectedSince counts how many members are connected to the local member // since the given time. func numConnectedSince(transport rafthttp.Transporter, since time.Time, self types.ID, members []*membership.Member) int { diff --git a/server/etcdserver/v3_server.go b/server/etcdserver/v3_server.go index a9e1f3586afe..01b32ea1a60e 100644 --- a/server/etcdserver/v3_server.go +++ b/server/etcdserver/v3_server.go @@ -15,7 +15,6 @@ package etcdserver import ( - "bytes" "context" "encoding/base64" "encoding/binary" @@ -170,7 +169,7 @@ func (s *EtcdServer) Txn(ctx context.Context, r *pb.TxnRequest) (*pb.TxnResponse var resp *pb.TxnResponse var err error chk := func(ai *auth.AuthInfo) error { - return checkTxnAuth(s.authStore, ai, r) + return checkTxnAuth(s.authStore, ai, s.lessor, r) } defer func(start time.Time) { @@ -268,6 +267,11 @@ func (s *EtcdServer) LeaseGrant(ctx context.Context, r *pb.LeaseGrantRequest) (* // only use positive int64 id's r.ID = int64(s.reqIDGen.Next() & ((1 << 63) - 1)) } + + if err := s.requireAuthInfo(ctx); err != nil { + return nil, err + } + resp, err := s.raftRequestOnce(ctx, pb.InternalRaftRequest{LeaseGrant: r}) if err != nil { return nil, err @@ -288,6 +292,10 @@ func (s *EtcdServer) waitAppliedIndex() error { } func (s *EtcdServer) LeaseRevoke(ctx context.Context, r *pb.LeaseRevokeRequest) (*pb.LeaseRevokeResponse, error) { + if err := s.requireAuthInfo(ctx); err != nil { + return nil, err + } + resp, err := s.raftRequestOnce(ctx, pb.InternalRaftRequest{LeaseRevoke: r}) if err != nil { return nil, err @@ -312,6 +320,10 @@ func (s *EtcdServer) LeaseRenew(ctx context.Context, id lease.LeaseID) (int64, e return 0, err } + if err := s.checkLeaseRenew(ctx, id); err != nil { + return 0, err + } + ttl, err := s.lessor.Renew(id) if err == nil { // already requested to primary lessor(leader) return ttl, nil @@ -330,6 +342,11 @@ func (s *EtcdServer) LeaseRenew(ctx context.Context, id lease.LeaseID) (int64, e if lerr != nil { return -1, lerr } + + if err := s.checkLeaseRenew(ctx, id); err != nil { + return 0, err + } + for _, url := range leader.PeerURLs { lurl := url + leasehttp.LeasePrefix ttl, err := leasehttp.RenewHTTP(cctx, id, lurl, s.peerRt) @@ -347,6 +364,39 @@ func (s *EtcdServer) LeaseRenew(ctx context.Context, id lease.LeaseID) (int64, e return -1, ErrCanceled } +func (s *EtcdServer) checkLeaseRenew(ctx context.Context, leaseID lease.LeaseID) error { + rev := s.AuthStore().Revision() + if !s.AuthStore().IsAuthEnabled() { + return nil + } + + authInfo, err := s.AuthInfoFromCtx(ctx) + if err != nil { + return err + } + if authInfo == nil { + return auth.ErrUserEmpty + } + + if s.AuthStore().IsAdminPermitted(authInfo) == nil { + return nil + } + + l := s.lessor.Lookup(leaseID) + if l != nil { + for _, key := range l.Keys() { + if err := s.AuthStore().IsPutPermitted(authInfo, []byte(key)); err != nil { + return err + } + } + } + + if rev != s.AuthStore().Revision() { + return auth.ErrAuthOldRevision + } + return nil +} + func (s *EtcdServer) checkLeaseTimeToLive(ctx context.Context, leaseID lease.LeaseID) (uint64, error) { rev := s.AuthStore().Revision() if !s.AuthStore().IsAuthEnabled() { @@ -360,6 +410,10 @@ func (s *EtcdServer) checkLeaseTimeToLive(ctx context.Context, leaseID lease.Lea return rev, auth.ErrUserEmpty } + if s.AuthStore().IsAdminPermitted(authInfo) == nil { + return rev, nil + } + l := s.lessor.Lookup(leaseID) if l != nil { for _, key := range l.Keys() { @@ -435,6 +489,10 @@ func (s *EtcdServer) leaseTimeToLive(ctx context.Context, r *pb.LeaseTimeToLiveR } func (s *EtcdServer) LeaseTimeToLive(ctx context.Context, r *pb.LeaseTimeToLiveRequest) (*pb.LeaseTimeToLiveResponse, error) { + if err := s.requireAuthInfo(ctx); err != nil { + return nil, err + } + var rev uint64 var err error if r.Keys { @@ -461,6 +519,11 @@ func (s *EtcdServer) LeaseTimeToLive(ctx context.Context, r *pb.LeaseTimeToLiveR // LeaseLeases is really ListLeases !??? func (s *EtcdServer) LeaseLeases(ctx context.Context, r *pb.LeaseLeasesRequest) (*pb.LeaseLeasesResponse, error) { ls := s.lessor.Leases() + + if err := s.checkLeaseLeases(ctx, ls); err != nil { + return nil, err + } + lss := make([]*pb.LeaseStatus, len(ls)) for i := range ls { lss[i] = &pb.LeaseStatus{ID: int64(ls[i].ID)} @@ -468,6 +531,40 @@ func (s *EtcdServer) LeaseLeases(ctx context.Context, r *pb.LeaseLeasesRequest) return &pb.LeaseLeasesResponse{Header: newHeader(s), Leases: lss}, nil } +func (s *EtcdServer) checkLeaseLeases(ctx context.Context, leases []*lease.Lease) error { + rev := s.AuthStore().Revision() + + if !s.AuthStore().IsAuthEnabled() { + return nil + } + + authInfo, err := s.AuthInfoFromCtx(ctx) + if err != nil { + return err + } + + if authInfo == nil { + return auth.ErrUserEmpty + } + + if err := s.AuthStore().IsAdminPermitted(authInfo); err == nil { + return nil + } + + for _, l := range leases { + for _, key := range l.Keys() { + if err := s.AuthStore().IsRangePermitted(authInfo, []byte(key), []byte{}); err != nil { + return err + } + } + } + + if rev != s.AuthStore().Revision() { + return auth.ErrAuthOldRevision + } + return nil +} + func (s *EtcdServer) waitLeader(ctx context.Context) (*membership.Member, error) { leader := s.cluster.Member(s.Leader()) for leader == nil { @@ -813,7 +910,6 @@ func (s *EtcdServer) Watchable() mvcc.WatchableKV { return s.KV() } func (s *EtcdServer) linearizableReadLoop() { for { - requestId := s.reqIDGen.Next() leaderChangedNotifier := s.LeaderChangedNotify() select { case <-leaderChangedNotifier: @@ -833,7 +929,7 @@ func (s *EtcdServer) linearizableReadLoop() { s.readNotifier = nextnr s.readMu.Unlock() - confirmedIndex, err := s.requestCurrentIndex(leaderChangedNotifier, requestId) + confirmedIndex, err := s.requestCurrentIndex(leaderChangedNotifier) if isStopped(err) { return } @@ -868,8 +964,11 @@ func isStopped(err error) bool { return err == raft.ErrStopped || err == ErrStopped } -func (s *EtcdServer) requestCurrentIndex(leaderChangedNotifier <-chan struct{}, requestId uint64) (uint64, error) { - err := s.sendReadIndex(requestId) +func (s *EtcdServer) requestCurrentIndex(leaderChangedNotifier <-chan struct{}) (uint64, error) { + requestIDs := map[uint64]struct{}{} + requestID := s.reqIDGen.Next() + requestIDs[requestID] = struct{}{} + err := s.sendReadIndex(requestID) if err != nil { return 0, err } @@ -885,19 +984,23 @@ func (s *EtcdServer) requestCurrentIndex(leaderChangedNotifier <-chan struct{}, for { select { case rs := <-s.r.readStateC: - requestIdBytes := uint64ToBigEndianBytes(requestId) - gotOwnResponse := bytes.Equal(rs.RequestCtx, requestIdBytes) - if !gotOwnResponse { + // Check again if leader changed as when multiple channels are ready, select picks randomly. + select { + case <-leaderChangedNotifier: + readIndexFailed.Inc() + return 0, ErrLeaderChanged + default: + } + responseID := uint64(0) + if len(rs.RequestCtx) == 8 { + responseID = binary.BigEndian.Uint64(rs.RequestCtx) + } + if _, ok := requestIDs[responseID]; !ok { // a previous request might time out. now we should ignore the response of it and // continue waiting for the response of the current requests. - responseId := uint64(0) - if len(rs.RequestCtx) == 8 { - responseId = binary.BigEndian.Uint64(rs.RequestCtx) - } lg.Warn( "ignored out-of-date read index response; local node read indexes queueing up and waiting to be in sync with leader", - zap.Uint64("sent-request-id", requestId), - zap.Uint64("received-request-id", responseId), + zap.Uint64("received-request-id", responseID), ) slowReadIndex.Inc() continue @@ -910,7 +1013,9 @@ func (s *EtcdServer) requestCurrentIndex(leaderChangedNotifier <-chan struct{}, case <-firstCommitInTermNotifier: firstCommitInTermNotifier = s.FirstCommitInTermNotify() lg.Info("first commit in current term: resending ReadIndex request") - err := s.sendReadIndex(requestId) + requestID = s.reqIDGen.Next() + requestIDs[requestID] = struct{}{} + err := s.sendReadIndex(requestID) if err != nil { return 0, err } @@ -919,10 +1024,12 @@ func (s *EtcdServer) requestCurrentIndex(leaderChangedNotifier <-chan struct{}, case <-retryTimer.C: lg.Warn( "waiting for ReadIndex response took too long, retrying", - zap.Uint64("sent-request-id", requestId), + zap.Uint64("sent-request-id", requestID), zap.Duration("retry-timeout", readIndexRetryTime), ) - err := s.sendReadIndex(requestId) + requestID = s.reqIDGen.Next() + requestIDs[requestID] = struct{}{} + err := s.sendReadIndex(requestID) if err != nil { return 0, err } @@ -1094,3 +1201,19 @@ func (s *EtcdServer) downgradeCancel(ctx context.Context) (*pb.DowngradeResponse resp := pb.DowngradeResponse{Version: s.ClusterVersion().String()} return &resp, nil } + +func (s *EtcdServer) requireAuthInfo(ctx context.Context) error { + if !s.authStore.IsAuthEnabled() { + return nil + } + + authInfo, err := s.AuthInfoFromCtx(ctx) + if err != nil { + return err + } + + if authInfo == nil { + return auth.ErrUserEmpty + } + return nil +} diff --git a/server/go.mod b/server/go.mod index ecc41bda77fd..988ad9c0ea1f 100644 --- a/server/go.mod +++ b/server/go.mod @@ -1,8 +1,8 @@ module go.etcd.io/etcd/server/v3 -go 1.22 +go 1.23 -toolchain go1.22.11 +toolchain go1.23.12 require ( github.com/coreos/go-semver v0.3.0 @@ -13,7 +13,7 @@ require ( github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da github.com/golang/protobuf v1.5.4 github.com/google/btree v1.0.1 - github.com/google/go-cmp v0.6.0 + github.com/google/go-cmp v0.7.0 github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 github.com/grpc-ecosystem/grpc-gateway v1.16.0 @@ -22,27 +22,27 @@ require ( github.com/prometheus/client_model v0.2.0 github.com/soheilhy/cmux v0.1.5 github.com/spf13/cobra v1.1.3 - github.com/stretchr/testify v1.9.0 + github.com/stretchr/testify v1.11.1 github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802 github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 go.etcd.io/bbolt v1.3.11 - go.etcd.io/etcd/api/v3 v3.5.18 - go.etcd.io/etcd/client/pkg/v3 v3.5.18 - go.etcd.io/etcd/client/v2 v2.305.18 - go.etcd.io/etcd/client/v3 v3.5.18 - go.etcd.io/etcd/pkg/v3 v3.5.18 - go.etcd.io/etcd/raft/v3 v3.5.18 + go.etcd.io/etcd/api/v3 v3.5.31 + go.etcd.io/etcd/client/pkg/v3 v3.5.31 + go.etcd.io/etcd/client/v2 v2.305.31 + go.etcd.io/etcd/client/v3 v3.5.31 + go.etcd.io/etcd/pkg/v3 v3.5.31 + go.etcd.io/etcd/raft/v3 v3.5.31 go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.0 - go.opentelemetry.io/otel v1.20.0 + go.opentelemetry.io/otel v1.34.0 go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.20.0 - go.opentelemetry.io/otel/sdk v1.20.0 + go.opentelemetry.io/otel/sdk v1.34.0 go.uber.org/multierr v1.6.0 go.uber.org/zap v1.17.0 golang.org/x/crypto v0.32.0 golang.org/x/net v0.34.0 golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba - google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d - google.golang.org/grpc v1.59.0 + google.golang.org/genproto/googleapis/api v0.0.0-20250115164207-1a7da9e5054f + google.golang.org/grpc v1.71.1 gopkg.in/natefinch/lumberjack.v2 v2.0.0 sigs.k8s.io/yaml v1.2.0 ) @@ -50,10 +50,11 @@ require ( require ( github.com/beorn7/perks v1.0.1 // indirect github.com/cenkalti/backoff/v4 v4.2.1 // indirect - github.com/cespare/xxhash/v2 v2.2.0 // indirect + github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-logr/logr v1.3.0 // indirect + github.com/go-logr/logr v1.4.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect + github.com/google/uuid v1.6.0 // indirect github.com/gorilla/websocket v1.4.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect github.com/inconshreveable/mousetrap v1.0.0 // indirect @@ -66,16 +67,17 @@ require ( github.com/prometheus/procfs v0.6.0 // indirect github.com/sirupsen/logrus v1.9.3 // indirect github.com/spf13/pflag v1.0.5 // indirect + go.opentelemetry.io/auto/sdk v1.1.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.20.0 // indirect - go.opentelemetry.io/otel/metric v1.20.0 // indirect - go.opentelemetry.io/otel/trace v1.20.0 // indirect + go.opentelemetry.io/otel/metric v1.34.0 // indirect + go.opentelemetry.io/otel/trace v1.34.0 // indirect go.opentelemetry.io/proto/otlp v1.0.0 // indirect go.uber.org/atomic v1.7.0 // indirect golang.org/x/sys v0.29.0 // indirect golang.org/x/text v0.21.0 // indirect google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect - google.golang.org/protobuf v1.33.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20250115164207-1a7da9e5054f // indirect + google.golang.org/protobuf v1.36.11 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/server/go.sum b/server/go.sum index e5f6fa072cef..11f6bfd11a49 100644 --- a/server/go.sum +++ b/server/go.sum @@ -8,9 +8,8 @@ cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg cloud.google.com/go v0.110.7 h1:rJyC7nWRg2jWGZ4wSJ5nY65GTdYJkg0cd/uXb+ACI6o= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/compute v1.23.0 h1:tP41Zoavr8ptEqaW6j+LQOnyBBhO7OkOMAGrgLopTwY= -cloud.google.com/go/compute v1.23.0/go.mod h1:4tCnrn48xsqlwSAiLf1HXMQk8CONslYbdiEZc9FEIbM= -cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= -cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= +cloud.google.com/go/compute/metadata v0.6.0 h1:A6hENjEsCDtC1k8byVsgwvVcioamEHvZ4j01OwKxG9I= +cloud.google.com/go/compute/metadata v0.6.0/go.mod h1:FjyFAW1MW0C203CEOMDTu3Dk1FlqW3Rga40jzHL4hfg= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= @@ -40,12 +39,12 @@ github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyY github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= -github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4 h1:/inchEIKaYC1Akx+H+gqO04wryn5h75LSazbRlnya1k= -github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20241223141626-cff3c89139a3 h1:boJj011Hh+874zpIySeApCX4GeOjPl9qhRF3QuIZq+Q= +github.com/cncf/xds/go v0.0.0-20241223141626-cff3c89139a3/go.mod h1:W+zGtBO5Y1IgJhy4+A9GOqVhqLpfZi+vwmdNXUehLA8= github.com/cockroachdb/datadriven v1.0.2 h1:H9MtNqVoVhvd9nCBwOyDjUEdZCREqbIdCJD93PBm/jA= github.com/cockroachdb/datadriven v1.0.2/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= @@ -68,8 +67,8 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/envoyproxy/protoc-gen-validate v1.0.2 h1:QkIBuU5k+x7/QXPvPPnWXWlCdaBFApVqftFV6k087DA= -github.com/envoyproxy/protoc-gen-validate v1.0.2/go.mod h1:GpiZQP3dDbg4JouG/NNS7QWXpgx6x8QiMKdmN72jogE= +github.com/envoyproxy/protoc-gen-validate v1.2.1 h1:DEo3O99U8j4hBFwbJfrz9VtgcDfUKS7KJ7spH3d86P8= +github.com/envoyproxy/protoc-gen-validate v1.2.1/go.mod h1:d/C80l/jxXLdfEIhX1W2TmLfsJ31lvEjwamM4DxlWXU= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= @@ -81,8 +80,8 @@ github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9 github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= -github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= +github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= @@ -94,8 +93,8 @@ github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69 github.com/golang-jwt/jwt/v4 v4.5.1 h1:JdqV9zKUdtaa9gdPlywC3aeoEsR681PlKC+4F5gQgeo= github.com/golang-jwt/jwt/v4 v4.5.1/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.1.2 h1:DVjP2PbBOzHyzA+dn3WhHIq4NdVu3Q+pvivFICf/7fo= -github.com/golang/glog v1.1.2/go.mod h1:zR+okUeTbrL6EL3xHUDxZuEtGv04p5shwip1+mL/rLQ= +github.com/golang/glog v1.2.4 h1:CNNw5U8lSiiBk7druxtSHHTsRWcxKoac6kZKm2peBBc= +github.com/golang/glog v1.2.4/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -125,14 +124,16 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= -github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= @@ -255,8 +256,8 @@ github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40T github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= -github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= +github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= +github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= @@ -287,8 +288,8 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802 h1:uruHq4dN7GR16kFc5fp3d1RIYzJW5onx8Ybykw2YQFA= @@ -302,20 +303,24 @@ go.etcd.io/bbolt v1.3.11 h1:yGEzV1wPz2yVCLsD8ZAiGHhHVlczyC9d1rP43/VCRJ0= go.etcd.io/bbolt v1.3.11/go.mod h1:dksAq7YMXoljX0xu6VF5DMZGbhYYoLUalEiSySYAS4I= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= +go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.0 h1:PzIubN4/sjByhDRHLviCjJuweBXWFZWhghjg7cS28+M= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.0/go.mod h1:Ct6zzQEuGK3WpJs2n4dn+wfJYzd/+hNnxMRTWjGn30M= -go.opentelemetry.io/otel v1.20.0 h1:vsb/ggIY+hUjD/zCAQHpzTmndPqv/ml2ArbsbfBYTAc= -go.opentelemetry.io/otel v1.20.0/go.mod h1:oUIGj3D77RwJdM6PPZImDpSZGDvkD9fhesHny69JFrs= +go.opentelemetry.io/otel v1.34.0 h1:zRLXxLCgL1WyKsPVrgbSdMN4c0FMkDAskSTQP+0hdUY= +go.opentelemetry.io/otel v1.34.0/go.mod h1:OWFPOQ+h4G8xpyjgqo4SxJYdDQ/qmRH+wivy7zzx9oI= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.20.0 h1:DeFD0VgTZ+Cj6hxravYYZE2W4GlneVH81iAOPjZkzk8= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.20.0/go.mod h1:GijYcYmNpX1KazD5JmWGsi4P7dDTTTnfv1UbGn84MnU= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.20.0 h1:gvmNvqrPYovvyRmCSygkUDyL8lC5Tl845MLEwqpxhEU= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.20.0/go.mod h1:vNUq47TGFioo+ffTSnKNdob241vePmtNZnAODKapKd0= -go.opentelemetry.io/otel/metric v1.20.0 h1:ZlrO8Hu9+GAhnepmRGhSU7/VkpjrNowxRN9GyKR4wzA= -go.opentelemetry.io/otel/metric v1.20.0/go.mod h1:90DRw3nfK4D7Sm/75yQ00gTJxtkBxX+wu6YaNymbpVM= -go.opentelemetry.io/otel/sdk v1.20.0 h1:5Jf6imeFZlZtKv9Qbo6qt2ZkmWtdWx/wzcCbNUlAWGM= -go.opentelemetry.io/otel/sdk v1.20.0/go.mod h1:rmkSx1cZCm/tn16iWDn1GQbLtsW/LvsdEEFzCSRM6V0= -go.opentelemetry.io/otel/trace v1.20.0 h1:+yxVAPZPbQhbC3OfAkeIVTky6iTFpcr4SiY9om7mXSQ= -go.opentelemetry.io/otel/trace v1.20.0/go.mod h1:HJSK7F/hA5RlzpZ0zKDCHCDHm556LCDtKaAo6JmBFUU= +go.opentelemetry.io/otel/metric v1.34.0 h1:+eTR3U0MyfWjRDhmFMxe2SsW64QrZ84AOhvqS7Y+PoQ= +go.opentelemetry.io/otel/metric v1.34.0/go.mod h1:CEDrp0fy2D0MvkXE+dPV7cMi8tWZwX3dmaIhwPOaqHE= +go.opentelemetry.io/otel/sdk v1.34.0 h1:95zS4k/2GOy069d321O8jWgYsW3MzVV+KuSPKp7Wr1A= +go.opentelemetry.io/otel/sdk v1.34.0/go.mod h1:0e/pNiaMAqaykJGKbi+tSjWfNNHMTxoC9qANsCzbyxU= +go.opentelemetry.io/otel/sdk/metric v1.34.0 h1:5CeK9ujjbFVL5c1PhLuStg1wxA7vQv7ce1EK0Gyvahk= +go.opentelemetry.io/otel/sdk/metric v1.34.0/go.mod h1:jQ/r8Ze28zRKoNRdkjCZxfs6YvBTG1+YIqyFVFYec5w= +go.opentelemetry.io/otel/trace v1.34.0 h1:+ouXS2V8Rd4hp4580a8q23bg0azF2nI8cqLYnC8mh/k= +go.opentelemetry.io/otel/trace v1.34.0/go.mod h1:Svm7lSjQD7kG7KJ/MUHPVXSDGz2OX4h0M2jHBhmSfRE= go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= @@ -384,8 +389,8 @@ golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAG golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.11.0 h1:vPL4xzxBM4niKCW6g9whtaWVXTJf1U5e4aZxxFx/gbU= -golang.org/x/oauth2 v0.11.0/go.mod h1:LdF7O/8bLR/qWK9DrpXmbHLTouvRHK0SgJl0GmDBchk= +golang.org/x/oauth2 v0.25.0 h1:CY4y7XT9v0cRI9oupztF8AgiIu99L/ksR/Xp/6jrZ70= +golang.org/x/oauth2 v0.25.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -464,8 +469,6 @@ google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9Ywl google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= -google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= -google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= @@ -479,10 +482,10 @@ google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfG google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d h1:VBu5YqKPv6XiJ199exd8Br+Aetz+o08F+PLMnwJQHAY= google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d/go.mod h1:yZTlhN0tQnXo3h00fuXNCxJdLdIdnVFVBaRJ5LWBbw4= -google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d h1:DoPTO70H+bcDXcd39vOqb2viZxgqeBeSGtZ55yZU4/Q= -google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d/go.mod h1:KjSP20unUpOx5kyQUFa7k4OJg0qeJ7DEZflGDu2p6Bk= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d h1:uvYuEyMHKNt+lT4K3bN6fGswmK8qSvcreM3BwjDh+y4= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= +google.golang.org/genproto/googleapis/api v0.0.0-20250115164207-1a7da9e5054f h1:gap6+3Gk41EItBuyi4XX/bp4oqJ3UwuIMl25yGinuAA= +google.golang.org/genproto/googleapis/api v0.0.0-20250115164207-1a7da9e5054f/go.mod h1:Ic02D47M+zbarjYYUlK57y316f2MoN0gjAwI3f2S95o= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250115164207-1a7da9e5054f h1:OxYkA3wjPsZyBylwymxSHa7ViiW1Sml4ToBrncvFehI= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250115164207-1a7da9e5054f/go.mod h1:+2Yz8+CLJbIfL9z73EW45avw8Lmge3xVElCP9zEKi50= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -491,8 +494,8 @@ google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= -google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= -google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= +google.golang.org/grpc v1.71.1 h1:ffsFWr7ygTUscGPI0KKK6TLrGz0476KUvvsbqWK0rPI= +google.golang.org/grpc v1.71.1/go.mod h1:H0GRtasmQOh9LkFoCPDu3ZrwUtD1YGE+b2vYBYd/8Ec= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -500,8 +503,8 @@ google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miE google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= -google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= +google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/server/lease/lessor.go b/server/lease/lessor.go index c21a3e2be883..b841e1660970 100644 --- a/server/lease/lessor.go +++ b/server/lease/lessor.go @@ -429,6 +429,8 @@ func (le *lessor) Renew(id LeaseID) (int64, error) { } } + // gofail: var beforeCheckpointInLeaseRenew struct{} + // Clear remaining TTL when we renew if it is set // By applying a RAFT entry only when the remainingTTL is already set, we limit the number // of RAFT entries written per lease to a max of 2 per checkpoint interval. @@ -439,6 +441,12 @@ func (le *lessor) Renew(id LeaseID) (int64, error) { } le.mu.Lock() + // Re-check in case the lease was revoked immediately after the previous check + l = le.leaseMap[id] + if l == nil { + le.mu.Unlock() + return -1, ErrLeaseNotFound + } l.refresh(0) item := &LeaseWithTime{id: l.ID, time: l.expiry} le.leaseExpiredNotifier.RegisterOrUpdate(item) diff --git a/server/mvcc/kvstore_compaction.go b/server/mvcc/kvstore_compaction.go index 6f3d1e59a742..5c81a2ebc2fd 100644 --- a/server/mvcc/kvstore_compaction.go +++ b/server/mvcc/kvstore_compaction.go @@ -65,6 +65,8 @@ func (s *store) scheduleCompaction(compactMainRev, prevCompactRev int64) (KeyVal revToBytes(revision{main: compactMainRev}, rbytes) tx.UnsafePut(buckets.Meta, finishedCompactKeyName, rbytes) tx.Unlock() + dbCompactionPauseMs.Observe(float64(time.Since(start) / time.Millisecond)) + // gofail: var compactAfterSetFinishedCompact struct{} hash := h.Hash() size, sizeInUse := s.b.Size(), s.b.SizeInUse() s.lg.Info( diff --git a/server/mvcc/watchable_store.go b/server/mvcc/watchable_store.go index cdac20ad5edc..4abc2a1ff656 100644 --- a/server/mvcc/watchable_store.go +++ b/server/mvcc/watchable_store.go @@ -15,6 +15,7 @@ package mvcc import ( + "fmt" "sync" "time" @@ -24,6 +25,7 @@ import ( "go.etcd.io/etcd/server/v3/lease" "go.etcd.io/etcd/server/v3/mvcc/backend" "go.etcd.io/etcd/server/v3/mvcc/buckets" + "go.etcd.io/etcd/server/v3/verify" "go.uber.org/zap" ) @@ -37,6 +39,9 @@ var ( // maxWatchersPerSync is the number of watchers to sync in a single batch maxWatchersPerSync = 512 + + // maxResyncPeriod is the period of executing resync. + watchResyncPeriod = 100 * time.Millisecond ) type watchable interface { @@ -117,12 +122,13 @@ func (s *watchableStore) NewWatchStream() WatchStream { func (s *watchableStore) watch(key, end []byte, startRev int64, id WatchID, ch chan<- WatchResponse, fcs ...FilterFunc) (*watcher, cancelFunc) { wa := &watcher{ - key: key, - end: end, - minRev: startRev, - id: id, - ch: ch, - fcs: fcs, + key: key, + end: end, + startRev: startRev, + minRev: startRev, + id: id, + ch: ch, + fcs: fcs, } s.mu.Lock() @@ -157,12 +163,12 @@ func (s *watchableStore) cancelWatcher(wa *watcher) { } else if s.synced.delete(wa) { watcherGauge.Dec() break - } else if wa.compacted { - watcherGauge.Dec() - break } else if wa.ch == nil { // already canceled (e.g., cancel/close race) break + } else if wa.compacted { + watcherGauge.Dec() + break } if !wa.victim { @@ -225,7 +231,7 @@ func (s *watchableStore) syncWatchersLoop() { } syncDuration := time.Since(st) - waitDuration := 100 * time.Millisecond + waitDuration := watchResyncPeriod // more work pending? if unsyncedWatchers != 0 && lastUnsyncedWatchers > unsyncedWatchers { // be fair to other store operations by yielding time taken @@ -348,6 +354,10 @@ func (s *watchableStore) syncWatchers() int { compactionRev := s.store.compactMainRev wg, minRev := s.unsynced.choose(maxWatchersPerSync, curRev, compactionRev) + if minRev < 0 { + s.store.lg.Warn("Unexpected negative revision range start", zap.Int64("minRev", minRev)) + minRev = 0 + } minBytes, maxBytes := newRevBytes(), newRevBytes() revToBytes(revision{main: minRev}, minBytes) revToBytes(revision{main: curRev + 1}, maxBytes) @@ -371,7 +381,7 @@ func (s *watchableStore) syncWatchers() int { // Next retry of syncWatchers would try to resend the compacted watch response to w.ch continue } - w.minRev = curRev + 1 + w.minRev = max(curRev+1, w.minRev) eb, ok := wb[w] if !ok { @@ -495,11 +505,15 @@ func (s *watchableStore) progressIfSync(watchers map[WatchID]*watcher, responseW s.mu.RLock() defer s.mu.RUnlock() + rev := s.rev() // Any watcher unsynced? for _, w := range watchers { if _, ok := s.synced.watchers[w]; !ok { return false } + if rev < w.startRev { + return false + } } // If all watchers are synchronised, send out progress @@ -508,7 +522,7 @@ func (s *watchableStore) progressIfSync(watchers map[WatchID]*watcher, responseW // notification will be broadcasted client-side if required // (see dispatchEvent in client/v3/watch.go) for _, w := range watchers { - w.send(WatchResponse{WatchID: responseWatchID, Revision: s.rev()}) + w.send(WatchResponse{WatchID: responseWatchID, Revision: rev}) return true } return true @@ -535,6 +549,7 @@ type watcher struct { // except when the watcher were to be moved from "synced" watcher group restore bool + startRev int64 // minRev is the minimum revision update the watcher will accept minRev int64 id WatchID @@ -565,6 +580,16 @@ func (w *watcher) send(wr WatchResponse) bool { wr.Events = ne } + if verify.VerifyEnabled() { + if w.startRev > 0 { + for _, ev := range wr.Events { + if ev.Kv.ModRevision < w.startRev { + panic(fmt.Sprintf("Event.ModRevision(%d) is less than the w.startRev(%d) for watchID: %d", ev.Kv.ModRevision, w.startRev, w.id)) + } + } + } + } + // if all events are filtered out, we should send nothing. if !progressEvent && len(wr.Events) == 0 { return true diff --git a/server/mvcc/watchable_store_test.go b/server/mvcc/watchable_store_test.go index c4e2c2d25371..0be5dc8d36f3 100644 --- a/server/mvcc/watchable_store_test.go +++ b/server/mvcc/watchable_store_test.go @@ -19,10 +19,13 @@ import ( "fmt" "os" "reflect" + "strings" "sync" "testing" "time" + "github.com/google/go-cmp/cmp" + "github.com/prometheus/client_golang/prometheus/testutil" "github.com/stretchr/testify/require" "go.uber.org/zap" "go.uber.org/zap/zaptest" @@ -80,6 +83,184 @@ func TestNewWatcherCancel(t *testing.T) { } } +func TestNewWatcherCountGauge(t *testing.T) { + expectWatchGauge := func(watchers int) { + expected := fmt.Sprintf(`# HELP etcd_debugging_mvcc_watcher_total Total number of watchers. +# TYPE etcd_debugging_mvcc_watcher_total gauge +etcd_debugging_mvcc_watcher_total %d +`, watchers) + err := testutil.CollectAndCompare(watcherGauge, strings.NewReader(expected), "etcd_debugging_mvcc_watcher_total") + if err != nil { + t.Error(err) + } + } + + t.Run("regular watch", func(t *testing.T) { + b, tmpPath := betesting.NewDefaultTmpBackend(t) + s := newWatchableStore(zap.NewExample(), b, &lease.FakeLessor{}, StoreConfig{}) + defer func() { + s.store.Close() + os.Remove(tmpPath) + }() + + // watcherGauge is a package variable and its value may change depending on + // the execution of other tests + initialGaugeState := int(testutil.ToFloat64(watcherGauge)) + + testKey := []byte("foo") + testValue := []byte("bar") + s.Put(testKey, testValue, lease.NoLease) + + // we expect the gauge state to still be in its initial state + expectWatchGauge(initialGaugeState) + + w := s.NewWatchStream() + defer w.Close() + + wt, _ := w.Watch(0, testKey, nil, 0) + + // after creating watch, the gauge state should have increased + expectWatchGauge(initialGaugeState + 1) + + if err := w.Cancel(wt); err != nil { + t.Error(err) + } + + // after cancelling watch, the gauge state should have decreased + expectWatchGauge(initialGaugeState) + + w.Cancel(wt) + + // cancelling the watch twice shouldn't decrement the counter twice + expectWatchGauge(initialGaugeState) + }) + + t.Run("compacted watch", func(t *testing.T) { + b, tmpPath := betesting.NewDefaultTmpBackend(t) + s := newWatchableStore(zap.NewExample(), b, &lease.FakeLessor{}, StoreConfig{}) + defer func() { + s.store.Close() + os.Remove(tmpPath) + }() + + // watcherGauge is a package variable and its value may change depending on + // the execution of other tests + initialGaugeState := int(testutil.ToFloat64(watcherGauge)) + + testKey := []byte("foo") + testValue := []byte("bar") + + s.Put(testKey, testValue, lease.NoLease) + rev := s.Put(testKey, testValue, lease.NoLease) + + // compact up to the revision of the key we just put + _, err := s.Compact(traceutil.TODO(), rev) + if err != nil { + t.Error(err) + } + + // we expect the gauge state to still be in its initial state + expectWatchGauge(initialGaugeState) + + w := s.NewWatchStream() + defer w.Close() + + wt, _ := w.Watch(0, testKey, nil, rev-1) + + // wait for the watcher to be marked as compacted + select { + case resp := <-w.Chan(): + if resp.CompactRevision == 0 { + t.Errorf("resp.Compacted = %v, want %v", resp.CompactRevision, rev) + } + case <-time.After(time.Second): + t.Fatalf("failed to receive response (timeout)") + } + + // after creating watch, the gauge state should have increased + expectWatchGauge(initialGaugeState + 1) + + if err := w.Cancel(wt); err != nil { + t.Error(err) + } + + // after cancelling watch, the gauge state should have decreased + expectWatchGauge(initialGaugeState) + + w.Cancel(wt) + + // cancelling the watch twice shouldn't decrement the counter twice + expectWatchGauge(initialGaugeState) + }) + + t.Run("compacted watch, close/cancel race", func(t *testing.T) { + b, tmpPath := betesting.NewDefaultTmpBackend(t) + s := newWatchableStore(zap.NewExample(), b, &lease.FakeLessor{}, StoreConfig{}) + defer func() { + s.store.Close() + os.Remove(tmpPath) + }() + + // watcherGauge is a package variable and its value may change depending on + // the execution of other tests + initialGaugeState := int(testutil.ToFloat64(watcherGauge)) + + testKey := []byte("foo") + testValue := []byte("bar") + + s.Put(testKey, testValue, lease.NoLease) + rev := s.Put(testKey, testValue, lease.NoLease) + + // compact up to the revision of the key we just put + _, err := s.Compact(traceutil.TODO(), rev) + if err != nil { + t.Error(err) + } + + // we expect the gauge state to still be in its initial state + expectWatchGauge(initialGaugeState) + + w := s.NewWatchStream() + + wt, _ := w.Watch(0, testKey, nil, rev-1) + + // wait for the watcher to be marked as compacted + select { + case resp := <-w.Chan(): + if resp.CompactRevision == 0 { + t.Errorf("resp.Compacted = %v, want %v", resp.CompactRevision, rev) + } + case <-time.After(time.Second): + t.Fatalf("failed to receive response (timeout)") + } + + // after creating watch, the gauge state should have increased + expectWatchGauge(initialGaugeState + 1) + + // now race cancelling and closing the watcher and watch stream. + // in rare scenarios the watcher cancel function can be invoked + // multiple times, leading to a potentially negative gauge state, + // see: https://github.com/etcd-io/etcd/issues/19577 + wg := sync.WaitGroup{} + wg.Add(2) + + go func() { + w.Cancel(wt) + wg.Done() + }() + + go func() { + w.Close() + wg.Done() + }() + + wg.Wait() + + // the gauge should be decremented to its original state + expectWatchGauge(initialGaugeState) + }) +} + // TestCancelUnsynced tests if running CancelFunc removes watchers from unsynced. func TestCancelUnsynced(t *testing.T) { b, tmpPath := betesting.NewDefaultTmpBackend(t) @@ -358,104 +539,115 @@ func TestWatchFutureRev(t *testing.T) { } func TestWatchRestore(t *testing.T) { - test := func(delay time.Duration) func(t *testing.T) { - return func(t *testing.T) { - b, tmpPath := betesting.NewDefaultTmpBackend(t) - s := newWatchableStore(zap.NewExample(), b, &lease.FakeLessor{}, StoreConfig{}) - defer cleanup(s, b, tmpPath) - - testKey := []byte("foo") - testValue := []byte("bar") - w := s.NewWatchStream() - defer w.Close() - w.Watch(0, testKey, nil, 1) + resyncDelay := watchResyncPeriod * 3 / 2 + + t.Run("NoResync", func(t *testing.T) { + testWatchRestore(t, 0, 0) + }) + t.Run("ResyncBefore", func(t *testing.T) { + testWatchRestore(t, resyncDelay, 0) + }) + t.Run("ResyncAfter", func(t *testing.T) { + testWatchRestore(t, 0, resyncDelay) + }) + + t.Run("ResyncBeforeAndAfter", func(t *testing.T) { + testWatchRestore(t, resyncDelay, resyncDelay) + }) +} - time.Sleep(delay) - wantRev := s.Put(testKey, testValue, lease.NoLease) +func testWatchRestore(t *testing.T, delayBeforeRestore, delayAfterRestore time.Duration) { + b, tmpPath := betesting.NewDefaultTmpBackend(t) + s := New(zaptest.NewLogger(t), b, &lease.FakeLessor{}, StoreConfig{}) + defer cleanup(s, b, tmpPath) - s.Restore(b) - events := readEventsForSecond(w.Chan()) - if len(events) != 1 { - t.Errorf("Expected only one event, got %d", len(events)) - } - if events[0].Kv.ModRevision != wantRev { - t.Errorf("Expected revision to match, got %d, want %d", events[0].Kv.ModRevision, wantRev) - } + testKey := []byte("foo") + testValue := []byte("bar") - } + tcs := []struct { + name string + startRevision int64 + wantEvents []mvccpb.Event + }{ + { + name: "zero revision", + startRevision: 0, + wantEvents: []mvccpb.Event{ + {Type: mvccpb.PUT, Kv: &mvccpb.KeyValue{Key: testKey, Value: testValue, CreateRevision: 2, ModRevision: 2, Version: 1}}, + {Type: mvccpb.DELETE, Kv: &mvccpb.KeyValue{Key: testKey, ModRevision: 3}}, + }, + }, + { + name: "revsion before first write", + startRevision: 1, + wantEvents: []mvccpb.Event{ + {Type: mvccpb.PUT, Kv: &mvccpb.KeyValue{Key: testKey, Value: testValue, CreateRevision: 2, ModRevision: 2, Version: 1}}, + {Type: mvccpb.DELETE, Kv: &mvccpb.KeyValue{Key: testKey, ModRevision: 3}}, + }, + }, + { + name: "revision of first write", + startRevision: 2, + wantEvents: []mvccpb.Event{ + {Type: mvccpb.PUT, Kv: &mvccpb.KeyValue{Key: testKey, Value: testValue, CreateRevision: 2, ModRevision: 2, Version: 1}}, + {Type: mvccpb.DELETE, Kv: &mvccpb.KeyValue{Key: testKey, ModRevision: 3}}, + }, + }, + { + name: "current revision", + startRevision: 3, + wantEvents: []mvccpb.Event{ + {Type: mvccpb.DELETE, Kv: &mvccpb.KeyValue{Key: testKey, ModRevision: 3}}, + }, + }, + { + name: "future revision", + startRevision: 4, + wantEvents: []mvccpb.Event{}, + }, + } + watchers := []WatchStream{} + for i, tc := range tcs { + w := s.NewWatchStream() + defer w.Close() + watchers = append(watchers, w) + w.Watch(WatchID(i+1), testKey, nil, tc.startRevision) } - t.Run("Normal", test(0)) - t.Run("RunSyncWatchLoopBeforeRestore", test(time.Millisecond*120)) // longer than default waitDuration + s.Put(testKey, testValue, lease.NoLease) + time.Sleep(delayBeforeRestore) + s.Restore(b) + time.Sleep(delayAfterRestore) + s.DeleteRange(testKey, nil) + + for i, tc := range tcs { + t.Run(tc.name, func(t *testing.T) { + events := readEventsForSecond(t, watchers[i].Chan()) + if diff := cmp.Diff(tc.wantEvents, events); diff != "" { + t.Errorf("unexpected events (-want +got):\n%s", diff) + } + }) + } } -func readEventsForSecond(ws <-chan WatchResponse) (events []mvccpb.Event) { +func readEventsForSecond(t *testing.T, ws <-chan WatchResponse) []mvccpb.Event { + events := []mvccpb.Event{} + deadline := time.After(time.Second) for { select { case resp := <-ws: + if len(resp.Events) == 0 { + t.Fatalf("Events should never be empty, resp: %+v", resp) + } events = append(events, resp.Events...) - case <-time.After(time.Second): + case <-deadline: + return events + case <-time.After(watchResyncPeriod * 3 / 2): return events } } } -// TestWatchRestoreSyncedWatcher tests such a case that: -// 1. watcher is created with a future revision "math.MaxInt64 - 2" -// 2. watcher with a future revision is added to "synced" watcher group -// 3. restore/overwrite storage with snapshot of a higher lasat revision -// 4. restore operation moves "synced" to "unsynced" watcher group -// 5. choose the watcher from step 1, without panic -func TestWatchRestoreSyncedWatcher(t *testing.T) { - b1, b1Path := betesting.NewDefaultTmpBackend(t) - s1 := newWatchableStore(zap.NewExample(), b1, &lease.FakeLessor{}, StoreConfig{}) - defer cleanup(s1, b1, b1Path) - - b2, b2Path := betesting.NewDefaultTmpBackend(t) - s2 := newWatchableStore(zap.NewExample(), b2, &lease.FakeLessor{}, StoreConfig{}) - defer cleanup(s2, b2, b2Path) - - testKey, testValue := []byte("foo"), []byte("bar") - rev := s1.Put(testKey, testValue, lease.NoLease) - startRev := rev + 2 - - // create a watcher with a future revision - // add to "synced" watcher group (startRev > s.store.currentRev) - w1 := s1.NewWatchStream() - w1.Watch(0, testKey, nil, startRev) - - // make "s2" ends up with a higher last revision - s2.Put(testKey, testValue, lease.NoLease) - s2.Put(testKey, testValue, lease.NoLease) - - // overwrite storage with higher revisions - if err := s1.Restore(b2); err != nil { - t.Fatal(err) - } - - // wait for next "syncWatchersLoop" iteration - // and the unsynced watcher should be chosen - time.Sleep(2 * time.Second) - - // trigger events for "startRev" - s1.Put(testKey, testValue, lease.NoLease) - - select { - case resp := <-w1.Chan(): - if resp.Revision != startRev { - t.Fatalf("resp.Revision expect %d, got %d", startRev, resp.Revision) - } - if len(resp.Events) != 1 { - t.Fatalf("len(resp.Events) expect 1, got %d", len(resp.Events)) - } - if resp.Events[0].Kv.ModRevision != startRev { - t.Fatalf("resp.Events[0].Kv.ModRevision expect %d, got %d", startRev, resp.Events[0].Kv.ModRevision) - } - case <-time.After(time.Second): - t.Fatal("failed to receive event in 1 second") - } -} - // TestWatchBatchUnsynced tests batching on unsynced watchers func TestWatchBatchUnsynced(t *testing.T) { b, tmpPath := betesting.NewDefaultTmpBackend(t) diff --git a/server/mvcc/watcher_test.go b/server/mvcc/watcher_test.go index 11136443f7e4..6b2f21fe22eb 100644 --- a/server/mvcc/watcher_test.go +++ b/server/mvcc/watcher_test.go @@ -288,9 +288,7 @@ func TestWatchStreamCancelWatcherByID(t *testing.T) { } } -// TestWatcherRequestProgress ensures synced watcher can correctly -// report its correct progress. -func TestWatcherRequestProgress(t *testing.T) { +func TestWatcherRequestProgressBadId(t *testing.T) { b, tmpPath := betesting.NewDefaultTmpBackend(t) // manually create watchableStore instead of newWatchableStore @@ -302,14 +300,12 @@ func TestWatcherRequestProgress(t *testing.T) { unsynced: newWatcherGroup(), synced: newWatcherGroup(), } - defer func() { s.store.Close() os.Remove(tmpPath) }() testKey := []byte("foo") - notTestKey := []byte("bad") testValue := []byte("bar") s.Put(testKey, testValue, lease.NoLease) @@ -322,26 +318,91 @@ func TestWatcherRequestProgress(t *testing.T) { t.Fatalf("unexpected %+v", resp) default: } +} - id, _ := w.Watch(0, notTestKey, nil, 1) - w.RequestProgress(id) - select { - case resp := <-w.Chan(): - t.Fatalf("unexpected %+v", resp) - default: +func TestWatcherRequestProgress(t *testing.T) { + testKey := []byte("foo") + notTestKey := []byte("bad") + testValue := []byte("bar") + tcs := []struct { + name string + startRev int64 + expectProgressBeforeSync bool + expectProgressAfterSync bool + }{ + { + name: "Zero revision", + startRev: 0, + expectProgressBeforeSync: true, + expectProgressAfterSync: true, + }, + { + name: "Old revision", + startRev: 1, + expectProgressAfterSync: true, + }, + { + name: "Current revision", + startRev: 2, + expectProgressAfterSync: true, + }, + { + name: "Current revision plus one", + startRev: 3, + }, + { + name: "Current revision plus two", + startRev: 4, + }, } + for _, tc := range tcs { + t.Run(tc.name, func(t *testing.T) { + b, tmpPath := betesting.NewDefaultTmpBackend(t) + + // manually create watchableStore instead of newWatchableStore + // because newWatchableStore automatically calls syncWatchers + // method to sync watchers in unsynced map. We want to keep watchers + // in unsynced to test if syncWatchers works as expected. + s := &watchableStore{ + store: NewStore(zap.NewExample(), b, &lease.FakeLessor{}, StoreConfig{}), + unsynced: newWatcherGroup(), + synced: newWatcherGroup(), + } - s.syncWatchers() + defer func() { + s.store.Close() + os.Remove(tmpPath) + }() + + s.Put(testKey, testValue, lease.NoLease) - w.RequestProgress(id) - wrs := WatchResponse{WatchID: id, Revision: 2} + w := s.NewWatchStream() + + id, _ := w.Watch(0, notTestKey, nil, tc.startRev) + w.RequestProgress(id) + asssertProgressSent(t, w, id, tc.expectProgressBeforeSync) + s.syncWatchers() + w.RequestProgress(id) + asssertProgressSent(t, w, id, tc.expectProgressAfterSync) + }) + } +} + +func asssertProgressSent(t *testing.T, stream WatchStream, id WatchID, expectProgress bool) { select { - case resp := <-w.Chan(): - if !reflect.DeepEqual(resp, wrs) { - t.Fatalf("got %+v, expect %+v", resp, wrs) + case resp := <-stream.Chan(): + if expectProgress { + wrs := WatchResponse{WatchID: id, Revision: 2} + if !reflect.DeepEqual(resp, wrs) { + t.Fatalf("got %+v, expect %+v", resp, wrs) + } + } else { + t.Fatalf("unexpected response %+v", resp) + } + default: + if expectProgress { + t.Fatalf("failed to receive progress") } - case <-time.After(time.Second): - t.Fatal("failed to receive progress") } } diff --git a/server/proxy/grpcproxy/watch.go b/server/proxy/grpcproxy/watch.go index c84a71bce935..22161848f868 100644 --- a/server/proxy/grpcproxy/watch.go +++ b/server/proxy/grpcproxy/watch.go @@ -235,6 +235,17 @@ func (wps *watchProxyStream) recvLoop() error { case *pb.WatchRequest_CreateRequest: cr := uv.CreateRequest + if cr.StartRevision < 0 { + wps.watchCh <- &pb.WatchResponse{ + Header: &pb.ResponseHeader{}, + WatchId: clientv3.InvalidWatchID, + Created: true, + Canceled: true, + CancelReason: rpctypes.ErrCompacted.Error(), + } + continue + } + if err := wps.checkPermissionForWatch(cr.Key, cr.RangeEnd); err != nil { wps.watchCh <- &pb.WatchResponse{ Header: &pb.ResponseHeader{}, diff --git a/server/verify/verify.go b/server/verify/verify.go index ef613d7eb05e..2436b670812d 100644 --- a/server/verify/verify.go +++ b/server/verify/verify.go @@ -90,12 +90,33 @@ func Verify(cfg Config) error { // VerifyIfEnabled performs verification according to ETCD_VERIFY env settings. // See Verify for more information. func VerifyIfEnabled(cfg Config) error { - if os.Getenv(ENV_VERIFY) == ENV_VERIFY_ALL_VALUE { + if VerifyEnabled() { return Verify(cfg) } return nil } +// VerifyEnabled returns `true` if verification is enabled. +func VerifyEnabled() bool { + return os.Getenv(ENV_VERIFY) == ENV_VERIFY_ALL_VALUE +} + +func EnableVerification() func() { + previousEnv := os.Getenv(ENV_VERIFY) + os.Setenv(ENV_VERIFY, ENV_VERIFY_ALL_VALUE) + return func() { + os.Setenv(ENV_VERIFY, previousEnv) + } +} + +func DisableVerification() func() { + previousEnv := os.Getenv(ENV_VERIFY) + os.Unsetenv(ENV_VERIFY) + return func() { + os.Setenv(ENV_VERIFY, previousEnv) + } +} + // MustVerifyIfEnabled performs verification according to ETCD_VERIFY env settings // and exits in case of found problems. // See Verify for more information. diff --git a/test.sh b/test.sh index 3604f627dacc..73c345151518 100755 --- a/test.sh +++ b/test.sh @@ -105,7 +105,6 @@ function unit_pass { function integration_extra { if [ -z "${PKG}" ] ; then - run_for_module "." go_test "./contrib/raftexample" "keep_going" : -timeout="${TIMEOUT:-5m}" "${RUN_ARG[@]}" "${COMMON_TEST_FLAGS[@]}" "$@" || return $? run_for_module "tests" go_test "./integration/v2store/..." "keep_going" : -tags v2v3 -timeout="${TIMEOUT:-5m}" "${RUN_ARG[@]}" "${COMMON_TEST_FLAGS[@]}" "$@" || return $? else log_warning "integration_extra ignored when PKG is specified" @@ -195,7 +194,17 @@ function functional_pass { } function grpcproxy_pass { - run_for_module "tests" go_test "./integration/... ./e2e" "fail_fast" : \ + grpcproxy_integration_pass "$@" + grpcproxy_e2e_pass "$@" +} + +function grpcproxy_integration_pass { + run_for_module "tests" go_test "./integration/..." "fail_fast" : \ + -timeout=45m -tags cluster_proxy "${COMMON_TEST_FLAGS[@]}" "$@" +} + +function grpcproxy_e2e_pass { + run_for_module "tests" go_test "./e2e/..." "fail_fast" : \ -timeout=45m -tags cluster_proxy "${COMMON_TEST_FLAGS[@]}" "$@" } @@ -371,28 +380,6 @@ function cov_pass { ######### Code formatting checkers ############################################# -function fmt_pass { - toggle_failpoints disable - - # TODO: add "unparam","staticcheck", "unconvert", "ineffasign","nakedret" - # after resolving ore-existing errors. - # markdown_you - too sensitive check was temporarilly disbled. - for p in shellcheck \ - goword \ - gofmt \ - govet \ - revive \ - license_header \ - receiver_name \ - mod_tidy \ - dep \ - shellcheck \ - shellws \ - ; do - run_pass "${p}" "${@}" - done -} - function shellcheck_pass { SHELLCHECK=shellcheck @@ -456,6 +443,10 @@ function markdown_marker_pass { fi } +function govuln_pass { + run_for_modules run govulncheck -show verbose +} + function govet_pass { run_for_modules generic_checker run go vet } @@ -663,6 +654,8 @@ function dep_pass { function release_pass { rm -f ./bin/etcd-last-release + rm -f ./bin/etcdctl-last-release + rm -f ./bin/etcdctl-v3439-release # Work out the previous minor release based on the version reported by etcd binary binary_version=$(./bin/etcd --version | grep --only-matching --perl-regexp '(?<=etcd Version: )\d+\.\d+') @@ -701,9 +694,58 @@ function release_pass { ;; esac - tar xzvf "/tmp/$file" -C /tmp/ --strip-components=1 + tar xzvf "/tmp/$file" -C /tmp/ --strip-components=1 --no-same-owner mkdir -p ./bin mv /tmp/etcd ./bin/etcd-last-release + mv /tmp/etcdctl ./bin/etcdctl-last-release + + # We also need etcdctl v3.4.39 binary to reproduce zombie members. + # + # See https://github.com/etcd-io/etcd/issues/20967 + log_callout "Downloading v3.4.39 etcdctl" + v3439_file="etcd-v3.4.39-linux-$GOARCH.tar.gz" + + set +e + curl --fail -L "https://github.com/etcd-io/etcd/releases/download/v3.4.39/$v3439_file" -o "/tmp/$v3439_file" + local result=$? + set -e + case $result in + 0) ;; + *) log_error "--- FAIL:" ${result} + return $result + ;; + esac + + tar xzvf "/tmp/$v3439_file" -C /tmp/ --strip-components=1 --no-same-owner + mv /tmp/etcdctl ./bin/etcdctl-v3439-release +} + +function release_tests_pass { + if [ -z "${VERSION:-}" ]; then + VERSION=$(go list -m go.etcd.io/etcd/api/v3 2>/dev/null | \ + awk '{split(substr($2,2), a, "."); print a[1]"."a[2]".99"}') + fi + + if [ -n "${CI:-}" ]; then + git config user.email "prow@etcd.io" + git config user.name "Prow" + + gpg --batch --gen-key < ../api @@ -29,41 +29,43 @@ require ( github.com/soheilhy/cmux v0.1.5 github.com/spf13/cobra v1.1.3 github.com/spf13/pflag v1.0.5 - github.com/stretchr/testify v1.9.0 - go.etcd.io/etcd/api/v3 v3.5.18 - go.etcd.io/etcd/client/pkg/v3 v3.5.18 - go.etcd.io/etcd/client/v2 v2.305.18 - go.etcd.io/etcd/client/v3 v3.5.18 - go.etcd.io/etcd/etcdutl/v3 v3.5.18 - go.etcd.io/etcd/pkg/v3 v3.5.18 - go.etcd.io/etcd/raft/v3 v3.5.18 - go.etcd.io/etcd/server/v3 v3.5.18 + github.com/stretchr/testify v1.11.1 + go.etcd.io/bbolt v1.3.11 + go.etcd.io/etcd/api/v3 v3.5.31 + go.etcd.io/etcd/client/pkg/v3 v3.5.31 + go.etcd.io/etcd/client/v2 v2.305.31 + go.etcd.io/etcd/client/v3 v3.5.31 + go.etcd.io/etcd/etcdutl/v3 v3.5.31 + go.etcd.io/etcd/pkg/v3 v3.5.31 + go.etcd.io/etcd/raft/v3 v3.5.31 + go.etcd.io/etcd/server/v3 v3.5.31 go.etcd.io/gofail v0.2.0 go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.0 - go.opentelemetry.io/otel v1.20.0 - go.opentelemetry.io/otel/sdk v1.20.0 - go.opentelemetry.io/otel/trace v1.20.0 + go.opentelemetry.io/otel v1.34.0 + go.opentelemetry.io/otel/sdk v1.34.0 + go.opentelemetry.io/otel/trace v1.34.0 go.opentelemetry.io/proto/otlp v1.0.0 go.uber.org/zap v1.17.0 golang.org/x/crypto v0.32.0 golang.org/x/sync v0.10.0 golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba - google.golang.org/grpc v1.59.0 + google.golang.org/grpc v1.71.1 gopkg.in/yaml.v2 v2.4.0 ) require ( github.com/beorn7/perks v1.0.1 // indirect github.com/cenkalti/backoff/v4 v4.2.1 // indirect - github.com/cespare/xxhash/v2 v2.2.0 // indirect + github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/coreos/go-systemd/v22 v22.3.2 // indirect github.com/creack/pty v1.1.11 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/go-logr/logr v1.3.0 // indirect + github.com/go-logr/logr v1.4.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang-jwt/jwt/v4 v4.5.1 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/google/btree v1.0.1 // indirect + github.com/google/uuid v1.6.0 // indirect github.com/gorilla/websocket v1.4.2 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect github.com/inconshreveable/mousetrap v1.0.0 // indirect @@ -78,19 +80,19 @@ require ( github.com/sirupsen/logrus v1.9.3 // indirect github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802 // indirect github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 // indirect - go.etcd.io/bbolt v1.3.11 // indirect + go.opentelemetry.io/auto/sdk v1.1.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.20.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.20.0 // indirect - go.opentelemetry.io/otel/metric v1.20.0 // indirect + go.opentelemetry.io/otel/metric v1.34.0 // indirect go.uber.org/atomic v1.7.0 // indirect go.uber.org/multierr v1.6.0 // indirect golang.org/x/net v0.34.0 // indirect golang.org/x/sys v0.29.0 // indirect golang.org/x/text v0.21.0 // indirect google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect - google.golang.org/protobuf v1.33.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20250115164207-1a7da9e5054f // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20250115164207-1a7da9e5054f // indirect + google.golang.org/protobuf v1.36.11 // indirect gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect sigs.k8s.io/yaml v1.2.0 // indirect diff --git a/tests/go.sum b/tests/go.sum index 2be79b19f2ed..59f576ce9452 100644 --- a/tests/go.sum +++ b/tests/go.sum @@ -8,9 +8,8 @@ cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg cloud.google.com/go v0.110.7 h1:rJyC7nWRg2jWGZ4wSJ5nY65GTdYJkg0cd/uXb+ACI6o= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/compute v1.23.0 h1:tP41Zoavr8ptEqaW6j+LQOnyBBhO7OkOMAGrgLopTwY= -cloud.google.com/go/compute v1.23.0/go.mod h1:4tCnrn48xsqlwSAiLf1HXMQk8CONslYbdiEZc9FEIbM= -cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= -cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= +cloud.google.com/go/compute/metadata v0.6.0 h1:A6hENjEsCDtC1k8byVsgwvVcioamEHvZ4j01OwKxG9I= +cloud.google.com/go/compute/metadata v0.6.0/go.mod h1:FjyFAW1MW0C203CEOMDTu3Dk1FlqW3Rga40jzHL4hfg= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= @@ -40,12 +39,12 @@ github.com/cenkalti/backoff/v4 v4.2.1/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyY github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= -github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= -github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4 h1:/inchEIKaYC1Akx+H+gqO04wryn5h75LSazbRlnya1k= -github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20241223141626-cff3c89139a3 h1:boJj011Hh+874zpIySeApCX4GeOjPl9qhRF3QuIZq+Q= +github.com/cncf/xds/go v0.0.0-20241223141626-cff3c89139a3/go.mod h1:W+zGtBO5Y1IgJhy4+A9GOqVhqLpfZi+vwmdNXUehLA8= github.com/cockroachdb/datadriven v1.0.2 h1:H9MtNqVoVhvd9nCBwOyDjUEdZCREqbIdCJD93PBm/jA= github.com/cockroachdb/datadriven v1.0.2/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU= github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= @@ -70,8 +69,8 @@ github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymF github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/envoyproxy/protoc-gen-validate v1.0.2 h1:QkIBuU5k+x7/QXPvPPnWXWlCdaBFApVqftFV6k087DA= -github.com/envoyproxy/protoc-gen-validate v1.0.2/go.mod h1:GpiZQP3dDbg4JouG/NNS7QWXpgx6x8QiMKdmN72jogE= +github.com/envoyproxy/protoc-gen-validate v1.2.1 h1:DEo3O99U8j4hBFwbJfrz9VtgcDfUKS7KJ7spH3d86P8= +github.com/envoyproxy/protoc-gen-validate v1.2.1/go.mod h1:d/C80l/jxXLdfEIhX1W2TmLfsJ31lvEjwamM4DxlWXU= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= @@ -83,8 +82,8 @@ github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9 github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= -github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= +github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= @@ -96,8 +95,8 @@ github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69 github.com/golang-jwt/jwt/v4 v4.5.1 h1:JdqV9zKUdtaa9gdPlywC3aeoEsR681PlKC+4F5gQgeo= github.com/golang-jwt/jwt/v4 v4.5.1/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.1.2 h1:DVjP2PbBOzHyzA+dn3WhHIq4NdVu3Q+pvivFICf/7fo= -github.com/golang/glog v1.1.2/go.mod h1:zR+okUeTbrL6EL3xHUDxZuEtGv04p5shwip1+mL/rLQ= +github.com/golang/glog v1.2.4 h1:CNNw5U8lSiiBk7druxtSHHTsRWcxKoac6kZKm2peBBc= +github.com/golang/glog v1.2.4/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -127,14 +126,16 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= -github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= @@ -257,8 +258,8 @@ github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40T github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= -github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= +github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= +github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= @@ -289,8 +290,8 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802 h1:uruHq4dN7GR16kFc5fp3d1RIYzJW5onx8Ybykw2YQFA= @@ -306,20 +307,24 @@ go.etcd.io/gofail v0.2.0 h1:p19drv16FKK345a09a1iubchlw/vmRuksmRzgBIGjcA= go.etcd.io/gofail v0.2.0/go.mod h1:nL3ILMGfkXTekKI3clMBNazKnjUZjYLKmBHzsVAnC1o= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= +go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= +go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.0 h1:PzIubN4/sjByhDRHLviCjJuweBXWFZWhghjg7cS28+M= go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.0/go.mod h1:Ct6zzQEuGK3WpJs2n4dn+wfJYzd/+hNnxMRTWjGn30M= -go.opentelemetry.io/otel v1.20.0 h1:vsb/ggIY+hUjD/zCAQHpzTmndPqv/ml2ArbsbfBYTAc= -go.opentelemetry.io/otel v1.20.0/go.mod h1:oUIGj3D77RwJdM6PPZImDpSZGDvkD9fhesHny69JFrs= +go.opentelemetry.io/otel v1.34.0 h1:zRLXxLCgL1WyKsPVrgbSdMN4c0FMkDAskSTQP+0hdUY= +go.opentelemetry.io/otel v1.34.0/go.mod h1:OWFPOQ+h4G8xpyjgqo4SxJYdDQ/qmRH+wivy7zzx9oI= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.20.0 h1:DeFD0VgTZ+Cj6hxravYYZE2W4GlneVH81iAOPjZkzk8= go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.20.0/go.mod h1:GijYcYmNpX1KazD5JmWGsi4P7dDTTTnfv1UbGn84MnU= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.20.0 h1:gvmNvqrPYovvyRmCSygkUDyL8lC5Tl845MLEwqpxhEU= go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.20.0/go.mod h1:vNUq47TGFioo+ffTSnKNdob241vePmtNZnAODKapKd0= -go.opentelemetry.io/otel/metric v1.20.0 h1:ZlrO8Hu9+GAhnepmRGhSU7/VkpjrNowxRN9GyKR4wzA= -go.opentelemetry.io/otel/metric v1.20.0/go.mod h1:90DRw3nfK4D7Sm/75yQ00gTJxtkBxX+wu6YaNymbpVM= -go.opentelemetry.io/otel/sdk v1.20.0 h1:5Jf6imeFZlZtKv9Qbo6qt2ZkmWtdWx/wzcCbNUlAWGM= -go.opentelemetry.io/otel/sdk v1.20.0/go.mod h1:rmkSx1cZCm/tn16iWDn1GQbLtsW/LvsdEEFzCSRM6V0= -go.opentelemetry.io/otel/trace v1.20.0 h1:+yxVAPZPbQhbC3OfAkeIVTky6iTFpcr4SiY9om7mXSQ= -go.opentelemetry.io/otel/trace v1.20.0/go.mod h1:HJSK7F/hA5RlzpZ0zKDCHCDHm556LCDtKaAo6JmBFUU= +go.opentelemetry.io/otel/metric v1.34.0 h1:+eTR3U0MyfWjRDhmFMxe2SsW64QrZ84AOhvqS7Y+PoQ= +go.opentelemetry.io/otel/metric v1.34.0/go.mod h1:CEDrp0fy2D0MvkXE+dPV7cMi8tWZwX3dmaIhwPOaqHE= +go.opentelemetry.io/otel/sdk v1.34.0 h1:95zS4k/2GOy069d321O8jWgYsW3MzVV+KuSPKp7Wr1A= +go.opentelemetry.io/otel/sdk v1.34.0/go.mod h1:0e/pNiaMAqaykJGKbi+tSjWfNNHMTxoC9qANsCzbyxU= +go.opentelemetry.io/otel/sdk/metric v1.34.0 h1:5CeK9ujjbFVL5c1PhLuStg1wxA7vQv7ce1EK0Gyvahk= +go.opentelemetry.io/otel/sdk/metric v1.34.0/go.mod h1:jQ/r8Ze28zRKoNRdkjCZxfs6YvBTG1+YIqyFVFYec5w= +go.opentelemetry.io/otel/trace v1.34.0 h1:+ouXS2V8Rd4hp4580a8q23bg0azF2nI8cqLYnC8mh/k= +go.opentelemetry.io/otel/trace v1.34.0/go.mod h1:Svm7lSjQD7kG7KJ/MUHPVXSDGz2OX4h0M2jHBhmSfRE= go.opentelemetry.io/proto/otlp v1.0.0 h1:T0TX0tmXU8a3CbNXzEKGeU5mIVOdf0oykP+u2lIVU/I= go.opentelemetry.io/proto/otlp v1.0.0/go.mod h1:Sy6pihPLfYHkr3NkUbEhGHFhINUSI/v80hjKIs5JXpM= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= @@ -388,8 +393,8 @@ golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAG golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/oauth2 v0.11.0 h1:vPL4xzxBM4niKCW6g9whtaWVXTJf1U5e4aZxxFx/gbU= -golang.org/x/oauth2 v0.11.0/go.mod h1:LdF7O/8bLR/qWK9DrpXmbHLTouvRHK0SgJl0GmDBchk= +golang.org/x/oauth2 v0.25.0 h1:CY4y7XT9v0cRI9oupztF8AgiIu99L/ksR/Xp/6jrZ70= +golang.org/x/oauth2 v0.25.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -468,8 +473,6 @@ google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9Ywl google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.6.1/go.mod h1:i06prIuMbXzDqacNJfV5OdTW448YApPu5ww/cMBSeb0= -google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= -google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190307195333-5fe7a883aa19/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= @@ -483,10 +486,10 @@ google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfG google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d h1:VBu5YqKPv6XiJ199exd8Br+Aetz+o08F+PLMnwJQHAY= google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d/go.mod h1:yZTlhN0tQnXo3h00fuXNCxJdLdIdnVFVBaRJ5LWBbw4= -google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d h1:DoPTO70H+bcDXcd39vOqb2viZxgqeBeSGtZ55yZU4/Q= -google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d/go.mod h1:KjSP20unUpOx5kyQUFa7k4OJg0qeJ7DEZflGDu2p6Bk= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d h1:uvYuEyMHKNt+lT4K3bN6fGswmK8qSvcreM3BwjDh+y4= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= +google.golang.org/genproto/googleapis/api v0.0.0-20250115164207-1a7da9e5054f h1:gap6+3Gk41EItBuyi4XX/bp4oqJ3UwuIMl25yGinuAA= +google.golang.org/genproto/googleapis/api v0.0.0-20250115164207-1a7da9e5054f/go.mod h1:Ic02D47M+zbarjYYUlK57y316f2MoN0gjAwI3f2S95o= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250115164207-1a7da9e5054f h1:OxYkA3wjPsZyBylwymxSHa7ViiW1Sml4ToBrncvFehI= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250115164207-1a7da9e5054f/go.mod h1:+2Yz8+CLJbIfL9z73EW45avw8Lmge3xVElCP9zEKi50= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -495,8 +498,8 @@ google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= -google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= -google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= +google.golang.org/grpc v1.71.1 h1:ffsFWr7ygTUscGPI0KKK6TLrGz0476KUvvsbqWK0rPI= +google.golang.org/grpc v1.71.1/go.mod h1:H0GRtasmQOh9LkFoCPDu3ZrwUtD1YGE+b2vYBYd/8Ec= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -504,8 +507,8 @@ google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miE google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= -google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= +google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/tests/integration/clientv3/cluster_test.go b/tests/integration/clientv3/cluster_test.go index d624a56d7b2c..f606d4a7cb8c 100644 --- a/tests/integration/clientv3/cluster_test.go +++ b/tests/integration/clientv3/cluster_test.go @@ -23,7 +23,10 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" + "go.etcd.io/etcd/api/v3/etcdserverpb" "go.etcd.io/etcd/client/pkg/v3/types" + clientv3 "go.etcd.io/etcd/client/v3" "go.etcd.io/etcd/tests/v3/integration" ) @@ -426,3 +429,51 @@ func TestMaxLearnerInCluster(t *testing.T) { t.Errorf("failed to add member %v", err) } } + +func TestMemberUpdateLearner(t *testing.T) { + integration.BeforeTest(t) + + clus := integration.NewClusterV3(t, &integration.ClusterConfig{Size: 3}) + defer clus.Terminate(t) + + capi := clus.Client(0) + + urls := []string{"http://127.0.0.1:1234"} + addResp, err := capi.MemberAddAsLearner(t.Context(), urls) + require.NoError(t, err) + learnerID := addResp.Member.ID + + learner, err := getMemberByID(t.Context(), capi, learnerID) + require.NoError(t, err) + require.Truef(t, learner.IsLearner, "added a member as learner, IsLearner is %t", learner.IsLearner) + + updatedURLs := []string{"http://127.0.0.1:5678"} + _, err = capi.MemberUpdate(t.Context(), learnerID, updatedURLs) + require.NoError(t, err) + + learner, err = getMemberByID(t.Context(), capi, learnerID) + require.NoError(t, err) + require.Equal(t, learner.PeerURLs, updatedURLs) + require.Truef(t, learner.IsLearner, "updated peer address of a learner member, IsLearner is %t", learner.IsLearner) +} + +func getMemberByID(ctx context.Context, cli *clientv3.Client, id uint64) (member *etcdserverpb.Member, err error) { + var resp *clientv3.MemberListResponse + resp, err = cli.MemberList(ctx) + if err != nil { + return member, err + } + + for _, m := range resp.Members { + if m.ID == id { + member = m + break + } + } + + if member == nil { + err = fmt.Errorf("failed to find member by id %d", id) + } + + return member, err +} diff --git a/tests/integration/clientv3/lease/lease_test.go b/tests/integration/clientv3/lease/lease_test.go index cd783952dcdd..739793845b30 100644 --- a/tests/integration/clientv3/lease/lease_test.go +++ b/tests/integration/clientv3/lease/lease_test.go @@ -24,7 +24,7 @@ import ( "time" "go.etcd.io/etcd/api/v3/v3rpc/rpctypes" - "go.etcd.io/etcd/client/v3" + clientv3 "go.etcd.io/etcd/client/v3" "go.etcd.io/etcd/client/v3/concurrency" "go.etcd.io/etcd/tests/v3/integration" ) @@ -434,7 +434,7 @@ func TestLeaseRevokeNewAfterClose(t *testing.T) { t.Fatal("le.Revoke took too long") case errMsg := <-errMsgCh: if errMsg != "" { - t.Fatalf(errMsg) + t.Fatalf("%v", errMsg) } } } diff --git a/tests/integration/clientv3/watch_test.go b/tests/integration/clientv3/watch_test.go index 397be4bb7cb0..9095169820cd 100644 --- a/tests/integration/clientv3/watch_test.go +++ b/tests/integration/clientv3/watch_test.go @@ -24,10 +24,11 @@ import ( "testing" "time" + "github.com/stretchr/testify/require" mvccpb "go.etcd.io/etcd/api/v3/mvccpb" "go.etcd.io/etcd/api/v3/v3rpc/rpctypes" "go.etcd.io/etcd/api/v3/version" - "go.etcd.io/etcd/client/v3" + clientv3 "go.etcd.io/etcd/client/v3" "go.etcd.io/etcd/server/v3/etcdserver/api/v3rpc" "go.etcd.io/etcd/tests/v3/integration" "google.golang.org/grpc/metadata" @@ -1214,3 +1215,77 @@ func testWatchClose(t *testing.T, wctx *watchctx) { t.Fatalf("read wch got %v; expected closed channel", wresp) } } + +func TestWatch(t *testing.T) { + integration.BeforeTest(t) + clus := integration.NewClusterV3(t, &integration.ClusterConfig{Size: 1}) + t.Cleanup(func() { clus.Terminate(t) }) + client := clus.Client(0) + + tcs := []struct { + name string + key string + opts []clientv3.OpOption + wantError error + wantEvents []*clientv3.Event + }{ + { + name: "Watch with negative revision", + key: "/", + opts: []clientv3.OpOption{clientv3.WithRev(-1)}, + wantError: rpctypes.ErrCompacted, + }, + { + name: "Watch with zero revision", + key: "/", + opts: []clientv3.OpOption{clientv3.WithRev(0)}, + }, + { + name: "Watch with positive revision", + key: "/", + opts: []clientv3.OpOption{clientv3.WithRev(1)}, + }, + } + ctx := t.Context() + + t.Log("Open watches") + watches := make([]clientv3.WatchChan, len(tcs)) + for i, tc := range tcs { + watchCtx, cancel := context.WithTimeout(ctx, time.Second) + defer cancel() + watches[i] = client.Watch(watchCtx, tc.key, tc.opts...) + } + + t.Log("Validate") + for i, tc := range tcs { + t.Run(tc.name, func(t *testing.T) { + _, err := collectEvents(ctx, watches[i]) + if tc.wantError == nil { + require.NoError(t, err) + } else { + require.ErrorContains(t, err, tc.wantError.Error()) + } + }) + } +} + +func collectEvents(ctx context.Context, watch clientv3.WatchChan) (events []*clientv3.Event, err error) { + for { + select { + case resp, ok := <-watch: + if !ok { + return events, nil + } + err := resp.Err() + if err != nil { + return events, err + } + events = append(events, resp.Events...) + case <-ctx.Done(): + return events, ctx.Err() + // Watch resync interval * 1.5 + case <-time.After(150 * time.Millisecond): + return events, nil + } + } +} diff --git a/tests/integration/member_test.go b/tests/integration/member_test.go index 99788b75785b..d87f374ea17e 100644 --- a/tests/integration/member_test.go +++ b/tests/integration/member_test.go @@ -127,3 +127,49 @@ func TestSnapshotAndRestartMember(t *testing.T) { } } } + +// TestRemoveMemberAndWALReplay ensures that etcd can properly handle +// member removal followed by restart with WAL replay, ensuring no panics +// occur when replaying already-applied removal operations. +func TestRemoveMemberAndWALReplay(t *testing.T) { + BeforeTest(t) + + // Create a cluster with 3 member and a low snapshot count + c := newCluster(t, &ClusterConfig{ + Size: 3, + SnapshotCount: 10, + UseBridge: true, + }) + + c.Launch(t) + defer c.Terminate(t) + + // Add some k/v to trigger snapshot + for i := 0; i < 15; i++ { + cc := MustNewHTTPClient(t, []string{c.Members[0].URL()}, nil) + kapi := client.NewKeysAPI(cc) + ctx, cancel := context.WithTimeout(context.Background(), requestTimeout) + _, err := kapi.Create(ctx, fmt.Sprintf("k%d", i), fmt.Sprintf("v%d", i)) + if err != nil { + t.Fatal("failed to put key-value") + } + cancel() + } + + // Record the ID of the member we'll remove + memberToRemoveID := uint64(c.Members[2].s.ID()) + + // Remove one member from the cluster + c.RemoveMember(t, memberToRemoveID) + + // Stop the remaining members + c.Members[0].Stop(t) + c.Members[1].Stop(t) + + // Restart one member - this would previously panic when loading + // WAL entries that try to remove an already removed member + err := c.Members[0].Restart(t) + if err != nil { + t.Fatal("failed to restart member after removal") + } +} diff --git a/tests/integration/metrics_test.go b/tests/integration/metrics_test.go index 61276fc94b66..b47bc577c87f 100644 --- a/tests/integration/metrics_test.go +++ b/tests/integration/metrics_test.go @@ -130,7 +130,7 @@ func testMetricDbSizeDefrag(t *testing.T, name string) { } retry++ if retry >= maxRetry { - t.Fatalf(err.Error()) + t.Fatalf("%v", err) } } diff --git a/tests/integration/snapshot/v3_snapshot_test.go b/tests/integration/snapshot/v3_snapshot_test.go index 4de0f251d6b9..003a5d8a5ff4 100644 --- a/tests/integration/snapshot/v3_snapshot_test.go +++ b/tests/integration/snapshot/v3_snapshot_test.go @@ -16,6 +16,7 @@ package snapshot_test import ( "context" + "encoding/binary" "fmt" "math/rand" "net/url" @@ -26,8 +27,9 @@ import ( "time" "go.etcd.io/etcd/client/pkg/v3/testutil" - "go.etcd.io/etcd/client/v3" + clientv3 "go.etcd.io/etcd/client/v3" "go.etcd.io/etcd/etcdutl/v3/snapshot" + "go.etcd.io/etcd/pkg/v3/cpuutil" "go.etcd.io/etcd/server/v3/embed" "go.etcd.io/etcd/tests/v3/integration" "go.uber.org/zap/zapcore" @@ -139,6 +141,9 @@ func TestSnapshotV3RestoreMulti(t *testing.T) { // TestCorruptedBackupFileCheck tests if we can correctly identify a corrupted backup file. func TestCorruptedBackupFileCheck(t *testing.T) { + if cpuutil.ByteOrder() == binary.BigEndian { + t.Skipf("skipping on big endian platforms since testdata/corrupted_backup.db is in little endian format") + } dbPath := integration.MustAbsPath("testdata/corrupted_backup.db") integration.BeforeTest(t) if _, err := os.Stat(dbPath); err != nil { diff --git a/tests/integration/v3_auth_test.go b/tests/integration/v3_auth_test.go index f030c4e164d9..b53265de76a4 100644 --- a/tests/integration/v3_auth_test.go +++ b/tests/integration/v3_auth_test.go @@ -17,15 +17,22 @@ package integration import ( "context" "fmt" + "strings" "sync" "testing" "time" + "github.com/stretchr/testify/require" + "go.etcd.io/etcd/api/v3/authpb" pb "go.etcd.io/etcd/api/v3/etcdserverpb" "go.etcd.io/etcd/api/v3/v3rpc/rpctypes" "go.etcd.io/etcd/client/pkg/v3/testutil" - "go.etcd.io/etcd/client/v3" + clientv3 "go.etcd.io/etcd/client/v3" +) + +const ( + PermissionDenied = "etcdserver: permission denied" ) // TestV3AuthEmptyUserGet ensures that a get with an empty user will return an empty user error. @@ -152,6 +159,16 @@ func testV3AuthWithLeaseRevokeWithRoot(t *testing.T, ccfg ClusterConfig) { defer clus.Terminate(t) api := toGRPC(clus.Client(0)) + + users := []user{ + { + name: "test-user", + password: "test-user-123", + role: "test-role", + key: "foo", + }, + } + authSetupUsers(t, api.Auth, users) authSetupRoot(t, api.Auth) rootc, cerr := NewClient(t, clientv3.Config{ @@ -164,6 +181,26 @@ func testV3AuthWithLeaseRevokeWithRoot(t *testing.T, ccfg ClusterConfig) { } defer rootc.Close() + testUserCli, terr := NewClient(t, clientv3.Config{ + Endpoints: clus.Client(0).Endpoints(), + Username: "test-user", + Password: "test-user-123", + }) + require.NoError(t, terr) + defer testUserCli.Close() + + anonCli, aerr := NewClient(t, clientv3.Config{ + Endpoints: clus.Client(0).Endpoints(), + }) + require.NoError(t, aerr) + defer anonCli.Close() + + _, aerr = anonCli.Grant(context.TODO(), 2) + require.ErrorContains(t, aerr, "etcdserver: user name is empty") + + _, terr = testUserCli.Grant(context.TODO(), 2) + require.NoError(t, terr) + leaseResp, err := rootc.Grant(context.TODO(), 2) if err != nil { t.Fatal(err) @@ -197,6 +234,7 @@ type user struct { name string password string role string + perm string key string end string } @@ -333,8 +371,15 @@ func authSetupUsers(t *testing.T, auth pb.AuthClient, users []user) { continue } + permType := authpb.READWRITE + if len(user.perm) > 0 { + val, ok := authpb.Permission_Type_value[strings.ToUpper(user.perm)] + if ok { + permType = authpb.Permission_Type(val) + } + } perm := &authpb.Permission{ - PermType: authpb.READWRITE, + PermType: permType, Key: []byte(user.key), RangeEnd: []byte(user.end), } @@ -589,6 +634,12 @@ func TestV3AuthWithLeaseTimeToLive(t *testing.T) { } defer user2c.Close() + anonCli, cerr := NewClient(t, clientv3.Config{Endpoints: clus.Client(0).Endpoints()}) + if cerr != nil { + t.Fatal(cerr) + } + defer anonCli.Close() + leaseResp, err := user1c.Grant(context.TODO(), 90) if err != nil { t.Fatal(err) @@ -614,6 +665,12 @@ func TestV3AuthWithLeaseTimeToLive(t *testing.T) { t.Fatal(err) } + _, err = anonCli.TimeToLive(context.TODO(), leaseID) + require.ErrorContains(t, err, "etcdserver: user name is empty") + + _, err = anonCli.TimeToLive(context.TODO(), leaseID, clientv3.WithAttachedKeys()) + require.ErrorContains(t, err, "etcdserver: user name is empty") + _, err = user2c.TimeToLive(context.TODO(), leaseID, clientv3.WithAttachedKeys()) if err == nil { t.Fatal("timetolive from user2 should be failed with permission denied") @@ -634,3 +691,456 @@ func TestV3AuthWithLeaseTimeToLive(t *testing.T) { t.Fatal("timetolive from user2 should be failed with permission denied") } } + +func TestV3AuthWithLeaseRenew(t *testing.T) { + BeforeTest(t) + clus := NewClusterV3(t, &ClusterConfig{Size: 3}) + defer clus.Terminate(t) + + users := []user{ + { + name: "test-user", + password: "test-user-123", + role: "test-role", + // test-user can only write keys in [k1, k3), i.e. k1 and k2. + key: "k1", + end: "k3", + }, + } + authSetupUsers(t, toGRPC(clus.Client(0)).Auth, users) + authSetupRoot(t, toGRPC(clus.Client(0)).Auth) + + rootCli, cerr := NewClient(t, clientv3.Config{ + Endpoints: clus.Client(0).Endpoints(), + Username: "root", + Password: "123", + }) + require.NoError(t, cerr) + defer rootCli.Close() + + testUserClis := []*clientv3.Client{} + for i := 0; i < len(clus.Members); i++ { + testUserCli, err := NewClient(t, clientv3.Config{ + Endpoints: clus.Client(i).Endpoints(), + Username: "test-user", + Password: "test-user-123", + }) + require.NoError(t, err) + defer testUserCli.Close() + + testUserClis = append(testUserClis, testUserCli) + } + + anonCli, cerr := NewClient(t, clientv3.Config{ + Endpoints: clus.Client(0).Endpoints(), + }) + require.NoError(t, cerr) + defer anonCli.Close() + + leaseResp, err := rootCli.Grant(t.Context(), 90) + require.NoError(t, err) + leaseID := leaseResp.ID + + _, err = rootCli.Put(t.Context(), "k1", "val", clientv3.WithLease(leaseID)) + require.NoError(t, err) + _, err = rootCli.Put(t.Context(), "k3", "val", clientv3.WithLease(leaseID)) + require.NoError(t, err) + + _, err = anonCli.KeepAliveOnce(t.Context(), leaseID) + require.ErrorContainsf(t, err, "etcdserver: user name is empty", "should reject renew") + + _, err = rootCli.KeepAliveOnce(t.Context(), leaseID) + require.NoError(t, err) + + for _, testUserCli := range testUserClis { + _, err = testUserCli.KeepAliveOnce(t.Context(), leaseID) + require.ErrorContainsf(t, err, "etcdserver: permission denied", "[%v] should reject renew", testUserCli.Endpoints()) + } + + leaseResp, err = rootCli.Grant(t.Context(), 90) + require.NoError(t, err) + leaseID = leaseResp.ID + + _, err = rootCli.Put(t.Context(), "k1", "val", clientv3.WithLease(leaseID)) + require.NoError(t, err) + _, err = rootCli.Put(t.Context(), "k2", "val", clientv3.WithLease(leaseID)) + require.NoError(t, err) + + for _, testUserCli := range testUserClis { + _, err = testUserCli.KeepAliveOnce(t.Context(), leaseID) + require.NoErrorf(t, err, "[%v] should accept renew", testUserCli.Endpoints()) + } +} + +func TestV3AuthAlarm(t *testing.T) { + BeforeTest(t) + ctx, cancel := context.WithTimeout(t.Context(), 30*time.Second) + defer cancel() + + clus := NewClusterV3(t, &ClusterConfig{ + Size: 1, + QuotaBackendBytes: 1024 * 5, + }) + defer clus.Terminate(t) + + users := []user{ + { + name: "test-user", + password: "test-user-123", + role: "test-role", + key: "k1", + end: "k3", + }, + } + authSetupUsers(t, toGRPC(clus.Client(0)).Auth, users) + authSetupRoot(t, toGRPC(clus.Client(0)).Auth) + + rootCli, rerr := NewClient(t, clientv3.Config{ + Endpoints: clus.Client(0).Endpoints(), + Username: "root", + Password: "123", + }) + require.NoError(t, rerr) + defer rootCli.Close() + + testUserCli, terr := NewClient(t, clientv3.Config{ + Endpoints: clus.Client(0).Endpoints(), + Username: "test-user", + Password: "test-user-123", + }) + require.NoError(t, terr) + defer testUserCli.Close() + + anonCli, aerr := NewClient(t, clientv3.Config{ + Endpoints: clus.Client(0).Endpoints(), + }) + require.NoError(t, aerr) + defer anonCli.Close() + + for i := 0; ; i++ { + _, err := rootCli.Put(ctx, fmt.Sprintf("%v", int64(i)), strings.Repeat("A", 1024)) + if err == nil { + continue + } + + require.ErrorContains(t, err, "etcdserver: mvcc: database space exceeded") + break + } + + _, err := anonCli.AlarmList(ctx) + require.ErrorContains(t, err, "etcdserver: user name is empty") + + memberID := uint64(0) + + for i := 0; i < 10; i++ { + resp, rerr := rootCli.AlarmList(ctx) + require.NoError(t, rerr) + + if len(resp.Alarms) > 0 { + memberID = resp.Header.MemberId + break + } + time.Sleep(1 * time.Second) + } + require.NotEqualf(t, uint64(0), memberID, "expect to find alarm with non-zero member ID") + + resp, err := testUserCli.AlarmList(ctx) + require.NoError(t, err) + require.Len(t, resp.Alarms, 1) + + _, err = testUserCli.AlarmDisarm(ctx, &clientv3.AlarmMember{ + MemberID: memberID, + Alarm: pb.AlarmType_NOSPACE, + }) + require.ErrorContains(t, err, PermissionDenied) + + resp, err = rootCli.AlarmDisarm(ctx, &clientv3.AlarmMember{ + MemberID: memberID, + Alarm: pb.AlarmType_NOSPACE, + }) + require.NoError(t, err) + require.Lenf(t, resp.Alarms, 1, "expect 1 alarm from disarm but got %v", resp.Alarms) + + resp, err = rootCli.AlarmList(ctx) + require.NoError(t, err) + require.Emptyf(t, resp.Alarms, "expect no alarm after disarm but got %v", resp.Alarms) +} + +func TestV3AuthMemberListAndStatus(t *testing.T) { + BeforeTest(t) + clus := NewClusterV3(t, &ClusterConfig{Size: 1}) + defer clus.Terminate(t) + + ctx, cancel := context.WithTimeout(t.Context(), 30*time.Second) + defer cancel() + + users := []user{ + { + name: "test-user", + password: "test-user-123", + role: "test-role", + key: "k1", + end: "k3", + }, + } + authSetupUsers(t, toGRPC(clus.Client(0)).Auth, users) + authSetupRoot(t, toGRPC(clus.Client(0)).Auth) + + rootCli, rerr := NewClient(t, clientv3.Config{ + Endpoints: clus.Client(0).Endpoints(), + Username: "root", + Password: "123", + }) + require.NoError(t, rerr) + defer rootCli.Close() + + testUserCli, terr := NewClient(t, clientv3.Config{ + Endpoints: clus.Client(0).Endpoints(), + Username: "test-user", + Password: "test-user-123", + }) + require.NoError(t, terr) + defer testUserCli.Close() + + anonCli, aerr := NewClient(t, clientv3.Config{ + Endpoints: clus.Client(0).Endpoints(), + }) + require.NoError(t, aerr) + defer anonCli.Close() + + _, err := anonCli.MemberList(ctx) + require.ErrorContains(t, err, "etcdserver: user name is empty") + + _, err = testUserCli.MemberList(ctx) + require.NoError(t, err) + + _, err = testUserCli.Status(ctx, clus.Client(0).Endpoints()[0]) + require.ErrorContains(t, err, PermissionDenied) + + _, err = rootCli.MemberList(ctx) + require.NoError(t, err) + + _, err = rootCli.Status(ctx, clus.Client(0).Endpoints()[0]) + require.NoError(t, err) +} + +func TestV3AuthLeaseLeases(t *testing.T) { + BeforeTest(t) + clus := NewClusterV3(t, &ClusterConfig{Size: 1}) + defer clus.Terminate(t) + + ctx, cancel := context.WithTimeout(t.Context(), 30*time.Second) + defer cancel() + + users := []user{ + { + name: "test-user", + password: "test-user-123", + role: "test-role", + key: "foo", + }, + } + authSetupUsers(t, toGRPC(clus.Client(0)).Auth, users) + authSetupRoot(t, toGRPC(clus.Client(0)).Auth) + + rootCli, rerr := NewClient(t, clientv3.Config{ + Endpoints: clus.Client(0).Endpoints(), + Username: "root", + Password: "123", + }) + require.NoError(t, rerr) + defer rootCli.Close() + + testUserCli, terr := NewClient(t, clientv3.Config{ + Endpoints: clus.Client(0).Endpoints(), + Username: "test-user", + Password: "test-user-123", + }) + require.NoError(t, terr) + defer testUserCli.Close() + + anonCli, aerr := NewClient(t, clientv3.Config{ + Endpoints: clus.Client(0).Endpoints(), + }) + require.NoError(t, aerr) + defer anonCli.Close() + + lresp, err := rootCli.Grant(ctx, 90) + require.NoError(t, err) + firstLeaseID := lresp.ID + + _, err = rootCli.Put(ctx, "foo", "value", clientv3.WithLease(firstLeaseID)) + require.NoError(t, err) + + lresp, err = rootCli.Grant(ctx, 90) + require.NoError(t, err) + secondLeaseID := lresp.ID + + _, err = rootCli.Put(ctx, "foo1", "value", clientv3.WithLease(secondLeaseID)) + require.NoError(t, err) + + _, err = testUserCli.Leases(ctx) + require.ErrorContains(t, err, PermissionDenied) + + _, err = anonCli.Leases(ctx) + require.ErrorContains(t, err, "etcdserver: user name is empty") + + resp, err := rootCli.Leases(ctx) + require.NoError(t, err) + require.Lenf(t, resp.Leases, 2, "want 2 leases but got %v", resp.Leases) + + leaseIDs := []clientv3.LeaseID{firstLeaseID, secondLeaseID} + for _, lease := range resp.Leases { + require.Containsf(t, leaseIDs, lease.ID, "unexpected lease ID %v, want one of %v", lease.ID, leaseIDs) + } + + _, err = rootCli.Revoke(ctx, secondLeaseID) + require.NoError(t, err) + + _, err = testUserCli.Leases(ctx) + require.NoError(t, err) +} + +func TestV3AuthCompact(t *testing.T) { + BeforeTest(t) + clus := NewClusterV3(t, &ClusterConfig{Size: 1}) + defer clus.Terminate(t) + + ctx, cancel := context.WithTimeout(t.Context(), 30*time.Second) + defer cancel() + + users := []user{ + { + name: "test-user", + password: "test-user-123", + role: "test-role", + key: "foo", + }, + } + authSetupUsers(t, toGRPC(clus.Client(0)).Auth, users) + authSetupRoot(t, toGRPC(clus.Client(0)).Auth) + + rootCli, rerr := NewClient(t, clientv3.Config{ + Endpoints: clus.Client(0).Endpoints(), + Username: "root", + Password: "123", + }) + require.NoError(t, rerr) + defer rootCli.Close() + + testUserCli, terr := NewClient(t, clientv3.Config{ + Endpoints: clus.Client(0).Endpoints(), + Username: "test-user", + Password: "test-user-123", + }) + require.NoError(t, terr) + defer testUserCli.Close() + + _, err := rootCli.Put(ctx, "key", "value") + require.NoError(t, err) + + _, err = rootCli.Put(ctx, "key", "value") + require.NoError(t, err) + + _, err = testUserCli.Compact(ctx, 1, clientv3.WithCompactPhysical()) + require.ErrorContains(t, err, PermissionDenied) + + _, err = rootCli.Compact(ctx, 1, clientv3.WithCompactPhysical()) + require.NoError(t, err) +} + +func TestReadWithPrevKvInTXN(t *testing.T) { + BeforeTest(t) + clus := NewClusterV3(t, &ClusterConfig{Size: 1}) + defer clus.Terminate(t) + + users := []user{ + { + name: "user1", + password: "user1-123", + role: "role1", + perm: "write", + key: "foo", + end: "zoo", + }, + } + anonCli := toGRPC(clus.Client(0)) + authSetupUsers(t, anonCli.Auth, users) + authSetupRoot(t, anonCli.Auth) + + rootc, err := NewClient(t, clientv3.Config{ + Endpoints: clus.Client(0).Endpoints(), + Username: "root", + Password: "123", + }) + require.NoError(t, err) + defer rootc.Close() + + userc, err := NewClient(t, clientv3.Config{ + Endpoints: clus.Client(0).Endpoints(), + Username: "user1", + Password: "user1-123", + }) + require.NoError(t, err) + defer userc.Close() + + _, err = rootc.Put(t.Context(), "foo", "bar") + require.NoError(t, err) + + _, err = userc.Txn(t.Context()). + Then(clientv3.OpPut("foo", "new", clientv3.WithPrevKV())). + Commit() + + require.Error(t, err) + require.Truef(t, eqErrGRPC(err, rpctypes.ErrGRPCPermissionDenied), "got %v, expected %v", err, rpctypes.ErrGRPCPermissionDenied) +} + +func TestPutWithLeaseInTXN(t *testing.T) { + BeforeTest(t) + clus := NewClusterV3(t, &ClusterConfig{Size: 1}) + defer clus.Terminate(t) + + users := []user{ + { + name: "user1", + password: "user1-123", + role: "role1", + perm: "write", + key: "foo", + end: "fop", + }, + } + anonCli := toGRPC(clus.Client(0)) + authSetupUsers(t, anonCli.Auth, users) + authSetupRoot(t, anonCli.Auth) + + rootc, err := NewClient(t, clientv3.Config{ + Endpoints: clus.Client(0).Endpoints(), + Username: "root", + Password: "123", + }) + require.NoError(t, err) + defer rootc.Close() + + userc, err := NewClient(t, clientv3.Config{ + Endpoints: clus.Client(0).Endpoints(), + Username: "user1", + Password: "user1-123", + }) + require.NoError(t, err) + defer userc.Close() + + t.Log("Create a lease and attach it to a key which the user1 doesn't have permission to write") + leaseResp, err := rootc.Grant(t.Context(), 90) + require.NoError(t, err) + leaseID := leaseResp.ID + _, err = rootc.Put(t.Context(), "eoo", "bar", clientv3.WithLease(leaseID)) + require.NoError(t, err) + + _, err = userc.Txn(t.Context()). + Then(clientv3.OpPut("foo", "new", clientv3.WithLease(leaseID))). + Commit() + + require.Error(t, err) + require.Truef(t, eqErrGRPC(err, rpctypes.ErrGRPCPermissionDenied), "got %v, expected %v", err, rpctypes.ErrGRPCPermissionDenied) +} diff --git a/tests/integration/v3_lease_test.go b/tests/integration/v3_lease_test.go index 9388a97f0dd5..6760de6d0e28 100644 --- a/tests/integration/v3_lease_test.go +++ b/tests/integration/v3_lease_test.go @@ -1142,7 +1142,7 @@ func acquireLeaseAndKey(clus *ClusterV3, key string) (int64, error) { return 0, err } if lresp.Error != "" { - return 0, fmt.Errorf(lresp.Error) + return 0, errors.New(lresp.Error) } // attach to key put := &pb.PutRequest{Key: []byte(key), Lease: lresp.ID} diff --git a/tools/mod/go.mod b/tools/mod/go.mod index 8eafa473f61d..ae48a11a58d0 100644 --- a/tools/mod/go.mod +++ b/tools/mod/go.mod @@ -1,8 +1,8 @@ module go.etcd.io/etcd/tools/v3 -go 1.22 +go 1.23 -toolchain go1.22.11 +toolchain go1.23.12 require ( github.com/alexkohler/nakedret v1.0.0 @@ -41,8 +41,9 @@ require ( github.com/go-openapi/swag v0.19.7 // indirect github.com/go-stack/stack v1.8.0 // indirect github.com/goccy/go-yaml v1.8.1 // indirect - github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b // indirect + github.com/golang/glog v1.2.5 // indirect github.com/golang/protobuf v1.5.4 // indirect + github.com/google/uuid v1.6.0 // indirect github.com/inconshreveable/mousetrap v1.0.0 // indirect github.com/kylelemons/godebug v1.1.0 // indirect github.com/mailru/easyjson v0.7.1 // indirect @@ -57,7 +58,7 @@ require ( github.com/spf13/cobra v1.1.3 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/trustmaster/go-aspell v0.0.0-20200701131845-c2b1f55bec8f // indirect - go.mongodb.org/mongo-driver v1.3.0 // indirect + go.mongodb.org/mongo-driver v1.5.4 // indirect golang.org/x/mod v0.17.0 // indirect golang.org/x/net v0.34.0 // indirect golang.org/x/sync v0.10.0 // indirect @@ -65,9 +66,8 @@ require ( golang.org/x/text v0.21.0 // indirect golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect - google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d // indirect - google.golang.org/protobuf v1.33.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20250115164207-1a7da9e5054f // indirect + google.golang.org/protobuf v1.36.11 // indirect gopkg.in/op/go-logging.v1 v1.0.0-20160211212156-b2cb9fa56473 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/tools/mod/go.sum b/tools/mod/go.sum index 013a8bc5dbaa..52f8cc51b7a3 100644 --- a/tools/mod/go.sum +++ b/tools/mod/go.sum @@ -35,6 +35,7 @@ github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf/go.mod h1:l github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= github.com/asaskevich/govalidator v0.0.0-20200108200545-475eaeb16496 h1:zV3ejI06GQ59hwDQAvmK1qxOQGB3WuVTRoY0okPTAv0= github.com/asaskevich/govalidator v0.0.0-20200108200545-475eaeb16496/go.mod h1:oGkLhpf+kjZl6xBf758TQhh5XrAeiJv/7FRz/2spLIg= +github.com/aws/aws-sdk-go v1.34.28/go.mod h1:H7NKnBqNVzoTJpGfLrQkkD+ytBA93eiDYi/+8rV9s48= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= @@ -111,6 +112,7 @@ github.com/go-openapi/swag v0.19.7 h1:VRuXN2EnMSsZdauzdss6JBC29YotDqG59BZ+tdlIL1 github.com/go-openapi/swag v0.19.7/go.mod h1:ao+8BpOPyKdpQz3AOJfbeEVpLmWAvlT1IfTe5McPyhY= github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= +github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg= github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/gobuffalo/attrs v0.0.0-20190224210810-a9411de4debd/go.mod h1:4duuawTqi2wkkpB4ePgWMaai6/Kc6WEz83bhFwpHzj0= @@ -143,8 +145,9 @@ github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7a github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/glog v1.2.5 h1:DrW6hGnjIhtvhOIiAKT6Psh/Kd/ldepEa81DKeiRJ5I= +github.com/golang/glog v1.2.5/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= @@ -161,16 +164,18 @@ github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= -github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.1.2 h1:EVhdT+1Kseyi1/pUmXKaFxYsDNy9RQYkMWRH68J/W7Y= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= @@ -209,6 +214,8 @@ github.com/hexfusion/schwag v0.0.0-20170606222847-b7d0fc9aadaa h1:oDcxzjIf33MTX7 github.com/hexfusion/schwag v0.0.0-20170606222847-b7d0fc9aadaa/go.mod h1:wSgrm+n3LvHOVxUJo2ha5ffLqRmt6+oGoD6J/suB66c= github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= +github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= @@ -290,6 +297,7 @@ github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FI github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml v1.4.0/go.mod h1:PN7xzY2wHTK0K9p34ErDQMlFxa51Fk0OUruD3k1mMwo= +github.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAvS1LBMMhTE= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -344,6 +352,7 @@ github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoH github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= @@ -353,10 +362,14 @@ github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1 github.com/trustmaster/go-aspell v0.0.0-20200701131845-c2b1f55bec8f h1:92ZQJRegaqnKjz9HY9an696Sw5EmAqRv0eie/U2IE6k= github.com/trustmaster/go-aspell v0.0.0-20200701131845-c2b1f55bec8f/go.mod h1:wxUiQ1klFJmwnM41kQI7IT2g8jjOKbtuL54LdjkxAI0= github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= +github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= +github.com/xdg-go/scram v1.0.2/go.mod h1:1WAq6h33pAW+iRreB34OORO2Nf7qel3VV3fjBj+hCSs= +github.com/xdg-go/stringprep v1.0.2/go.mod h1:8F9zXuvzgwmyT5DUm4GUfZGDdT3W+LCvS6+da4O5kxM= github.com/xdg/scram v0.0.0-20180814205039-7eeb5667e42c/go.mod h1:lB8K/P019DLNhemzwFU4jHLhdvlE6uDZjXFejJXr49I= github.com/xdg/stringprep v0.0.0-20180714160509-73f8eece6fdc/go.mod h1:Jhud4/sHMO4oL310DaZAKk9ZaJ08SJfe+sJh0HrGL1Y= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d/go.mod h1:rHwXgn7JulP+udvsHwJoVG1YGAP6VLg4y9I5dyZdqmA= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= @@ -365,8 +378,9 @@ go.etcd.io/gofail v0.2.0/go.mod h1:nL3ILMGfkXTekKI3clMBNazKnjUZjYLKmBHzsVAnC1o= go.etcd.io/protodoc v0.0.0-20180829002748-484ab544e116 h1:QQiUXlqz+d96jyNG71NE+IGTgOK6Xlhdx+PzvfbLHlQ= go.etcd.io/protodoc v0.0.0-20180829002748-484ab544e116/go.mod h1:F9kog+iVAuvPJucb1dkYcDcbV0g4uyGEHllTP5NrXiw= go.mongodb.org/mongo-driver v1.0.3/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= -go.mongodb.org/mongo-driver v1.3.0 h1:ew6uUIeJOo+qdUUv7LxFCUhtWmVv7ZV/Xuy4FAUsw2E= go.mongodb.org/mongo-driver v1.3.0/go.mod h1:MSWZXKOynuguX+JSvwP8i+58jYCXxbia8HS3gZBapIE= +go.mongodb.org/mongo-driver v1.5.4 h1:NPIBF/lxEcKNfWwoCJRX8+dMVwecWf9q3qUJkuh75oM= +go.mongodb.org/mongo-driver v1.5.4/go.mod h1:gRXCHX4Jo7J0IJ1oDQyUxF7jfy19UfxniMS4xxMmUqw= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= @@ -381,6 +395,7 @@ golang.org/x/crypto v0.0.0-20190530122614-20be4c3c3ed5/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -423,6 +438,7 @@ golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= @@ -476,6 +492,7 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -535,10 +552,8 @@ google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98 google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d h1:VBu5YqKPv6XiJ199exd8Br+Aetz+o08F+PLMnwJQHAY= -google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d/go.mod h1:yZTlhN0tQnXo3h00fuXNCxJdLdIdnVFVBaRJ5LWBbw4= -google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d h1:DoPTO70H+bcDXcd39vOqb2viZxgqeBeSGtZ55yZU4/Q= -google.golang.org/genproto/googleapis/api v0.0.0-20230822172742-b8732ec3820d/go.mod h1:KjSP20unUpOx5kyQUFa7k4OJg0qeJ7DEZflGDu2p6Bk= +google.golang.org/genproto/googleapis/api v0.0.0-20250115164207-1a7da9e5054f h1:gap6+3Gk41EItBuyi4XX/bp4oqJ3UwuIMl25yGinuAA= +google.golang.org/genproto/googleapis/api v0.0.0-20250115164207-1a7da9e5054f/go.mod h1:Ic02D47M+zbarjYYUlK57y316f2MoN0gjAwI3f2S95o= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -547,8 +562,8 @@ google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyac google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= -google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= -google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= +google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -570,6 +585,7 @@ gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=