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 2020/03/17 10:25:02 UTC
[GitHub] [incubator-shardingsphere] phoema opened a new issue #4806: Only
Use Hint to shard switch database, with not sqlParse
phoema opened a new issue #4806: Only Use Hint to shard switch database,with not sqlParse
URL: https://github.com/apache/incubator-shardingsphere/issues/4806
Version
5.0.0-RC1-SNAPSHOT from master branch
## Question
I used hint as a database rule.
But does the SQL statement still have to execute the sqlparse call? I just want to use hint to perform sub database operations. My statements have some associated retrieval or more complex statistical statements. Sqlparse is not well supported.
Of course, the release version may support it, but I don't want to witre many table config,Most tables only need to be sharding into databases
What can I do to tell shardingsphere not to parse it? Just access the specified database according to my hint rules.
or is there have some simple configuration writing methods to only shard with db and with not table?
my config is:
dataSources:
#names: master,test
master: !!com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/wise-master?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true
username: root
password: J
#filters: stat
maxActive: 20
initialSize: 1
maxWait: 60000
minIdle: 1
timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 300000
validationQuery: select 'x'
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
poolPreparedStatements: true
maxOpenPreparedStatements: 20
#
filters: stat,wall,slf4j
connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=500;druid.stat.logSlowSql=true
test: !!com.alibaba.druid.pool.DruidDataSource
#type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/wise-test?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true
username: root
password: J
test2: !!com.alibaba.druid.pool.DruidDataSource
#type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/wise-test2?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true
username: root
password: J
shardingRule:
tables:
v_s_biz_fee: #TODO saas
databaseStrategy:
hint: #Hint
algorithmClassName: com.smarttree.manage.config.mybatis.HintShardingStrategy
v_s_official_notice: #TODO saas
databaseStrategy:
hint: #Hint
algorithmClassName: com.smarttree.manage.config.mybatis.HintShardingStrategy
act_ru_history_job:
databaseStrategy:
hint: #Hint
algorithmClassName: com.smarttree.manage.config.mybatis.HintShardingStrategy
act_ru_identitylink:
databaseStrategy:
hint: #Hint
algorithmClassName: com.smarttree.manage.config.mybatis.HintShardingStrategy
........
many tables with Hint
sys_area:
actualDataNodes: master.sys_area
databaseStrategy:
none: #Hint
sys_area_cn:
actualDataNodes: master.sys_area_cn
databaseStrategy:
none: #Hint
sys_tenant_info:
actualDataNodes: master.sys_tenant_info
databaseStrategy:
none: #Hint
sys_column_define:
actualDataNodes: master.sys_column_define
databaseStrategy:
none: #Hint
mst_cpc_info:
actualDataNodes: master.mst_cpc_info
defaultDataSourceName: master
defaultDatabaseStrategy:
hint: #Hint
algorithmClassName: com.smarttree.manage.config.mybatis.HintShardingStrategy
bindingTables:
- quartz_user_monitor,qrtz_triggers
- qrtz_job_details,qrtz_fired_triggers
props:
sql.show: true
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-shardingsphere] phoema edited a comment on issue #4806:
Only Use Hint to shard switch database, with not sqlParse
Posted by GitBox <gi...@apache.org>.
phoema edited a comment on issue #4806: Only Use Hint to shard switch database,with not sqlParse
URL: https://github.com/apache/incubator-shardingsphere/issues/4806#issuecomment-600000185
#4478
@KomachiSion
KomachiSion commented 13 days ago:
I understand your problem. But if you do not config shardingRule, how can ShardingSphere judge which SQLs should be shared and which SQL not?
If you have hundreds of tables need to shard, you should config all of them to shardingRule, what ever you manual configuration files or program generate.
now i have 141 tables。。。。
is there any default config with many same loop config?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-shardingsphere] terrymanu closed issue #4806: Only Use
Hint to shard switch database, with not sqlParse
Posted by GitBox <gi...@apache.org>.
terrymanu closed issue #4806: Only Use Hint to shard switch database,with not sqlParse
URL: https://github.com/apache/incubator-shardingsphere/issues/4806
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-shardingsphere] phoema commented on issue #4806: Only
Use Hint to shard switch database, with not sqlParse
Posted by GitBox <gi...@apache.org>.
phoema commented on issue #4806: Only Use Hint to shard switch database,with not sqlParse
URL: https://github.com/apache/incubator-shardingsphere/issues/4806#issuecomment-600016950
The answer was timely
Thanks
if every table must be config,if not config then exception。
but my temp table name Alias will be not config in xml file.
like RES
it can be exception with 【Can not find owner from table.】
org.apache.shardingsphere.sql.parser.binder.segment.select.projection.engine.ProjectionsContextEngine
is this the same question with upper question ?
SELECT DISTINCT
RES.*
FROM
(
SELECT
SELF.*,
DEF.NAME_,
DEF.VERSION_
FROM
ACT_HI_PROCINST SELF
LEFT JOIN ACT_RE_PROCDEF DEF ON SELF.PROC_DEF_ID_ = DEF.ID_
WHERE
( 1 = 1 AND SELF.PROC_INST_ID_ = ? )
) RES
ORDER BY
RES.ID_ ASC
LIMIT ? OFFSET ?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-shardingsphere] phoema commented on issue #4806: Only
Use Hint to shard switch database, with not sqlParse
Posted by GitBox <gi...@apache.org>.
phoema commented on issue #4806: Only Use Hint to shard switch database,with not sqlParse
URL: https://github.com/apache/incubator-shardingsphere/issues/4806#issuecomment-600000185
#4478
@KomachiSion
KomachiSion commented 13 days ago:
I understand your problem. But if you do not config shardingRule, how can ShardingSphere judge which SQLs should be shared and which SQL not?
If you have hundreds of tables need to shard, you should config all of them to shardingRule, what ever you manual configuration files or program generate.
is there any default config with many same loop config?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-shardingsphere] phoema commented on issue #4806: Only
Use Hint to shard switch database, with not sqlParse
Posted by GitBox <gi...@apache.org>.
phoema commented on issue #4806: Only Use Hint to shard switch database,with not sqlParse
URL: https://github.com/apache/incubator-shardingsphere/issues/4806#issuecomment-600017302
@terrymanu @kimmking
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-shardingsphere] terrymanu commented on issue #4806: Only
Use Hint to shard switch database, with not sqlParse
Posted by GitBox <gi...@apache.org>.
terrymanu commented on issue #4806: Only Use Hint to shard switch database,with not sqlParse
URL: https://github.com/apache/incubator-shardingsphere/issues/4806#issuecomment-600009589
Every SQL need to pass SQL parser engine.
The SQL parser engine should supported all SQL in future.
So I just close this issue and label it as `won't fix`
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [incubator-shardingsphere] kimmking commented on issue #4806: Only
Use Hint to shard switch database, with not sqlParse
Posted by GitBox <gi...@apache.org>.
kimmking commented on issue #4806: Only Use Hint to shard switch database,with not sqlParse
URL: https://github.com/apache/incubator-shardingsphere/issues/4806#issuecomment-600009871
> I used hint as a database rule.
But does the SQL statement still have to execute the sqlparse call?
Answer is yes.
Every sql will be parsed now.
Hint a ds as databaseShardingOnly=true, will avoid sql-rewrite phase, but parse phase is need.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services