You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/12/29 16:05:22 UTC
[GitHub] [shardingsphere] youlongchengfeng opened a new issue, #23173: custom HintShardingAlgorithm initialize more then once when project started
youlongchengfeng opened a new issue, #23173:
URL: https://github.com/apache/shardingsphere/issues/23173
public class MyTableHintShardingAlgorithm implements HintShardingAlgorithm<Integer> {
public Collection<String> doSharding(Collection<String> tableNames, HintShardingValue<Integer> hintShardingValue) {
Collection<String> result = new ArrayList<String>();
for (String tableName : tableNames) {
for (Integer shardingValue : hintShardingValue.getValues()) {
if (tableName.endsWith(shardingValue+ "")) {
result.add(tableName);
}
}
}
return result;
}
@Override
public Properties getProps() {
// TODO Auto-generated method stub
return null;
}
@Override
public void init(Properties props) {
// TODO Auto-generated method stub
System.out.println("--------------------------------MyTableHintShardingAlgorithm---init------------------------");
}
}
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.3.2.RELEASE)
2022-12-29 23:53:22.700 INFO 11816 --- [ main] com.longshun.admin.MyTest : Starting MyTest on longshun-PC with PID 11816 (started by longshun in C:\Develop\workspace\shardingTest)
2022-12-29 23:53:22.701 INFO 11816 --- [ main] com.longshun.admin.MyTest : No active profile set, falling back to default profiles: default
--------------------------------MyTableHintShardingAlgorithm---init------------------------
2022-12-29 23:53:23.520 INFO 11816 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'stringToNoneShardingStrategyConfigurationConverter' of type [org.apache.shardingsphere.spring.boot.converter.StringToNoneShardingStrategyConfigurationConverter] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2022-12-29 23:53:23.529 INFO 11816 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'spring.shardingsphere-org.apache.shardingsphere.spring.boot.prop.SpringBootPropertiesConfiguration' of type [org.apache.shardingsphere.spring.boot.prop.SpringBootPropertiesConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2022-12-29 23:53:24.032 INFO 11816 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.apache.shardingsphere.spring.boot.ShardingSphereAutoConfiguration' of type [org.apache.shardingsphere.spring.boot.ShardingSphereAutoConfiguration$$EnhancerBySpringCGLIB$$7e4de5fa] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
--------------------------------MyTableHintShardingAlgorithm---init------------------------
2022-12-29 23:53:24.579 INFO 11816 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2022-12-29 23:53:24.923 INFO 11816 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2022-12-29 23:53:25.189 INFO 11816 --- [ main] com.alibaba.druid.pool.DruidDataSource : {dataSource-1} inited
--------------------------------MyTableHintShardingAlgorithm---init------------------------
Logging initialized using 'class org.apache.ibatis.logging.stdout.StdOutImpl' adapter.
Parsed mapper file: 'file [C:\Develop\workspace\shardingTest\target\classes\com\longshun\admin\mapper\StudentMapper.xml]'
is this normal?
--
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] TeslaCN commented on issue #23173: custom HintShardingAlgorithm initialize more then once when project started
Posted by GitBox <gi...@apache.org>.
TeslaCN commented on issue #23173:
URL: https://github.com/apache/shardingsphere/issues/23173#issuecomment-1367679229
Hi @youlongchengfeng
It's hard to answer your question without any information about your environment. Please provide us detail of your project, such as version, configuration...
--
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] TeslaCN commented on issue #23173: custom HintShardingAlgorithm initialize more then once when project started
Posted by GitBox <gi...@apache.org>.
TeslaCN commented on issue #23173:
URL: https://github.com/apache/shardingsphere/issues/23173#issuecomment-1367688058
ShardingSphere Spring modules have been deprecated and removed since 5.3.0. You may integrate ShardingSphere with Spring in a more simple way.
https://shardingsphere.apache.org/document/current/en/user-manual/shardingsphere-jdbc/yaml-config/jdbc-driver/spring-boot/
If you are interested, you may debug to figure out why it was repeatedly initialized.
--
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] RaigorJiang commented on issue #23173: custom HintShardingAlgorithm initialize more then once when project started
Posted by "RaigorJiang (via GitHub)" <gi...@apache.org>.
RaigorJiang commented on issue #23173:
URL: https://github.com/apache/shardingsphere/issues/23173#issuecomment-1441488808
@youlongchengfeng
I used version 5.3.1 for verification, and there is no such problem, you can try the latest version.
<img width="1475" alt="image" src="https://user-images.githubusercontent.com/5668787/220876294-33cf28e6-b84e-48f6-b5a3-5da426eb3b43.png">
--
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] youlongchengfeng commented on issue #23173: custom HintShardingAlgorithm initialize more then once when project started
Posted by GitBox <gi...@apache.org>.
youlongchengfeng commented on issue #23173:
URL: https://github.com/apache/shardingsphere/issues/23173#issuecomment-1367680219
> Hi @youlongchengfeng It's hard to answer your question without any information about your environment. Please provide us detail of your project, such as version, configuration...
i'am sorry
version is shardingSphere5.2.1
configuration as follows
spring:
shardingsphere:
props:
sql-show: true
datasource:
names: db1
db1:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/hb99_gengy?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true&allowMultiQueries=true
username: root
password: root
type: com.alibaba.druid.pool.DruidDataSource
rules:
sharding:
sharding-algorithms:
myHint:
props:
strategy: hint
algorithmClassName: com.longshun.admin.shardingalgorithm.MyTableHintShardingAlgorithm
type: CLASS_BASED
tables:
t_student:
actual-data-nodes: db1.t_student0,db1.t_student1
table-strategy:
hint:
sharding-algorithm-name: myHint
--
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] RaigorJiang closed issue #23173: custom HintShardingAlgorithm initialize more then once when project started
Posted by "RaigorJiang (via GitHub)" <gi...@apache.org>.
RaigorJiang closed issue #23173: custom HintShardingAlgorithm initialize more then once when project started
URL: https://github.com/apache/shardingsphere/issues/23173
--
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