Skip to content

modify dubbo plugin configuration based on selector #5953

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 27 commits into
base: master
Choose a base branch
from

Conversation

Wweiei
Copy link
Contributor

@Wweiei Wweiei commented Mar 7, 2025

complete task 4 in #5923 , modify dubbo registry config base on selector.

Make sure that:

  • You have read the contribution guidelines.
  • You submit test cases (unit or integration tests) that back your changes.
  • Your local test passed ./mvnw clean install -Dmaven.javadoc.skip=true.

@Aias00
Copy link
Contributor

Aias00 commented Mar 20, 2025

@Wweiei if u got time, fix the conflicts

…g-base-on-selector

# Conflicts:
#	db/upgrade/2.7.0-upgrade-2.7.1-mysql.sql
#	db/upgrade/2.7.0-upgrade-2.7.1-ob.sql
#	db/upgrade/2.7.0-upgrade-2.7.1-og.sql
#	db/upgrade/2.7.0-upgrade-2.7.1-oracle.sql
#	db/upgrade/2.7.0-upgrade-2.7.1-pg.sql
@Wweiei
Copy link
Contributor Author

Wweiei commented Mar 20, 2025

@Wweiei if u got time, fix the conflicts
ok, i have fixed it

@Aias00
Copy link
Contributor

Aias00 commented Mar 27, 2025

@Wweiei hi, fix the ci, pls

Wweiei and others added 2 commits March 28, 2025 09:00
…g-base-on-selector

# Conflicts:
#	db/upgrade/2.7.0-upgrade-2.7.1-mysql.sql
#	db/upgrade/2.7.0-upgrade-2.7.1-ob.sql
#	db/upgrade/2.7.0-upgrade-2.7.1-og.sql
#	db/upgrade/2.7.0-upgrade-2.7.1-oracle.sql
#	db/upgrade/2.7.0-upgrade-2.7.1-pg.sql
@Aias00 Aias00 added this to the 2.7.0.1 milestone Mar 31, 2025
@Aias00
Copy link
Contributor

Aias00 commented Apr 10, 2025

@Wweiei fix ci pls

@Aias00 Aias00 requested a review from moremind April 10, 2025 12:08
Wweiei and others added 5 commits April 11, 2025 09:44
…g-base-on-selector

# Conflicts:
#	db/upgrade/2.7.0-upgrade-2.7.1-mysql.sql
#	db/upgrade/2.7.0-upgrade-2.7.1-ob.sql
#	db/upgrade/2.7.0-upgrade-2.7.1-og.sql
#	db/upgrade/2.7.0-upgrade-2.7.1-oracle.sql
#	db/upgrade/2.7.0-upgrade-2.7.1-pg.sql
@@ -21,7 +21,7 @@ spring:
application:
name: shenyu-admin
profiles:
active: h2
active: mysql
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not change this configuration

/**
* The constant string separator.
*/
String SEPARATOR_UNDERLINE = "_";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is existed

address: zookeeper://localhost:2181

address: nacos://127.0.0.1:8849?namespace=namespace1
# address: zookeeper://localhost:2181
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why change this?


address: nacos://127.0.0.1:8849?namespace=namespace1
# address: zookeeper://localhost:2181

shenyu:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not add this

}

ReferenceConfig<GenericService> reference = new ReferenceConfig<>();
reference.setGeneric("true");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why "true"? not true?

Optional.ofNullable(dubboUpstream.getVersion()).ifPresent(registryConfigTemp::setVersion);
if (StringUtils.isNotBlank(namespace)) {
if (!registryConfigTemp.getAddress().contains(Constants.NAMESPACE)) {
registryConfigTemp.setAddress(registryConfigTemp.getAddress() + "?" + Constants.NAMESPACE + "=" + namespace);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use common method!

: dubboUpstreams.stream().filter(u -> u.isStatus() && StringUtils.isNotBlank(u.getRegistry())).collect(Collectors.toList());
// if dubboUpstreams is empty, use default plugin config
if (CollectionUtils.isEmpty(dubboUpstreams)) {
referenceKey = StringUtils.isNotBlank(namespace) ? namespace + ":" + referenceKey : referenceKey;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add common variable

List<Upstream> upstreams = this.convertUpstreamList(dubboUpstreams);
String ip = Objects.requireNonNull(exchange.getRequest().getRemoteAddress()).getAddress().getHostAddress();
Upstream upstream = LoadBalancerFactory.selector(upstreams, LoadBalanceEnum.RANDOM.getName(), ip);
DubboUpstream dubboUpstream = null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

judge null

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 12 out of 22 changed files in this pull request and generated 1 comment.

Files not reviewed (10)
  • db/init/mysql/schema.sql: Language not supported
  • db/init/ob/schema.sql: Language not supported
  • db/init/og/create-table.sql: Language not supported
  • db/init/oracle/schema.sql: Language not supported
  • db/init/pg/create-table.sql: Language not supported
  • db/upgrade/2.7.0-upgrade-2.7.1-mysql.sql: Language not supported
  • db/upgrade/2.7.0-upgrade-2.7.1-ob.sql: Language not supported
  • db/upgrade/2.7.0-upgrade-2.7.1-og.sql: Language not supported
  • db/upgrade/2.7.0-upgrade-2.7.1-oracle.sql: Language not supported
  • db/upgrade/2.7.0-upgrade-2.7.1-pg.sql: Language not supported

Upstream upstream = LoadBalancerFactory.selector(upstreams, LoadBalanceEnum.RANDOM.getName(), ip);
DubboUpstream dubboUpstream = null;
for (DubboUpstream upstreamItem : dubboUpstreams) {
if (Objects.equals(upstreamItem.getRegistry(), upstreamItem.getRegistry())
Copy link
Preview

Copilot AI Apr 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Self-comparison of 'upstreamItem.getRegistry()' is detected. It is likely intended to compare 'upstreamItem.getRegistry()' with 'upstream.getRegistry()'.

Suggested change
if (Objects.equals(upstreamItem.getRegistry(), upstreamItem.getRegistry())
if (Objects.equals(upstreamItem.getRegistry(), upstream.getRegistry())

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants