-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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
feature: Raft mode supports access outside the cluster #7069
base: 2.x
Are you sure you want to change the base?
Conversation
|
||
private static InetSocketAddress selectEndpoint(String type, Node node) { | ||
if (StringUtils.isBlank(PREFERRED_NETWORKS)) { | ||
// 采取默认的方式,直接使用node.control node.transaction |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// 采取默认的方式,直接使用node.control node.transaction | |
// Use the default method, directly using node.control and node.transaction |
@@ -366,7 +366,7 @@ public RaftClusterMetadata changeOrInitRaftClusterMetadata() { | |||
Integer.parseInt( | |||
((Environment)ObjectHolder.INSTANCE.getObject(OBJECT_KEY_SPRING_CONFIGURABLE_ENVIRONMENT)) | |||
.getProperty("server.port", String.valueOf(7091))), | |||
group, Collections.emptyMap()); | |||
group, new HashMap<>()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why change to new HashMap < > ()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
因为Collections.emptyMap()返回的集合使用了final修饰,导致我进行put操作时,报错,unsupoort...
@@ -406,7 +406,7 @@ private void syncCurrentNodeInfo(PeerId leaderPeerId) { | |||
Integer.parseInt( | |||
((Environment)ObjectHolder.INSTANCE.getObject(OBJECT_KEY_SPRING_CONFIGURABLE_ENVIRONMENT)) | |||
.getProperty("server.port", String.valueOf(7091))), | |||
group, Collections.emptyMap()); | |||
group, new HashMap<>()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same
@@ -55,6 +58,10 @@ public Node createNode(String host, int txPort, int internalPort, int controlPor | |||
node.setGroup(group); | |||
node.setVersion(Version.getCurrent()); | |||
node.setInternal(node.createEndpoint(host, internalPort, "raft")); | |||
String serverRegistryMetadataExternalValue = System.getProperty("SERVER_REGISTRY_METADATA_EXTERNAL_VALUE"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不应该这样读取,如果有用户直接使用properties配置文件去配置怎么办?应该通过下面这样的方式读取
It should not be read like this. What if a user directly uses the properties configuration file to configure it? It should be read in the following way
ConfigurableEnvironment environment=ObjectHolder.INSTANCE.getObject(OBJECT_KEY_SPRING_CONFIGURABLE_ENVIRONMENT);
environment.resolvePlaceholders("${seata.registry.metadata.external:${registry.metadata.external:}}")
private static String selectTransactionEndpointStr(Node node) { | ||
InetSocketAddress transaction = selectTransactionEndpoint( node); | ||
return NetUtil.toStringAddress(transaction); | ||
} | ||
|
||
private static InetSocketAddress selectControlEndpoint(Node node) { | ||
return selectEndpoint("control", node); | ||
} | ||
|
||
private static InetSocketAddress selectTransactionEndpoint(Node node) { | ||
return selectEndpoint("transaction", node); | ||
} | ||
|
||
private static InetSocketAddress selectEndpoint(String type, Node node) { | ||
if (StringUtils.isBlank(PREFERRED_NETWORKS)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
请增加这些方法的测试用例
Please add test cases for these methods
Ⅰ. Describe what this PR did
现有raft sdk如果在k8s环境下,客户端集群外访问,无法通过域名方式链接raft node,造成无法通信。
Ⅱ. Does this pull request fix one issue?
Ⅲ. Why don't you add test cases (unit test/integration test)?
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews