hi there
today I got a confusion about the usage of hint , hope someone could help to
explian.
as followings are parts of configuration for hint in shardingsphere example :
shardingRule:
tables:
t_order:
actualDataNodes: ds_${0..1}.t_order_${0..1}
databaseStrategy:
hint:
algorithmClassName:
org.apache.shardingsphere.example.hint.raw.jdbc.ModuloHintShardingAlgorithm
tableStrategy:
hint:
algorithmClassName:
org.apache.shardingsphere.example.hint.raw.jdbc.ModuloHintShardingAlgorithm
after I got the code for ModuloHintShardingAlgorithm, I realized this is so
similar as `inline` , I'm not sure why not use inline instead of this strategy .
public Collection<String> doSharding(final Collection<String>
availableTargetNames, final HintShardingValue<Long> shardingValue) {
Collection<String> result = new ArrayList<>();
for (String each : availableTargetNames) {
System.out.println("each is : "+each);
System.out.println("sharding value is : "+shardingValue);
for (Long value : shardingValue.getValues()) {
if (each.endsWith(String.valueOf(value % 2))) {
result.add(each);
}
}
}
return result;
}
until I encount following settings
hintManager.addDatabaseShardingValue("t_order", 1L);
hintManager.addTableShardingValue("t_order", 1L);
so , here is my confusion , the `HintShardingValues` that set by hintManager
will paticipate in the Sharding Process, I still don't understand what kind of
situation will use this kind of strategy ? If I set a collections to
TableShardingValue, what does that use for ?
and another question is , when or how the `defaultDatbaseStrategy` and
`defaultTableStrategy` will be triggered since I already set up the
DatabaseStrategy and TalbeStrategy
anybody could help will be grateful