From ce14ff2e56485574f7cfdcd945cdb9455f9cbc06 Mon Sep 17 00:00:00 2001 From: Andrew Mains Date: Mon, 29 Aug 2022 17:52:28 -0400 Subject: [PATCH] etcd_docker 6: Remove etcd embed from M3DB node PR 6 for https://github.com/m3db/m3/issues/4144 Now that all test usages of the embed package had been removed, this PR removes the usage of the embed package from the m3db server itself. N.B.: this PR currently makes no attempt to fix up any "quick start" flows relying on embedded etcd; that will come later. commit-id:2870a75c --- go.mod | 16 -- go.sum | 28 +- src/cmd/services/m3dbnode/config/config.go | 77 ------ .../services/m3dbnode/config/config_test.go | 22 -- src/cmd/services/m3dbnode/main/main_test.go | 241 ------------------ src/dbnode/server/server.go | 20 +- 6 files changed, 2 insertions(+), 402 deletions(-) diff --git a/go.mod b/go.mod index 485f992594..79da8e4f8b 100644 --- a/go.mod +++ b/go.mod @@ -69,7 +69,6 @@ require ( go.etcd.io/etcd/api/v3 v3.6.0-alpha.0 go.etcd.io/etcd/client/pkg/v3 v3.6.0-alpha.0 go.etcd.io/etcd/client/v3 v3.6.0-alpha.0 - go.etcd.io/etcd/server/v3 v3.6.0-alpha.0 go.opentelemetry.io/collector v0.45.0 go.opentelemetry.io/otel v1.4.1 go.opentelemetry.io/otel/bridge/opentracing v1.4.1 @@ -109,7 +108,6 @@ require ( github.com/dennwc/varint v1.0.0 // indirect github.com/docker/go-connections v0.4.0 // indirect github.com/docker/go-units v0.4.0 // indirect - github.com/dustin/go-humanize v1.0.0 // indirect github.com/edsrzf/mmap-go v1.0.0 // indirect github.com/felixge/httpsnoop v1.0.2 // indirect github.com/glycerine/go-unsnap-stream v0.0.0-20181221182339-f9677308dec2 // indirect @@ -119,12 +117,7 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/go-playground/locales v0.13.0 // indirect github.com/go-playground/universal-translator v0.17.0 // indirect - github.com/golang-jwt/jwt v3.2.2+incompatible // indirect - github.com/google/btree v1.0.1 // indirect github.com/gorilla/handlers v1.5.1 // 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 github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect github.com/hashicorp/hcl v1.0.1-0.20190611123218-cf7d376da96d // indirect github.com/inconshreveable/mousetrap v1.0.0 // indirect @@ -158,18 +151,12 @@ require ( github.com/rs/cors v1.8.2 // indirect github.com/shirou/gopsutil v3.21.6+incompatible // indirect github.com/sirupsen/logrus v1.8.1 // indirect - github.com/soheilhy/cmux v0.1.5 // indirect github.com/spf13/cast v1.4.1 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/stretchr/objx v0.3.0 // indirect github.com/tinylib/msgp v1.1.0 // indirect - github.com/tmc/grpc-websocket-proxy v0.0.0-20201229170055-e5319fda7802 // indirect github.com/twmb/murmur3 v1.1.6 // indirect - github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 // indirect go.etcd.io/bbolt v1.3.6 // indirect - go.etcd.io/etcd/client/v2 v2.306.0-alpha.0 // indirect - go.etcd.io/etcd/pkg/v3 v3.6.0-alpha.0 // indirect - go.etcd.io/etcd/raft/v3 v3.6.0-alpha.0 // indirect go.opencensus.io v0.23.0 // indirect go.opentelemetry.io/collector/model v0.45.0 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.28.0 // indirect @@ -180,7 +167,6 @@ require ( go.opentelemetry.io/otel/trace v1.4.1 // indirect go.opentelemetry.io/proto/otlp v0.12.0 // indirect go.uber.org/multierr v1.7.0 // indirect - golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 // indirect golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 // indirect golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b // indirect golang.org/x/text v0.3.7 // indirect @@ -190,8 +176,6 @@ require ( google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto v0.0.0-20211208223120-3a66f561d7aa // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect - gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect - sigs.k8s.io/yaml v1.2.0 // indirect ) // NB(nate): upgrading to the latest msgpack is not backwards compatibile as msgpack will no longer attempt to automatically diff --git a/go.sum b/go.sum index 22fa99d1b7..2f3236ae9c 100644 --- a/go.sum +++ b/go.sum @@ -104,7 +104,6 @@ github.com/Azure/go-autorest/logger v0.2.1/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZ github.com/Azure/go-autorest/tracing v0.5.0/go.mod h1:r/s2XiOKccPW3HrqB+W0TQzfbtp2fGCgRFtBroKn4Dk= github.com/Azure/go-autorest/tracing v0.6.0 h1:TYi4+3m5t6K48TGI9AUdb+IzbnSxvnvUMfuitfgcfuo= github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU= -github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/CAFxX/gcnotifier v0.0.0-20170518020117-39b0596a2da3/go.mod h1:Rn2zM2MnHze07LwkneP48TWt6UiZhzQTwCvw6djVGfE= @@ -258,7 +257,6 @@ github.com/cenkalti/backoff/v4 v4.1.2 h1:6Yo7N8UP2K6LWZnW94DLVSSrbobcWdVzAYOisuD github.com/cenkalti/backoff/v4 v4.1.2/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/census-instrumentation/opencensus-proto v0.3.0/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/certifi/gocertifi v0.0.0-20200922220541-2c3bb06c6054 h1:uH66TXeswKn5PW5zdZ39xEwfS9an067BirqA+P4QaLI= github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.0/go.mod h1:dgIUBU3pDso/gPgZ1osOZ0iQf77oPR28Tjxl5dIMyVM= @@ -286,9 +284,6 @@ github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWH github.com/cncf/xds/go v0.0.0-20211130200136-a8f946100490 h1:KwaoQzs/WeUxxJqiJsZ4euOly1Az/IgZXXSxlD/UBNk= github.com/cncf/xds/go v0.0.0-20211130200136-a8f946100490/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= -github.com/cockroachdb/datadriven v0.0.0-20200714090401-bf6692d28da5 h1:xD/lrqdvwsc+O2bjSSi3YqY73Ke3LAiSCx49aCesA0E= -github.com/cockroachdb/errors v1.2.4 h1:Lap807SXTH5tri2TivECb/4abUkMZC9zRoLarvcKDqs= -github.com/cockroachdb/logtags v0.0.0-20190617123548-eb05cc24525f h1:o/kfcElHqOiXqcou5a3rIlMc7oJbMQkeLk0VQJ7zgqY= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= github.com/containerd/aufs v0.0.0-20200908144142-dab0cbea06f4/go.mod h1:nukgQABAEopAHvB6j7cnP5zJ+/3aVcE7hCYqvIwAHyE= github.com/containerd/aufs v0.0.0-20201003224125-76a6863f2989/go.mod h1:AkGGQs9NM2vtYHaUen+NljV0/baGCAPELGm2q9ZXpWU= @@ -446,7 +441,6 @@ github.com/docker/libtrust v0.0.0-20150114040149-fa567046d9b1/go.mod h1:cyGadeNE github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM= github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -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/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= @@ -495,7 +489,6 @@ github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5 github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa/go.mod h1:KnogPXtdwXqoenmZCw6S+25EAm2MkxbG0deNDu4cbSA= github.com/garyburd/redigo v0.0.0-20150301180006-535138d7bcd7/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY= github.com/getkin/kin-openapi v0.53.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4= -github.com/getsentry/raven-go v0.2.0 h1:no+xWJRb5ZI7eE8TWgIq1jLulQiIoLG0IfYxv5JYMGs= github.com/ghodss/yaml v0.0.0-20150909031657-73d445a93680/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= @@ -690,9 +683,8 @@ github.com/gogo/protobuf v1.3.0/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXP github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= -github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY= -github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= github.com/golang-jwt/jwt/v4 v4.0.0 h1:RAqyYixv1p7uEnocuy8P1nru5wprCh/MH2BIlW5z5/o= github.com/golang-jwt/jwt/v4 v4.0.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= @@ -820,14 +812,10 @@ github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= -github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= -github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 h1:+9834+KizmvFV7pXQGSXQTsaWhq2GjuNUt0aUU0YBYw= -github.com/grpc-ecosystem/go-grpc-middleware v1.3.0/go.mod h1:z0ButlSOZa5vEBq9m2m2hlwIgKw+rp3sdCBRoJY+30Y= -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/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= @@ -1436,8 +1424,6 @@ github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:s github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/snowflakedb/gosnowflake v1.3.13/go.mod h1:6nfka9aTXkUNha1p1cjeeyjDvcyh7jfjp0l8kGpDBok= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= -github.com/soheilhy/cmux v0.1.5 h1:jjzc5WVemNEDTLwv9tlmemhC73tI08BNOIGwBOo10Js= -github.com/soheilhy/cmux v0.1.5/go.mod h1:T7TcVDs9LWfQgPlPsdngu6I6QIoyIFZDDC6sNE1GqG0= github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= @@ -1494,8 +1480,6 @@ github.com/tklauser/go-sysconf v0.3.9 h1:JeUVdAOWhhxVcU6Eqr/ATFHgXk/mmiItdKeJPev github.com/tklauser/numcpus v0.3.0 h1:ILuRUQBtssgnxw0XXIjKUC56fgnOrFoQQ/4+DeU2biQ= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= 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/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/twmb/murmur3 v1.1.4/go.mod h1:Qq/R7NUyOfr65zD+6Q5IHKsJLwP7exErjN6lyyq3OSQ= github.com/twmb/murmur3 v1.1.6 h1:mqrRot1BRxm+Yct+vavLMou2/iJt0tNVTTC0QoIjaZg= @@ -1552,7 +1536,6 @@ github.com/xdg/stringprep v0.0.0-20180714160509-73f8eece6fdc/go.mod h1:Jhud4/sHM github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= github.com/xeipuuv/gojsonschema v0.0.0-20180618132009-1d523034197f/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs= -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/xlab/treeprint v0.0.0-20180616005107-d6fb6747feb6/go.mod h1:ce1O1j6UtZfjr22oyGxGLbauSBp2YVXpARAosm7dHBg= github.com/xlab/treeprint v1.1.0/go.mod h1:gj5Gd3gPdKtR1ikdDK6fnFLdmIS0X30kTTuNd/WEJu0= @@ -1582,16 +1565,9 @@ go.etcd.io/etcd/client/pkg/v3 v3.5.0/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3 go.etcd.io/etcd/client/pkg/v3 v3.5.1/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g= go.etcd.io/etcd/client/pkg/v3 v3.6.0-alpha.0 h1:2UyRzFWbZZzgu/xzxoRukgixvafiJtGyxO+3IKUyJ6c= go.etcd.io/etcd/client/pkg/v3 v3.6.0-alpha.0/go.mod h1:Vl/FkH40bHqmBFwhr8WVKtV47neyts36zl1voccRq8s= -go.etcd.io/etcd/client/v2 v2.305.0-alpha.0.0.20211029212747-6656181d312a h1:QPs92HLtaB/YLNnHLxnmkn0H6ZqRSfx5vvyPU/Mk5As= go.etcd.io/etcd/client/v2 v2.305.0-alpha.0.0.20211029212747-6656181d312a/go.mod h1:FJu6BdnY7u/JiFObq/nS0UPx+p2L3p1tw2kMj/UZGg0= go.etcd.io/etcd/client/v3 v3.6.0-alpha.0 h1:hHaJ8CvTPJ9iv7xPz3G0gxt3csEqJW8evgty/kYICwo= go.etcd.io/etcd/client/v3 v3.6.0-alpha.0/go.mod h1:a9JuChoQBDnw7WclHYBYCtTOIC12Wwj+Fw0LX4TI/Gs= -go.etcd.io/etcd/pkg/v3 v3.6.0-alpha.0 h1:cV/VsaYde/tcc2G9aHN5DQwx6CtUsWSEW4UqYzXuyyk= -go.etcd.io/etcd/pkg/v3 v3.6.0-alpha.0/go.mod h1:tXqWms0MpOJAS6L0B9nhFqZr0C/WEYzj/OtN90G8xzo= -go.etcd.io/etcd/raft/v3 v3.6.0-alpha.0 h1:BQ6CnNP4pIpy5rusFlTBxAacDgPXhuiHFwoTsBNsVpI= -go.etcd.io/etcd/raft/v3 v3.6.0-alpha.0/go.mod h1:/kZdrBXlc5fUgYXfIEQ0B5sb7ejXPKbtF4jWzF1exiQ= -go.etcd.io/etcd/server/v3 v3.6.0-alpha.0 h1:BQUVqBqNFZZyrRbfydrRLzq9hYvCcRj97SsX1YwD7CA= -go.etcd.io/etcd/server/v3 v3.6.0-alpha.0/go.mod h1:3QM2rLq3B3hSXmVEvgVt3vEEbG/AumSs0Is7EgrlKzU= go.mongodb.org/mongo-driver v1.0.3/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= go.mongodb.org/mongo-driver v1.1.1/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= go.mongodb.org/mongo-driver v1.1.2/go.mod h1:u7ryQJ+DOzQmeO7zB6MHyr8jkEQvC8vH7qLUO4lqsUM= @@ -2178,7 +2154,6 @@ google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfG google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200420144010-e5e8543f8aeb/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200511104702-f5ebc3bea380/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= @@ -2267,7 +2242,6 @@ gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.66.2/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8= gopkg.in/natefinch/lumberjack.v2 v2.0.0/go.mod h1:l0ndWWf7gzL7RNwBG7wST/UCcT4T24xpD6X8LsfU/+k= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/square/go-jose.v2 v2.2.2/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= diff --git a/src/cmd/services/m3dbnode/config/config.go b/src/cmd/services/m3dbnode/config/config.go index 6825fd22ce..28174b7d59 100644 --- a/src/cmd/services/m3dbnode/config/config.go +++ b/src/cmd/services/m3dbnode/config/config.go @@ -25,7 +25,6 @@ import ( "errors" "fmt" "net/url" - "path" "strings" "time" @@ -42,9 +41,7 @@ import ( "github.com/m3db/m3/src/x/opentracing" "github.com/m3dbx/vellum/regexp" - "go.etcd.io/etcd/client/pkg/v3/transport" "go.etcd.io/etcd/client/pkg/v3/types" - "go.etcd.io/etcd/server/v3/embed" "gopkg.in/yaml.v2" ) @@ -681,80 +678,6 @@ func (c *ProtoConfiguration) Validate() error { return nil } -// NewEtcdEmbedConfig creates a new embedded etcd config from kv config. -func NewEtcdEmbedConfig(cfg DBConfiguration) (*embed.Config, error) { - newKVCfg := embed.NewConfig() - - hostID, err := cfg.HostIDOrDefault().Resolve() - if err != nil { - return nil, fmt.Errorf("failed resolving hostID %w", err) - } - - discoveryCfg := cfg.DiscoveryOrDefault() - envCfg, err := discoveryCfg.EnvironmentConfig(hostID) - if err != nil { - return nil, fmt.Errorf("failed getting env config from discovery config %w", err) - } - - kvCfg := envCfg.SeedNodes - newKVCfg.Name = hostID - - dir := kvCfg.RootDir - if dir == "" { - dir = path.Join(cfg.Filesystem.FilePathPrefixOrDefault(), defaultEtcdDirSuffix) - } - newKVCfg.Dir = dir - - LPUrls, err := convertToURLsWithDefault(kvCfg.ListenPeerUrls, newURL(defaultEtcdListenHost, DefaultEtcdServerPort)) - if err != nil { - return nil, err - } - newKVCfg.LPUrls = LPUrls - - LCUrls, err := convertToURLsWithDefault(kvCfg.ListenClientUrls, newURL(defaultEtcdListenHost, DefaultEtcdClientPort)) - if err != nil { - return nil, err - } - newKVCfg.LCUrls = LCUrls - - host, endpoint, err := getHostAndEndpointFromID(kvCfg.InitialCluster, hostID) - if err != nil { - return nil, err - } - - if host.ClusterState != "" { - newKVCfg.ClusterState = host.ClusterState - } - - APUrls, err := convertToURLsWithDefault(kvCfg.InitialAdvertisePeerUrls, newURL(endpoint, DefaultEtcdServerPort)) - if err != nil { - return nil, err - } - newKVCfg.APUrls = APUrls - - ACUrls, err := convertToURLsWithDefault(kvCfg.AdvertiseClientUrls, newURL(endpoint, DefaultEtcdClientPort)) - if err != nil { - return nil, err - } - newKVCfg.ACUrls = ACUrls - - newKVCfg.InitialCluster = initialClusterString(kvCfg.InitialCluster) - - copySecurityDetails := func(tls *transport.TLSInfo, ysc *environment.SeedNodeSecurityConfig) { - tls.TrustedCAFile = ysc.CAFile - tls.CertFile = ysc.CertFile - tls.KeyFile = ysc.KeyFile - tls.ClientCertAuth = ysc.CertAuth - tls.TrustedCAFile = ysc.TrustedCAFile - } - copySecurityDetails(&newKVCfg.ClientTLSInfo, &kvCfg.ClientTransportSecurity) - copySecurityDetails(&newKVCfg.PeerTLSInfo, &kvCfg.PeerTransportSecurity) - newKVCfg.ClientAutoTLS = kvCfg.ClientTransportSecurity.AutoTLS - newKVCfg.PeerAutoTLS = kvCfg.PeerTransportSecurity.AutoTLS - - return newKVCfg, nil -} - func newURL(host string, port int) string { return fmt.Sprintf("%s:%d", host, port) } diff --git a/src/cmd/services/m3dbnode/config/config_test.go b/src/cmd/services/m3dbnode/config/config_test.go index b2e47f5b53..e95d2845e9 100644 --- a/src/cmd/services/m3dbnode/config/config_test.go +++ b/src/cmd/services/m3dbnode/config/config_test.go @@ -909,28 +909,6 @@ func TestGetHostAndEndpointFromID(t *testing.T) { } } -func TestNewEtcdEmbedConfig(t *testing.T) { - fd, err := ioutil.TempFile("", "config2.yaml") - require.NoError(t, err) - defer func() { - assert.NoError(t, fd.Close()) - assert.NoError(t, os.Remove(fd.Name())) - }() - - _, err = fd.Write([]byte(testBaseConfig)) - require.NoError(t, err) - - // Verify is valid - var cfg Configuration - err = xconfig.LoadFile(&cfg, fd.Name(), xconfig.Options{}) - require.NoError(t, err) - - embedCfg, err := NewEtcdEmbedConfig(*cfg.DB) - require.NoError(t, err) - - assert.Equal(t, "existing", embedCfg.ClusterState) -} - func TestNewJaegerTracer(t *testing.T) { fd, err := ioutil.TempFile("", "config_jaeger.yaml") require.NoError(t, err) diff --git a/src/cmd/services/m3dbnode/main/main_test.go b/src/cmd/services/m3dbnode/main/main_test.go index f46e6c39aa..25af8403e6 100644 --- a/src/cmd/services/m3dbnode/main/main_test.go +++ b/src/cmd/services/m3dbnode/main/main_test.go @@ -250,220 +250,6 @@ func TestConfig(t *testing.T) { serverWg.Wait() } -// TestEmbeddedConfig tests booting a server using an embedded KV. -func TestEmbeddedConfig(t *testing.T) { - // Create config file - tmpl, err := template.New("config").Parse(testConfig + embeddedKVConfigPortion) - require.NoError(t, err) - - configFd, cleanup := tempFile(t, "config.yaml") - defer cleanup() - - logFile, cleanupLogFile := tempFileTouch(t, "m3dbnode.log") - defer cleanupLogFile() - - configServiceCacheDir, cleanupConfigServiceCacheDir := tempDir(t, "kv") - defer cleanupConfigServiceCacheDir() - - embeddedKVDir, cleanupEmbeddedKVDir := tempDir(t, "embedded") - defer cleanupEmbeddedKVDir() - - dataDir, cleanupDataDir := tempDir(t, "data") - defer cleanupDataDir() - - servicePort := nextServicePort() - err = tmpl.Execute(configFd, struct { - HostID string - LogFile string - DataDir string - ServicePort string - ServiceName string - ServiceEnv string - ServiceZone string - ConfigServiceCacheDir string - EmbeddedKVDir string - LPURL string - LCURL string - APURL string - ACURL string - EtcdEndpoint string - InitialClusterHostID string - InitialClusterEndpoint string - }{ - HostID: hostID, - LogFile: logFile, - DataDir: dataDir, - ServicePort: strconv.Itoa(int(servicePort)), - ServiceName: serviceName, - ServiceEnv: serviceEnv, - ServiceZone: serviceZone, - ConfigServiceCacheDir: configServiceCacheDir, - EmbeddedKVDir: embeddedKVDir, - LPURL: lpURL, - LCURL: lcURL, - APURL: apURL, - ACURL: acURL, - EtcdEndpoint: etcdEndpoint, - InitialClusterHostID: initialClusterHostID, - InitialClusterEndpoint: initialClusterEndpoint, - }) - require.NoError(t, err) - - // Run server - var ( - interruptCh = make(chan error, 1) - bootstrapCh = make(chan struct{}, 1) - embeddedKVCh = make(chan struct{}, 1) - serverWg sync.WaitGroup - ) - serverWg.Add(1) - go func() { - server.Run(server.RunOptions{ - ConfigFile: configFd.Name(), - BootstrapCh: bootstrapCh, - EmbeddedKVCh: embeddedKVCh, - InterruptCh: interruptCh, - }) - serverWg.Done() - }() - defer func() { - // Resetting DefaultServeMux to prevent multiple assignments - // to /debug/dump in Server.Run() - http.DefaultServeMux = http.NewServeMux() - }() - - // Wait for embedded KV to be up. - <-embeddedKVCh - - // Setup the placement - var cfg config.Configuration - err = xconfig.LoadFile(&cfg, configFd.Name(), xconfig.Options{}) - require.NoError(t, err) - - discoveryCfg := cfg.DB.DiscoveryOrDefault() - envCfg, err := discoveryCfg.EnvironmentConfig(hostID) - require.NoError(t, err) - - syncCluster, err := envCfg.Services.SyncCluster() - require.NoError(t, err) - configSvcClient, err := syncCluster.Service.NewClient(instrument.NewOptions(). - SetLogger(zap.NewNop())) - require.NoError(t, err) - - svcs, err := configSvcClient.Services(services.NewOverrideOptions()) - require.NoError(t, err) - - serviceID := services.NewServiceID(). - SetName(serviceName). - SetEnvironment(serviceEnv). - SetZone(serviceZone) - - metadata := services.NewMetadata(). - SetPort(servicePort). - SetLivenessInterval(time.Minute). - SetHeartbeatInterval(10 * time.Second) - - err = svcs.SetMetadata(serviceID, metadata) - require.NoError(t, err) - - placementOpts := placement.NewOptions(). - SetValidZone(serviceZone) - placementSvc, err := svcs.PlacementService(serviceID, placementOpts) - require.NoError(t, err) - - var ( - instance = placement.NewInstance(). - SetID(hostID). - SetEndpoint(endpoint("127.0.0.1", servicePort)). - SetPort(servicePort). - SetIsolationGroup("local"). - SetWeight(1). - SetZone(serviceZone) - instances = []placement.Instance{instance} - // Use a low number of shards to avoid having to tune F.D limits. - shards = 4 - replicas = 1 - ) - - _, err = placementSvc.BuildInitialPlacement(instances, shards, replicas) - require.NoError(t, err) - - // Setup the namespace - ns, err := newNamespaceProtoValue(namespaceID) - require.NoError(t, err) - - kvStore, err := configSvcClient.KV() - require.NoError(t, err) - - _, err = kvStore.Set(kvconfig.NamespacesKey, ns) - require.NoError(t, err) - - // Wait for bootstrap - <-bootstrapCh - - // Create client, read and write some data - // NB(r): Make sure client config points to the root config - // service since we're going to instantiate the client configuration - // just by itself. - cfg.DB.Client.EnvironmentConfig = &envCfg - - cli, err := cfg.DB.Client.NewClient(client.ConfigurationParameters{}) - require.NoError(t, err) - - adminCli := cli.(client.AdminClient) - adminSession, err := adminCli.DefaultAdminSession() - require.NoError(t, err) - defer adminSession.Close() - - // Propagation of shard state from Initializing --> Available post-bootstrap is eventually - // consistent, so we must wait. - waitUntilAllShardsAreAvailable(t, adminSession) - - // Cast to narrower-interface instead of grabbing DefaultSession to make sure - // we use the same topology.Map that we validated in waitUntilAllShardsAreAvailable. - session := adminSession.(client.Session) - - start := xtime.Now().Add(-time.Minute) - values := []struct { - value float64 - at xtime.UnixNano - unit xtime.Unit - }{ - {value: 1.0, at: start, unit: xtime.Second}, - {value: 2.0, at: start.Add(1 * time.Second), unit: xtime.Second}, - {value: 3.0, at: start.Add(2 * time.Second), unit: xtime.Second}, - } - - for _, v := range values { - err := session.Write(ident.StringID(namespaceID), ident.StringID("foo"), v.at, v.value, v.unit, nil) - require.NoError(t, err) - } - - // Account for first value inserted at xtime.Second precision - fetchStart := start.Truncate(time.Second) - - // Account for last value being inserted at xtime.Second and - // the "end" param to fetch being exclusive - fetchEnd := values[len(values)-1].at.Truncate(time.Second).Add(time.Nanosecond) - - iter, err := session.Fetch(ident.StringID(namespaceID), ident.StringID("foo"), fetchStart, fetchEnd) - require.NoError(t, err) - - for _, v := range values { - require.True(t, iter.Next()) - dp, unit, _ := iter.Current() - assert.Equal(t, v.value, dp.Value) - // Account for xtime.Second precision on values going in - expectAt := v.at.Truncate(time.Second) - assert.Equal(t, expectAt, dp.TimestampNanos) - assert.Equal(t, v.unit, unit) - } - - // Wait for server to stop - interruptCh <- fmt.Errorf("test complete") - serverWg.Wait() -} - var ( testConfig = ` db: @@ -635,31 +421,4 @@ db: endpoints: {{.EtcdEndpoints}} autoSyncInterval: -1 ` - - embeddedKVConfigPortion = ` - discovery: - config: - service: - env: {{.ServiceEnv}} - zone: {{.ServiceZone}} - service: {{.ServiceName}} - cacheDir: {{.ConfigServiceCacheDir}} - etcdClusters: - - zone: {{.ServiceZone}} - endpoints: - - {{.EtcdEndpoint}} - seedNodes: - rootDir: {{.EmbeddedKVDir}} - listenPeerUrls: - - {{.LPURL}} - listenClientUrls: - - {{.LCURL}} - initialAdvertisePeerUrls: - - {{.APURL}} - advertiseClientUrls: - - {{.ACURL}} - initialCluster: - - hostID: {{.InitialClusterHostID}} - endpoint: {{.InitialClusterEndpoint}} -` ) diff --git a/src/dbnode/server/server.go b/src/dbnode/server/server.go index b1b856c4b4..cae76c6d53 100644 --- a/src/dbnode/server/server.go +++ b/src/dbnode/server/server.go @@ -100,7 +100,6 @@ import ( "github.com/opentracing/opentracing-go" "github.com/uber-go/tally" "github.com/uber/tchannel-go" - "go.etcd.io/etcd/server/v3/embed" "go.uber.org/zap" ) @@ -355,24 +354,7 @@ func Run(runOpts RunOptions) { if !config.IsSeedNode(seedNodes, hostID) { logger.Info("not a seed node, using cluster seed nodes") } else { - logger.Info("seed node, starting etcd server") - - etcdCfg, err := config.NewEtcdEmbedConfig(cfg) - if err != nil { - logger.Fatal("unable to create etcd config", zap.Error(err)) - } - - e, err := embed.StartEtcd(etcdCfg) - if err != nil { - logger.Fatal("could not start embedded etcd", zap.Error(err)) - } - - if runOpts.EmbeddedKVCh != nil { - // Notify on embedded KV bootstrap chan if specified - runOpts.EmbeddedKVCh <- struct{}{} - } - - defer e.Close() + logger.Warn("seed node with embedded etcd no longer supported; skipping etcd setup.") } }