From 6f12982fcc1bcba2d3fc2e13657bd58ead95beef Mon Sep 17 00:00:00 2001 From: "vito.he" Date: Tue, 13 Oct 2020 21:53:08 +0800 Subject: [PATCH 1/9] Merge pull request #788 from LaurenceLiZhixin/fix/consul-destory Fix: consul destory --- registry/consul/registry.go | 23 ++++++++++++++++++++++- registry/consul/registry_test.go | 16 ++++++++++++++++ registry/consul/utils_test.go | 2 ++ 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/registry/consul/registry.go b/registry/consul/registry.go index c425c5ec20..b92e335fdb 100644 --- a/registry/consul/registry.go +++ b/registry/consul/registry.go @@ -36,7 +36,8 @@ import ( ) const ( - registryConnDelay = 3 + registryConnDelay = 3 + registryDestroyDefaultTimeout = time.Second * 3 ) func init() { @@ -187,5 +188,25 @@ func (r *consulRegistry) IsAvailable() bool { // Destroy consul registry center func (r *consulRegistry) Destroy() { + if r.URL != nil { + done := make(chan struct{}, 1) + go func() { + defer func() { + if e := recover(); e != nil { + logger.Errorf("consulRegistry destory with panic: %v", e) + } + done <- struct{}{} + }() + if err := r.UnRegister(*r.URL); err != nil { + logger.Errorf("consul registry unregister with err: %s", err.Error()) + } + }() + select { + case <-done: + logger.Infof("consulRegistry unregister done") + case <-time.After(registryDestroyDefaultTimeout): + logger.Errorf("consul unregister timeout") + } + } close(r.done) } diff --git a/registry/consul/registry_test.go b/registry/consul/registry_test.go index 94718f5ab6..b300f7536d 100644 --- a/registry/consul/registry_test.go +++ b/registry/consul/registry_test.go @@ -55,3 +55,19 @@ func (suite *consulRegistryTestSuite) testSubscribe() { assert.NoError(suite.t, err) suite.listener = listener } + +func (suite *consulRegistryTestSuite) testDestroy() { + consumerRegistryUrl := newConsumerRegistryUrl(registryHost, registryPort) + consumerRegistry, _ := newConsulRegistry(consumerRegistryUrl) + consulRegistryImp := consumerRegistry.(*consulRegistry) + assert.True(suite.t, consulRegistryImp.IsAvailable()) + consulRegistryImp.Destroy() + assert.False(suite.t, consulRegistryImp.IsAvailable()) + + consumerRegistry, _ = newConsulRegistry(consumerRegistryUrl) + consulRegistryImp = consumerRegistry.(*consulRegistry) + consulRegistryImp.URL = nil + assert.True(suite.t, consulRegistryImp.IsAvailable()) + consulRegistryImp.Destroy() + assert.False(suite.t, consulRegistryImp.IsAvailable()) +} diff --git a/registry/consul/utils_test.go b/registry/consul/utils_test.go index 939352dc08..0e5bffe457 100644 --- a/registry/consul/utils_test.go +++ b/registry/consul/utils_test.go @@ -163,6 +163,7 @@ func test1(t *testing.T) { suite.testListener(remoting.EventTypeAdd) suite.testUnregister() suite.testListener(remoting.EventTypeDel) + suite.testDestroy() } // subscribe -> register -> unregister @@ -183,6 +184,7 @@ func test2(t *testing.T) { suite.testListener(remoting.EventTypeAdd) suite.testUnregister() suite.testListener(remoting.EventTypeDel) + suite.testDestroy() } func TestConsulRegistry(t *testing.T) { From f94c3e7213374347332a465f41e3b9d137c616fe Mon Sep 17 00:00:00 2001 From: Joe Zou Date: Sun, 1 Nov 2020 00:27:02 +0800 Subject: [PATCH 2/9] Merge pull request #784 from sanxun0325/metadata_default_port Fix: issue 774 [fix metadata default port] --- .../service/exporter/configurable/exporter.go | 19 +++++++-------- .../exporter/configurable/exporter_test.go | 24 ++++++++++++++----- metadata/service/exporter/exporter.go | 2 +- .../service_discovery_registry.go | 6 ++--- 4 files changed, 31 insertions(+), 20 deletions(-) diff --git a/metadata/service/exporter/configurable/exporter.go b/metadata/service/exporter/configurable/exporter.go index 5a930c5e95..75e52d8d1b 100644 --- a/metadata/service/exporter/configurable/exporter.go +++ b/metadata/service/exporter/configurable/exporter.go @@ -19,6 +19,7 @@ package configurable import ( "context" + "errors" "sync" ) @@ -46,12 +47,18 @@ func NewMetadataServiceExporter(metadataService service.MetadataService) exporte } // Export will export the metadataService -func (exporter *MetadataServiceExporter) Export() error { +func (exporter *MetadataServiceExporter) Export(url *common.URL) error { if !exporter.IsExported() { serviceConfig := config.NewServiceConfig(constant.SIMPLE_METADATA_SERVICE_NAME, context.Background()) serviceConfig.Protocol = constant.DEFAULT_PROTOCOL + if url == nil || url.SubURL == nil { + return errors.New("metadata server url is nil, pls check your configuration") + } serviceConfig.Protocols = map[string]*config.ProtocolConfig{ - constant.DEFAULT_PROTOCOL: generateMetadataProtocol(), + constant.DEFAULT_PROTOCOL: { + Name: url.SubURL.Protocol, + Port: url.SubURL.Port, + }, } serviceConfig.InterfaceName = constant.METADATA_SERVICE_NAME // identify this is a golang server @@ -95,11 +102,3 @@ func (exporter *MetadataServiceExporter) IsExported() bool { defer exporter.lock.RUnlock() return exporter.ServiceConfig != nil && exporter.ServiceConfig.IsExport() } - -// generateMetadataProtocol will return a default ProtocolConfig -func generateMetadataProtocol() *config.ProtocolConfig { - return &config.ProtocolConfig{ - Name: constant.DEFAULT_PROTOCOL, - Port: "20000", - } -} diff --git a/metadata/service/exporter/configurable/exporter_test.go b/metadata/service/exporter/configurable/exporter_test.go index b304b9153f..ceda2550e2 100644 --- a/metadata/service/exporter/configurable/exporter_test.go +++ b/metadata/service/exporter/configurable/exporter_test.go @@ -26,6 +26,7 @@ import ( ) import ( + "github.com/apache/dubbo-go/common" _ "github.com/apache/dubbo-go/common/proxy/proxy_factory" "github.com/apache/dubbo-go/config" _ "github.com/apache/dubbo-go/filter/filter_impl" @@ -55,12 +56,23 @@ func TestConfigurableExporter(t *testing.T) { mockInitProviderWithSingleRegistry() metadataService, _ := inmemory.NewMetadataService() exported := NewMetadataServiceExporter(metadataService) - assert.Equal(t, false, exported.IsExported()) - assert.NoError(t, exported.Export()) - assert.Equal(t, true, exported.IsExported()) - assert.Regexp(t, "dubbo://:20000/MetadataService*", exported.GetExportedURLs()[0].String()) - exported.Unexport() - assert.Equal(t, false, exported.IsExported()) + + t.Run("configurableExporterUrlNil", func(t *testing.T) { + assert.Equal(t, false, exported.IsExported()) + assert.Error(t, exported.Export(nil), "metadata server url is nil, pls check your configuration") + }) + + t.Run("configurableExporter", func(t *testing.T) { + registryURL, _ := common.NewURL("service-discovery://localhost:12345") + subURL, _ := common.NewURL("dubbo://localhost:20003") + registryURL.SubURL = &subURL + assert.Equal(t, false, exported.IsExported()) + assert.NoError(t, exported.Export(®istryURL)) + assert.Equal(t, true, exported.IsExported()) + assert.Regexp(t, "dubbo://:20003/MetadataService*", exported.GetExportedURLs()[0].String()) + exported.Unexport() + assert.Equal(t, false, exported.IsExported()) + }) } // mockInitProviderWithSingleRegistry will init a mocked providerConfig diff --git a/metadata/service/exporter/exporter.go b/metadata/service/exporter/exporter.go index cfdef3a0e7..33ceaca467 100644 --- a/metadata/service/exporter/exporter.go +++ b/metadata/service/exporter/exporter.go @@ -23,7 +23,7 @@ import ( // MetadataServiceExporter will export & unexport the metadata service, get exported url, and return is exported or not type MetadataServiceExporter interface { - Export() error + Export(url *common.URL) error Unexport() GetExportedURLs() []*common.URL IsExported() bool diff --git a/registry/servicediscovery/service_discovery_registry.go b/registry/servicediscovery/service_discovery_registry.go index 7576804eb5..4db2c5aad4 100644 --- a/registry/servicediscovery/service_discovery_registry.go +++ b/registry/servicediscovery/service_discovery_registry.go @@ -75,7 +75,7 @@ type serviceDiscoveryRegistry struct { func newServiceDiscoveryRegistry(url *common.URL) (registry.Registry, error) { - tryInitMetadataService() + tryInitMetadataService(url) serviceDiscovery, err := creatServiceDiscovery(url) if err != nil { @@ -642,7 +642,7 @@ var ( // tryInitMetadataService will try to initialize metadata service // TODO (move to somewhere) -func tryInitMetadataService() { +func tryInitMetadataService(url *common.URL) { ms, err := extension.GetMetadataService(config.GetApplicationConfig().MetadataType) if err != nil { @@ -662,7 +662,7 @@ func tryInitMetadataService() { expt := configurable.NewMetadataServiceExporter(ms) - err = expt.Export() + err = expt.Export(url) if err != nil { logger.Errorf("could not export the metadata service", err) } From 9a16d4f4e8c5b7acb8c1af40e7938cc0927ae400 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Jiang=28=E7=99=BD=E6=B3=BD=29?= Date: Fri, 30 Oct 2020 10:36:46 +0800 Subject: [PATCH 3/9] Merge pull request #821 from louyuting/20201029-fix-sentinel-windows-issue fix sentinel windows issue --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 2ac1f85404..0718f1e3f2 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ require ( github.com/NYTimes/gziphandler v1.1.1 // indirect github.com/Workiva/go-datastructures v1.0.50 github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5 - github.com/alibaba/sentinel-golang v0.6.1 + github.com/alibaba/sentinel-golang v0.6.2 github.com/apache/dubbo-getty v1.3.10 github.com/apache/dubbo-go-hessian2 v1.7.0 github.com/coreos/etcd v3.3.25+incompatible diff --git a/go.sum b/go.sum index fa3b0d8653..29c5380604 100644 --- a/go.sum +++ b/go.sum @@ -93,6 +93,8 @@ github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuy github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alibaba/sentinel-golang v0.6.1 h1:Pxyw2X7ryklvToF40KG9l4uuO90jRZA2MWb8Z3d1wPo= github.com/alibaba/sentinel-golang v0.6.1/go.mod h1:5jemKdyCQCKVf+quEia53fo9a17OSe+wnl9HX2NbNpc= +github.com/alibaba/sentinel-golang v0.6.2 h1:1OjjpljJbNKWp9p5RJKxOqS1gHGZPUWPlCcokv5xYJs= +github.com/alibaba/sentinel-golang v0.6.2/go.mod h1:5jemKdyCQCKVf+quEia53fo9a17OSe+wnl9HX2NbNpc= github.com/aliyun/alibaba-cloud-sdk-go v0.0.0-20190808125512-07798873deee/go.mod h1:myCDvQSzCW+wB1WAlocEru4wMGJxy+vlxHdhegi1CDQ= github.com/aliyun/alibaba-cloud-sdk-go v1.61.18 h1:zOVTBdCKFd9JbCKz9/nt+FovbjPFmb7mUnp8nH9fQBA= github.com/aliyun/alibaba-cloud-sdk-go v1.61.18/go.mod h1:v8ESoHo4SyHmuB4b1tJqDHxfTGEciD+yhvOU/5s1Rfk= From 7a33e64334acc1fe72ce28328f3d8368ef448cc6 Mon Sep 17 00:00:00 2001 From: Joe Zou Date: Sat, 31 Oct 2020 10:51:31 +0800 Subject: [PATCH 4/9] Merge pull request #820 from wenxuwan/fix_panic_error Fix: go client quit abnormally when it connects java server --- remoting/getty/pool.go | 1 + remoting/getty/pool_test.go | 51 +++++++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 remoting/getty/pool_test.go diff --git a/remoting/getty/pool.go b/remoting/getty/pool.go index 464cff956e..a07243219c 100644 --- a/remoting/getty/pool.go +++ b/remoting/getty/pool.go @@ -385,6 +385,7 @@ func (p *gettyRPCClientPool) get() (*gettyRPCClient, error) { if d := now - conn.getActive(); d > p.ttl { p.remove(conn) go conn.close() + num = len(p.conns) continue } conn.updateActive(now) //update active time diff --git a/remoting/getty/pool_test.go b/remoting/getty/pool_test.go new file mode 100644 index 0000000000..1115a49042 --- /dev/null +++ b/remoting/getty/pool_test.go @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package getty + +import ( + "testing" + "time" +) + +import ( + "github.com/stretchr/testify/assert" +) + +func TestGetConnFromPool(t *testing.T) { + var rpcClient Client + + clientPoll := newGettyRPCClientConnPool(&rpcClient, 1, time.Duration(5*time.Second)) + + var conn1 gettyRPCClient + conn1.active = time.Now().Unix() + clientPoll.put(&conn1) + assert.Equal(t, 1, len(clientPoll.conns)) + + var conn2 gettyRPCClient + conn2.active = time.Now().Unix() + clientPoll.put(&conn2) + assert.Equal(t, 1, len(clientPoll.conns)) + conn, err := clientPoll.get() + assert.Nil(t, err) + assert.Equal(t, &conn1, conn) + time.Sleep(6 * time.Second) + conn, err = clientPoll.get() + assert.Nil(t, conn) + assert.Nil(t, err) + assert.Equal(t, 0, len(clientPoll.conns)) +} From e5f1ee2cef22b3efc0e4a301fdf5b69424888829 Mon Sep 17 00:00:00 2001 From: "Xin.Zh" Date: Sat, 31 Oct 2020 16:53:14 +0800 Subject: [PATCH 5/9] Merge pull request #822 from fangyincheng/fix-generic fix generic struct2MapAll --- filter/filter_impl/generic_filter.go | 19 ++++++++++++++----- filter/filter_impl/generic_filter_test.go | 7 +++++++ 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/filter/filter_impl/generic_filter.go b/filter/filter_impl/generic_filter.go index d385054ed9..36b4b13186 100644 --- a/filter/filter_impl/generic_filter.go +++ b/filter/filter_impl/generic_filter.go @@ -21,6 +21,7 @@ import ( "context" "reflect" "strings" + "time" ) import ( @@ -93,13 +94,21 @@ func struct2MapAll(obj interface{}) interface{} { if t.Kind() == reflect.Struct { result := make(map[string]interface{}, t.NumField()) for i := 0; i < t.NumField(); i++ { - if v.Field(i).Kind() == reflect.Struct || v.Field(i).Kind() == reflect.Slice || v.Field(i).Kind() == reflect.Map { - if v.Field(i).CanInterface() { - setInMap(result, t.Field(i), struct2MapAll(v.Field(i).Interface())) + field := t.Field(i) + value := v.Field(i) + kind := value.Kind() + if kind == reflect.Struct || kind == reflect.Slice || kind == reflect.Map { + if value.CanInterface() { + tmp := value.Interface() + if _, ok := tmp.(time.Time); ok { + setInMap(result, field, tmp) + continue + } + setInMap(result, field, struct2MapAll(tmp)) } } else { - if v.Field(i).CanInterface() { - setInMap(result, t.Field(i), v.Field(i).Interface()) + if value.CanInterface() { + setInMap(result, field, value.Interface()) } } } diff --git a/filter/filter_impl/generic_filter_test.go b/filter/filter_impl/generic_filter_test.go index e40733209b..40cf743106 100644 --- a/filter/filter_impl/generic_filter_test.go +++ b/filter/filter_impl/generic_filter_test.go @@ -20,6 +20,7 @@ package filter_impl import ( "reflect" "testing" + "time" ) import ( @@ -38,6 +39,8 @@ func TestStruct2MapAll(t *testing.T) { Xx string `m:"xx"` } `m:"xxYy"` } `m:"caCa"` + DaDa time.Time + EeEe int } testData.AaAa = "1" testData.BaBa = "1" @@ -45,6 +48,8 @@ func TestStruct2MapAll(t *testing.T) { testData.CaCa.AaAa = "2" testData.CaCa.XxYy.xxXx = "3" testData.CaCa.XxYy.Xx = "3" + testData.DaDa = time.Date(2020, 10, 29, 2, 34, 0, 0, time.Local) + testData.EeEe = 100 m := struct2MapAll(testData).(map[string]interface{}) assert.Equal(t, "1", m["aaAa"].(string)) assert.Equal(t, "1", m["baBa"].(string)) @@ -53,6 +58,8 @@ func TestStruct2MapAll(t *testing.T) { assert.Equal(t, reflect.Map, reflect.TypeOf(m["caCa"]).Kind()) assert.Equal(t, reflect.Map, reflect.TypeOf(m["caCa"].(map[string]interface{})["xxYy"]).Kind()) + assert.Equal(t, "2020-10-29 02:34:00", m["daDa"].(time.Time).Format("2006-01-02 15:04:05")) + assert.Equal(t, 100, m["eeEe"].(int)) } type testStruct struct { From e78c26d83a3cc5a1c3ef7704e87335e04d8467f1 Mon Sep 17 00:00:00 2001 From: Joe Zou Date: Sat, 31 Oct 2020 23:39:06 +0800 Subject: [PATCH 6/9] Merge pull request #819 from lin-jianjun/develop Fix: etcd registry --- registry/etcdv3/registry.go | 2 +- registry/etcdv3/service_discovery.go | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/registry/etcdv3/registry.go b/registry/etcdv3/registry.go index 9cbc494560..f3cc379bd8 100644 --- a/registry/etcdv3/registry.go +++ b/registry/etcdv3/registry.go @@ -91,7 +91,7 @@ func newETCDV3Registry(url *common.URL) (registry.Registry, error) { r, etcdv3.WithName(etcdv3.RegistryETCDV3Client), etcdv3.WithTimeout(timeout), - etcdv3.WithEndpoints(url.Location), + etcdv3.WithEndpoints(strings.Split(url.Location, ",")...), ); err != nil { return nil, err } diff --git a/registry/etcdv3/service_discovery.go b/registry/etcdv3/service_discovery.go index dceaa99df8..e8d4aea9a4 100644 --- a/registry/etcdv3/service_discovery.go +++ b/registry/etcdv3/service_discovery.go @@ -19,6 +19,7 @@ package etcdv3 import ( "fmt" + "strings" "sync" "time" ) @@ -313,7 +314,7 @@ func newEtcdV3ServiceDiscovery(name string) (registry.ServiceDiscovery, error) { client := etcdv3.NewServiceDiscoveryClient( etcdv3.WithName(etcdv3.RegistryETCDV3Client), etcdv3.WithTimeout(timeout), - etcdv3.WithEndpoints(remoteConfig.Address), + etcdv3.WithEndpoints(strings.Split(remoteConfig.Address, ",")...), ) descriptor := fmt.Sprintf("etcd-service-discovery[%s]", remoteConfig.Address) From 8a81beebeb9e3d3ca2fcbbf26dad874e06da400a Mon Sep 17 00:00:00 2001 From: watermelon <80680489@qq.com> Date: Sun, 1 Nov 2020 00:03:54 +0800 Subject: [PATCH 7/9] Merge pull request #826 from pantianying/change_zk_version change zk version to v1.0.2 --- go.mod | 2 +- go.sum | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index 0718f1e3f2..317431f49b 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,7 @@ require ( github.com/apache/dubbo-go-hessian2 v1.7.0 github.com/coreos/etcd v3.3.25+incompatible github.com/creasty/defaults v1.3.0 - github.com/dubbogo/go-zookeeper v1.0.1 + github.com/dubbogo/go-zookeeper v1.0.2 github.com/dubbogo/gost v1.9.1 github.com/elazarl/go-bindata-assetfs v1.0.0 // indirect github.com/emicklei/go-restful/v3 v3.0.0 diff --git a/go.sum b/go.sum index 29c5380604..20d53452be 100644 --- a/go.sum +++ b/go.sum @@ -91,8 +91,6 @@ github.com/alangpierce/go-forceexport v0.0.0-20160317203124-8f1d6941cd75/go.mod github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7/go.mod h1:6zEj6s6u/ghQa61ZWa/C2Aw3RkjiTBOix7dkqa1VLIs= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alibaba/sentinel-golang v0.6.1 h1:Pxyw2X7ryklvToF40KG9l4uuO90jRZA2MWb8Z3d1wPo= -github.com/alibaba/sentinel-golang v0.6.1/go.mod h1:5jemKdyCQCKVf+quEia53fo9a17OSe+wnl9HX2NbNpc= github.com/alibaba/sentinel-golang v0.6.2 h1:1OjjpljJbNKWp9p5RJKxOqS1gHGZPUWPlCcokv5xYJs= github.com/alibaba/sentinel-golang v0.6.2/go.mod h1:5jemKdyCQCKVf+quEia53fo9a17OSe+wnl9HX2NbNpc= github.com/aliyun/alibaba-cloud-sdk-go v0.0.0-20190808125512-07798873deee/go.mod h1:myCDvQSzCW+wB1WAlocEru4wMGJxy+vlxHdhegi1CDQ= @@ -210,8 +208,8 @@ github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKoh github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM= -github.com/dubbogo/go-zookeeper v1.0.1 h1:irLzvOsDOTNsN8Sv9tvYYxVu6DCQfLtziZQtUHmZgz8= -github.com/dubbogo/go-zookeeper v1.0.1/go.mod h1:fn6n2CAEer3novYgk9ULLwAjuV8/g4DdC2ENwRb6E+c= +github.com/dubbogo/go-zookeeper v1.0.2 h1:xmEnPL8SlCe3/+J5ZR9e8qE35LmFVYe8VVpDakjNM4A= +github.com/dubbogo/go-zookeeper v1.0.2/go.mod h1:fn6n2CAEer3novYgk9ULLwAjuV8/g4DdC2ENwRb6E+c= github.com/dubbogo/gost v1.9.0/go.mod h1:pPTjVyoJan3aPxBPNUX0ADkXjPibLo+/Ib0/fADXSG8= github.com/dubbogo/gost v1.9.1 h1:0/PPFo13zPbjt4Ia0zYWMFi3C6rAe9X7O1J2Iv+BHNM= github.com/dubbogo/gost v1.9.1/go.mod h1:pPTjVyoJan3aPxBPNUX0ADkXjPibLo+/Ib0/fADXSG8= From 8dc2e84be51623b910e7de642d9f6ee2bb71d5b8 Mon Sep 17 00:00:00 2001 From: watermelon <80680489@qq.com> Date: Sun, 1 Nov 2020 00:06:21 +0800 Subject: [PATCH 8/9] Merge pull request #815 from jack15083/develop fix cannot call go provider service when used by java dubbo 2.7.7 version # Conflicts: # registry/base_registry.go --- registry/base_registry.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/registry/base_registry.go b/registry/base_registry.go index ad1a3b6174..797ffb2eae 100644 --- a/registry/base_registry.go +++ b/registry/base_registry.go @@ -326,7 +326,16 @@ func (r *BaseRegistry) providerRegistry(c common.URL, params url.Values, f creat } host += ":" + c.Port - rawURL = fmt.Sprintf("%s://%s%s?%s", c.Protocol, host, c.Path, params.Encode()) + //delete empty param key + for key, val := range params { + if len(val) > 0 && val[0] == "" { + params.Del(key) + } + } + + s, _ := url.QueryUnescape(params.Encode()) + rawURL = fmt.Sprintf("%s://%s%s?%s", c.Protocol, host, c.Path, s) + // Print your own registration service providers. dubboPath = fmt.Sprintf("/dubbo/%s/%s", r.service(c), (common.RoleType(common.PROVIDER)).String()) logger.Debugf("provider path:%s, url:%s", dubboPath, rawURL) From 0a8b1c8b11ca320a48e92a0697312b1d200932d2 Mon Sep 17 00:00:00 2001 From: Joe Zou Date: Sun, 1 Nov 2020 00:52:31 +0800 Subject: [PATCH 9/9] Merge pull request #828 from watermelo/fix_etcd_reconnet Fix: etcd cluster reconnect --- remoting/etcdv3/facade.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/remoting/etcdv3/facade.go b/remoting/etcdv3/facade.go index 52b1cce3e4..614ba9ae3a 100644 --- a/remoting/etcdv3/facade.go +++ b/remoting/etcdv3/facade.go @@ -63,7 +63,7 @@ LOOP: r.ClientLock().Lock() clientName := RegistryETCDV3Client timeout, _ := time.ParseDuration(r.GetUrl().GetParam(constant.REGISTRY_TIMEOUT_KEY, constant.DEFAULT_REG_TIMEOUT)) - endpoint := r.GetUrl().Location + endpoints := r.Client().endpoints r.Client().Close() r.SetClient(nil) r.ClientLock().Unlock() @@ -80,11 +80,11 @@ LOOP: err = ValidateClient( r, WithName(clientName), - WithEndpoints(endpoint), + WithEndpoints(endpoints...), WithTimeout(timeout), ) logger.Infof("ETCDV3ProviderRegistry.validateETCDV3Client(etcd Addr{%s}) = error{%#v}", - endpoint, perrors.WithStack(err)) + endpoints, perrors.WithStack(err)) if err == nil && r.RestartCallBack() { break }