You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "DMzmwh (via GitHub)" <gi...@apache.org> on 2023/05/18 02:02:28 UTC
[GitHub] [shardingsphere] DMzmwh opened a new issue, #25751: hintManager.setDatabaseShardingValue(0); If “shardingRuleConfig.getTables().addAll” is not configured, the “DefaultDatabaseShardingStrategy” logic is not used and the default database is used
DMzmwh opened a new issue, #25751:
URL: https://github.com/apache/shardingsphere/issues/25751
version:5.2.0
private ShardingRuleConfiguration createShardingRuleConfiguration() {
ShardingRuleConfiguration shardingRuleConfig = new ShardingRuleConfiguration();
HashMap<String, AlgorithmConfiguration> algorithms = new HashMap<>();
Properties hint = new Properties();
hint.setProperty("strategy", "HINT");
hint.setProperty("algorithmClassName", DBHintAlgorithm.class.getName());
AlgorithmConfiguration algorithmConfiguration = new AlgorithmConfiguration("CLASS_BASED", hint);
Properties tableHint = new Properties();
tableHint.setProperty("strategy", "HINT");
tableHint.setProperty("algorithmClassName", TableHintAlgorithm.class.getName());
AlgorithmConfiguration tableHintAC = new AlgorithmConfiguration("CLASS_BASED", tableHint);
algorithms.put("my-hint", algorithmConfiguration);
algorithms.put("my-table-hint", tableHintAC);
shardingRuleConfig.setShardingAlgorithms(algorithms);
shardingRuleConfig.getTables().addAll(this.getTableRuleConfiguration());
shardingRuleConfig.setDefaultDatabaseShardingStrategy(new HintShardingStrategyConfiguration("my-hint"));
shardingRuleConfig.setDefaultTableShardingStrategy(new HintShardingStrategyConfiguration("my-table-hint"));
return shardingRuleConfig;
}
try (HintManager hintManager = HintManager.getInstance()) {
hintManager.setDatabaseShardingValue(0);
waybillLogMapper.qryWaybillNos111(1,1L);
System.out.printf("");
}
Actual SQL: dp_log_1 ::: SELECT * FROM waybill_log_log
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] DMzmwh commented on issue #25751: hintManager.setDatabaseShardingValue(0); If “shardingRuleConfig.getTables().addAll” is not configured, the “DefaultDatabaseShardingStrategy” logic is not used and the default database is used
Posted by "DMzmwh (via GitHub)" <gi...@apache.org>.
DMzmwh commented on issue #25751:
URL: https://github.com/apache/shardingsphere/issues/25751#issuecomment-1573563743
That's still the case;
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] DMzmwh commented on issue #25751: hintManager.setDatabaseShardingValue(0); If “shardingRuleConfig.getTables().addAll” is not configured, the “DefaultDatabaseShardingStrategy” logic is not used and the default database is used
Posted by "DMzmwh (via GitHub)" <gi...@apache.org>.
DMzmwh commented on issue #25751:
URL: https://github.com/apache/shardingsphere/issues/25751#issuecomment-1583720297
The expectation is not to configure “shardingRuleConfig.getTables().addAll(this.getTableRuleConfiguration())”, to switch databases by “hintManager.setDatabaseShardingValue(0)”
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] tuichenchuxin commented on issue #25751: hintManager.setDatabaseShardingValue(0); If “shardingRuleConfig.getTables().addAll” is not configured, the “DefaultDatabaseShardingStrategy” logic is not used and the default database is used
Posted by "tuichenchuxin (via GitHub)" <gi...@apache.org>.
tuichenchuxin commented on issue #25751:
URL: https://github.com/apache/shardingsphere/issues/25751#issuecomment-1582259304
@DMzmwh I don't quite understand what your question is? What are the expectations?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] sandynz commented on issue #25751: hintManager.setDatabaseShardingValue(0); If “shardingRuleConfig.getTables().addAll” is not configured, the “DefaultDatabaseShardingStrategy” logic is not used and the default database is used
Posted by "sandynz (via GitHub)" <gi...@apache.org>.
sandynz commented on issue #25751:
URL: https://github.com/apache/shardingsphere/issues/25751#issuecomment-1556775012
Hi @DMzmwh , could you try latest version? Currently, it's [5.3.2]( https://shardingsphere.apache.org/document/5.3.2/en/user-manual/shardingsphere-jdbc/special-api/sharding/hint/ ).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] DMzmwh commented on issue #25751: hintManager.setDatabaseShardingValue(0); If “shardingRuleConfig.getTables().addAll” is not configured, the “DefaultDatabaseShardingStrategy” logic is not used and the default database is used
Posted by "DMzmwh (via GitHub)" <gi...@apache.org>.
DMzmwh commented on issue #25751:
URL: https://github.com/apache/shardingsphere/issues/25751#issuecomment-1583723048
No logical table is configured, the actual table name is used, and only the database is switched
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] DMzmwh commented on issue #25751: hintManager.setDatabaseShardingValue(0); If “shardingRuleConfig.getTables().addAll” is not configured, the “DefaultDatabaseShardingStrategy” logic is not used and the default database is used
Posted by "DMzmwh (via GitHub)" <gi...@apache.org>.
DMzmwh commented on issue #25751:
URL: https://github.com/apache/shardingsphere/issues/25751#issuecomment-1552329178
**version** : Previously, using 4.0.0-RC1 was fine for the business
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] hintManager.setDatabaseShardingValue(0); If “shardingRuleConfig.getTables().addAll” is not configured, the “DefaultDatabaseShardingStrategy” logic is not used and the default database is used [shardingsphere]
Posted by "terrymanu (via GitHub)" <gi...@apache.org>.
terrymanu closed issue #25751: hintManager.setDatabaseShardingValue(0); If “shardingRuleConfig.getTables().addAll” is not configured, the “DefaultDatabaseShardingStrategy” logic is not used and the default database is used
URL: https://github.com/apache/shardingsphere/issues/25751
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] DMzmwh commented on issue #25751: hintManager.setDatabaseShardingValue(0); If “shardingRuleConfig.getTables().addAll” is not configured, the “DefaultDatabaseShardingStrategy” logic is not used and the default database is used
Posted by "DMzmwh (via GitHub)" <gi...@apache.org>.
DMzmwh commented on issue #25751:
URL: https://github.com/apache/shardingsphere/issues/25751#issuecomment-1552350264
I want to just switch the database and manipulate the table using the actual table name without configuring “shardingRuleConfig.getTables()”
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] sandynz commented on issue #25751: hintManager.setDatabaseShardingValue(0); If “shardingRuleConfig.getTables().addAll” is not configured, the “DefaultDatabaseShardingStrategy” logic is not used and the default database is used
Posted by "sandynz (via GitHub)" <gi...@apache.org>.
sandynz commented on issue #25751:
URL: https://github.com/apache/shardingsphere/issues/25751#issuecomment-1581918439
Hi @tuichenchuxin , could you help to have a look at it?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org