From 150a89f99bf5f3c9f358bb340450cfae95f34fdc Mon Sep 17 00:00:00 2001 From: cvictory Date: Wed, 2 Dec 2020 16:20:59 +0800 Subject: [PATCH 01/10] #901 Optimize the memory usage. --- common/url.go | 44 +++++++++++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 15 deletions(-) diff --git a/common/url.go b/common/url.go index d8f096bb48..015b5ba6c1 100644 --- a/common/url.go +++ b/common/url.go @@ -427,6 +427,17 @@ func (c *URL) SetParam(key string, value string) { c.params.Set(key, value) } +// SetParams will replace the URL.params +// SetParams will put all key-value pair into url. +// 1. if there already has same key, the value will be override +// 2. it's not thread safe +// usually it should only be invoked when you want to modify an url, such as MergeURL +func (c *URL) SetParams(param url.Values) { + c.paramsLock.Lock() + defer c.paramsLock.Unlock() + c.params = param +} + // RangeParams will iterate the params func (c *URL) RangeParams(f func(key, value string) bool) { c.paramsLock.RLock() @@ -563,11 +574,11 @@ func (c *URL) GetMethodParamBool(method string, key string, d bool) bool { // 1. if there already has same key, the value will be override // 2. it's not thread safe // 3. think twice when you want to invoke this method -func (c *URL) SetParams(m url.Values) { - for k := range m { - c.SetParam(k, m.Get(k)) - } -} +//func (c *URL) SetParams(m url.Values) { +// for k := range m { +// c.SetParam(k, m.Get(k)) +// } +//} // ToMap transfer URL to Map func (c *URL) ToMap() map[string]string { @@ -621,22 +632,24 @@ func (c *URL) ToMap() map[string]string { // You should notice that the value of b1 is v2, not v4. // due to URL is not thread-safe, so this method is not thread-safe func MergeUrl(serviceUrl *URL, referenceUrl *URL) *URL { + // After Clone, it is a new url that there is no thread safe issue. mergedUrl := serviceUrl.Clone() - + params := mergedUrl.GetParams() // iterator the referenceUrl if serviceUrl not have the key ,merge in referenceUrl.RangeParams(func(key, value string) bool { - if v := mergedUrl.GetParam(key, ""); len(v) == 0 { - mergedUrl.SetParam(key, value) + if v := params[key]; len(v) == 0 { + params[key] = []string{value} } return true }) + // loadBalance,cluster,retries strategy config - methodConfigMergeFcn := mergeNormalParam(mergedUrl, referenceUrl, []string{constant.LOADBALANCE_KEY, constant.CLUSTER_KEY, constant.RETRIES_KEY, constant.TIMEOUT_KEY}) + methodConfigMergeFcn := mergeNormalParam(params, referenceUrl, []string{constant.LOADBALANCE_KEY, constant.CLUSTER_KEY, constant.RETRIES_KEY, constant.TIMEOUT_KEY}) // remote timestamp if v := serviceUrl.GetParam(constant.TIMESTAMP_KEY, ""); len(v) > 0 { - mergedUrl.SetParam(constant.REMOTE_TIMESTAMP_KEY, v) - mergedUrl.SetParam(constant.TIMESTAMP_KEY, referenceUrl.GetParam(constant.TIMESTAMP_KEY, "")) + params[constant.REMOTE_TIMESTAMP_KEY] = []string{v} + params[constant.TIMESTAMP_KEY] = []string{referenceUrl.GetParam(constant.TIMESTAMP_KEY, "")} } // finally execute methodConfigMergeFcn @@ -645,7 +658,8 @@ func MergeUrl(serviceUrl *URL, referenceUrl *URL) *URL { fcn("methods." + method) } } - + // In this way, we will raise some performance. + mergedUrl.SetParams(params) return mergedUrl } @@ -737,15 +751,15 @@ func IsEquals(left *URL, right *URL, excludes ...string) bool { return true } -func mergeNormalParam(mergedUrl *URL, referenceUrl *URL, paramKeys []string) []func(method string) { +func mergeNormalParam(params url.Values, referenceUrl *URL, paramKeys []string) []func(method string) { methodConfigMergeFcn := make([]func(method string), 0, len(paramKeys)) for _, paramKey := range paramKeys { if v := referenceUrl.GetParam(paramKey, ""); len(v) > 0 { - mergedUrl.SetParam(paramKey, v) + params[paramKey] = []string{v} } methodConfigMergeFcn = append(methodConfigMergeFcn, func(method string) { if v := referenceUrl.GetParam(method+"."+paramKey, ""); len(v) > 0 { - mergedUrl.SetParam(method+"."+paramKey, v) + params[method+"."+paramKey] = []string{v} } }) } From 0ff136d5595b5f8927b3160b022b2c4fe2da1568 Mon Sep 17 00:00:00 2001 From: cvictory Date: Wed, 2 Dec 2020 18:00:38 +0800 Subject: [PATCH 02/10] add unit test and keep origin SetParams method --- common/url.go | 22 +++++++++++----------- common/url_test.go | 10 ++++++++++ 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/common/url.go b/common/url.go index 015b5ba6c1..c9f4b727f1 100644 --- a/common/url.go +++ b/common/url.go @@ -432,7 +432,7 @@ func (c *URL) SetParam(key string, value string) { // 1. if there already has same key, the value will be override // 2. it's not thread safe // usually it should only be invoked when you want to modify an url, such as MergeURL -func (c *URL) SetParams(param url.Values) { +func (c *URL) ReplaceParams(param url.Values) { c.paramsLock.Lock() defer c.paramsLock.Unlock() c.params = param @@ -570,15 +570,15 @@ func (c *URL) GetMethodParamBool(method string, key string, d bool) bool { return r } -// SetParams will put all key-value pair into url. -// 1. if there already has same key, the value will be override -// 2. it's not thread safe -// 3. think twice when you want to invoke this method -//func (c *URL) SetParams(m url.Values) { -// for k := range m { -// c.SetParam(k, m.Get(k)) -// } -//} +//SetParams will put all key-value pair into url. +//1. if there already has same key, the value will be override +//2. it's not thread safe +//3. think twice when you want to invoke this method +func (c *URL) SetParams(m url.Values) { + for k := range m { + c.SetParam(k, m.Get(k)) + } +} // ToMap transfer URL to Map func (c *URL) ToMap() map[string]string { @@ -659,7 +659,7 @@ func MergeUrl(serviceUrl *URL, referenceUrl *URL) *URL { } } // In this way, we will raise some performance. - mergedUrl.SetParams(params) + mergedUrl.ReplaceParams(params) return mergedUrl } diff --git a/common/url_test.go b/common/url_test.go index 05377c19c9..056e067980 100644 --- a/common/url_test.go +++ b/common/url_test.go @@ -307,6 +307,16 @@ func TestURLSetParams(t *testing.T) { assert.Equal(t, "2.6.0", u1.GetParam("version", "")) } +func TestURLReplaceParams(t *testing.T) { + u1, err := NewURL("dubbo://127.0.0.1:20000/com.ikurento.user.UserProvider?interface=com.ikurento.user.UserProvider&group=&version=2.6.0&configVersion=1.0") + assert.NoError(t, err) + params := url.Values{} + params.Set("key", "3") + u1.ReplaceParams(params) + assert.Equal(t, "3", u1.GetParam("key", "")) + assert.Equal(t, "", u1.GetParam("version", "")) +} + func TestClone(t *testing.T) { u1, err := NewURL("dubbo://127.0.0.1:20000/com.ikurento.user.UserProvider?interface=com.ikurento.user.UserProvider&group=&version=2.6.0&configVersion=1.0") assert.NoError(t, err) From 85eadf4b58d725af13af28904f3a8e97acb19a70 Mon Sep 17 00:00:00 2001 From: cvictory Date: Tue, 8 Dec 2020 11:45:26 +0800 Subject: [PATCH 03/10] chane RangeParams to GetParams --- common/url.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/common/url.go b/common/url.go index c9f4b727f1..b33b6d310d 100644 --- a/common/url.go +++ b/common/url.go @@ -636,12 +636,14 @@ func MergeUrl(serviceUrl *URL, referenceUrl *URL) *URL { mergedUrl := serviceUrl.Clone() params := mergedUrl.GetParams() // iterator the referenceUrl if serviceUrl not have the key ,merge in - referenceUrl.RangeParams(func(key, value string) bool { - if v := params[key]; len(v) == 0 { - params[key] = []string{value} + // referenceUrl usually will not changed. so change RangeParams to GetParams to avoid the string value copy. + for key, value := range referenceUrl.GetParams() { + if v := mergedUrl.GetParam(key, ""); len(v) == 0 { + if len(value) > 0 { + mergedUrl.SetParam(key, value[0]) + } } - return true - }) + } // loadBalance,cluster,retries strategy config methodConfigMergeFcn := mergeNormalParam(params, referenceUrl, []string{constant.LOADBALANCE_KEY, constant.CLUSTER_KEY, constant.RETRIES_KEY, constant.TIMEOUT_KEY}) From 29e6cffa9e6633600f6febecdba2b831a134abc6 Mon Sep 17 00:00:00 2001 From: cvictory Date: Wed, 9 Dec 2020 10:47:30 +0800 Subject: [PATCH 04/10] #901 Optimize the memory usage. --- common/url.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/url.go b/common/url.go index b33b6d310d..ec2462652d 100644 --- a/common/url.go +++ b/common/url.go @@ -640,7 +640,7 @@ func MergeUrl(serviceUrl *URL, referenceUrl *URL) *URL { for key, value := range referenceUrl.GetParams() { if v := mergedUrl.GetParam(key, ""); len(v) == 0 { if len(value) > 0 { - mergedUrl.SetParam(key, value[0]) + params[key] = value } } } From 08a13cf7c861233e763a031bff791ff82dc58ced Mon Sep 17 00:00:00 2001 From: cvictory Date: Wed, 9 Dec 2020 14:24:20 +0800 Subject: [PATCH 05/10] fix comments issue --- common/url.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/common/url.go b/common/url.go index ec2462652d..80d0e38178 100644 --- a/common/url.go +++ b/common/url.go @@ -427,10 +427,7 @@ func (c *URL) SetParam(key string, value string) { c.params.Set(key, value) } -// SetParams will replace the URL.params -// SetParams will put all key-value pair into url. -// 1. if there already has same key, the value will be override -// 2. it's not thread safe +// ReplaceParams will replace the URL.params // usually it should only be invoked when you want to modify an url, such as MergeURL func (c *URL) ReplaceParams(param url.Values) { c.paramsLock.Lock() From ad8a8ad94b04db4d4bc6b39fc611c44d8cd407d1 Mon Sep 17 00:00:00 2001 From: cvictory Date: Sun, 20 Dec 2020 23:11:35 +0800 Subject: [PATCH 06/10] fix metadata report fail --- config/service_config.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/config/service_config.go b/config/service_config.go index 32104f03dd..1021306d0b 100644 --- a/config/service_config.go +++ b/config/service_config.go @@ -40,10 +40,13 @@ import ( "github.com/apache/dubbo-go/common/constant" "github.com/apache/dubbo-go/common/extension" "github.com/apache/dubbo-go/common/logger" + "github.com/apache/dubbo-go/metadata/service" "github.com/apache/dubbo-go/protocol" "github.com/apache/dubbo-go/protocol/protocolwrapper" ) +var remoteMetadataService service.MetadataService + // ServiceConfig is the configuration of the service provider type ServiceConfig struct { context context.Context @@ -223,6 +226,7 @@ func (c *ServiceConfig) Export() error { } c.exporters = append(c.exporters, exporter) } + PublishServiceDefinition(ivkURL) } c.exported.Store(true) return nil @@ -332,3 +336,17 @@ func (c *ServiceConfig) GetExportedUrls() []*common.URL { } return nil } + +func PublishServiceDefinition(url *common.URL) { + if remoteMetadataService == nil { + var err error + if remoteMetadataService, err = extension.GetMetadataService("remote"); err != nil { + logger.Warnf("get remote metadataService fail. %v", err) + return + } else if remoteMetadataService == nil { + logger.Info("get remote metadataService will nil.") + return + } + } + remoteMetadataService.PublishServiceDefinition(url) +} From b2b70d25aff424fce25e4302109b7ac0025b540d Mon Sep 17 00:00:00 2001 From: cvictory Date: Sun, 20 Dec 2020 23:38:30 +0800 Subject: [PATCH 07/10] fix metadata report fail --- config/service_config.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/service_config.go b/config/service_config.go index 1021306d0b..8aa59380ff 100644 --- a/config/service_config.go +++ b/config/service_config.go @@ -226,7 +226,7 @@ func (c *ServiceConfig) Export() error { } c.exporters = append(c.exporters, exporter) } - PublishServiceDefinition(ivkURL) + publishServiceDefinition(ivkURL) } c.exported.Store(true) return nil @@ -337,7 +337,7 @@ func (c *ServiceConfig) GetExportedUrls() []*common.URL { return nil } -func PublishServiceDefinition(url *common.URL) { +func publishServiceDefinition(url *common.URL) { if remoteMetadataService == nil { var err error if remoteMetadataService, err = extension.GetMetadataService("remote"); err != nil { From 5a7f093001b97c581012403b34ae5820e84c4785 Mon Sep 17 00:00:00 2001 From: cvictory Date: Mon, 21 Dec 2020 15:13:30 +0800 Subject: [PATCH 08/10] make metadata report work without serviceDiscovery --- common/extension/metadata_service.go | 17 +++++++++++ config/reference_config.go | 9 +++++- config/service_config.go | 15 ++-------- metadata/report/delegate/delegate_report.go | 4 +++ metadata/service/remote/service.go | 32 +++++++++++++++++---- 5 files changed, 57 insertions(+), 20 deletions(-) diff --git a/common/extension/metadata_service.go b/common/extension/metadata_service.go index e35677d148..cf8b286c66 100644 --- a/common/extension/metadata_service.go +++ b/common/extension/metadata_service.go @@ -26,12 +26,15 @@ import ( ) import ( + "github.com/apache/dubbo-go/common/logger" "github.com/apache/dubbo-go/metadata/service" ) var ( // there will be two types: local or remote metadataServiceInsMap = make(map[string]func() (service.MetadataService, error), 2) + // remoteMetadataService + remoteMetadataService service.MetadataService ) // SetMetadataService will store the msType => creator pair @@ -48,3 +51,17 @@ func GetMetadataService(msType string) (service.MetadataService, error) { "local - github.com/apache/dubbo-go/metadata/service/inmemory, \n"+ "remote - github.com/apache/dubbo-go/metadata/service/remote", msType)) } + +// GetRemoteMetadataService will get a RemoteMetadataService instance +func GetRemoteMetadataService() (service.MetadataService, error) { + if remoteMetadataService != nil { + return remoteMetadataService, nil + } + if creator, ok := metadataServiceInsMap["remote"]; ok { + var err error + remoteMetadataService, err = creator() + return remoteMetadataService, err + } + logger.Info("could not find the metadata service creator for metadataType: remote") + return nil, perrors.New(fmt.Sprintf("could not find the metadata service creator for metadataType: remote")) +} diff --git a/config/reference_config.go b/config/reference_config.go index 05df347736..f78d45af72 100644 --- a/config/reference_config.go +++ b/config/reference_config.go @@ -164,7 +164,8 @@ func (c *ReferenceConfig) Refer(_ interface{}) { // FailoverClusterInvoker(RegistryDirectory, routing happens here) -> Invoker c.invoker = cluster.Join(directory.NewStaticDirectory(invokers)) } - + // publish consumer metadata + publishConsumerDefinition(cfgURL) // create proxy if c.Async { callback := GetCallback(c.id) @@ -248,3 +249,9 @@ func (c *ReferenceConfig) GenericLoad(id string) { c.Refer(genericService) c.Implement(genericService) } + +func publishConsumerDefinition(url *common.URL) { + if remoteMetadataService, err := extension.GetRemoteMetadataService(); err == nil && remoteMetadataService != nil { + remoteMetadataService.PublishServiceDefinition(url) + } +} diff --git a/config/service_config.go b/config/service_config.go index 8aa59380ff..f718b00a7f 100644 --- a/config/service_config.go +++ b/config/service_config.go @@ -40,13 +40,10 @@ import ( "github.com/apache/dubbo-go/common/constant" "github.com/apache/dubbo-go/common/extension" "github.com/apache/dubbo-go/common/logger" - "github.com/apache/dubbo-go/metadata/service" "github.com/apache/dubbo-go/protocol" "github.com/apache/dubbo-go/protocol/protocolwrapper" ) -var remoteMetadataService service.MetadataService - // ServiceConfig is the configuration of the service provider type ServiceConfig struct { context context.Context @@ -338,15 +335,7 @@ func (c *ServiceConfig) GetExportedUrls() []*common.URL { } func publishServiceDefinition(url *common.URL) { - if remoteMetadataService == nil { - var err error - if remoteMetadataService, err = extension.GetMetadataService("remote"); err != nil { - logger.Warnf("get remote metadataService fail. %v", err) - return - } else if remoteMetadataService == nil { - logger.Info("get remote metadataService will nil.") - return - } + if remoteMetadataService, err := extension.GetRemoteMetadataService(); err == nil && remoteMetadataService != nil { + remoteMetadataService.PublishServiceDefinition(url) } - remoteMetadataService.PublishServiceDefinition(url) } diff --git a/metadata/report/delegate/delegate_report.go b/metadata/report/delegate/delegate_report.go index 836a8f9ef4..3c34545658 100644 --- a/metadata/report/delegate/delegate_report.go +++ b/metadata/report/delegate/delegate_report.go @@ -109,6 +109,10 @@ type MetadataReport struct { // NewMetadataReport will create a MetadataReport with initiation func NewMetadataReport() (*MetadataReport, error) { url := instance.GetMetadataReportUrl() + if url == nil { + logger.Warn("the metadataReport URL is not configured, you should configure it.") + return nil, perrors.New("the metadataReport URL is not configured, you should configure it.") + } bmr := &MetadataReport{ reportUrl: url, syncReport: url.GetParamBool(constant.SYNC_REPORT_KEY, false), diff --git a/metadata/service/remote/service.go b/metadata/service/remote/service.go index efd16bdc6d..7e49ee817a 100644 --- a/metadata/service/remote/service.go +++ b/metadata/service/remote/service.go @@ -114,22 +114,42 @@ func (mts *MetadataService) UnsubscribeURL(url *common.URL) error { func (mts *MetadataService) PublishServiceDefinition(url *common.URL) error { interfaceName := url.GetParam(constant.INTERFACE_KEY, "") isGeneric := url.GetParamBool(constant.GENERIC_KEY, false) - if len(interfaceName) > 0 && !isGeneric { - sv := common.ServiceMap.GetServiceByServiceKey(url.Protocol, url.ServiceKey()) - sd := definition.BuildServiceDefinition(*sv, url) + if common.RoleType(common.PROVIDER).Role() == url.GetParam(constant.SIDE_KEY, "") { + if len(interfaceName) > 0 && !isGeneric { + sv := common.ServiceMap.GetServiceByServiceKey(url.Protocol, url.ServiceKey()) + sd := definition.BuildServiceDefinition(*sv, url) + id := &identifier.MetadataIdentifier{ + BaseMetadataIdentifier: identifier.BaseMetadataIdentifier{ + ServiceInterface: interfaceName, + Version: url.GetParam(constant.VERSION_KEY, ""), + // Group: url.GetParam(constant.GROUP_KEY, constant.SERVICE_DISCOVERY_DEFAULT_GROUP), + Group: url.GetParam(constant.GROUP_KEY, constant.DUBBO), + Side: url.GetParam(constant.SIDE_KEY, "provider"), + }, + } + mts.delegateReport.StoreProviderMetadata(id, sd) + return nil + } + logger.Errorf("publishProvider interfaceName is empty . providerUrl:%v ", url) + } else { + params := make(map[string]string, len(url.GetParams())) + url.RangeParams(func(key, value string) bool { + params[key] = value + return true + }) id := &identifier.MetadataIdentifier{ BaseMetadataIdentifier: identifier.BaseMetadataIdentifier{ ServiceInterface: interfaceName, Version: url.GetParam(constant.VERSION_KEY, ""), // Group: url.GetParam(constant.GROUP_KEY, constant.SERVICE_DISCOVERY_DEFAULT_GROUP), Group: url.GetParam(constant.GROUP_KEY, constant.DUBBO), - Side: url.GetParam(constant.SIDE_KEY, "provider"), + Side: url.GetParam(constant.SIDE_KEY, "consumer"), }, } - mts.delegateReport.StoreProviderMetadata(id, sd) + mts.delegateReport.StoreConsumerMetadata(id, params) return nil } - logger.Errorf("publishProvider interfaceName is empty . providerUrl:%v ", url) + return nil } From bfbe4e9ce2f44d812f00a9002b8afdbc053abdc9 Mon Sep 17 00:00:00 2001 From: cvictory Date: Sun, 17 Jan 2021 20:27:52 +0800 Subject: [PATCH 09/10] fix review issue --- common/extension/metadata_service.go | 2 +- metadata/service/remote/service.go | 5 ++--- registry/servicediscovery/service_discovery_registry.go | 4 ---- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/common/extension/metadata_service.go b/common/extension/metadata_service.go index cf8b286c66..08ddbc333e 100644 --- a/common/extension/metadata_service.go +++ b/common/extension/metadata_service.go @@ -62,6 +62,6 @@ func GetRemoteMetadataService() (service.MetadataService, error) { remoteMetadataService, err = creator() return remoteMetadataService, err } - logger.Info("could not find the metadata service creator for metadataType: remote") + logger.Warn("could not find the metadata service creator for metadataType: remote") return nil, perrors.New(fmt.Sprintf("could not find the metadata service creator for metadataType: remote")) } diff --git a/metadata/service/remote/service.go b/metadata/service/remote/service.go index 1ad246314d..c72d02e33a 100644 --- a/metadata/service/remote/service.go +++ b/metadata/service/remote/service.go @@ -124,9 +124,8 @@ func (mts *MetadataService) PublishServiceDefinition(url *common.URL) error { BaseMetadataIdentifier: identifier.BaseMetadataIdentifier{ ServiceInterface: interfaceName, Version: url.GetParam(constant.VERSION_KEY, ""), - // Group: url.GetParam(constant.GROUP_KEY, constant.SERVICE_DISCOVERY_DEFAULT_GROUP), - Group: url.GetParam(constant.GROUP_KEY, constant.DUBBO), - Side: url.GetParam(constant.SIDE_KEY, "provider"), + Group: url.GetParam(constant.GROUP_KEY, constant.DUBBO), + Side: url.GetParam(constant.SIDE_KEY, "provider"), }, } mts.delegateReport.StoreProviderMetadata(id, sd) diff --git a/registry/servicediscovery/service_discovery_registry.go b/registry/servicediscovery/service_discovery_registry.go index 2ca4b8015b..c97a7f7b51 100644 --- a/registry/servicediscovery/service_discovery_registry.go +++ b/registry/servicediscovery/service_discovery_registry.go @@ -174,10 +174,6 @@ func (s *serviceDiscoveryRegistry) Register(url *common.URL) error { logger.Warnf("The URL[%s] has been registry!", url.String()) } - err = s.metaDataService.PublishServiceDefinition(url) - if err != nil { - return perrors.WithMessage(err, "publish the service definition failed. ") - } return s.serviceNameMapping.Map(url.GetParam(constant.INTERFACE_KEY, ""), url.GetParam(constant.GROUP_KEY, ""), url.GetParam(constant.Version, ""), From b21ce4e8e47826c085aef8831a8cf39c1182dbb2 Mon Sep 17 00:00:00 2001 From: cvictory Date: Fri, 22 Jan 2021 20:25:04 +0800 Subject: [PATCH 10/10] fix review issue --- go.mod | 2 ++ metadata/service/remote/service.go | 7 +++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index 18d85a650f..ac83a94bcf 100644 --- a/go.mod +++ b/go.mod @@ -1,5 +1,7 @@ module github.com/apache/dubbo-go +go 1.15 + require ( github.com/NYTimes/gziphandler v1.1.1 // indirect github.com/RoaringBitmap/roaring v0.5.5 diff --git a/metadata/service/remote/service.go b/metadata/service/remote/service.go index c72d02e33a..bb520d3df7 100644 --- a/metadata/service/remote/service.go +++ b/metadata/service/remote/service.go @@ -125,7 +125,7 @@ func (mts *MetadataService) PublishServiceDefinition(url *common.URL) error { ServiceInterface: interfaceName, Version: url.GetParam(constant.VERSION_KEY, ""), Group: url.GetParam(constant.GROUP_KEY, constant.DUBBO), - Side: url.GetParam(constant.SIDE_KEY, "provider"), + Side: url.GetParam(constant.SIDE_KEY, constant.PROVIDER_PROTOCOL), }, } mts.delegateReport.StoreProviderMetadata(id, sd) @@ -142,9 +142,8 @@ func (mts *MetadataService) PublishServiceDefinition(url *common.URL) error { BaseMetadataIdentifier: identifier.BaseMetadataIdentifier{ ServiceInterface: interfaceName, Version: url.GetParam(constant.VERSION_KEY, ""), - // Group: url.GetParam(constant.GROUP_KEY, constant.SERVICE_DISCOVERY_DEFAULT_GROUP), - Group: url.GetParam(constant.GROUP_KEY, constant.DUBBO), - Side: url.GetParam(constant.SIDE_KEY, "consumer"), + Group: url.GetParam(constant.GROUP_KEY, constant.DUBBO), + Side: url.GetParam(constant.SIDE_KEY, "consumer"), }, } mts.delegateReport.StoreConsumerMetadata(id, params)