Skip to content

Same address cannot distinguish different registry center #2524

@lanux

Description

@lanux

Environment

  • Server: Dubbo-go, v3.0.5
  • Client: Dubbo-go, v3.0.5
  • Protocol: dubbo
  • Registry: Nacos, v1

Issue description

Nacos registry,Different namespaces represent different registry
eg. developtestproduct

http://122.32.33.4:6801/nacos?namespace=develop
http://122.32.33.4:6801/nacos?namespace=test
http://122.32.33.4:6801/nacos?namespace=product

registryUrl.PrimitiveURL all equals "registry://122.32.33.4:6801"
When the method getRegistry is called, it returns the same registry every time

func (proto *registryProtocol) getRegistry(registryUrl *common.URL) registry.Registry {
	var err error
	reg, loaded := proto.registries.Load(registryUrl.PrimitiveURL)
	if !loaded {
		reg, err = extension.GetRegistry(registryUrl.Protocol, registryUrl)
		if err != nil {
			logger.Errorf("Registry can not connect success, program is going to panic.Error message is %s", err.Error())
			panic(err)
		}
		proto.registries.Store(registryUrl.PrimitiveURL, reg)
	}
	return reg.(registry.Registry)
}

Logs

Click me to check logs
Copy logs to here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions