Skip to content
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

Unique actual data nodes issue in sharding rule checker #34251

Conversation

Yash-cor
Copy link
Contributor

@Yash-cor Yash-cor commented Jan 4, 2025

Fixes #ISSUSE_ID.

Changes proposed in this pull request:

In ShardingRuleChecker, while performing the check for Unique Actual Data Nodes, the initial check was performed for the first actualDataNode in the ShardingTable. Now, it has been changed to perform the check for every actualDataNode


Before committing this PR, I'm sure that I have checked the following options:

  • My code follows the code of conduct of this project.
  • I have self-reviewed the commit code.
  • I have (or in comment I request) added corresponding labels for the pull request.
  • I have passed maven check locally : ./mvnw clean install -B -T1C -Dmaven.javadoc.skip -Dmaven.jacoco.skip -e.
  • I have made corresponding changes to the documentation.
  • I have added corresponding unit tests for my changes.
  • I have updated the Release Notes of the current development version. For more details, see Update Release Note

@@ -64,7 +64,7 @@ public void check(final ShardingRuleConfiguration ruleConfig) {

private void checkUniqueActualDataNodesInTableRules() {
Collection<DataNode> uniqueActualDataNodes = new HashSet<>(shardingRule.getShardingTables().size(), 1F);
shardingRule.getShardingTables().forEach((key, value) -> checkUniqueActualDataNodes(uniqueActualDataNodes, key, value.getActualDataNodes().iterator().next()));
shardingRule.getShardingTables().forEach((key, value) -> value.getActualDataNodes().forEach(each -> checkUniqueActualDataNodes(uniqueActualDataNodes, key, each)));
Copy link
Member

Choose a reason for hiding this comment

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

If actualDataNodes contains many nodes, checking all nodes will take more time. Is it possible to add a props to control whether to check all actualDataNodes or sampleDataNode?

@strongduanmu
Copy link
Member

In addition, actualDataNodes are usually configured according to the same rules, so you only need to select sampleDataNode for verification without verifying all actualDataNodes.

@Yash-cor Yash-cor marked this pull request as draft January 13, 2025 04:06
@Yash-cor Yash-cor closed this Jan 16, 2025
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.

3 participants