diff --git a/cmd/distributed/main.go b/cmd/distributed/main.go index 5e6b50e929a043435941f63a5b0064273d80be5f..97eec6d0be9a11693512451483bf0b175aab884a 100644 --- a/cmd/distributed/main.go +++ b/cmd/distributed/main.go @@ -8,7 +8,6 @@ import ( "syscall" "github.com/zilliztech/milvus-distributed/cmd/distributed/roles" - "github.com/zilliztech/milvus-distributed/internal/errors" ) const ( @@ -34,7 +33,7 @@ func run(serverType string) error { _, _ = fd.WriteString(fmt.Sprintf("%d", os.Getpid())) } else { - return errors.Errorf("service %s is running", serverType) + return fmt.Errorf("service %s is running", serverType) } role := roles.MilvusRoles{} @@ -62,7 +61,7 @@ func run(serverType string) error { case "standalone": role.EnableStandalone = true default: - return errors.Errorf("unknown server type = %s", serverType) + return fmt.Errorf("unknown server type = %s", serverType) } role.Run(false) return nil diff --git a/go.mod b/go.mod index ee24c6d1afc0baec87110c05bba55440a303b210..b81cad6c5db46be511b22a6a5ff4340b4e9adae3 100644 --- a/go.mod +++ b/go.mod @@ -17,14 +17,12 @@ require ( github.com/golang/protobuf v1.4.2 github.com/google/btree v1.0.0 github.com/klauspost/compress v1.10.11 // indirect - github.com/kr/text v0.2.0 // indirect github.com/minio/minio-go/v7 v7.0.5 github.com/mitchellh/mapstructure v1.1.2 - github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect - github.com/onsi/gomega v1.10.5 // indirect github.com/opentracing-contrib/go-grpc v0.0.0-20200813121455-4a6760c71486 github.com/opentracing/opentracing-go v1.2.0 github.com/pierrec/lz4 v2.5.2+incompatible // indirect + github.com/pkg/errors v0.9.1 github.com/sirupsen/logrus v1.6.0 // indirect github.com/spaolacci/murmur3 v1.1.0 github.com/spf13/cast v1.3.0 @@ -41,11 +39,10 @@ require ( golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb golang.org/x/time v0.0.0-20191024005414-555d28b269f0 // indirect golang.org/x/tools v0.0.0-20200825202427-b303f430e36d // indirect - golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150 // indirect google.golang.org/grpc v1.31.0 - gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect gopkg.in/natefinch/lumberjack.v2 v2.0.0 + gopkg.in/yaml.v2 v2.3.0 // indirect honnef.co/go/tools v0.0.1-2020.1.4 // indirect sigs.k8s.io/yaml v1.2.0 // indirect ) diff --git a/go.sum b/go.sum index 9b0020fb528f37665dba096dd4b0f3e86e6ef93a..56765485b76fea2f0375988a60db6643e794a6f2 100644 --- a/go.sum +++ b/go.sum @@ -10,8 +10,6 @@ cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqCl cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -github.com/99designs/keyring v1.1.5 h1:wLv7QyzYpFIyMSwOADq1CLTF9KbjbBfcnfmOGJ64aO4= -github.com/99designs/keyring v1.1.5/go.mod h1:7hsVvt2qXgtadGevGJ4ujg+u8m6SpJ5TpHqTozIPqf0= 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= @@ -19,18 +17,10 @@ github.com/HdrHistogram/hdrhistogram-go v1.0.1 h1:GX8GAYDuhlFQnI2fRDHQhTlkHMz8bE github.com/HdrHistogram/hdrhistogram-go v1.0.1/go.mod h1:BWJ+nMSHY3L41Zj7CA3uXnloDp7xxV0YvstAE7nKTaM= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 h1:JYp7IbQjafoB+tBA3gMyHYHrpOtNuDiK/uB5uXxq5wM= -github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4 h1:Hs82Z41s6SdL1CELW+XaDYmOH4hkBN4/N9og/AsOv7E= -github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/apache/pulsar-client-go v0.1.1 h1:v/kU+2ZCC6yFIcbZrFtWa9/nvVzVr18L+xYJUvZSxEQ= github.com/apache/pulsar-client-go v0.1.1/go.mod h1:mlxC65KL1BLhGO2bnT9zWMttVzR2czVPb27D477YpyU= -github.com/apache/pulsar-client-go v0.3.0 h1:rNhJ/ENwoEfZPHHwUHNxPBTNqNQE2LQEm7DXu043giM= -github.com/apache/pulsar-client-go v0.3.0/go.mod h1:9eSgOadVhCfb2DfWtS1SCYaYIMk9VDOZztr4u3FO8cQ= -github.com/apache/pulsar-client-go/oauth2 v0.0.0-20200715083626-b9f8c5cedefb h1:E1P0FudxDdj2RhbveZC9i3PwukLCA/4XQSkBS/dw6/I= -github.com/apache/pulsar-client-go/oauth2 v0.0.0-20200715083626-b9f8c5cedefb/go.mod h1:0UtvvETGDdvXNDCHa8ZQpxl+w3HbdFtfYZvDHLgWGTY= -github.com/apache/thrift v0.14.0 h1:vqZ2DP42i8th2OsgCcYZkirtbzvpZEFx53LiWDJXIAs= +github.com/apache/thrift v0.14.1 h1:Yh8v0hpCj63p5edXOLaqTJW0IJ1p+eMW6+YSOqw1d6s= github.com/apache/thrift/lib/go/thrift v0.0.0-20210120171102-e27e82c46ba4 h1:orNYqmQGnSjgOauLWjHEp9/qIDT98xv/0Aa4Zet3/Y8= github.com/apache/thrift/lib/go/thrift v0.0.0-20210120171102-e27e82c46ba4/go.mod h1:V/LzksIyqd3KZuQ2SunvReTG/UkArhII1dAWY5U1sCE= github.com/ardielle/ardielle-go v1.5.2 h1:TilHTpHIQJ27R1Tl/iITBzMwiUGSlVfiVhwDNGM3Zj4= @@ -45,8 +35,6 @@ github.com/beefsack/go-rate v0.0.0-20180408011153-efa7637bb9b6/go.mod h1:6YNgTHL github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0 h1:HWo1m869IqiPhD389kmkxeTalrjNbbJTC8LXupb+sl0= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= -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/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= github.com/bmizerany/perks v0.0.0-20141205001514-d9a9656a3a4b/go.mod h1:ac9efd0D1fsDb3EJvhqgXRbFx7bs2wqZ10HQPeU8U/Q= @@ -54,8 +42,6 @@ github.com/boynton/repl v0.0.0-20170116235056-348863958e3e/go.mod h1:Crc/GCZ3NXD github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= 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.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+qY= -github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa h1:OaNxuTZr7kxeODyLWsRMC+OD03aFUH+mW6r2d+MWa5Y= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= github.com/coreos/bbolt v1.3.2 h1:wZwiHHUieZCquLkDL0B8UhzreNWsPHooDAG3q34zk0s= @@ -72,10 +58,6 @@ github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f h1:lBNOc5arjvs8E5mO2tbp github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/danieljoos/wincred v1.0.2 h1:zf4bhty2iLuwgjgpraD2E9UbvO+fe54XXGJbOwe23fU= -github.com/danieljoos/wincred v1.0.2/go.mod h1:SnuYRW9lp1oJrZX/dXJqr0cPK5gYXqx3EJbmjhLdK9U= -github.com/datadog/zstd v1.4.6-0.20200617134701-89f69fb7df32 h1:QWqadCIHYA5zja4b6h9uGQn93u1vL+G/aewImumdg/M= -github.com/datadog/zstd v1.4.6-0.20200617134701-89f69fb7df32/go.mod h1:inRp+etsHuvVqMPNTXaFlpf/Tj7wqviBtdJoPVrPEFQ= 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= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -86,8 +68,6 @@ github.com/dimfeld/httptreemux v5.0.1+incompatible h1:Qj3gVcDNoOthBAqftuD596rm4w github.com/dimfeld/httptreemux v5.0.1+incompatible/go.mod h1:rbUlSV+CCpv/SuqUTP/8Bk2O3LyUV436/yaRGkhP6Z0= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4 h1:qk/FSDDxo05wdJH28W+p5yivv7LuLYLRXPPD8KQCtZs= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/dvsekhvalnov/jose2go v0.0.0-20180829124132-7f401d37b68a h1:mq+R6XEM6lJX5VlLyZIrUSP8tSuJp82xTK89hvBwJbU= -github.com/dvsekhvalnov/jose2go v0.0.0-20180829124132-7f401d37b68a/go.mod h1:7BvyPhdbLxMXIYTFPLsyJRFMsKmOZnQmzh6Gb+uquuM= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c h1:8ISkoahWXwZR41ois5lSJBSVw4D0OV19Ht/JSTzvSv0= @@ -101,23 +81,17 @@ github.com/frankban/quicktest v1.10.2 h1:19ARM85nVi4xH7xPXuc5eM/udya5ieh7b/Sv+d8 github.com/frankban/quicktest v1.10.2/go.mod h1:K+q6oSqb0W0Ininfk863uOk1lMy69l/P6txr3mVT54s= github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV9I= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= -github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-basic/ipv4 v1.0.0 h1:gjyFAa1USC1hhXTkPOwBWDPfMcUaIM+tvo1XzV9EZxs= github.com/go-basic/ipv4 v1.0.0/go.mod h1:etLBnaxbidQfuqE6wgZQfs38nEWNmzALkxDZe4xY8Dg= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-kit/kit v0.9.0 h1:wDJmvq38kDhkVxi50ni9ykkdUr1PKgqKOoi01fa0Mdk= -github.com/go-kit/kit v0.9.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 h1:MP4Eh7ZCb31lleYCFuwm0oe4/YGak+5l1vA2NOE80nA= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= 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/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 h1:ZpnhV/YsD2/4cESfV5+Hoeu/iUR3ruzNvZ+yQfO03a0= -github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.2.1 h1:/s5zKNz0uPFCZ5hddgPdo2TK2TVrUNMn0OOX8/aZMTE= github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= @@ -144,8 +118,6 @@ github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:W github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= github.com/golang/protobuf v1.4.2 h1:+Z5KGCizgyZCbGh1KZqA0fcLLkwbsjIzS4aV2v7wJX0= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= -github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= -github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= @@ -182,8 +154,6 @@ github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t github.com/grpc-ecosystem/grpc-gateway v1.9.5 h1:UImYN5qQ8tuGpGE16ZmjvcTtTw24zw1QAp/SlnNrZhI= github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645/go.mod h1:6iZfnjpejD4L/4DwD7NryNaJyCQdzwWwH2MWhCA90Kw= -github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU= -github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0= github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= @@ -205,7 +175,6 @@ github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= -github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/jawher/mow.cli v1.0.4/go.mod h1:5hQj2V8g+qYmLUVWqu4Wuja1pI57M83EChYLVZ0sMKk= github.com/jawher/mow.cli v1.1.0/go.mod h1:aNaQlc7ozF3vw6IJ2dHjp2ZFiA4ozMIYY6PyuRJwlUg= @@ -222,8 +191,6 @@ github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1 github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d h1:Z+RDyXzjKE0i2sTjZ/b1uxiGtPhFy34Ou/Tk0qwN0kM= -github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d/go.mod h1:JJNrCn9otv/2QP4D7SMJBgaleKpOf66PnW6F5WGNRIc= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= @@ -246,8 +213,6 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/linkedin/goavro/v2 v2.9.8 h1:jN50elxBsGBDGVDEKqUlDuU1cFwJ11K/yrJCBMe/7Wg= -github.com/linkedin/goavro/v2 v2.9.8/go.mod h1:UgQUb2N/pmueQYH9bfqFioWxzYCZXSfF8Jw03O5sjqA= github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= @@ -279,25 +244,11 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1 h1:9f412s+6RmYXLWZSEzVVgPGK7C2PphHj5RJrvfx9AWI= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/mtibben/percent v0.2.1 h1:5gssi8Nqo8QU/r2pynCm+hBQHpkB/uNK7BJCFogWdzs= -github.com/mtibben/percent v0.2.1/go.mod h1:KG9uO+SZkUp+VkRHsCdYQV3XSZrrSpR3O9ibNBTZrns= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= -github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= -github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= -github.com/onsi/ginkgo v1.12.1 h1:mFwc4LvZ0xpSvDZ3E+k8Yte0hLOMxXUlP+yXtJqkYfQ= -github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= -github.com/onsi/ginkgo v1.14.0 h1:2mOpI4JVVPBN+WQRa0WKH2eXR+Ey+uK4n7Zj0aYpIQA= -github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= -github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= -github.com/onsi/gomega v1.10.1 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= -github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/onsi/gomega v1.10.5 h1:7n6FEkpFmfCoo2t+YYqXH0evK+a9ICQz0xcAy9dYcaQ= -github.com/onsi/gomega v1.10.5/go.mod h1:gza4q3jKQJijlu05nKWRCW/GavJumGt8aNRxWg7mt48= github.com/opentracing-contrib/go-grpc v0.0.0-20200813121455-4a6760c71486 h1:K35HCWaOTJIPW6cDHK4yj3QfRY/NhE0pBbfoc0M2NMQ= github.com/opentracing-contrib/go-grpc v0.0.0-20200813121455-4a6760c71486/go.mod h1:DYR5Eij8rJl8h7gblRrOZ8g0kW1umSpKqYIBTgeDtLo= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= @@ -322,28 +273,21 @@ github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXP github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= github.com/prometheus/client_golang v1.0.0 h1:vrDKnkGzuGvhNAL56c7DBz29ZL+KxnoR0x7enabFceM= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= -github.com/prometheus/client_golang v1.7.1 h1:NTGy1Ja9pByO+xAeH/qiWnLrKtr3hJPNjaVUwnjpdpA= -github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4 h1:gQz4mCbXsO+nc9n1hCxHcGA3Zx3Eo+UHZoInFGUIXNM= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= -github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1 h1:K0MGApIoQvMw27RTdJkPbr3JZ7DNbtxQNyi5STVM6Kw= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.10.0 h1:RyRA7RzGXQZiW+tGMr7sxa85G1z0yOpM1qq5c8lNawc= -github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.2 h1:6LJUbpNm42llc4HRCuvApCSWB/WfhuNo9K98Q9sNGfs= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/procfs v0.1.3 h1:F0+tqvhOksq22sc6iCHF5WGlWjdwj92p0udFh1VFBS8= -github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= -github.com/protocolbuffers/protobuf v3.15.1+incompatible h1:HfHKbdokPc6vkBuYYXW/PTpOIo8BICHl1vfE8dT5jGo= +github.com/protocolbuffers/protobuf v3.15.3+incompatible h1:5WExaSYHEGvU73sVHvqe+3/APOOyCVg/pDCeAlfpCrw= +github.com/protocolbuffers/protobuf v3.15.4+incompatible h1:Blv4dGFGqHXX+r5Tqoc1ziXPMDElqZ+/ryYcE4bddN4= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rs/xid v1.2.1 h1:mhH9Nq+C1fY2l1XIpgxIiUOfNpRBYH1kKcr+qfKgjRc= @@ -352,7 +296,6 @@ github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q= -github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM= @@ -394,10 +337,8 @@ github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c/go.mod h1:ahpPrc7 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 h1:LnC5Kc/wtumK+WB441p7ynQJzVuNRJiqddSIE3IlSEQ= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/uber/jaeger-client-go v1.6.0 h1:3+zLlq+4npI5fg8IsgAje3YsP7TcEdNzJScyqFIzxEQ= github.com/uber/jaeger-client-go v2.25.0+incompatible h1:IxcNZ7WRY1Y3G4poYlx24szfsn/3LvK9QHCq9oQw8+U= github.com/uber/jaeger-client-go v2.25.0+incompatible/go.mod h1:WVhlPFC8FDjOFMMWRy2pZqQJSXxYSwNYOkTr/Z6d3Kk= -github.com/uber/jaeger-lib v1.5.0 h1:OHbgr8l656Ub3Fw5k9SWnBfIEwvoHQ+W2y+Aa9D1Uyo= github.com/uber/jaeger-lib v2.4.0+incompatible h1:fY7QsGQWiCt8pajv4r7JEvmATdCVaWxXbjwyYwsNaLQ= github.com/uber/jaeger-lib v2.4.0+incompatible/go.mod h1:ComeNDZlWwrWnDv8aPp0Ba6+uUTzImX/AauajbLI56U= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= @@ -460,7 +401,6 @@ golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzB golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181023162649-9b4f9f5ad519/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181201002055-351d144fa1fc/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -472,13 +412,11 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190501004415-9ce7a6920f09/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -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-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190921015927-1a5e07d1ff72/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-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb h1:eBmm0M9fYhWpKZLjQUUKka/LtIxf46G4fxeEz5KJr9U= @@ -486,18 +424,13 @@ golang.org/x/net v0.0.0-20201202161906-c7110b5ffcbb/go.mod h1:sp8m0HH+o8qH0wwXwY 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.0.0-20200107190931-bf48bf16ab8d h1:TzXSXBo42m9gQenoE3b9BGiEpg5IG2JkU5FkPIawgtw= -golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -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= golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -509,17 +442,10 @@ golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190712062909-fae7ac547cb7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190804053845-51ab0e2deafa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f h1:+Nyd8tzPX9R7BWHguqsrbFdRx3WQ/1ib8I44HXV5yTA= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -601,7 +527,6 @@ gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8X gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/ini.v1 v1.51.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/ini.v1 v1.57.0 h1:9unxIsFcTt4I55uWluz+UmL95q4kdJ0buvQ1ZIqVQww= gopkg.in/ini.v1 v1.57.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= @@ -609,8 +534,6 @@ gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXL 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.4.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= -gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/internal/allocator/allocator.go b/internal/allocator/allocator.go index bae89e4fee0ffd05993b663f0cd0bb38039a5bf4..6c827a04461c679966b27656da3d9f44559f69eb 100644 --- a/internal/allocator/allocator.go +++ b/internal/allocator/allocator.go @@ -2,9 +2,10 @@ package allocator import ( "context" - "errors" "sync" "time" + + "errors" ) const ( diff --git a/internal/allocator/timestamp.go b/internal/allocator/timestamp.go index fda5d9271cd7a5977a5a3bf38566dcf41cc2277e..c37ade8d7276b21a10adc60630c0631c257f77ab 100644 --- a/internal/allocator/timestamp.go +++ b/internal/allocator/timestamp.go @@ -2,10 +2,10 @@ package allocator import ( "context" + "errors" "log" "time" - "github.com/zilliztech/milvus-distributed/internal/errors" "github.com/zilliztech/milvus-distributed/internal/proto/commonpb" "github.com/zilliztech/milvus-distributed/internal/proto/masterpb" "github.com/zilliztech/milvus-distributed/internal/util/retry" @@ -147,7 +147,7 @@ func (ta *TimestampAllocator) Alloc(count uint32) ([]Timestamp, error) { req.Wait() if !req.IsValid() { - return nil, errors.Errorf("alloc time stamp request failed") + return nil, errors.New("alloc time stamp request failed") } start, count := req.timestamp, req.count diff --git a/internal/datanode/collection.go b/internal/datanode/collection.go index 59321233522e25b87c59f18eb1f84ab22ae9a564..ae1b1d1f5ccb548cbad59540fea8d773687858d0 100644 --- a/internal/datanode/collection.go +++ b/internal/datanode/collection.go @@ -1,7 +1,8 @@ package datanode import ( - "github.com/zilliztech/milvus-distributed/internal/errors" + "errors" + "github.com/zilliztech/milvus-distributed/internal/proto/schemapb" ) @@ -27,7 +28,7 @@ func (c *Collection) GetSchema() *schemapb.CollectionSchema { func newCollection(collectionID UniqueID, schema *schemapb.CollectionSchema) (*Collection, error) { if schema == nil { - return nil, errors.Errorf("Invalid schema") + return nil, errors.New("invalid schema") } var newCollection = &Collection{ diff --git a/internal/datanode/collection_replica.go b/internal/datanode/collection_replica.go index d283140761fbc58dc0bd63d723d162f2d8b78385..a83370be924c44a36f6ebf3c270a409c6cc6daa8 100644 --- a/internal/datanode/collection_replica.go +++ b/internal/datanode/collection_replica.go @@ -1,11 +1,11 @@ package datanode import ( + "fmt" "sync" "go.uber.org/zap" - "github.com/zilliztech/milvus-distributed/internal/errors" "github.com/zilliztech/milvus-distributed/internal/log" "github.com/zilliztech/milvus-distributed/internal/proto/internalpb2" "github.com/zilliztech/milvus-distributed/internal/proto/schemapb" @@ -71,7 +71,7 @@ func (replica *ReplicaImpl) getSegmentByID(segmentID UniqueID) (*Segment, error) return segment, nil } } - return nil, errors.Errorf("Cannot find segment, id = %v", segmentID) + return nil, fmt.Errorf("Cannot find segment, id = %v", segmentID) } func (replica *ReplicaImpl) addSegment( @@ -114,7 +114,7 @@ func (replica *ReplicaImpl) removeSegment(segmentID UniqueID) error { return nil } } - return errors.Errorf("Error, there's no segment %v", segmentID) + return fmt.Errorf("Error, there's no segment %v", segmentID) } func (replica *ReplicaImpl) hasSegment(segmentID UniqueID) bool { @@ -141,7 +141,7 @@ func (replica *ReplicaImpl) updateStatistics(segmentID UniqueID, numRows int64) return nil } } - return errors.Errorf("Error, there's no segment %v", segmentID) + return fmt.Errorf("Error, there's no segment %v", segmentID) } func (replica *ReplicaImpl) getSegmentStatisticsUpdates(segmentID UniqueID) (*internalpb2.SegmentStatisticsUpdates, error) { @@ -165,7 +165,7 @@ func (replica *ReplicaImpl) getSegmentStatisticsUpdates(segmentID UniqueID) (*in return updates, nil } } - return nil, errors.Errorf("Error, there's no segment %v", segmentID) + return nil, fmt.Errorf("Error, there's no segment %v", segmentID) } // --- collection --- @@ -181,7 +181,7 @@ func (replica *ReplicaImpl) addCollection(collectionID UniqueID, schema *schemap defer replica.mu.Unlock() if _, ok := replica.collections[collectionID]; ok { - return errors.Errorf("Create an existing collection=%s", schema.GetName()) + return fmt.Errorf("Create an existing collection=%s", schema.GetName()) } newCollection, err := newCollection(collectionID, schema) @@ -210,7 +210,7 @@ func (replica *ReplicaImpl) getCollectionByID(collectionID UniqueID) (*Collectio coll, ok := replica.collections[collectionID] if !ok { - return nil, errors.Errorf("Cannot get collection %d by ID: not exist", collectionID) + return nil, fmt.Errorf("Cannot get collection %d by ID: not exist", collectionID) } return coll, nil diff --git a/internal/datanode/data_node.go b/internal/datanode/data_node.go index 6a56f30585c02cfbfdf22ad1593adf5f38cc21d9..b61e0c98e21dcf7d1ae009fb784f70baf8c3f906 100644 --- a/internal/datanode/data_node.go +++ b/internal/datanode/data_node.go @@ -9,7 +9,8 @@ import ( "go.uber.org/zap" - "github.com/zilliztech/milvus-distributed/internal/errors" + "errors" + "github.com/zilliztech/milvus-distributed/internal/log" "github.com/zilliztech/milvus-distributed/internal/msgstream" "github.com/zilliztech/milvus-distributed/internal/proto/commonpb" @@ -128,7 +129,7 @@ func (node *DataNode) Init() error { resp, err := node.dataService.RegisterNode(ctx, req) if err != nil { - return errors.Errorf("Register node failed: %v", err) + return fmt.Errorf("Register node failed: %v", err) } select { @@ -149,7 +150,7 @@ func (node *DataNode) Init() error { case "CompleteFlushChannelName": Params.CompleteFlushChannelName = kv.Value default: - return errors.Errorf("Invalid key: %v", kv.Key) + return fmt.Errorf("Invalid key: %v", kv.Key) } } diff --git a/internal/datanode/flow_graph_dd_node.go b/internal/datanode/flow_graph_dd_node.go index f89e4132a1d2f05eba35e5ddaffa8eed75c032eb..1295004f56c9122d38497eaed051590a203512f4 100644 --- a/internal/datanode/flow_graph_dd_node.go +++ b/internal/datanode/flow_graph_dd_node.go @@ -2,7 +2,7 @@ package datanode import ( "context" - "errors" + "fmt" "path" "sort" "strconv" @@ -217,7 +217,7 @@ func (ddNode *ddNode) createCollection(msg *msgstream.CreateCollectionMsg) { // add collection if _, ok := ddNode.ddRecords.collectionRecords[collectionID]; ok { - err := errors.New("collection " + strconv.FormatInt(collectionID, 10) + " is already exists") + err := fmt.Errorf("collection %d is already exists", collectionID) log.Error("String conversion wrong", zap.Error(err)) return } diff --git a/internal/datanode/flow_graph_insert_buffer_node.go b/internal/datanode/flow_graph_insert_buffer_node.go index c7aea7fdba191945ce3f9c2a589b033f9bc9da02..9d1e66af3836ff1500ad37497d5276017c71a223 100644 --- a/internal/datanode/flow_graph_insert_buffer_node.go +++ b/internal/datanode/flow_graph_insert_buffer_node.go @@ -4,13 +4,13 @@ import ( "bytes" "context" "encoding/binary" + "fmt" "path" "strconv" "unsafe" "go.uber.org/zap" - "github.com/zilliztech/milvus-distributed/internal/errors" "github.com/zilliztech/milvus-distributed/internal/kv" miniokv "github.com/zilliztech/milvus-distributed/internal/kv/minio" "github.com/zilliztech/milvus-distributed/internal/log" @@ -481,7 +481,7 @@ func (ibNode *insertBufferNode) flushSegment(segID UniqueID, partitionID UniqueI collSch, err := ibNode.getCollectionSchemaByID(collID) if err != nil { - return errors.Errorf("Get collection by ID wrong, %v", err) + return fmt.Errorf("Get collection by ID wrong, %v", err) } collMeta := &etcdpb.CollectionMeta{ @@ -496,7 +496,7 @@ func (ibNode *insertBufferNode) flushSegment(segID UniqueID, partitionID UniqueI segID, ibNode.insertBuffer.insertData[segID]) if err != nil { - return errors.Errorf("generate binlog wrong: %v", err) + return fmt.Errorf("generate binlog wrong: %v", err) } // clear buffer @@ -513,18 +513,18 @@ func (ibNode *insertBufferNode) flushSegment(segID UniqueID, partitionID UniqueI for index, blob := range binLogs { uid, err := ibNode.idAllocator.allocID() if err != nil { - return errors.Errorf("Allocate Id failed, %v", err) + return fmt.Errorf("Allocate Id failed, %v", err) } key := path.Join(keyPrefix, blob.Key, strconv.FormatInt(uid, 10)) err = ibNode.minIOKV.Save(key, string(blob.Value[:])) if err != nil { - return errors.Errorf("Save to MinIO failed, %v", err) + return fmt.Errorf("Save to MinIO failed, %v", err) } fieldID, err := strconv.ParseInt(blob.Key, 10, 32) if err != nil { - return errors.Errorf("string to fieldID wrong, %v", err) + return fmt.Errorf("string to fieldID wrong, %v", err) } log.Debug("... Appending binlog paths ...", zap.Int("number", index)) diff --git a/internal/datanode/meta_service.go b/internal/datanode/meta_service.go index 7287cde427b827ebfc856f00cbab35b0832f4888..6127e53eb4b86a7f87a72563e96fb7de7d90a48b 100644 --- a/internal/datanode/meta_service.go +++ b/internal/datanode/meta_service.go @@ -7,7 +7,6 @@ import ( "go.uber.org/zap" - "github.com/zilliztech/milvus-distributed/internal/errors" "github.com/zilliztech/milvus-distributed/internal/log" "github.com/zilliztech/milvus-distributed/internal/proto/commonpb" "github.com/zilliztech/milvus-distributed/internal/proto/etcdpb" @@ -65,7 +64,7 @@ func (mService *metaService) getCollectionNames(ctx context.Context) ([]string, response, err := mService.masterClient.ShowCollections(ctx, req) if err != nil { - return nil, errors.Errorf("Get collection names from master service wrong: %v", err) + return nil, fmt.Errorf("Get collection names from master service wrong: %v", err) } return response.GetCollectionNames(), nil } @@ -85,12 +84,12 @@ func (mService *metaService) createCollection(ctx context.Context, name string) response, err := mService.masterClient.DescribeCollection(ctx, req) if err != nil { - return errors.Errorf("Describe collection %v from master service wrong: %v", name, err) + return fmt.Errorf("Describe collection %v from master service wrong: %v", name, err) } err = mService.replica.addCollection(response.GetCollectionID(), response.GetSchema()) if err != nil { - return errors.Errorf("Add collection %v into collReplica wrong: %v", name, err) + return fmt.Errorf("Add collection %v into collReplica wrong: %v", name, err) } return nil diff --git a/internal/datanode/meta_table.go b/internal/datanode/meta_table.go index 6a9128ff8690a40e149db17f082ad3a21b2c2e6a..28257cebb6f888993648e61c630fff4d7ef24b49 100644 --- a/internal/datanode/meta_table.go +++ b/internal/datanode/meta_table.go @@ -1,12 +1,12 @@ package datanode import ( + "fmt" "path" "strconv" "sync" "github.com/golang/protobuf/proto" - "github.com/zilliztech/milvus-distributed/internal/errors" "github.com/zilliztech/milvus-distributed/internal/kv" "github.com/zilliztech/milvus-distributed/internal/proto/datapb" ) @@ -72,7 +72,7 @@ func (mt *metaTable) CompleteFlush(segmentID UniqueID) error { defer mt.lock.Unlock() meta, ok := mt.segID2FlushMeta[segmentID] if !ok { - return errors.Errorf("segment not exists with ID = %v", segmentID) + return fmt.Errorf("segment not exists with ID = %v", segmentID) } meta.IsFlushed = true @@ -132,7 +132,7 @@ func (mt *metaTable) checkFlushComplete(segmentID UniqueID) (bool, error) { defer mt.lock.RUnlock() meta, ok := mt.segID2FlushMeta[segmentID] if !ok { - return false, errors.Errorf("segment not exists with ID = %v", segmentID) + return false, fmt.Errorf("segment not exists with ID = %v", segmentID) } return meta.IsFlushed, nil } @@ -142,7 +142,7 @@ func (mt *metaTable) getSegBinlogPaths(segmentID UniqueID) (map[int64][]string, defer mt.lock.RUnlock() meta, ok := mt.segID2FlushMeta[segmentID] if !ok { - return nil, errors.Errorf("segment not exists with ID = %v", segmentID) + return nil, fmt.Errorf("segment not exists with ID = %v", segmentID) } ret := make(map[int64][]string) for _, field := range meta.Fields { @@ -211,7 +211,7 @@ func (mt *metaTable) getDDLBinlogPaths(collID UniqueID) (map[UniqueID][]string, defer mt.lock.RUnlock() meta, ok := mt.collID2DdlMeta[collID] if !ok { - return nil, errors.Errorf("collection not exists with ID = %v", collID) + return nil, fmt.Errorf("collection not exists with ID = %v", collID) } ret := make(map[UniqueID][]string) ret[meta.CollectionID] = meta.BinlogPaths diff --git a/internal/dataservice/meta.go b/internal/dataservice/meta.go index f88a96161714becaae700308ef9b74372fd81d45..daad1d335ff7173d7dbcdeb557d54f30e8faac65 100644 --- a/internal/dataservice/meta.go +++ b/internal/dataservice/meta.go @@ -13,7 +13,6 @@ import ( "github.com/zilliztech/milvus-distributed/internal/proto/schemapb" "github.com/golang/protobuf/proto" - "github.com/zilliztech/milvus-distributed/internal/errors" "github.com/zilliztech/milvus-distributed/internal/kv" ) @@ -319,7 +318,7 @@ func (meta *meta) AddPartition(collectionID UniqueID, partitionID UniqueID) erro for _, t := range coll.Partitions { if t == partitionID { - return errors.Errorf("partition %d already exists.", partitionID) + return fmt.Errorf("partition %d already exists", partitionID) } } coll.Partitions = append(coll.Partitions, partitionID) diff --git a/internal/dataservice/server.go b/internal/dataservice/server.go index 8f0d1e4fd60fc33d35e5f416e9a2d18a58502e34..810a32f5c386976a75f78eb00fcef2ba63275a3a 100644 --- a/internal/dataservice/server.go +++ b/internal/dataservice/server.go @@ -2,6 +2,7 @@ package dataservice import ( "context" + "errors" "fmt" "path" "strconv" @@ -297,7 +298,7 @@ func (s *Server) checkMasterIsHealthy() error { var err error select { case <-ctx.Done(): - return fmt.Errorf("master is not healthy") + return errors.New("master is not healthy") case <-ticker.C: resp, err = s.masterClient.GetComponentStates(ctx) if err = VerifyResponse(resp, err); err != nil { diff --git a/internal/distributed/datanode/service.go b/internal/distributed/datanode/service.go index cdf739ee73a093dea6371bd06a8b6455d942a9e8..579f9a955fbe825bfe10460d7866fbd7e53f679f 100644 --- a/internal/distributed/datanode/service.go +++ b/internal/distributed/datanode/service.go @@ -2,6 +2,7 @@ package grpcdatanode import ( "context" + "errors" "fmt" "io" "net" @@ -19,7 +20,6 @@ import ( dsc "github.com/zilliztech/milvus-distributed/internal/distributed/dataservice/client" msc "github.com/zilliztech/milvus-distributed/internal/distributed/masterservice/client" - "github.com/zilliztech/milvus-distributed/internal/errors" "github.com/zilliztech/milvus-distributed/internal/log" "github.com/zilliztech/milvus-distributed/internal/msgstream" "github.com/zilliztech/milvus-distributed/internal/proto/commonpb" @@ -235,7 +235,7 @@ func (s *Server) FlushSegments(ctx context.Context, in *datapb.FlushSegRequest) return &commonpb.Status{ ErrorCode: commonpb.ErrorCode_UNEXPECTED_ERROR, Reason: "DataNode isn't healthy.", - }, errors.Errorf("DataNode is not ready yet") + }, errors.New("DataNode is not ready yet") } return &commonpb.Status{ ErrorCode: commonpb.ErrorCode_SUCCESS, diff --git a/internal/distributed/querynode/mock.go b/internal/distributed/querynode/mock.go index 7922e1698f215ef8ec1e6d14a91147798eb332c8..ffae7c19f6f1b15a7c79d6e0912d72289b1a2569 100644 --- a/internal/distributed/querynode/mock.go +++ b/internal/distributed/querynode/mock.go @@ -4,7 +4,8 @@ import ( "path" "strconv" - "github.com/zilliztech/milvus-distributed/internal/errors" + "errors" + "github.com/zilliztech/milvus-distributed/internal/proto/commonpb" "github.com/zilliztech/milvus-distributed/internal/proto/datapb" "github.com/zilliztech/milvus-distributed/internal/proto/indexpb" diff --git a/internal/errors/errors.go b/internal/errors/errors.go deleted file mode 100644 index f6d6937ad63ca93d6c95d94f9598adc9e01a4b59..0000000000000000000000000000000000000000 --- a/internal/errors/errors.go +++ /dev/null @@ -1,238 +0,0 @@ -package errors - -import ( - "fmt" - "io" -) - -// New returns an error with the supplied message. -// New also records the stack trace at the point it was called. -func New(message string) error { - return &fundamental{ - msg: message, - stack: callers(), - } -} - -// Errorf formats according to a format specifier and returns the string -// as a value that satisfies error. -// Errorf also records the stack trace at the point it was called. -func Errorf(format string, args ...interface{}) error { - return &fundamental{ - msg: fmt.Sprintf(format, args...), - stack: callers(), - } -} - -// StackTraceAware is an optimization to avoid repetitive traversals of an error chain. -// HasStack checks for this marker first. -// Annotate/Wrap and Annotatef/Wrapf will produce this marker. -type StackTraceAware interface { - HasStack() bool -} - -// HasStack tells whether a StackTracer exists in the error chain -func HasStack(err error) bool { - if errWithStack, ok := err.(StackTraceAware); ok { - return errWithStack.HasStack() - } - return GetStackTracer(err) != nil -} - -// fundamental is an error that has a message and a stack, but no caller. -type fundamental struct { - msg string - *stack -} - -func (f *fundamental) Error() string { return f.msg } - -func (f *fundamental) Format(s fmt.State, verb rune) { - switch verb { - case 'v': - if s.Flag('+') { - io.WriteString(s, f.msg) - f.stack.Format(s, verb) - return - } - fallthrough - case 's': - io.WriteString(s, f.msg) - case 'q': - fmt.Fprintf(s, "%q", f.msg) - } -} - -// WithStack annotates err with a stack trace at the point WithStack was called. -// If err is nil, WithStack returns nil. -// -// For most use cases this is deprecated and AddStack should be used (which will ensure just one stack trace). -// However, one may want to use this in some situations, for example to create a 2nd trace across a goroutine. -func WithStack(err error) error { - if err == nil { - return nil - } - - return &withStack{ - err, - callers(), - } -} - -// AddStack is similar to WithStack. -// However, it will first check with HasStack to see if a stack trace already exists in the causer chain before creating another one. -func AddStack(err error) error { - if HasStack(err) { - return err - } - return WithStack(err) -} - -type withStack struct { - error - *stack -} - -func (w *withStack) Cause() error { return w.error } - -func (w *withStack) Format(s fmt.State, verb rune) { - switch verb { - case 'v': - if s.Flag('+') { - fmt.Fprintf(s, "%+v", w.Cause()) - w.stack.Format(s, verb) - return - } - fallthrough - case 's': - io.WriteString(s, w.Error()) - case 'q': - fmt.Fprintf(s, "%q", w.Error()) - } -} - -// Wrap returns an error annotating err with a stack trace -// at the point Wrap is called, and the supplied message. -// If err is nil, Wrap returns nil. -// -// For most use cases this is deprecated in favor of Annotate. -// Annotate avoids creating duplicate stack traces. -func Wrap(err error, message string) error { - if err == nil { - return nil - } - hasStack := HasStack(err) - err = &withMessage{ - cause: err, - msg: message, - causeHasStack: hasStack, - } - return &withStack{ - err, - callers(), - } -} - -// Wrapf returns an error annotating err with a stack trace -// at the point Wrapf is call, and the format specifier. -// If err is nil, Wrapf returns nil. -// -// For most use cases this is deprecated in favor of Annotatef. -// Annotatef avoids creating duplicate stack traces. -func Wrapf(err error, format string, args ...interface{}) error { - if err == nil { - return nil - } - hasStack := HasStack(err) - err = &withMessage{ - cause: err, - msg: fmt.Sprintf(format, args...), - causeHasStack: hasStack, - } - return &withStack{ - err, - callers(), - } -} - -// WithMessage annotates err with a new message. -// If err is nil, WithMessage returns nil. -func WithMessage(err error, message string) error { - if err == nil { - return nil - } - return &withMessage{ - cause: err, - msg: message, - causeHasStack: HasStack(err), - } -} - -type withMessage struct { - cause error - msg string - causeHasStack bool -} - -func (w *withMessage) Error() string { return w.msg + ": " + w.cause.Error() } -func (w *withMessage) Cause() error { return w.cause } -func (w *withMessage) HasStack() bool { return w.causeHasStack } - -func (w *withMessage) Format(s fmt.State, verb rune) { - switch verb { - case 'v': - if s.Flag('+') { - fmt.Fprintf(s, "%+v\n", w.Cause()) - io.WriteString(s, w.msg) - return - } - fallthrough - case 's', 'q': - io.WriteString(s, w.Error()) - } -} - -// Cause returns the underlying cause of the error, if possible. -// An error value has a cause if it implements the following -// interface: -// -// type causer interface { -// Cause() error -// } -// -// If the error does not implement Cause, the original error will -// be returned. If the error is nil, nil will be returned without further -// investigation. -func Cause(err error) error { - cause := Unwrap(err) - if cause == nil { - return err - } - return Cause(cause) -} - -// Unwrap uses causer to return the next error in the chain or nil. -// This goes one-level deeper, whereas Cause goes as far as possible -func Unwrap(err error) error { - type causer interface { - Cause() error - } - if unErr, ok := err.(causer); ok { - return unErr.Cause() - } - return nil -} - -// Find an error in the chain that matches a test function. -// returns nil if no error is found. -func Find(origErr error, test func(error) bool) error { - var foundErr error - WalkDeep(origErr, func(err error) bool { - if test(err) { - foundErr = err - return true - } - return false - }) - return foundErr -} diff --git a/internal/errors/group.go b/internal/errors/group.go deleted file mode 100644 index e5a969ab76f76c5b88cfe0f155b2b9121ba1e297..0000000000000000000000000000000000000000 --- a/internal/errors/group.go +++ /dev/null @@ -1,42 +0,0 @@ -package errors - -// ErrorGroup is an interface for multiple errors that are not a chain. -// This happens for example when executing multiple operations in parallel. -type ErrorGroup interface { - Errors() []error -} - -// Errors uses the ErrorGroup interface to return a slice of errors. -// If the ErrorGroup interface is not implemented it returns an array containing just the given error. -func Errors(err error) []error { - if eg, ok := err.(ErrorGroup); ok { - return eg.Errors() - } - return []error{err} -} - -// WalkDeep does a depth-first traversal of all errors. -// Any ErrorGroup is traversed (after going deep). -// The visitor function can return true to end the traversal early -// In that case, WalkDeep will return true, otherwise false. -func WalkDeep(err error, visitor func(err error) bool) bool { - // Go deep - unErr := err - for unErr != nil { - if done := visitor(unErr); done { - return true - } - unErr = Unwrap(unErr) - } - - // Go wide - if group, ok := err.(ErrorGroup); ok { - for _, err := range group.Errors() { - if early := WalkDeep(err, visitor); early { - return true - } - } - } - - return false -} diff --git a/internal/errors/stack.go b/internal/errors/stack.go deleted file mode 100644 index bb1e6a84f339d84a9e2701f1c37071f5ab6af799..0000000000000000000000000000000000000000 --- a/internal/errors/stack.go +++ /dev/null @@ -1,226 +0,0 @@ -package errors - -import ( - "bytes" - "fmt" - "io" - "path" - "runtime" - "strconv" - "strings" -) - -// StackTracer retrieves the StackTrace -// Generally you would want to use the GetStackTracer function to do that. -type StackTracer interface { - StackTrace() StackTrace -} - -// GetStackTracer will return the first StackTracer in the causer chain. -// This function is used by AddStack to avoid creating redundant stack traces. -// -// You can also use the StackTracer interface on the returned error to get the stack trace. -func GetStackTracer(origErr error) StackTracer { - var stacked StackTracer - WalkDeep(origErr, func(err error) bool { - if stackTracer, ok := err.(StackTracer); ok { - stacked = stackTracer - return true - } - return false - }) - return stacked -} - -// Frame represents a program counter inside a stack frame. -type Frame uintptr - -// pc returns the program counter for this frame; -// multiple frames may have the same PC value. -func (f Frame) pc() uintptr { return uintptr(f) - 1 } - -// file returns the full path to the file that contains the -// function for this Frame's pc. -func (f Frame) file() string { - fn := runtime.FuncForPC(f.pc()) - if fn == nil { - return "unknown" - } - file, _ := fn.FileLine(f.pc()) - return file -} - -// line returns the line number of source code of the -// function for this Frame's pc. -func (f Frame) line() int { - fn := runtime.FuncForPC(f.pc()) - if fn == nil { - return 0 - } - _, line := fn.FileLine(f.pc()) - return line -} - -// Format formats the frame according to the fmt.Formatter interface. -// -// %s source file -// %d source line -// %n function name -// %v equivalent to %s:%d -// -// Format accepts flags that alter the printing of some verbs, as follows: -// -// %+s function name and path of source file relative to the compile time -// GOPATH separated by \n\t (<funcname>\n\t<path>) -// %+v equivalent to %+s:%d -func (f Frame) Format(s fmt.State, verb rune) { - f.format(s, s, verb) -} - -// format allows stack trace printing calls to be made with a bytes.Buffer. -func (f Frame) format(w io.Writer, s fmt.State, verb rune) { - switch verb { - case 's': - switch { - case s.Flag('+'): - pc := f.pc() - fn := runtime.FuncForPC(pc) - if fn == nil { - io.WriteString(w, "unknown") - } else { - file, _ := fn.FileLine(pc) - io.WriteString(w, fn.Name()) - io.WriteString(w, "\n\t") - io.WriteString(w, file) - } - default: - io.WriteString(w, path.Base(f.file())) - } - case 'd': - io.WriteString(w, strconv.Itoa(f.line())) - case 'n': - name := runtime.FuncForPC(f.pc()).Name() - io.WriteString(w, funcname(name)) - case 'v': - f.format(w, s, 's') - io.WriteString(w, ":") - f.format(w, s, 'd') - } -} - -// StackTrace is stack of Frames from innermost (newest) to outermost (oldest). -type StackTrace []Frame - -// Format formats the stack of Frames according to the fmt.Formatter interface. -// -// %s lists source files for each Frame in the stack -// %v lists the source file and line number for each Frame in the stack -// -// Format accepts flags that alter the printing of some verbs, as follows: -// -// %+v Prints filename, function, and line number for each Frame in the stack. -func (st StackTrace) Format(s fmt.State, verb rune) { - var b bytes.Buffer - switch verb { - case 'v': - switch { - case s.Flag('+'): - b.Grow(len(st) * stackMinLen) - for _, fr := range st { - b.WriteByte('\n') - fr.format(&b, s, verb) - } - case s.Flag('#'): - fmt.Fprintf(&b, "%#v", []Frame(st)) - default: - st.formatSlice(&b, s, verb) - } - case 's': - st.formatSlice(&b, s, verb) - } - io.Copy(s, &b) -} - -// formatSlice will format this StackTrace into the given buffer as a slice of -// Frame, only valid when called with '%s' or '%v'. -func (st StackTrace) formatSlice(b *bytes.Buffer, s fmt.State, verb rune) { - b.WriteByte('[') - if len(st) == 0 { - b.WriteByte(']') - return - } - - b.Grow(len(st) * (stackMinLen / 4)) - st[0].format(b, s, verb) - for _, fr := range st[1:] { - b.WriteByte(' ') - fr.format(b, s, verb) - } - b.WriteByte(']') -} - -// stackMinLen is a best-guess at the minimum length of a stack trace. It -// doesn't need to be exact, just give a good enough head start for the buffer -// to avoid the expensive early growth. -const stackMinLen = 96 - -// stack represents a stack of program counters. -type stack []uintptr - -func (s *stack) Format(st fmt.State, verb rune) { - switch verb { - case 'v': - switch { - case st.Flag('+'): - var b bytes.Buffer - b.Grow(len(*s) * stackMinLen) - for _, pc := range *s { - f := Frame(pc) - b.WriteByte('\n') - f.format(&b, st, 'v') - } - io.Copy(st, &b) - } - } -} - -func (s *stack) StackTrace() StackTrace { - f := make([]Frame, len(*s)) - for i := 0; i < len(f); i++ { - f[i] = Frame((*s)[i]) - } - return f -} - -func callers() *stack { - return callersSkip(4) -} - -func callersSkip(skip int) *stack { - const depth = 32 - var pcs [depth]uintptr - n := runtime.Callers(skip, pcs[:]) - var st stack = pcs[0:n] - return &st -} - -// funcname removes the path prefix component of a function's name reported by func.Name(). -func funcname(name string) string { - i := strings.LastIndex(name, "/") - name = name[i+1:] - i = strings.Index(name, ".") - return name[i+1:] -} - -// NewStack is for library implementers that want to generate a stack trace. -// Normally you should insted use AddStack to get an error with a stack trace. -// -// The result of this function can be turned into a stack trace by calling .StackTrace() -// -// This function takes an argument for the number of stack frames to skip. -// This avoids putting stack generation function calls like this one in the stack trace. -// A value of 0 will give you the line that called NewStack(0) -// A library author wrapping this in their own function will want to use a value of at least 1. -func NewStack(skip int) StackTracer { - return callersSkip(skip + 3) -} diff --git a/internal/indexnode/index.go b/internal/indexnode/index.go index 23ae6ae6323e484eebcb3c0a10129c7a32793fad..0758cbaf41061bca062cb83d83b46cc047d5c3dc 100644 --- a/internal/indexnode/index.go +++ b/internal/indexnode/index.go @@ -14,11 +14,11 @@ package indexnode import "C" import ( - "errors" "fmt" - "strconv" "unsafe" + "errors" + "github.com/golang/protobuf/proto" "github.com/zilliztech/milvus-distributed/internal/proto/commonpb" "github.com/zilliztech/milvus-distributed/internal/proto/indexcgopb" @@ -49,7 +49,7 @@ func TryCatch(fn CFunc) error { if errorCode != 0 { errorMsg := C.GoString(status.error_msg) defer C.free(unsafe.Pointer(status.error_msg)) - return errors.New("error code = " + strconv.Itoa(int(errorCode)) + ", error msg = " + errorMsg) + return fmt.Errorf("error code = %d, error msg = %s", errorCode, errorMsg) } return nil } @@ -138,7 +138,7 @@ func (index *CIndex) Serialize() ([]*Blob, error) { if errorCode != 0 { errorMsg := C.GoString(status.error_msg) defer C.free(unsafe.Pointer(status.error_msg)) - return nil, errors.New("SerializeToSlicedBuffer failed, C runtime error detected, error code = " + strconv.Itoa(int(errorCode)) + ", error msg = " + errorMsg) + return nil, fmt.Errorf("SerializeToSlicedBuffer failed, C runtime error detected, error code = %d, err msg = %s", errorCode, errorMsg) } binarySize := C.GetCBinarySize(cBinary) @@ -179,7 +179,7 @@ func (index *CIndex) Load(blobs []*Blob) error { if errorCode != 0 { errorMsg := C.GoString(status.error_msg) defer C.free(unsafe.Pointer(status.error_msg)) - return errors.New("BuildFloatVecIndexWithoutIds failed, C runtime error detected, error code = " + strconv.Itoa(int(errorCode)) + ", error msg = " + errorMsg) + return fmt.Errorf("BuildFloatVecIndexWithoutIds failed, C runtime error detected, error code = %d, err msg = %s", errorCode, errorMsg) } return nil } @@ -197,7 +197,7 @@ func (index *CIndex) BuildFloatVecIndexWithoutIds(vectors []float32) error { errorMsg := C.GoString(status.error_msg) fmt.Println("BuildFloatVecIndexWithoutIds error msg: ", errorMsg) defer C.free(unsafe.Pointer(status.error_msg)) - return errors.New("BuildFloatVecIndexWithoutIds failed, C runtime error detected, error code = " + strconv.Itoa(int(errorCode)) + ", error msg = " + errorMsg) + return fmt.Errorf("BuildFloatVecIndexWithoutIds failed, C runtime error detected, error code = %d, err msg = %s", errorCode, errorMsg) } return nil } @@ -212,7 +212,7 @@ func (index *CIndex) BuildBinaryVecIndexWithoutIds(vectors []byte) error { if errorCode != 0 { errorMsg := C.GoString(status.error_msg) defer C.free(unsafe.Pointer(status.error_msg)) - return errors.New(" failed, C runtime error detected, error code = " + strconv.Itoa(int(errorCode)) + ", error msg = " + errorMsg) + return fmt.Errorf("BuildBinaryVecIndexWithoutIds failed, C runtime error detected, error code = %d, err msg = %s", errorCode, errorMsg) } return nil } @@ -266,7 +266,7 @@ func NewCIndex(typeParams, indexParams map[string]string) (Index, error) { errorMsg := C.GoString(status.error_msg) fmt.Println("EEEEEEEEEEEEEEEEEEEEEEEEEE error msg: ", errorMsg) defer C.free(unsafe.Pointer(status.error_msg)) - return nil, errors.New(" failed, C runtime error detected, error code = " + strconv.Itoa(int(errorCode)) + ", error msg = " + errorMsg) + return nil, fmt.Errorf(" failed, C runtime error detected, error code = %d, err msg = %s", errorCode, errorMsg) } return &CIndex{ diff --git a/internal/indexnode/indexnode.go b/internal/indexnode/indexnode.go index 22704bdbed89b2837379fe6c9969261f3794c1d4..44e2aad02304c77f8b4f7c9e49c63843c6df15dd 100644 --- a/internal/indexnode/indexnode.go +++ b/internal/indexnode/indexnode.go @@ -9,9 +9,10 @@ import ( "github.com/zilliztech/milvus-distributed/internal/proto/milvuspb" + "errors" + "github.com/opentracing/opentracing-go" "github.com/uber/jaeger-client-go/config" - "github.com/zilliztech/milvus-distributed/internal/errors" "github.com/zilliztech/milvus-distributed/internal/kv" miniokv "github.com/zilliztech/milvus-distributed/internal/kv/minio" "github.com/zilliztech/milvus-distributed/internal/proto/commonpb" diff --git a/internal/indexnode/task.go b/internal/indexnode/task.go index 21f16149cd51adb33ac1b20312704dff4d467cea..15c1488a7b989ea010a7ee12c859fae1aaeb70d6 100644 --- a/internal/indexnode/task.go +++ b/internal/indexnode/task.go @@ -6,12 +6,13 @@ import ( "log" "strconv" + "errors" + "github.com/zilliztech/milvus-distributed/internal/util/funcutil" "github.com/zilliztech/milvus-distributed/internal/proto/commonpb" "github.com/zilliztech/milvus-distributed/internal/util/typeutil" - "github.com/zilliztech/milvus-distributed/internal/errors" "github.com/zilliztech/milvus-distributed/internal/kv" "github.com/zilliztech/milvus-distributed/internal/proto/indexpb" "github.com/zilliztech/milvus-distributed/internal/storage" diff --git a/internal/indexnode/task_scheduler.go b/internal/indexnode/task_scheduler.go index 91721082f0cd19a33a2cd72c248c3c93fd159afc..d7c67dae1e56e77e0b105afe84cc7254ac364464 100644 --- a/internal/indexnode/task_scheduler.go +++ b/internal/indexnode/task_scheduler.go @@ -3,10 +3,11 @@ package indexnode import ( "container/list" "context" - "errors" "log" "sync" + "errors" + "github.com/opentracing/opentracing-go" oplog "github.com/opentracing/opentracing-go/log" "github.com/zilliztech/milvus-distributed/internal/kv" diff --git a/internal/indexservice/indexservice.go b/internal/indexservice/indexservice.go index 3206f8621bb97ec33d50cbb04491b4f2320fbb71..f61cf4b34165852717f52435473b7c136152aa80 100644 --- a/internal/indexservice/indexservice.go +++ b/internal/indexservice/indexservice.go @@ -12,7 +12,8 @@ import ( "go.etcd.io/etcd/clientv3" - "github.com/zilliztech/milvus-distributed/internal/errors" + "errors" + "github.com/zilliztech/milvus-distributed/internal/kv" etcdkv "github.com/zilliztech/milvus-distributed/internal/kv/etcd" miniokv "github.com/zilliztech/milvus-distributed/internal/kv/minio" diff --git a/internal/indexservice/meta_table.go b/internal/indexservice/meta_table.go index 44369c563da8673a84acd5d076e741d060a9b652..94def53570d932f92cc5d6ed0c1e41420cbb027d 100644 --- a/internal/indexservice/meta_table.go +++ b/internal/indexservice/meta_table.go @@ -18,7 +18,6 @@ import ( "sync" "github.com/golang/protobuf/proto" - "github.com/zilliztech/milvus-distributed/internal/errors" "github.com/zilliztech/milvus-distributed/internal/kv" "github.com/zilliztech/milvus-distributed/internal/proto/commonpb" "github.com/zilliztech/milvus-distributed/internal/proto/indexpb" @@ -77,7 +76,7 @@ func (mt *metaTable) AddIndex(indexBuildID UniqueID, req *indexpb.BuildIndexRequ defer mt.lock.Unlock() _, ok := mt.indexBuildID2Meta[indexBuildID] if ok { - return errors.Errorf("index already exists with ID = " + strconv.FormatInt(indexBuildID, 10)) + return fmt.Errorf("index already exists with ID = %d", indexBuildID) } meta := &indexpb.IndexMeta{ State: commonpb.IndexState_UNISSUED, @@ -107,10 +106,10 @@ func (mt *metaTable) NotifyBuildIndex(nty *indexpb.BuildIndexNotification) error indexBuildID := nty.IndexBuildID meta, ok := mt.indexBuildID2Meta[indexBuildID] if !ok { - return errors.Errorf("index not exists with ID = " + strconv.FormatInt(indexBuildID, 10)) + return fmt.Errorf("index not exists with ID = %d", indexBuildID) } if meta.State == commonpb.IndexState_DELETED { - return errors.Errorf("index not exists with ID = " + strconv.FormatInt(indexBuildID, 10)) + return fmt.Errorf("index not exists with ID = %d", indexBuildID) } if nty.Status.ErrorCode != commonpb.ErrorCode_SUCCESS { @@ -133,10 +132,10 @@ func (mt *metaTable) GetIndexState(indexBuildID UniqueID) (*indexpb.IndexInfo, e } meta, ok := mt.indexBuildID2Meta[indexBuildID] if !ok { - return ret, errors.Errorf("index not exists with ID = " + strconv.FormatInt(indexBuildID, 10)) + return ret, fmt.Errorf("index not exists with ID = %d", indexBuildID) } if meta.State == commonpb.IndexState_DELETED { - return ret, errors.Errorf("index not exists with ID = " + strconv.FormatInt(indexBuildID, 10)) + return ret, fmt.Errorf("index not exists with ID = %d", indexBuildID) } ret.IndexID = meta.Req.IndexID ret.IndexName = meta.Req.IndexName @@ -153,10 +152,10 @@ func (mt *metaTable) GetIndexFilePathInfo(indexBuildID UniqueID) (*indexpb.Index } meta, ok := mt.indexBuildID2Meta[indexBuildID] if !ok { - return nil, errors.Errorf("index not exists with ID = " + strconv.FormatInt(indexBuildID, 10)) + return nil, fmt.Errorf("index not exists with ID = %d", indexBuildID) } if meta.State == commonpb.IndexState_DELETED { - return nil, errors.Errorf("index not exists with ID = " + strconv.FormatInt(indexBuildID, 10)) + return nil, fmt.Errorf("index not exists with ID = %d", indexBuildID) } ret.IndexFilePaths = meta.IndexFilePaths return ret, nil @@ -198,7 +197,7 @@ func (mt *metaTable) DeleteIndex(indexBuildID UniqueID) error { indexMeta, ok := mt.indexBuildID2Meta[indexBuildID] if !ok { - return errors.Errorf("can't find index. id = " + strconv.FormatInt(indexBuildID, 10)) + return fmt.Errorf("can't find index. id = %d", indexBuildID) } fmt.Print(indexMeta) diff --git a/internal/indexservice/node_mgr.go b/internal/indexservice/node_mgr.go index 2ce52d01a1cf4231bdded09bd5ee36cdaa4c729e..ea6dd78b451134d16fcbf08dc19f2bb446cacf71 100644 --- a/internal/indexservice/node_mgr.go +++ b/internal/indexservice/node_mgr.go @@ -4,8 +4,9 @@ import ( "context" "strconv" + "errors" + grpcindexnodeclient "github.com/zilliztech/milvus-distributed/internal/distributed/indexnode/client" - "github.com/zilliztech/milvus-distributed/internal/errors" "github.com/zilliztech/milvus-distributed/internal/proto/commonpb" "github.com/zilliztech/milvus-distributed/internal/proto/indexpb" "github.com/zilliztech/milvus-distributed/internal/proto/internalpb2" diff --git a/internal/indexservice/task.go b/internal/indexservice/task.go index 9e55fc645e842a631cda2053f11e4a6747db6251..f8219b5b4e156a5718faeff8b2ef3d104a3aa4b9 100644 --- a/internal/indexservice/task.go +++ b/internal/indexservice/task.go @@ -9,7 +9,8 @@ import ( "github.com/zilliztech/milvus-distributed/internal/proto/commonpb" "github.com/zilliztech/milvus-distributed/internal/util/typeutil" - "github.com/zilliztech/milvus-distributed/internal/errors" + "errors" + "github.com/zilliztech/milvus-distributed/internal/kv" "github.com/zilliztech/milvus-distributed/internal/proto/indexpb" ) diff --git a/internal/indexservice/task_scheduler.go b/internal/indexservice/task_scheduler.go index f3578196be06eb35fe1b8774b7f11098cb8a75ac..e23a2ed456f8346a1e0527a50b6859457339c9aa 100644 --- a/internal/indexservice/task_scheduler.go +++ b/internal/indexservice/task_scheduler.go @@ -3,10 +3,11 @@ package indexservice import ( "container/list" "context" - "errors" "log" "sync" + "errors" + "github.com/zilliztech/milvus-distributed/internal/allocator" "github.com/opentracing/opentracing-go" diff --git a/internal/kv/etcd/etcd_kv.go b/internal/kv/etcd/etcd_kv.go index 5e17a77d4e41cba2ea8e0695bdb08f6f2fa09c62..657c0f04be75dd44406d57e79dea7138c1a5c60a 100644 --- a/internal/kv/etcd/etcd_kv.go +++ b/internal/kv/etcd/etcd_kv.go @@ -2,11 +2,11 @@ package etcdkv import ( "context" + "fmt" "log" "path" "time" - "github.com/zilliztech/milvus-distributed/internal/errors" "go.etcd.io/etcd/clientv3" ) @@ -62,7 +62,7 @@ func (kv *EtcdKV) Load(key string) (string, error) { return "", err } if resp.Count <= 0 { - return "", errors.Errorf("there is no value on key = %s", key) + return "", fmt.Errorf("there is no value on key = %s", key) } return string(resp.Kvs[0].Value), nil @@ -107,7 +107,7 @@ func (kv *EtcdKV) MultiLoad(keys []string) ([]string, error) { } if len(invalid) != 0 { log.Printf("MultiLoad: there are invalid keys: %s", invalid) - err = errors.Errorf("there are invalid keys: %s", invalid) + err = fmt.Errorf("there are invalid keys: %s", invalid) return result, err } return result, nil diff --git a/internal/kv/minio/minio_kv.go b/internal/kv/minio/minio_kv.go index 1f00916073dc25dbbe7b3662024fbe52ca9edb48..0d6c9ff80979550b60cea0ba4bdc2f4468d233ea 100644 --- a/internal/kv/minio/minio_kv.go +++ b/internal/kv/minio/minio_kv.go @@ -11,7 +11,6 @@ import ( "github.com/minio/minio-go/v7" "github.com/minio/minio-go/v7/pkg/credentials" - "github.com/zilliztech/milvus-distributed/internal/errors" "github.com/zilliztech/milvus-distributed/internal/util/retry" ) @@ -63,7 +62,7 @@ func NewMinIOKV(ctx context.Context, option *Option) (*MinIOKV, error) { } } else { if !bucketExists { - return nil, errors.New(fmt.Sprintf("Bucket %s not Existed.", option.BucketName)) + return nil, fmt.Errorf("bucket %s not Existed", option.BucketName) } } diff --git a/internal/log/log.go b/internal/log/log.go index 8b04be8f0ab932e3a6714d7db8d6f1d31414e56d..3cf0fd49fce3afc8e70df3d1cf25201f2886895a 100644 --- a/internal/log/log.go +++ b/internal/log/log.go @@ -14,10 +14,11 @@ package log import ( - "errors" "os" "sync/atomic" + "errors" + "go.uber.org/zap" "go.uber.org/zap/zapcore" lumberjack "gopkg.in/natefinch/lumberjack.v2" diff --git a/internal/log/zap_text_encoder.go b/internal/log/zap_text_encoder.go index 7b03b9220dc7163a9ca27e0a3850f7ecaa94d031..28031c672596994f3e9d02912dff03a42bf9d7d3 100644 --- a/internal/log/zap_text_encoder.go +++ b/internal/log/zap_text_encoder.go @@ -654,7 +654,7 @@ func (enc *textEncoder) encodeError(f zapcore.Field) { verbose := fmt.Sprintf("%+v", e) if verbose != basic { // This is a rich error type, like those produced by - // github.com/pkg/errors. + // errors. enc.beginQuoteFiled() enc.AddString(f.Key+"Verbose", verbose) enc.endQuoteFiled() diff --git a/internal/masterservice/master_service.go b/internal/masterservice/master_service.go index 0f4924ca55b077f44845558606b97a230656f109..2ef51384e11d67567cbbfc15bd0bb96bc302bcc6 100644 --- a/internal/masterservice/master_service.go +++ b/internal/masterservice/master_service.go @@ -11,8 +11,9 @@ import ( "go.etcd.io/etcd/clientv3" "go.uber.org/zap" + "errors" + "github.com/zilliztech/milvus-distributed/internal/allocator" - "github.com/zilliztech/milvus-distributed/internal/errors" etcdkv "github.com/zilliztech/milvus-distributed/internal/kv/etcd" "github.com/zilliztech/milvus-distributed/internal/log" ms "github.com/zilliztech/milvus-distributed/internal/msgstream" @@ -207,64 +208,64 @@ func (c *Core) UpdateStateCode(code internalpb2.StateCode) { func (c *Core) checkInit() error { if c.MetaTable == nil { - return errors.Errorf("MetaTable is nil") + return errors.New("MetaTable is nil") } if c.idAllocator == nil { - return errors.Errorf("idAllocator is nil") + return errors.New("idAllocator is nil") } if c.tsoAllocator == nil { - return errors.Errorf("tsoAllocator is nil") + return errors.New("tsoAllocator is nil") } if c.etcdCli == nil { - return errors.Errorf("etcdCli is nil") + return errors.New("etcdCli is nil") } if c.metaKV == nil { - return errors.Errorf("metaKV is nil") + return errors.New("metaKV is nil") } if c.kvBase == nil { - return errors.Errorf("kvBase is nil") + return errors.New("kvBase is nil") } if c.ProxyTimeTickChan == nil { - return errors.Errorf("ProxyTimeTickChan is nil") + return errors.New("ProxyTimeTickChan is nil") } if c.ddReqQueue == nil { - return errors.Errorf("ddReqQueue is nil") + return errors.New("ddReqQueue is nil") } if c.DdCreateCollectionReq == nil { - return errors.Errorf("DdCreateCollectionReq is nil") + return errors.New("DdCreateCollectionReq is nil") } if c.DdDropCollectionReq == nil { - return errors.Errorf("DdDropCollectionReq is nil") + return errors.New("DdDropCollectionReq is nil") } if c.DdCreatePartitionReq == nil { - return errors.Errorf("DdCreatePartitionReq is nil") + return errors.New("DdCreatePartitionReq is nil") } if c.DdDropPartitionReq == nil { - return errors.Errorf("DdDropPartitionReq is nil") + return errors.New("DdDropPartitionReq is nil") } if c.DataServiceSegmentChan == nil { - return errors.Errorf("DataServiceSegmentChan is nil") + return errors.New("DataServiceSegmentChan is nil") } if c.GetBinlogFilePathsFromDataServiceReq == nil { - return errors.Errorf("GetBinlogFilePathsFromDataServiceReq is nil") + return errors.New("GetBinlogFilePathsFromDataServiceReq is nil") } if c.BuildIndexReq == nil { - return errors.Errorf("BuildIndexReq is nil") + return errors.New("BuildIndexReq is nil") } if c.DropIndexReq == nil { - return errors.Errorf("DropIndexReq is nil") + return errors.New("DropIndexReq is nil") } if c.InvalidateCollectionMetaCache == nil { - return errors.Errorf("InvalidateCollectionMetaCache is nil") + return errors.New("InvalidateCollectionMetaCache is nil") } if c.indexTaskQueue == nil { - return errors.Errorf("indexTaskQueue is nil") + return errors.New("indexTaskQueue is nil") } if c.DataNodeSegmentFlushCompletedChan == nil { - return errors.Errorf("DataNodeSegmentFlushCompletedChan is nil") + return errors.New("DataNodeSegmentFlushCompletedChan is nil") } if c.ReleaseCollection == nil { - return errors.Errorf("ReleaseCollection is nil") + return errors.New("ReleaseCollection is nil") } log.Debug("master", zap.Int64("node id", int64(Params.NodeID))) @@ -290,7 +291,7 @@ func (c *Core) startDdScheduler() { break } if !task.IgnoreTimeStamp() && ts <= c.lastDdTimeStamp { - task.Notify(errors.Errorf("input timestamp = %d, last dd time stamp = %d", ts, c.lastDdTimeStamp)) + task.Notify(fmt.Errorf("input timestamp = %d, last dd time stamp = %d", ts, c.lastDdTimeStamp)) break } err = task.Execute() @@ -433,15 +434,15 @@ func (c *Core) tsLoop() { } func (c *Core) setMsgStreams() error { if Params.PulsarAddress == "" { - return errors.Errorf("PulsarAddress is empty") + return errors.New("PulsarAddress is empty") } if Params.MsgChannelSubName == "" { - return errors.Errorf("MsgChannelSubName is emptyr") + return errors.New("MsgChannelSubName is emptyr") } //proxy time tick stream, if Params.ProxyTimeTickChannel == "" { - return errors.Errorf("ProxyTimeTickChannel is empty") + return errors.New("ProxyTimeTickChannel is empty") } var err error @@ -460,14 +461,14 @@ func (c *Core) setMsgStreams() error { // master time tick channel if Params.TimeTickChannel == "" { - return errors.Errorf("TimeTickChannel is empty") + return errors.New("TimeTickChannel is empty") } timeTickStream, _ := c.msFactory.NewMsgStream(c.ctx) timeTickStream.AsProducer([]string{Params.TimeTickChannel}) // master dd channel if Params.DdChannel == "" { - return errors.Errorf("DdChannel is empty") + return errors.New("DdChannel is empty") } ddStream, _ := c.msFactory.NewMsgStream(c.ctx) ddStream.AsProducer([]string{Params.DdChannel}) @@ -600,7 +601,7 @@ func (c *Core) setMsgStreams() error { //segment channel, data service create segment,or data node flush segment will put msg in this channel if Params.DataServiceSegmentChannel == "" { - return errors.Errorf("DataServiceSegmentChannel is empty") + return errors.New("DataServiceSegmentChannel is empty") } dataServiceStream, _ := c.msFactory.NewMsgStream(c.ctx) dataServiceStream.AsConsumer([]string{Params.DataServiceSegmentChannel}, Params.MsgChannelSubName) @@ -696,14 +697,14 @@ func (c *Core) SetDataService(ctx context.Context, s DataServiceInterface) error return nil, err } if binlog.Status.ErrorCode != commonpb.ErrorCode_SUCCESS { - return nil, errors.Errorf("GetInsertBinlogPaths from data service failed, error = %s", binlog.Status.Reason) + return nil, fmt.Errorf("GetInsertBinlogPaths from data service failed, error = %s", binlog.Status.Reason) } for i := range binlog.FieldIDs { if binlog.FieldIDs[i] == fieldID { return binlog.Paths[i].Values, nil } } - return nil, errors.Errorf("binlog file not exist, segment id = %d, field id = %d", segID, fieldID) + return nil, fmt.Errorf("binlog file not exist, segment id = %d, field id = %d", segID, fieldID) } return nil } @@ -721,7 +722,7 @@ func (c *Core) SetIndexService(ctx context.Context, s IndexServiceInterface) err return 0, err } if rsp.Status.ErrorCode != commonpb.ErrorCode_SUCCESS { - return 0, errors.Errorf("BuildIndex from index service failed, error = %s", rsp.Status.Reason) + return 0, fmt.Errorf("BuildIndex from index service failed, error = %s", rsp.Status.Reason) } return rsp.IndexBuildID, nil } @@ -734,7 +735,7 @@ func (c *Core) SetIndexService(ctx context.Context, s IndexServiceInterface) err return err } if rsp.ErrorCode != commonpb.ErrorCode_SUCCESS { - return errors.Errorf("%s", rsp.Reason) + return errors.New(rsp.Reason) } return nil } @@ -759,7 +760,7 @@ func (c *Core) SetQueryService(ctx context.Context, s QueryServiceInterface) err return err } if rsp.ErrorCode != commonpb.ErrorCode_SUCCESS { - return errors.Errorf("ReleaseCollection from query service failed, error = %s", rsp.Reason) + return fmt.Errorf("ReleaseCollection from query service failed, error = %s", rsp.Reason) } return nil } diff --git a/internal/masterservice/meta_table.go b/internal/masterservice/meta_table.go index 092efad014a40d4b44372b6dab54422c06692764..0e466020631a646765605bc4e2958b2304a1eadd 100644 --- a/internal/masterservice/meta_table.go +++ b/internal/masterservice/meta_table.go @@ -1,6 +1,7 @@ package masterservice import ( + "fmt" "path" "strconv" "sync" @@ -8,7 +9,8 @@ import ( "github.com/golang/protobuf/proto" "go.uber.org/zap" - "github.com/zilliztech/milvus-distributed/internal/errors" + "errors" + "github.com/zilliztech/milvus-distributed/internal/kv" "github.com/zilliztech/milvus-distributed/internal/log" "github.com/zilliztech/milvus-distributed/internal/proto/commonpb" @@ -179,17 +181,17 @@ func (mt *metaTable) AddCollection(coll *pb.CollectionInfo, part *pb.PartitionIn defer mt.ddLock.Unlock() if len(part.SegmentIDs) != 0 { - return errors.Errorf("segment should be empty when creating collection") + return errors.New("segment should be empty when creating collection") } if len(coll.PartitionIDs) != 0 { - return errors.Errorf("partitions should be empty when creating collection") + return errors.New("partitions should be empty when creating collection") } if _, ok := mt.collName2ID[coll.Schema.Name]; ok { - return errors.Errorf("collection %s exist", coll.Schema.Name) + return fmt.Errorf("collection %s exist", coll.Schema.Name) } if len(coll.FieldIndexes) != len(idx) { - return errors.Errorf("incorrect index id when creating collection") + return fmt.Errorf("incorrect index id when creating collection") } coll.PartitionIDs = append(coll.PartitionIDs, part.PartitionID) @@ -227,7 +229,7 @@ func (mt *metaTable) DeleteCollection(collID typeutil.UniqueID) error { collMeta, ok := mt.collID2Meta[collID] if !ok { - return errors.Errorf("can't find collection. id = " + strconv.FormatInt(collID, 10)) + return fmt.Errorf("can't find collection. id = %d", collID) } metaKeys := []string{path.Join(CollectionMetaPrefix, strconv.FormatInt(collID, 10))} @@ -283,7 +285,7 @@ func (mt *metaTable) GetCollectionByID(collectionID typeutil.UniqueID) (*pb.Coll col, ok := mt.collID2Meta[collectionID] if !ok { - return nil, errors.Errorf("can't find collection id : %d", collectionID) + return nil, fmt.Errorf("can't find collection id : %d", collectionID) } colCopy := proto.Clone(&col) @@ -296,11 +298,11 @@ func (mt *metaTable) GetCollectionByName(collectionName string) (*pb.CollectionI vid, ok := mt.collName2ID[collectionName] if !ok { - return nil, errors.Errorf("can't find collection: " + collectionName) + return nil, fmt.Errorf("can't find collection: " + collectionName) } col, ok := mt.collID2Meta[vid] if !ok { - return nil, errors.Errorf("can't find collection: " + collectionName) + return nil, fmt.Errorf("can't find collection: " + collectionName) } colCopy := proto.Clone(&col) return colCopy.(*pb.CollectionInfo), nil @@ -312,11 +314,11 @@ func (mt *metaTable) GetCollectionBySegmentID(segID typeutil.UniqueID) (*pb.Coll vid, ok := mt.segID2CollID[segID] if !ok { - return nil, errors.Errorf("segment id %d not belong to any collection", segID) + return nil, fmt.Errorf("segment id %d not belong to any collection", segID) } col, ok := mt.collID2Meta[vid] if !ok { - return nil, errors.Errorf("can't find collection id: %d", vid) + return nil, fmt.Errorf("can't find collection id: %d", vid) } colCopy := proto.Clone(&col) return colCopy.(*pb.CollectionInfo), nil @@ -338,12 +340,12 @@ func (mt *metaTable) AddPartition(collID typeutil.UniqueID, partitionName string defer mt.ddLock.Unlock() coll, ok := mt.collID2Meta[collID] if !ok { - return errors.Errorf("can't find collection. id = " + strconv.FormatInt(collID, 10)) + return fmt.Errorf("can't find collection. id = %d", collID) } // number of partition tags (except _default) should be limited to 4096 by default if int64(len(coll.PartitionIDs)) > Params.MaxPartitionNum { - return errors.New("maximum partition's number should be limit to " + strconv.FormatInt(Params.MaxPartitionNum, 10)) + return fmt.Errorf("maximum partition's number should be limit to %d", Params.MaxPartitionNum) } for _, t := range coll.PartitionIDs { part, ok := mt.partitionID2Meta[t] @@ -352,10 +354,10 @@ func (mt *metaTable) AddPartition(collID typeutil.UniqueID, partitionName string continue } if part.PartitionName == partitionName { - return errors.Errorf("partition name = %s already exists", partitionName) + return fmt.Errorf("partition name = %s already exists", partitionName) } if part.PartitionID == partitionID { - return errors.Errorf("partition id = %d already exists", partitionID) + return fmt.Errorf("partition id = %d already exists", partitionID) } } partMeta := pb.PartitionInfo{ @@ -411,7 +413,7 @@ func (mt *metaTable) DeletePartition(collID typeutil.UniqueID, partitionName str collMeta, ok := mt.collID2Meta[collID] if !ok { - return 0, errors.Errorf("can't find collection id = " + strconv.FormatInt(collID, 10)) + return 0, fmt.Errorf("can't find collection id = %d", collID) } // check tag exists @@ -433,7 +435,7 @@ func (mt *metaTable) DeletePartition(collID typeutil.UniqueID, partitionName str } if !exist { - return 0, errors.New("partition " + partitionName + " does not exist") + return 0, fmt.Errorf("partition %s does not exist", partitionName) } delete(mt.partitionID2Meta, partMeta.PartitionID) collMeta.PartitionIDs = pd @@ -473,7 +475,7 @@ func (mt *metaTable) GetPartitionByID(partitionID typeutil.UniqueID) (pb.Partiti defer mt.ddLock.RUnlock() partMeta, ok := mt.partitionID2Meta[partitionID] if !ok { - return pb.PartitionInfo{}, errors.Errorf("partition id = %d not exist", partitionID) + return pb.PartitionInfo{}, fmt.Errorf("partition id = %d not exist", partitionID) } return partMeta, nil } @@ -483,11 +485,11 @@ func (mt *metaTable) AddSegment(seg *datapb.SegmentInfo) error { defer mt.ddLock.Unlock() collMeta, ok := mt.collID2Meta[seg.CollectionID] if !ok { - return errors.Errorf("can't find collection id = " + strconv.FormatInt(seg.CollectionID, 10)) + return fmt.Errorf("can't find collection id = %d", seg.CollectionID) } partMeta, ok := mt.partitionID2Meta[seg.PartitionID] if !ok { - return errors.Errorf("can't find partition id = " + strconv.FormatInt(seg.PartitionID, 10)) + return fmt.Errorf("can't find partition id = %d", seg.PartitionID) } exist := false for _, partID := range collMeta.PartitionIDs { @@ -497,7 +499,7 @@ func (mt *metaTable) AddSegment(seg *datapb.SegmentInfo) error { } } if !exist { - return errors.Errorf("partition id = %d, not belong to collection id = %d", seg.PartitionID, seg.CollectionID) + return fmt.Errorf("partition id = %d, not belong to collection id = %d", seg.PartitionID, seg.CollectionID) } exist = false for _, segID := range partMeta.SegmentIDs { @@ -506,7 +508,7 @@ func (mt *metaTable) AddSegment(seg *datapb.SegmentInfo) error { } } if exist { - return errors.Errorf("segment id = %d exist", seg.SegmentID) + return fmt.Errorf("segment id = %d exist", seg.SegmentID) } partMeta.SegmentIDs = append(partMeta.SegmentIDs, seg.SegmentID) mt.partitionID2Meta[seg.PartitionID] = partMeta @@ -531,16 +533,16 @@ func (mt *metaTable) AddIndex(seg *pb.SegmentIndexInfo) error { } else { _, ok := (*segIdxMap)[seg.IndexID] if ok { - return errors.Errorf("index id = %d exist", seg.IndexID) + return fmt.Errorf("index id = %d exist", seg.IndexID) } } collID, ok := mt.segID2CollID[seg.SegmentID] if !ok { - return errors.Errorf("segment id = %d not belong to any collection", seg.SegmentID) + return fmt.Errorf("segment id = %d not belong to any collection", seg.SegmentID) } collMeta, ok := mt.collID2Meta[collID] if !ok { - return errors.Errorf("collection id = %d not found", collID) + return fmt.Errorf("collection id = %d not found", collID) } exist := false for _, i := range collMeta.FieldIndexes { @@ -550,7 +552,7 @@ func (mt *metaTable) AddIndex(seg *pb.SegmentIndexInfo) error { } } if !exist { - return errors.Errorf("index id = %d not found", seg.IndexID) + return fmt.Errorf("index id = %d not found", seg.IndexID) } (*(mt.segID2IndexMeta[seg.SegmentID]))[seg.IndexID] = *seg @@ -571,11 +573,11 @@ func (mt *metaTable) DropIndex(collName, fieldName, indexName string) (typeutil. collID, ok := mt.collName2ID[collName] if !ok { - return 0, false, errors.Errorf("collection name = %s not exist", collName) + return 0, false, fmt.Errorf("collection name = %s not exist", collName) } collMeta, ok := mt.collID2Meta[collID] if !ok { - return 0, false, errors.Errorf("collection name = %s not has meta", collName) + return 0, false, fmt.Errorf("collection name = %s not has meta", collName) } fieldSch, err := mt.unlockGetFieldSchema(collName, fieldName) if err != nil { @@ -646,10 +648,10 @@ func (mt *metaTable) GetSegmentIndexInfoByID(segID typeutil.UniqueID, filedID in segIdxMap, ok := mt.segID2IndexMeta[segID] if !ok { - return pb.SegmentIndexInfo{}, errors.Errorf("segment id %d not has any index", segID) + return pb.SegmentIndexInfo{}, fmt.Errorf("segment id %d not has any index", segID) } if len(*segIdxMap) == 0 { - return pb.SegmentIndexInfo{}, errors.Errorf("segment id %d not has any index", segID) + return pb.SegmentIndexInfo{}, fmt.Errorf("segment id %d not has any index", segID) } if filedID == -1 && idxName == "" { // return default index @@ -673,7 +675,7 @@ func (mt *metaTable) GetSegmentIndexInfoByID(segID typeutil.UniqueID, filedID in } } } - return pb.SegmentIndexInfo{}, errors.Errorf("can't find index name = %s on segment = %d, with filed id = %d", idxName, segID, filedID) + return pb.SegmentIndexInfo{}, fmt.Errorf("can't find index name = %s on segment = %d, with filed id = %d", idxName, segID, filedID) } func (mt *metaTable) GetFieldSchema(collName string, fieldName string) (schemapb.FieldSchema, error) { @@ -686,11 +688,11 @@ func (mt *metaTable) GetFieldSchema(collName string, fieldName string) (schemapb func (mt *metaTable) unlockGetFieldSchema(collName string, fieldName string) (schemapb.FieldSchema, error) { collID, ok := mt.collName2ID[collName] if !ok { - return schemapb.FieldSchema{}, errors.Errorf("collection %s not found", collName) + return schemapb.FieldSchema{}, fmt.Errorf("collection %s not found", collName) } collMeta, ok := mt.collID2Meta[collID] if !ok { - return schemapb.FieldSchema{}, errors.Errorf("collection %s not found", collName) + return schemapb.FieldSchema{}, fmt.Errorf("collection %s not found", collName) } for _, field := range collMeta.Schema.Fields { @@ -698,7 +700,7 @@ func (mt *metaTable) unlockGetFieldSchema(collName string, fieldName string) (sc return *field, nil } } - return schemapb.FieldSchema{}, errors.Errorf("collection %s doesn't have filed %s", collName, fieldName) + return schemapb.FieldSchema{}, fmt.Errorf("collection %s doesn't have filed %s", collName, fieldName) } //return true/false @@ -737,11 +739,11 @@ func (mt *metaTable) GetNotIndexedSegments(collName string, fieldName string, id collID, ok := mt.collName2ID[collName] if !ok { - return nil, schemapb.FieldSchema{}, errors.Errorf("collection %s not found", collName) + return nil, schemapb.FieldSchema{}, fmt.Errorf("collection %s not found", collName) } collMeta, ok := mt.collID2Meta[collID] if !ok { - return nil, schemapb.FieldSchema{}, errors.Errorf("collection %s not found", collName) + return nil, schemapb.FieldSchema{}, fmt.Errorf("collection %s not found", collName) } fieldSchema, err := mt.unlockGetFieldSchema(collName, fieldName) if err != nil { @@ -755,7 +757,7 @@ func (mt *metaTable) GetNotIndexedSegments(collName string, fieldName string, id if f.FiledID == fieldSchema.FieldID { existInfo, ok = mt.indexID2Meta[f.IndexID] if !ok { - return nil, schemapb.FieldSchema{}, errors.Errorf("index id = %d not found", f.IndexID) + return nil, schemapb.FieldSchema{}, fmt.Errorf("index id = %d not found", f.IndexID) } // (collMeta.IndexNames[i] == indexName) @@ -822,11 +824,11 @@ func (mt *metaTable) GetIndexByName(collName string, fieldName string, indexName collID, ok := mt.collName2ID[collName] if !ok { - return nil, errors.Errorf("collection %s not found", collName) + return nil, fmt.Errorf("collection %s not found", collName) } collMeta, ok := mt.collID2Meta[collID] if !ok { - return nil, errors.Errorf("collection %s not found", collName) + return nil, fmt.Errorf("collection %s not found", collName) } fieldSchema, err := mt.GetFieldSchema(collName, fieldName) if err != nil { @@ -838,7 +840,7 @@ func (mt *metaTable) GetIndexByName(collName string, fieldName string, indexName if idx.FiledID == fieldSchema.FieldID { idxInfo, ok := mt.indexID2Meta[idx.IndexID] if !ok { - return nil, errors.Errorf("index id = %d not found", idx.IndexID) + return nil, fmt.Errorf("index id = %d not found", idx.IndexID) } if indexName == "" || idxInfo.IndexName == indexName { rstIndex = append(rstIndex, idxInfo) @@ -854,7 +856,7 @@ func (mt *metaTable) GetIndexByID(indexID typeutil.UniqueID) (*pb.IndexInfo, err indexInfo, ok := mt.indexID2Meta[indexID] if !ok { - return nil, errors.New("cannot find index, id =" + strconv.FormatInt(indexID, 10)) + return nil, fmt.Errorf("cannot find index, id = %d", indexID) } return &indexInfo, nil } diff --git a/internal/masterservice/task.go b/internal/masterservice/task.go index 96efde31d8eb7f99394af69f7cf4e08248ab96a3..33a304dda8103f5284853ab57fb5f1895b82141a 100644 --- a/internal/masterservice/task.go +++ b/internal/masterservice/task.go @@ -1,12 +1,12 @@ package masterservice import ( + "errors" "fmt" "github.com/golang/protobuf/proto" "go.uber.org/zap" - "github.com/zilliztech/milvus-distributed/internal/errors" "github.com/zilliztech/milvus-distributed/internal/log" "github.com/zilliztech/milvus-distributed/internal/proto/commonpb" "github.com/zilliztech/milvus-distributed/internal/proto/etcdpb" @@ -37,10 +37,10 @@ func (bt *baseReqTask) Notify(err error) { func (bt *baseReqTask) WaitToFinish() error { select { case <-bt.core.ctx.Done(): - return errors.Errorf("context done") + return errors.New("context done") case err, ok := <-bt.cv: if !ok { - return errors.Errorf("notify chan closed") + return errors.New("notify chan closed") } return err } @@ -71,7 +71,7 @@ func (t *CreateCollectionReqTask) Execute() error { } if t.Req.CollectionName != schema.Name { - return errors.Errorf("collection name = %s, schema.Name=%s", t.Req.CollectionName, schema.Name) + return fmt.Errorf("collection name = %s, schema.Name=%s", t.Req.CollectionName, schema.Name) } for idx, field := range schema.Fields { @@ -544,7 +544,7 @@ func (t *DescribeSegmentReqTask) Execute() error { } } if !exist { - return errors.Errorf("segment id %d not belong to collection id %d", t.Req.SegmentID, t.Req.CollectionID) + return fmt.Errorf("segment id %d not belong to collection id %d", t.Req.SegmentID, t.Req.CollectionID) } //TODO, get filed_id and index_name from request segIdxInfo, err := t.core.MetaTable.GetSegmentIndexInfoByID(t.Req.SegmentID, -1, "") @@ -587,7 +587,7 @@ func (t *ShowSegmentReqTask) Execute() error { } } if !exist { - return errors.Errorf("partition id = %d not belong to collection id = %d", t.Req.PartitionID, t.Req.CollectionID) + return fmt.Errorf("partition id = %d not belong to collection id = %d", t.Req.PartitionID, t.Req.CollectionID) } partMeta, err := t.core.MetaTable.GetPartitionByID(t.Req.PartitionID) if err != nil { @@ -630,7 +630,7 @@ func (t *CreateIndexReqTask) Execute() error { return err } if field.DataType != schemapb.DataType_VECTOR_FLOAT && field.DataType != schemapb.DataType_VECTOR_BINARY { - return errors.Errorf("field name = %s, data type = %s", t.Req.FieldName, schemapb.DataType_name[int32(field.DataType)]) + return fmt.Errorf("field name = %s, data type = %s", t.Req.FieldName, schemapb.DataType_name[int32(field.DataType)]) } for _, seg := range segIDs { task := CreateIndexTask{ @@ -708,7 +708,7 @@ func (t *DropIndexReqTask) Execute() error { return nil } if len(info) != 1 { - return errors.Errorf("len(index) = %d", len(info)) + return fmt.Errorf("len(index) = %d", len(info)) } err = t.core.DropIndexReq(info[0].IndexID) if err != nil { diff --git a/internal/masterservice/util.go b/internal/masterservice/util.go index 9ce7fecb246d9236275e0b398b15c66a806d2b70..99617b34e22a05f61346df83880d002431901822 100644 --- a/internal/masterservice/util.go +++ b/internal/masterservice/util.go @@ -1,7 +1,8 @@ package masterservice import ( - "github.com/zilliztech/milvus-distributed/internal/errors" + "fmt" + "github.com/zilliztech/milvus-distributed/internal/proto/commonpb" "github.com/zilliztech/milvus-distributed/internal/proto/etcdpb" "github.com/zilliztech/milvus-distributed/internal/proto/schemapb" @@ -35,5 +36,5 @@ func GetFieldSchemaByID(coll *etcdpb.CollectionInfo, fieldID typeutil.UniqueID) return f, nil } } - return nil, errors.Errorf("field id = %d not found", fieldID) + return nil, fmt.Errorf("field id = %d not found", fieldID) } diff --git a/internal/msgstream/pulsarms/msg_test.go b/internal/msgstream/pulsarms/msg_test.go index 48496c99c428b7f042ddf48b952a915b502e2318..088d76edc80abbab5a5ab89e1f01d902c2b51b37 100644 --- a/internal/msgstream/pulsarms/msg_test.go +++ b/internal/msgstream/pulsarms/msg_test.go @@ -2,11 +2,12 @@ package pulsarms import ( "context" - "errors" "fmt" "log" "testing" + "errors" + "github.com/golang/protobuf/proto" "github.com/zilliztech/milvus-distributed/internal/msgstream" @@ -51,7 +52,7 @@ func newRepackFunc(tsMsgs []msgstream.TsMsg, hashKeys [][]int32) (map[int32]*msg result := make(map[int32]*msgstream.MsgPack) for i, request := range tsMsgs { if request.Type() != commonpb.MsgType_kInsert { - return nil, errors.New(string("msg's must be Insert")) + return nil, errors.New("msg's must be Insert") } insertRequest := request.(*InsertTask).InsertRequest keys := hashKeys[i] @@ -62,7 +63,7 @@ func newRepackFunc(tsMsgs []msgstream.TsMsg, hashKeys [][]int32) (map[int32]*msg keysLen := len(keys) if keysLen != timestampLen || keysLen != rowIDLen || keysLen != rowDataLen { - return nil, errors.New(string("the length of hashValue, timestamps, rowIDs, RowData are not equal")) + return nil, errors.New("the length of hashValue, timestamps, rowIDs, RowData are not equal") } for index, key := range keys { _, ok := result[key] diff --git a/internal/msgstream/pulsarms/pulsar_msgstream.go b/internal/msgstream/pulsarms/pulsar_msgstream.go index d4fca089788e583cd52cd503d27a0bb68c0c133f..778c3480187b32801cf99bddbc09e52ebf82d903 100644 --- a/internal/msgstream/pulsarms/pulsar_msgstream.go +++ b/internal/msgstream/pulsarms/pulsar_msgstream.go @@ -8,10 +8,11 @@ import ( "sync" "time" + "errors" + "github.com/apache/pulsar-client-go/pulsar" "github.com/golang/protobuf/proto" "github.com/opentracing/opentracing-go" - "github.com/zilliztech/milvus-distributed/internal/errors" "github.com/zilliztech/milvus-distributed/internal/log" "github.com/zilliztech/milvus-distributed/internal/msgstream" "github.com/zilliztech/milvus-distributed/internal/msgstream/util" diff --git a/internal/msgstream/rmqms/rmq_msgstream.go b/internal/msgstream/rmqms/rmq_msgstream.go index cac7056f6f11f688d394073938c87e1e7e93399f..eaa35f6f810f7e6052ddcfeb0537b078286c32b0 100644 --- a/internal/msgstream/rmqms/rmq_msgstream.go +++ b/internal/msgstream/rmqms/rmq_msgstream.go @@ -2,13 +2,14 @@ package rmqms import ( "context" - "errors" "log" "path/filepath" "reflect" "strconv" "sync" + "errors" + "github.com/gogo/protobuf/proto" "github.com/zilliztech/milvus-distributed/internal/msgstream/util" "github.com/zilliztech/milvus-distributed/internal/proto/commonpb" diff --git a/internal/msgstream/unmarshal.go b/internal/msgstream/unmarshal.go index ff86fcc6f2257a9dac4663364757066fa19bc845..ea38e05e31e382e3b16157760ba69ff2ed211f87 100644 --- a/internal/msgstream/unmarshal.go +++ b/internal/msgstream/unmarshal.go @@ -1,7 +1,8 @@ package msgstream import ( - "github.com/zilliztech/milvus-distributed/internal/errors" + "errors" + "github.com/zilliztech/milvus-distributed/internal/proto/commonpb" ) @@ -25,7 +26,7 @@ type ProtoUnmarshalDispatcher struct { func (p *ProtoUnmarshalDispatcher) Unmarshal(input interface{}, msgType commonpb.MsgType) (TsMsg, error) { unmarshalFunc, ok := p.TempMap[msgType] if !ok { - return nil, errors.New(string("Not set unmarshalFunc for this messageType.")) + return nil, errors.New("not set unmarshalFunc for this messageType") } return unmarshalFunc(input) } diff --git a/internal/msgstream/util/repack_func.go b/internal/msgstream/util/repack_func.go index 0727b7338239eed87ffd015c6d7d64ae0eafd16f..a4d9692ce406786557ead8e384872352f9c9e6df 100644 --- a/internal/msgstream/util/repack_func.go +++ b/internal/msgstream/util/repack_func.go @@ -1,7 +1,8 @@ package util import ( - "github.com/zilliztech/milvus-distributed/internal/errors" + "errors" + "github.com/zilliztech/milvus-distributed/internal/msgstream" "github.com/zilliztech/milvus-distributed/internal/proto/commonpb" "github.com/zilliztech/milvus-distributed/internal/proto/internalpb2" diff --git a/internal/proxynode/condition.go b/internal/proxynode/condition.go index a55ec9d63f56390df768ce6d04bfa3ad38cfa2c1..3c280ab4001bd0ba6280124ae32f9646d3ee045b 100644 --- a/internal/proxynode/condition.go +++ b/internal/proxynode/condition.go @@ -3,7 +3,7 @@ package proxynode import ( "context" - "github.com/zilliztech/milvus-distributed/internal/errors" + "errors" ) type Condition interface { diff --git a/internal/proxynode/impl.go b/internal/proxynode/impl.go index eadbe3c4034672ec5fc390d91c419fd528fbbfc9..d3a5e580e2b60e18e074778dff0169d135f9fcce 100644 --- a/internal/proxynode/impl.go +++ b/internal/proxynode/impl.go @@ -6,7 +6,8 @@ import ( "strconv" "time" - "github.com/zilliztech/milvus-distributed/internal/errors" + "errors" + "github.com/zilliztech/milvus-distributed/internal/msgstream" "github.com/zilliztech/milvus-distributed/internal/proto/commonpb" "github.com/zilliztech/milvus-distributed/internal/proto/datapb" diff --git a/internal/proxynode/insert_channels.go b/internal/proxynode/insert_channels.go index ef01ece4a0cdf617c35cbc971404811acc40b648..ed3598154863404903f3ef1452198fbfd87baf04 100644 --- a/internal/proxynode/insert_channels.go +++ b/internal/proxynode/insert_channels.go @@ -2,13 +2,13 @@ package proxynode import ( "context" + "fmt" "log" "reflect" "sort" - "strconv" "sync" - "github.com/zilliztech/milvus-distributed/internal/errors" + "errors" "github.com/zilliztech/milvus-distributed/internal/msgstream" ) @@ -120,7 +120,7 @@ func (m *InsertChannelsMap) closeInsertMsgStream(collID UniqueID) error { loc, ok := m.collectionID2InsertChannels[collID] if !ok { - return errors.New("cannot find collection with id: " + strconv.Itoa(int(collID))) + return fmt.Errorf("cannot find collection with id %d", collID) } if m.droppedBitMap[loc] != 0 { return errors.New("insert message stream already closed") @@ -145,7 +145,7 @@ func (m *InsertChannelsMap) getInsertChannels(collID UniqueID) ([]string, error) loc, ok := m.collectionID2InsertChannels[collID] if !ok { - return nil, errors.New("cannot find collection with id: " + strconv.Itoa(int(collID))) + return nil, fmt.Errorf("cannot find collection with id: %d", collID) } if m.droppedBitMap[loc] != 0 { @@ -161,7 +161,7 @@ func (m *InsertChannelsMap) getInsertMsgStream(collID UniqueID) (msgstream.MsgSt loc, ok := m.collectionID2InsertChannels[collID] if !ok { - return nil, errors.New("cannot find collection with id: " + strconv.Itoa(int(collID))) + return nil, fmt.Errorf("cannot find collection with id: %d", collID) } if m.droppedBitMap[loc] != 0 { diff --git a/internal/proxynode/meta_cache.go b/internal/proxynode/meta_cache.go index 637e51d61492460abf01e70f680bd741afcd1815..87bde8948d2487c1e9e95a0df8eedf2531cb0650 100644 --- a/internal/proxynode/meta_cache.go +++ b/internal/proxynode/meta_cache.go @@ -2,9 +2,10 @@ package proxynode import ( "context" + "errors" + "fmt" "sync" - "github.com/zilliztech/milvus-distributed/internal/errors" "github.com/zilliztech/milvus-distributed/internal/proto/commonpb" "github.com/zilliztech/milvus-distributed/internal/proto/milvuspb" "github.com/zilliztech/milvus-distributed/internal/proto/schemapb" @@ -61,7 +62,7 @@ func (m *MetaCache) readCollectionID(ctx context.Context, collectionName string) collInfo, ok := m.collInfo[collectionName] if !ok { - return 0, errors.Errorf("can't find collection name:%s", collectionName) + return 0, fmt.Errorf("can't find collection name:%s", collectionName) } return collInfo.collID, nil } @@ -72,7 +73,7 @@ func (m *MetaCache) readCollectionSchema(ctx context.Context, collectionName str collInfo, ok := m.collInfo[collectionName] if !ok { - return nil, errors.Errorf("can't find collection name:%s", collectionName) + return nil, fmt.Errorf("can't find collection name:%s", collectionName) } return collInfo.schema, nil } @@ -83,12 +84,12 @@ func (m *MetaCache) readPartitionID(ctx context.Context, collectionName string, collInfo, ok := m.collInfo[collectionName] if !ok { - return 0, errors.Errorf("can't find collection name:%s", collectionName) + return 0, fmt.Errorf("can't find collection name:%s", collectionName) } partitionID, ok := collInfo.partInfo[partitionName] if !ok { - return 0, errors.Errorf("can't find partition name:%s", partitionName) + return 0, fmt.Errorf("can't find partition name:%s", partitionName) } return partitionID, nil } @@ -112,7 +113,7 @@ func (m *MetaCache) GetCollectionID(ctx context.Context, collectionName string) return 0, err } if coll.Status.ErrorCode != commonpb.ErrorCode_SUCCESS { - return 0, errors.Errorf("%s", coll.Status.Reason) + return 0, errors.New(coll.Status.Reason) } _, ok := m.collInfo[collectionName] @@ -143,7 +144,7 @@ func (m *MetaCache) GetCollectionSchema(ctx context.Context, collectionName stri return nil, err } if coll.Status.ErrorCode != commonpb.ErrorCode_SUCCESS { - return nil, errors.Errorf("%s", coll.Status.Reason) + return nil, errors.New(coll.Status.Reason) } _, ok := m.collInfo[collectionName] @@ -175,10 +176,10 @@ func (m *MetaCache) GetPartitionID(ctx context.Context, collectionName string, p return 0, err } if partitions.Status.ErrorCode != commonpb.ErrorCode_SUCCESS { - return 0, errors.Errorf("%s", partitions.Status.Reason) + return 0, fmt.Errorf("%s", partitions.Status.Reason) } if len(partitions.PartitionIDs) != len(partitions.PartitionNames) { - return 0, errors.Errorf("partition ids len: %d doesn't equal Partition name len %d", + return 0, fmt.Errorf("partition ids len: %d doesn't equal Partition name len %d", len(partitions.PartitionIDs), len(partitions.PartitionNames)) } @@ -201,7 +202,7 @@ func (m *MetaCache) GetPartitionID(ctx context.Context, collectionName string, p } _, ok = partInfo[partitionName] if !ok { - return 0, errors.Errorf("partitionID of partitionName:%s can not be find", partitionName) + return 0, fmt.Errorf("partitionID of partitionName:%s can not be find", partitionName) } return partInfo[partitionName], nil diff --git a/internal/proxynode/proxy_node.go b/internal/proxynode/proxy_node.go index 264e7f59e97b5b77abd1b8cf5ae674dafae957aa..0a394356318c0ea06606437ed2be28cfd78f5bec 100644 --- a/internal/proxynode/proxy_node.go +++ b/internal/proxynode/proxy_node.go @@ -12,7 +12,8 @@ import ( "github.com/zilliztech/milvus-distributed/internal/proto/proxypb" "github.com/zilliztech/milvus-distributed/internal/util/retry" - "github.com/zilliztech/milvus-distributed/internal/errors" + "errors" + "github.com/zilliztech/milvus-distributed/internal/proto/commonpb" "github.com/zilliztech/milvus-distributed/internal/proto/internalpb2" diff --git a/internal/proxynode/repack_func.go b/internal/proxynode/repack_func.go index 89c6014d51c666810833ee1c273c453811810378..ec2534736d9f8d3f3f1125d8cf3dbe5dce8e1ce8 100644 --- a/internal/proxynode/repack_func.go +++ b/internal/proxynode/repack_func.go @@ -4,11 +4,12 @@ import ( "log" "sort" + "errors" + "github.com/zilliztech/milvus-distributed/internal/proto/internalpb2" "github.com/zilliztech/milvus-distributed/internal/util/typeutil" - "github.com/zilliztech/milvus-distributed/internal/errors" "github.com/zilliztech/milvus-distributed/internal/msgstream" "github.com/zilliztech/milvus-distributed/internal/proto/commonpb" ) @@ -27,11 +28,11 @@ func insertRepackFunc(tsMsgs []msgstream.TsMsg, for i, request := range tsMsgs { if request.Type() != commonpb.MsgType_kInsert { - return nil, errors.New(string("msg's must be Insert")) + return nil, errors.New("msg's must be Insert") } insertRequest, ok := request.(*msgstream.InsertMsg) if !ok { - return nil, errors.New(string("msg's must be Insert")) + return nil, errors.New("msg's must be Insert") } keys := hashKeys[i] @@ -41,7 +42,7 @@ func insertRepackFunc(tsMsgs []msgstream.TsMsg, keysLen := len(keys) if keysLen != timestampLen || keysLen != rowIDLen || keysLen != rowDataLen { - return nil, errors.New(string("the length of hashValue, timestamps, rowIDs, RowData are not equal")) + return nil, errors.New("the length of hashValue, timestamps, rowIDs, RowData are not equal") } reqID := insertRequest.Base.MsgID diff --git a/internal/proxynode/segment.go b/internal/proxynode/segment.go index a7d37fc8e5d6d4dd69440319930bad85b46d470c..4af7c1d44060c78b57ff3399cc782b3bc37b16b1 100644 --- a/internal/proxynode/segment.go +++ b/internal/proxynode/segment.go @@ -7,9 +7,10 @@ import ( "log" "time" + "errors" + "github.com/zilliztech/milvus-distributed/internal/allocator" - "github.com/zilliztech/milvus-distributed/internal/errors" "github.com/zilliztech/milvus-distributed/internal/proto/commonpb" "github.com/zilliztech/milvus-distributed/internal/proto/datapb" "github.com/zilliztech/milvus-distributed/internal/util/typeutil" diff --git a/internal/proxynode/task.go b/internal/proxynode/task.go index 8c98a6ac7819d8636b91343ca6f88af1e21b356a..de4a36503519e020430e58b929152714215c47cf 100644 --- a/internal/proxynode/task.go +++ b/internal/proxynode/task.go @@ -2,12 +2,13 @@ package proxynode import ( "context" - "errors" "fmt" "log" "math" "strconv" + "errors" + "github.com/golang/protobuf/proto" "github.com/zilliztech/milvus-distributed/internal/allocator" "github.com/zilliztech/milvus-distributed/internal/msgstream" @@ -296,7 +297,7 @@ func (cct *CreateCollectionTask) PreExecute(ctx context.Context) error { } if int64(len(cct.schema.Fields)) > Params.MaxFieldNum { - return errors.New("maximum field's number should be limited to " + strconv.FormatInt(Params.MaxFieldNum, 10)) + return fmt.Errorf("maximum field's number should be limited to %d", Params.MaxFieldNum) } // validate collection name @@ -590,7 +591,7 @@ func (st *SearchTask) PostExecute(ctx context.Context) error { select { case <-st.Ctx().Done(): log.Print("SearchTask: wait to finish failed, timeout!, taskID:", st.ID()) - return errors.New("SearchTask:wait to finish failed, timeout:" + strconv.FormatInt(st.ID(), 10)) + return fmt.Errorf("SearchTask:wait to finish failed, timeout: %d", st.ID()) case searchResults := <-st.resultBuf: // fmt.Println("searchResults: ", searchResults) filterSearchResult := make([]*internalpb2.SearchResults, 0) diff --git a/internal/proxynode/task_scheduler.go b/internal/proxynode/task_scheduler.go index 6347bdc95c2bce9365e9cce4974a589dccf468b5..21a70a189514f026315411008e3bc036b6454637 100644 --- a/internal/proxynode/task_scheduler.go +++ b/internal/proxynode/task_scheduler.go @@ -3,12 +3,13 @@ package proxynode import ( "container/list" "context" - "errors" "fmt" "log" "strconv" "sync" + "errors" + "github.com/opentracing/opentracing-go" oplog "github.com/opentracing/opentracing-go/log" "github.com/zilliztech/milvus-distributed/internal/allocator" diff --git a/internal/proxynode/validate_util.go b/internal/proxynode/validate_util.go index 839fedd9f0eefea1685e788a7b4c88234483a03f..c650979089fbc9843c46c89433897ce672cd1806 100644 --- a/internal/proxynode/validate_util.go +++ b/internal/proxynode/validate_util.go @@ -1,10 +1,12 @@ package proxynode import ( + "fmt" "strconv" "strings" - "github.com/zilliztech/milvus-distributed/internal/errors" + "errors" + "github.com/zilliztech/milvus-distributed/internal/proto/schemapb" ) @@ -120,11 +122,10 @@ func ValidateFieldName(fieldName string) error { func ValidateDimension(dim int64, isBinary bool) error { if dim <= 0 || dim > Params.MaxDimension { - return errors.New("invalid dimension: " + strconv.FormatInt(dim, 10) + ". should be in range 1 ~ " + - strconv.FormatInt(Params.MaxDimension, 10) + ".") + return fmt.Errorf("invalid dimension: %d. should be in range 1 ~ %d", dim, Params.MaxDimension) } if isBinary && dim%8 != 0 { - return errors.New("invalid dimension: " + strconv.FormatInt(dim, 10) + ". should be multiple of 8.") + return fmt.Errorf("invalid dimension: %d. should be multiple of 8. ", dim) } return nil } @@ -158,7 +159,7 @@ func ValidatePrimaryKey(coll *schemapb.CollectionSchema) error { if coll.AutoID { for _, field := range coll.Fields { if field.IsPrimaryKey { - return errors.Errorf("collection %s is auto id, so filed %s should not defined as primary key", coll.Name, field.Name) + return fmt.Errorf("collection %s is auto id, so filed %s should not defined as primary key", coll.Name, field.Name) } } return nil @@ -167,16 +168,16 @@ func ValidatePrimaryKey(coll *schemapb.CollectionSchema) error { for i, field := range coll.Fields { if field.IsPrimaryKey { if idx != -1 { - return errors.Errorf("there are more than one primary key, filed name = %s, %s", coll.Fields[idx].Name, field.Name) + return fmt.Errorf("there are more than one primary key, filed name = %s, %s", coll.Fields[idx].Name, field.Name) } if field.DataType != schemapb.DataType_INT64 { - return errors.Errorf("the data type of primary key should be int64") + return errors.New("the data type of primary key should be int64") } idx = i } } if idx == -1 { - return errors.Errorf("primay key is undefined") + return errors.New("primay key is undefined") } return nil } diff --git a/internal/proxyservice/node_info.go b/internal/proxyservice/node_info.go index 1fb3811f87a6724557d3e94aab1b7a16587f8470..da330f402ce21daa664d8b95308474fd8174e0fb 100644 --- a/internal/proxyservice/node_info.go +++ b/internal/proxyservice/node_info.go @@ -12,7 +12,7 @@ import ( grpcproxynodeclient "github.com/zilliztech/milvus-distributed/internal/distributed/proxynode/client" - "github.com/zilliztech/milvus-distributed/internal/errors" + "errors" "github.com/zilliztech/milvus-distributed/internal/proto/proxypb" ) diff --git a/internal/proxyservice/task.go b/internal/proxyservice/task.go index 7c17824174f59ddc1e25bc79ef868242bf5eaef8..e675eabb8fd4983e2dc8fa56c325274d4d24ea02 100644 --- a/internal/proxyservice/task.go +++ b/internal/proxyservice/task.go @@ -3,7 +3,8 @@ package proxyservice import ( "context" - "github.com/zilliztech/milvus-distributed/internal/errors" + "errors" + "github.com/zilliztech/milvus-distributed/internal/proto/commonpb" "github.com/zilliztech/milvus-distributed/internal/proto/internalpb2" "github.com/zilliztech/milvus-distributed/internal/proto/milvuspb" diff --git a/internal/proxyservice/task_queue.go b/internal/proxyservice/task_queue.go index f1a01ff9d865a4cfedbeee80f2df555c252e2bc9..f58620eda0c9cace8296d925f7fddcf566001d8d 100644 --- a/internal/proxyservice/task_queue.go +++ b/internal/proxyservice/task_queue.go @@ -5,7 +5,7 @@ import ( "log" "sync" - "github.com/zilliztech/milvus-distributed/internal/errors" + "errors" ) type TaskQueue interface { diff --git a/internal/proxyservice/timesync.go b/internal/proxyservice/timesync.go index 8f2976c2334511db482e34a42821cec581a3897e..45633c5391f7ad0dfe83c0d9a2627277ced1f3ea 100644 --- a/internal/proxyservice/timesync.go +++ b/internal/proxyservice/timesync.go @@ -2,12 +2,12 @@ package proxyservice import ( "context" + "errors" "log" "math" "sync" "sync/atomic" - "github.com/zilliztech/milvus-distributed/internal/errors" ms "github.com/zilliztech/milvus-distributed/internal/msgstream" ) @@ -54,16 +54,16 @@ func (ttBarrier *softTimeTickBarrier) AddPeer(peerID UniqueID) error { func (ttBarrier *softTimeTickBarrier) GetTimeTick() (Timestamp, error) { select { case <-ttBarrier.ctx.Done(): - return 0, errors.Errorf("[GetTimeTick] closed.") + return 0, errors.New("getTimeTick closed") case ts, ok := <-ttBarrier.outTt: if !ok { - return 0, errors.Errorf("[GetTimeTick] closed.") + return 0, errors.New("getTimeTick closed") } num := len(ttBarrier.outTt) for i := 0; i < num; i++ { ts, ok = <-ttBarrier.outTt if !ok { - return 0, errors.Errorf("[GetTimeTick] closed.") + return 0, errors.New("getTimeTick closed") } } atomic.StoreInt64(&(ttBarrier.lastTt), int64(ts)) diff --git a/internal/querynode/collection_replica.go b/internal/querynode/collection_replica.go index d965acd18741f6c223d2d587078cae25a3a57605..5b64394d2488313aab3293200623143a883021ad 100644 --- a/internal/querynode/collection_replica.go +++ b/internal/querynode/collection_replica.go @@ -12,12 +12,14 @@ package querynode */ import "C" import ( + "fmt" "strconv" "sync" + "errors" + "go.uber.org/zap" - "github.com/zilliztech/milvus-distributed/internal/errors" "github.com/zilliztech/milvus-distributed/internal/log" "github.com/zilliztech/milvus-distributed/internal/proto/internalpb2" "github.com/zilliztech/milvus-distributed/internal/proto/schemapb" @@ -96,7 +98,7 @@ func (colReplica *collectionReplicaImpl) addCollection(collectionID UniqueID, sc defer colReplica.mu.Unlock() if ok := colReplica.hasCollectionPrivate(collectionID); ok { - return errors.New("collection has been existed, id = " + strconv.FormatInt(collectionID, 10)) + return fmt.Errorf("collection has been existed, id %d", collectionID) } var newCollection = newCollection(collectionID, schema) @@ -138,7 +140,7 @@ func (colReplica *collectionReplicaImpl) getCollectionByID(collectionID UniqueID func (colReplica *collectionReplicaImpl) getCollectionByIDPrivate(collectionID UniqueID) (*Collection, error) { collection, ok := colReplica.collections[collectionID] if !ok { - return nil, errors.New("cannot find collection, id = " + strconv.FormatInt(collectionID, 10)) + return nil, fmt.Errorf("cannot find collection, id = %d", collectionID) } return collection, nil @@ -190,7 +192,7 @@ func (colReplica *collectionReplicaImpl) getVecFieldIDsByCollectionID(collection } if len(vecFields) <= 0 { - return nil, errors.New("no vector field in collection " + strconv.FormatInt(collectionID, 10)) + return nil, fmt.Errorf("no vector field in collection %d", collectionID) } return vecFields, nil @@ -223,7 +225,7 @@ func (colReplica *collectionReplicaImpl) getFieldsByCollectionIDPrivate(collecti } if len(collection.Schema().Fields) <= 0 { - return nil, errors.New("no field in collection " + strconv.FormatInt(collectionID, 10)) + return nil, fmt.Errorf("no field in collection %d", collectionID) } return collection.Schema().Fields, nil @@ -286,7 +288,7 @@ func (colReplica *collectionReplicaImpl) getPartitionByID(partitionID UniqueID) func (colReplica *collectionReplicaImpl) getPartitionByIDPrivate(partitionID UniqueID) (*Partition, error) { partition, ok := colReplica.partitions[partitionID] if !ok { - return nil, errors.New("cannot find partition, id = " + strconv.FormatInt(partitionID, 10)) + return nil, fmt.Errorf("cannot find partition, id = %d", partitionID) } return partition, nil diff --git a/internal/querynode/index_loader.go b/internal/querynode/index_loader.go index d15bab474fa3178a0deadb79bd28b1e7d7318735..4d2848206a6502a7a7a05b05acce38d2ffdef989 100644 --- a/internal/querynode/index_loader.go +++ b/internal/querynode/index_loader.go @@ -2,7 +2,6 @@ package querynode import ( "context" - "errors" "fmt" "path" "sort" @@ -11,6 +10,8 @@ import ( "sync" "time" + "errors" + "go.uber.org/zap" "github.com/zilliztech/milvus-distributed/internal/kv" diff --git a/internal/querynode/load_index_info.go b/internal/querynode/load_index_info.go index 3643f1e87571177bcfab2ef0f699b39663d359a1..0a3c0643ca533a0bc874870b7be3f498ef9114a1 100644 --- a/internal/querynode/load_index_info.go +++ b/internal/querynode/load_index_info.go @@ -9,11 +9,12 @@ package querynode */ import "C" import ( - "errors" "path/filepath" "strconv" "unsafe" + "errors" + "go.uber.org/zap" "github.com/zilliztech/milvus-distributed/internal/log" diff --git a/internal/querynode/load_service.go b/internal/querynode/load_service.go index f26503af0bf2793b18872eaf954a3e5b52de868a..3d78d5707c893b792d79737b0422120b5914d2fd 100644 --- a/internal/querynode/load_service.go +++ b/internal/querynode/load_service.go @@ -6,9 +6,10 @@ import ( "sync" "time" + "errors" + "go.uber.org/zap" - "github.com/zilliztech/milvus-distributed/internal/errors" "github.com/zilliztech/milvus-distributed/internal/log" "github.com/zilliztech/milvus-distributed/internal/msgstream" "github.com/zilliztech/milvus-distributed/internal/proto/commonpb" diff --git a/internal/querynode/plan.go b/internal/querynode/plan.go index 0909406189a66b1ce2c74865bc2bbb25237f9463..e4059d6e17cf286f0df200a385d4596070bf1f6c 100644 --- a/internal/querynode/plan.go +++ b/internal/querynode/plan.go @@ -10,9 +10,10 @@ package querynode */ import "C" import ( - "errors" "strconv" "unsafe" + + "errors" ) type Plan struct { diff --git a/internal/querynode/query_node.go b/internal/querynode/query_node.go index 6f604adb7c8fed4d2a796ace8fa9ce6e310c85af..32e783b7855cf43d5638b6e74f4c6a3218f50a9f 100644 --- a/internal/querynode/query_node.go +++ b/internal/querynode/query_node.go @@ -17,9 +17,10 @@ import ( "fmt" "sync/atomic" + "errors" + "go.uber.org/zap" - "github.com/zilliztech/milvus-distributed/internal/errors" "github.com/zilliztech/milvus-distributed/internal/log" "github.com/zilliztech/milvus-distributed/internal/msgstream" "github.com/zilliztech/milvus-distributed/internal/msgstream/pulsarms" @@ -144,7 +145,7 @@ func (node *QueryNode) Init() error { case "QueryResultChannelName": Params.SearchResultChannelNames = append(Params.SearchResultChannelNames, kv.Value) default: - return errors.Errorf("Invalid key: %v", kv.Key) + return fmt.Errorf("Invalid key: %v", kv.Key) } } diff --git a/internal/querynode/reduce.go b/internal/querynode/reduce.go index 8fa56bf7fbaf4dd2ade4cae0b966bee92f61b8fa..027eaa9fcf3df9e7c402daa2091ccfde71e7b86d 100644 --- a/internal/querynode/reduce.go +++ b/internal/querynode/reduce.go @@ -10,9 +10,10 @@ package querynode */ import "C" import ( - "errors" "strconv" "unsafe" + + "errors" ) type SearchResult struct { diff --git a/internal/querynode/segment.go b/internal/querynode/segment.go index bf6e6793e6c4927fc3b6a7be24671dbbdf51a0dd..7b713e59d2c4f728a47464f0f38d5f9afd9989f2 100644 --- a/internal/querynode/segment.go +++ b/internal/querynode/segment.go @@ -19,7 +19,8 @@ import ( "github.com/stretchr/testify/assert" "go.uber.org/zap" - "github.com/zilliztech/milvus-distributed/internal/errors" + "errors" + "github.com/zilliztech/milvus-distributed/internal/log" "github.com/zilliztech/milvus-distributed/internal/proto/commonpb" ) diff --git a/internal/querynode/segment_loader.go b/internal/querynode/segment_loader.go index c4e3a18bc3ed373a06bec1a3365e229cee1e7b19..997a208f6410d29c53b74aed8c75212cb4e70f71 100644 --- a/internal/querynode/segment_loader.go +++ b/internal/querynode/segment_loader.go @@ -2,9 +2,10 @@ package querynode import ( "context" - "errors" "strconv" + "errors" + "github.com/zilliztech/milvus-distributed/internal/kv" minioKV "github.com/zilliztech/milvus-distributed/internal/kv/minio" "github.com/zilliztech/milvus-distributed/internal/msgstream" diff --git a/internal/queryservice/meta_replica.go b/internal/queryservice/meta_replica.go index 8431c3107df358cb3423863537bf466532eb3fec..15f06315319286fc315a302ec7105660e4cbec5f 100644 --- a/internal/queryservice/meta_replica.go +++ b/internal/queryservice/meta_replica.go @@ -3,7 +3,8 @@ package queryservice import ( "strconv" - "github.com/zilliztech/milvus-distributed/internal/errors" + "errors" + "github.com/zilliztech/milvus-distributed/internal/proto/querypb" "github.com/zilliztech/milvus-distributed/internal/proto/schemapb" ) diff --git a/internal/queryservice/mock.go b/internal/queryservice/mock.go index 69b5e1fa6264e71d03dce15f6ab0e91343ccc166..992d5c9233b5414f957d5e80fb361bd27f5e2f26 100644 --- a/internal/queryservice/mock.go +++ b/internal/queryservice/mock.go @@ -2,9 +2,10 @@ package queryservice import ( "context" - "errors" "strconv" + "errors" + "github.com/zilliztech/milvus-distributed/internal/proto/commonpb" "github.com/zilliztech/milvus-distributed/internal/proto/datapb" "github.com/zilliztech/milvus-distributed/internal/proto/internalpb2" diff --git a/internal/queryservice/queryservice.go b/internal/queryservice/queryservice.go index 063fef71000913f4cd1b9acfdb5e8e70fe948e5d..2179028cf1a18f6b56a3006d474890ba0fd7b2b0 100644 --- a/internal/queryservice/queryservice.go +++ b/internal/queryservice/queryservice.go @@ -14,8 +14,9 @@ import ( "github.com/uber/jaeger-client-go/config" "go.uber.org/zap" + "errors" + nodeclient "github.com/zilliztech/milvus-distributed/internal/distributed/querynode/client" - "github.com/zilliztech/milvus-distributed/internal/errors" "github.com/zilliztech/milvus-distributed/internal/log" "github.com/zilliztech/milvus-distributed/internal/msgstream" "github.com/zilliztech/milvus-distributed/internal/proto/commonpb" diff --git a/internal/storage/binlog_reader.go b/internal/storage/binlog_reader.go index 3bdfa884ecf690bce2716744e3165deb2b16400e..a6f8aa7e58297223607608285741fe6c48eed45d 100644 --- a/internal/storage/binlog_reader.go +++ b/internal/storage/binlog_reader.go @@ -3,9 +3,10 @@ package storage import ( "bytes" "encoding/binary" + "fmt" "strconv" - "github.com/zilliztech/milvus-distributed/internal/errors" + "errors" ) type BinlogReader struct { @@ -36,8 +37,7 @@ func (reader *BinlogReader) readMagicNumber() (int32, error) { return -1, err } if reader.magicNumber != MagicNumber { - return -1, errors.New("parse magic number failed, expected: " + strconv.Itoa(int(MagicNumber)) + - ", actual: " + strconv.Itoa(int(reader.magicNumber))) + return -1, fmt.Errorf("parse magic number failed, expected: %s, actual: %s", strconv.Itoa(int(MagicNumber)), strconv.Itoa(int(reader.magicNumber))) } return reader.magicNumber, nil diff --git a/internal/storage/binlog_writer.go b/internal/storage/binlog_writer.go index 3cd12c242638ef664c1571e7f54687aa0702d40a..97f38a69febe19430075af63b25511cdbea8b37f 100644 --- a/internal/storage/binlog_writer.go +++ b/internal/storage/binlog_writer.go @@ -4,7 +4,8 @@ import ( "bytes" "encoding/binary" - "github.com/zilliztech/milvus-distributed/internal/errors" + "errors" + "github.com/zilliztech/milvus-distributed/internal/proto/schemapb" ) diff --git a/internal/storage/data_codec.go b/internal/storage/data_codec.go index 7d2f0eea8ee785d8bf9a0f8aac7d60dbeea47045..2b34e3700ea195a7a2163119b5d9903f659b67ef 100644 --- a/internal/storage/data_codec.go +++ b/internal/storage/data_codec.go @@ -7,7 +7,8 @@ import ( "strconv" "strings" - "github.com/zilliztech/milvus-distributed/internal/errors" + "errors" + ms "github.com/zilliztech/milvus-distributed/internal/masterservice" "github.com/zilliztech/milvus-distributed/internal/proto/etcdpb" "github.com/zilliztech/milvus-distributed/internal/proto/schemapb" @@ -179,7 +180,7 @@ func (insertCodec *InsertCodec) Serialize(partitionID UniqueID, segmentID Unique case schemapb.DataType_VECTOR_FLOAT: err = eventWriter.AddFloatVectorToPayload(singleData.(*FloatVectorFieldData).Data, singleData.(*FloatVectorFieldData).Dim) default: - return nil, errors.Errorf("undefined data type %d", field.DataType) + return nil, fmt.Errorf("undefined data type %d", field.DataType) } if err != nil { return nil, err @@ -409,7 +410,7 @@ func (insertCodec *InsertCodec) Deserialize(blobs []*Blob) (partitionID UniqueID floatVectorFieldData.NumRows += length resultData.Data[fieldID] = floatVectorFieldData default: - return -1, -1, nil, errors.Errorf("undefined data type %d", dataType) + return -1, -1, nil, fmt.Errorf("undefined data type %d", dataType) } } insertCodec.readerCloseFunc = append(insertCodec.readerCloseFunc, readerClose(binlogReader)) @@ -671,7 +672,7 @@ func (indexCodec *IndexCodec) Deserialize(blobs []*Blob) ([]*Blob, map[string]st IndexID UniqueID }{} if err := json.Unmarshal(file.Value, &info); err != nil { - return nil, nil, "", -1, errors.New("json unmarshal error: " + err.Error()) + return nil, nil, "", -1, fmt.Errorf("json unmarshal error: %s", err.Error()) } return blobs, info.Params, info.IndexName, info.IndexID, nil diff --git a/internal/storage/event_data.go b/internal/storage/event_data.go index 5a0d0671bb222c1df53ac0967bbbb052e0d02321..1c2fc98fb7fd47eb0300af0fdd3896352b07ca8c 100644 --- a/internal/storage/event_data.go +++ b/internal/storage/event_data.go @@ -2,9 +2,11 @@ package storage import ( "encoding/binary" + "fmt" "io" - "github.com/zilliztech/milvus-distributed/internal/errors" + "errors" + "github.com/zilliztech/milvus-distributed/internal/proto/schemapb" "github.com/zilliztech/milvus-distributed/internal/util/typeutil" ) @@ -277,7 +279,7 @@ func newDescriptorEventData() (*descriptorEventData, error) { for i := DescriptorEventType; i < EventTypeEnd; i++ { size := getEventFixPartSize(i) if size == -1 { - return nil, errors.Errorf("undefined event type %d", i) + return nil, fmt.Errorf("undefined event type %d", i) } data.PostHeaderLengths = append(data.PostHeaderLengths, uint8(size)) } diff --git a/internal/storage/event_reader.go b/internal/storage/event_reader.go index 41a76d58cd1f85bb0311a6a9b228eb621b311709..a6b0ad98305801aa0ea3e8e2ed788181e858c1cc 100644 --- a/internal/storage/event_reader.go +++ b/internal/storage/event_reader.go @@ -3,7 +3,7 @@ package storage import ( "bytes" "errors" - "strconv" + "fmt" "github.com/zilliztech/milvus-distributed/internal/proto/schemapb" ) @@ -55,7 +55,7 @@ func (reader *EventReader) readData() (eventData, error) { case DropPartitionEventType: data, err = readDropPartitionEventDataFixPart(reader.buffer) default: - return nil, errors.New("unknown header type code: " + strconv.Itoa(int(reader.TypeCode))) + return nil, fmt.Errorf("unknown header type code: %d", reader.TypeCode) } if err != nil { diff --git a/internal/storage/event_writer.go b/internal/storage/event_writer.go index d28c84c4bf5d8b9da94619db0ac933b3938117ec..a08f9d5614161af76fe4249c4c693277a0db06cc 100644 --- a/internal/storage/event_writer.go +++ b/internal/storage/event_writer.go @@ -5,7 +5,8 @@ import ( "encoding/binary" "io" - "github.com/zilliztech/milvus-distributed/internal/errors" + "errors" + "github.com/zilliztech/milvus-distributed/internal/proto/schemapb" ) diff --git a/internal/storage/payload.go b/internal/storage/payload.go index a8b976bff244664eee40862a5cd9ec79e9b71386..6580147340110a7e9a77804f755ab151d72656c2 100644 --- a/internal/storage/payload.go +++ b/internal/storage/payload.go @@ -11,7 +11,8 @@ import "C" import ( "unsafe" - "github.com/zilliztech/milvus-distributed/internal/errors" + "errors" + "github.com/zilliztech/milvus-distributed/internal/proto/commonpb" "github.com/zilliztech/milvus-distributed/internal/proto/schemapb" ) @@ -158,7 +159,7 @@ func (w *PayloadWriter) AddDataToPayload(msgs interface{}, dim ...int) error { func (w *PayloadWriter) AddBoolToPayload(msgs []bool) error { length := len(msgs) if length <= 0 { - return errors.Errorf("can't add empty msgs into payload") + return errors.New("can't add empty msgs into payload") } cMsgs := (*C.bool)(unsafe.Pointer(&msgs[0])) @@ -178,7 +179,7 @@ func (w *PayloadWriter) AddBoolToPayload(msgs []bool) error { func (w *PayloadWriter) AddInt8ToPayload(msgs []int8) error { length := len(msgs) if length <= 0 { - return errors.Errorf("can't add empty msgs into payload") + return errors.New("can't add empty msgs into payload") } cMsgs := (*C.int8_t)(unsafe.Pointer(&msgs[0])) cLength := C.int(length) @@ -197,7 +198,7 @@ func (w *PayloadWriter) AddInt8ToPayload(msgs []int8) error { func (w *PayloadWriter) AddInt16ToPayload(msgs []int16) error { length := len(msgs) if length <= 0 { - return errors.Errorf("can't add empty msgs into payload") + return errors.New("can't add empty msgs into payload") } cMsgs := (*C.int16_t)(unsafe.Pointer(&msgs[0])) @@ -217,7 +218,7 @@ func (w *PayloadWriter) AddInt16ToPayload(msgs []int16) error { func (w *PayloadWriter) AddInt32ToPayload(msgs []int32) error { length := len(msgs) if length <= 0 { - return errors.Errorf("can't add empty msgs into payload") + return errors.New("can't add empty msgs into payload") } cMsgs := (*C.int32_t)(unsafe.Pointer(&msgs[0])) @@ -237,7 +238,7 @@ func (w *PayloadWriter) AddInt32ToPayload(msgs []int32) error { func (w *PayloadWriter) AddInt64ToPayload(msgs []int64) error { length := len(msgs) if length <= 0 { - return errors.Errorf("can't add empty msgs into payload") + return errors.New("can't add empty msgs into payload") } cMsgs := (*C.int64_t)(unsafe.Pointer(&msgs[0])) @@ -257,7 +258,7 @@ func (w *PayloadWriter) AddInt64ToPayload(msgs []int64) error { func (w *PayloadWriter) AddFloatToPayload(msgs []float32) error { length := len(msgs) if length <= 0 { - return errors.Errorf("can't add empty msgs into payload") + return errors.New("can't add empty msgs into payload") } cMsgs := (*C.float)(unsafe.Pointer(&msgs[0])) @@ -277,7 +278,7 @@ func (w *PayloadWriter) AddFloatToPayload(msgs []float32) error { func (w *PayloadWriter) AddDoubleToPayload(msgs []float64) error { length := len(msgs) if length <= 0 { - return errors.Errorf("can't add empty msgs into payload") + return errors.New("can't add empty msgs into payload") } cMsgs := (*C.double)(unsafe.Pointer(&msgs[0])) diff --git a/internal/storage/print_binlog.go b/internal/storage/print_binlog.go index 5fb91d3110acc8611711a5a02dcd60c996794de0..b1f691d41b788985cb50b1c46beeb5d56d7ab2a5 100644 --- a/internal/storage/print_binlog.go +++ b/internal/storage/print_binlog.go @@ -1,12 +1,12 @@ package storage import ( + "errors" "fmt" "os" "syscall" "github.com/golang/protobuf/proto" - "github.com/zilliztech/milvus-distributed/internal/errors" "github.com/zilliztech/milvus-distributed/internal/proto/milvuspb" "github.com/zilliztech/milvus-distributed/internal/proto/schemapb" "github.com/zilliztech/milvus-distributed/internal/util/tsoutil" @@ -71,7 +71,7 @@ func printBinlogFile(filename string) error { fmt.Printf("\tEndTimestamp: %v\n", physical) dataTypeName, ok := schemapb.DataType_name[int32(r.descriptorEvent.descriptorEventData.PayloadDataType)] if !ok { - return errors.Errorf("undefine data type %d", r.descriptorEvent.descriptorEventData.PayloadDataType) + return fmt.Errorf("undefine data type %d", r.descriptorEvent.descriptorEventData.PayloadDataType) } fmt.Printf("\tPayloadDataType: %v\n", dataTypeName) fmt.Printf("\tPostHeaderLengths: %v\n", r.descriptorEvent.descriptorEventData.PostHeaderLengths) @@ -95,7 +95,7 @@ func printBinlogFile(filename string) error { case InsertEventType: evd, ok := event.eventData.(*insertEventData) if !ok { - return errors.Errorf("incorrect event data type") + return errors.New("incorrect event data type") } fmt.Printf("event %d insert event:\n", eventNum) physical, _ = tsoutil.ParseTS(evd.StartTimestamp) @@ -108,7 +108,7 @@ func printBinlogFile(filename string) error { case DeleteEventType: evd, ok := event.eventData.(*deleteEventData) if !ok { - return errors.Errorf("incorrect event data type") + return errors.New("incorrect event data type") } fmt.Printf("event %d delete event:\n", eventNum) physical, _ = tsoutil.ParseTS(evd.StartTimestamp) @@ -121,7 +121,7 @@ func printBinlogFile(filename string) error { case CreateCollectionEventType: evd, ok := event.eventData.(*createCollectionEventData) if !ok { - return errors.Errorf("incorrect event data type") + return errors.New("incorrect event data type") } fmt.Printf("event %d create collection event:\n", eventNum) physical, _ = tsoutil.ParseTS(evd.StartTimestamp) @@ -134,7 +134,7 @@ func printBinlogFile(filename string) error { case DropCollectionEventType: evd, ok := event.eventData.(*dropCollectionEventData) if !ok { - return errors.Errorf("incorrect event data type") + return errors.New("incorrect event data type") } fmt.Printf("event %d drop collection event:\n", eventNum) physical, _ = tsoutil.ParseTS(evd.StartTimestamp) @@ -147,7 +147,7 @@ func printBinlogFile(filename string) error { case CreatePartitionEventType: evd, ok := event.eventData.(*createPartitionEventData) if !ok { - return errors.Errorf("incorrect event data type") + return errors.New("incorrect event data type") } fmt.Printf("event %d create partition event:\n", eventNum) physical, _ = tsoutil.ParseTS(evd.StartTimestamp) @@ -160,7 +160,7 @@ func printBinlogFile(filename string) error { case DropPartitionEventType: evd, ok := event.eventData.(*dropPartitionEventData) if !ok { - return errors.Errorf("incorrect event data type") + return errors.New("incorrect event data type") } fmt.Printf("event %d drop partition event:\n", eventNum) physical, _ = tsoutil.ParseTS(evd.StartTimestamp) @@ -171,7 +171,7 @@ func printBinlogFile(filename string) error { return err } default: - return errors.Errorf("undefined event typd %d\n", event.eventHeader.TypeCode) + return fmt.Errorf("undefined event typd %d", event.eventHeader.TypeCode) } eventNum++ } @@ -280,7 +280,7 @@ func printPayloadValues(colType schemapb.DataType, reader PayloadReaderInterface fmt.Println() } default: - return errors.Errorf("undefined data type") + return errors.New("undefined data type") } return nil } @@ -333,11 +333,11 @@ func printDDLPayloadValues(eventType EventTypeCode, colType schemapb.DataType, r } fmt.Printf("\t\t%d : drop partition: %v\n", i, req) default: - return errors.Errorf("undefined ddl event type %d", eventType) + return fmt.Errorf("undefined ddl event type %d", eventType) } } default: - return errors.Errorf("undefined data type") + return errors.New("undefined data type") } return nil } diff --git a/internal/timesync/timesync.go b/internal/timesync/timesync.go index b3290d0e3268d321b5553200f47dc547fe53bd47..de0a2ca4b4513cb77f7ebd5e6eee9385465d25f9 100644 --- a/internal/timesync/timesync.go +++ b/internal/timesync/timesync.go @@ -2,6 +2,7 @@ package timesync import ( "context" + "errors" "math" "sync" "sync/atomic" @@ -12,7 +13,6 @@ import ( "github.com/zilliztech/milvus-distributed/internal/util/typeutil" - "github.com/zilliztech/milvus-distributed/internal/errors" "github.com/zilliztech/milvus-distributed/internal/log" ms "github.com/zilliztech/milvus-distributed/internal/msgstream" ) @@ -72,16 +72,16 @@ func NewSoftTimeTickBarrier(ctx context.Context, ttStream ms.MsgStream, peerIds func (ttBarrier *softTimeTickBarrier) GetTimeTick() (Timestamp, error) { select { case <-ttBarrier.ctx.Done(): - return 0, errors.Errorf("[GetTimeTick] closed.") + return 0, errors.New("getTimeTick closed") case ts, ok := <-ttBarrier.outTt: if !ok { - return 0, errors.Errorf("[GetTimeTick] closed.") + return 0, errors.New("getTimeTick closed") } num := len(ttBarrier.outTt) for i := 0; i < num; i++ { ts, ok = <-ttBarrier.outTt if !ok { - return 0, errors.Errorf("[GetTimeTick] closed.") + return 0, errors.New("getTimeTick closed") } } atomic.StoreInt64(&(ttBarrier.lastTt), int64(ts)) @@ -137,10 +137,10 @@ func (ttBarrier *softTimeTickBarrier) minTimestamp() Timestamp { func (ttBarrier *hardTimeTickBarrier) GetTimeTick() (Timestamp, error) { select { case <-ttBarrier.ctx.Done(): - return 0, errors.Errorf("[GetTimeTick] closed.") + return 0, errors.New("getTimeTick closed") case ts, ok := <-ttBarrier.outTt: if !ok { - return 0, errors.Errorf("[GetTimeTick] closed.") + return 0, errors.New("getTimeTick closed") } return ts, ttBarrier.ctx.Err() } diff --git a/internal/tso/global_allocator.go b/internal/tso/global_allocator.go index 032f3000acd3b673a53e090ec165d6f620bab0e4..edcfd76adb1e08032b57a7e4107c1ad56b0303d2 100644 --- a/internal/tso/global_allocator.go +++ b/internal/tso/global_allocator.go @@ -18,7 +18,8 @@ import ( "sync/atomic" "time" - "github.com/zilliztech/milvus-distributed/internal/errors" + "errors" + "github.com/zilliztech/milvus-distributed/internal/kv" "github.com/zilliztech/milvus-distributed/internal/util/tsoutil" "github.com/zilliztech/milvus-distributed/internal/util/typeutil" diff --git a/internal/tso/tso.go b/internal/tso/tso.go index 14ef341596ee0800c8d76b93c461451c8b4a0725..04f58beae4420e615c4cddffd58cec16f1f19a30 100644 --- a/internal/tso/tso.go +++ b/internal/tso/tso.go @@ -21,7 +21,7 @@ import ( "go.uber.org/zap" - "github.com/zilliztech/milvus-distributed/internal/errors" + "github.com/pkg/errors" "github.com/zilliztech/milvus-distributed/internal/kv" "github.com/zilliztech/milvus-distributed/internal/util/tsoutil" "github.com/zilliztech/milvus-distributed/internal/util/typeutil" diff --git a/internal/util/flowgraph/flow_graph.go b/internal/util/flowgraph/flow_graph.go index 6d91f201b56b7ba1a1db8e2b3e44806b2cf9f6e7..edae1d777af75329f6664ab4276db12d130c9d2d 100644 --- a/internal/util/flowgraph/flow_graph.go +++ b/internal/util/flowgraph/flow_graph.go @@ -5,7 +5,7 @@ import ( "log" "sync" - "github.com/zilliztech/milvus-distributed/internal/errors" + "errors" ) type TimeTickedFlowGraph struct { diff --git a/internal/util/flowgraph/input_node.go b/internal/util/flowgraph/input_node.go index 86822910250cb72a11cc0e39f5099069226c62f2..51ccb07ec2131f109ce51e3507fe0f6f1f0aa298 100644 --- a/internal/util/flowgraph/input_node.go +++ b/internal/util/flowgraph/input_node.go @@ -4,8 +4,9 @@ import ( "context" "log" + "errors" + "github.com/opentracing/opentracing-go" - "github.com/zilliztech/milvus-distributed/internal/errors" "github.com/zilliztech/milvus-distributed/internal/msgstream" "github.com/zilliztech/milvus-distributed/internal/util/trace" ) diff --git a/internal/util/funcutil/func.go b/internal/util/funcutil/func.go index e4c84d92d0cb87c89fd84fa1b3577b2c968f33b7..a8d27cbec55edd75e19a111db9f000d30cf5892d 100644 --- a/internal/util/funcutil/func.go +++ b/internal/util/funcutil/func.go @@ -3,12 +3,13 @@ package funcutil import ( "context" "encoding/json" - "errors" "fmt" "net" "strconv" "time" + "errors" + "github.com/go-basic/ipv4" "github.com/zilliztech/milvus-distributed/internal/proto/commonpb" "github.com/zilliztech/milvus-distributed/internal/proto/internalpb2" diff --git a/internal/util/rocksmq/rocksmq.go b/internal/util/rocksmq/rocksmq.go index 984f67f161bbbdb0bb20fe0a1b7d0baaf0f7322b..1c96bcaf529325e47193245313100e4ff78bfb16 100644 --- a/internal/util/rocksmq/rocksmq.go +++ b/internal/util/rocksmq/rocksmq.go @@ -1,13 +1,15 @@ package rocksmq import ( + "fmt" "strconv" "sync" + "errors" + "github.com/zilliztech/milvus-distributed/internal/allocator" "github.com/tecbot/gorocksdb" - "github.com/zilliztech/milvus-distributed/internal/errors" "github.com/zilliztech/milvus-distributed/internal/kv" "github.com/zilliztech/milvus-distributed/internal/util/typeutil" @@ -165,7 +167,7 @@ func (rmq *RocksMQ) DestroyChannel(channelName string) error { func (rmq *RocksMQ) CreateConsumerGroup(groupName string, channelName string) (*Consumer, error) { key := groupName + "/" + channelName + "/current_id" if rmq.checkKeyExist(key) { - return nil, errors.New("ConsumerGroup " + groupName + " already exists.") + return nil, fmt.Errorf("ConsumerGroup %s already exists", groupName) } err := rmq.kv.Save(key, DefaultMessageID) if err != nil { @@ -323,7 +325,7 @@ func (rmq *RocksMQ) Seek(groupName string, channelName string, msgID UniqueID) e /* Step I: Check if key exists */ key := groupName + "/" + channelName + "/current_id" if !rmq.checkKeyExist(key) { - return errors.New("ConsumerGroup " + groupName + ", channel " + channelName + " not exists.") + return fmt.Errorf("ConsumerGroup %s, channel %s not exists", groupName, channelName) } storeKey, err := combKey(channelName, msgID) diff --git a/internal/util/trace/util.go b/internal/util/trace/util.go index 6b7b8e5a4eb2a0e3457deae3fdb7a4c112b3efb6..9816fc5d4ca9c0a4291f47347bfabf2403ed37ab 100644 --- a/internal/util/trace/util.go +++ b/internal/util/trace/util.go @@ -2,10 +2,11 @@ package trace import ( "context" - "errors" "runtime" "strings" + "errors" + "github.com/opentracing/opentracing-go" "github.com/opentracing/opentracing-go/ext" "github.com/opentracing/opentracing-go/log" diff --git a/internal/util/trace/util_test.go b/internal/util/trace/util_test.go index cd5f343d0006253ce22a5bb99342e787627eeace..b69830e43b245092588f6bb2e1a0430832d97311 100644 --- a/internal/util/trace/util_test.go +++ b/internal/util/trace/util_test.go @@ -2,11 +2,12 @@ package trace import ( "context" - "errors" "fmt" "io" "testing" + "errors" + "github.com/opentracing/opentracing-go" oplog "github.com/opentracing/opentracing-go/log" "github.com/uber/jaeger-client-go/config" diff --git a/internal/util/typeutil/convension.go b/internal/util/typeutil/convension.go index 4713184e644562de4c368d8929f51610ecb475f6..e71a8a73c586ea4f1e106bd55415d81c79262b78 100644 --- a/internal/util/typeutil/convension.go +++ b/internal/util/typeutil/convension.go @@ -7,14 +7,12 @@ import ( "strings" "github.com/apache/pulsar-client-go/pulsar" - - "github.com/zilliztech/milvus-distributed/internal/errors" ) // BytesToUint64 converts a byte slice to uint64. func BytesToInt64(b []byte) (int64, error) { if len(b) != 8 { - return 0, errors.Errorf("invalid data, must 8 bytes, but %d", len(b)) + return 0, fmt.Errorf("invalid data, must 8 bytes, but %d", len(b)) } return int64(binary.BigEndian.Uint64(b)), nil @@ -30,7 +28,7 @@ func Int64ToBytes(v int64) []byte { // BytesToUint64 converts a byte slice to uint64. func BytesToUint64(b []byte) (uint64, error) { if len(b) != 8 { - return 0, errors.Errorf("invalid data, must 8 bytes, but %d", len(b)) + return 0, fmt.Errorf("invalid data, must 8 bytes, but %d", len(b)) } return binary.BigEndian.Uint64(b), nil