lanrenbulan opened a new issue, #21437:
URL: https://github.com/apache/shardingsphere/issues/21437
## Question
SQL comment hint not work in proxy, it queries all databases.
## ENV
proxy-5.2.0
windows11
## config
service.yaml
```
mode:
type: Standalone
rules:
- !AUTHORITY
users:
- root@%:root
provider:
type: ALL_PRIVILEGES_PERMITTED
- !SQL_PARSER
sqlCommentParseEnabled: true
sqlStatementCache:
initialCapacity: 2000
maximumSize: 65535
parseTreeCache:
initialCapacity: 128
maximumSize: 1024
props:
max-connections-size-per-query: 1
kernel-executor-size: 16 # Infinite by default.
proxy-frontend-flush-threshold: 128 # The default value is 128.
proxy-opentracing-enabled: false
proxy-hint-enabled: true
sql-show: true
check-table-metadata-enabled: false
```
config.sharding.yaml
```
databaseName: tenant_db
dataSources:
tenant_db_1:
url: jdbc:mysql://localhost/tenant_db_1
username: root
password: root
connectionTimeoutMilliseconds: 30000
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 50
minPoolSize: 1
tenant_db_2:
url: jdbc:mysql://localhost/tenant_db_2
username: root
password: root
connectionTimeoutMilliseconds: 30000
idleTimeoutMilliseconds: 60000
maxLifetimeMilliseconds: 1800000
maxPoolSize: 50
minPoolSize: 1
rules:
- !SHARDING
tables:
user:
actualDataNodes: tenant_db_${1..2}.user
tableStrategy:
hint:
defaultDatabaseStrategy:
none:
defaultTableStrategy:
none:
```
## log
The port is configured as 3309
The classpath is "..;..\lib\*;..\ext-lib\*"
we find java version: java17, full_version=17.0.3"
Starting the ShardingSphere-Proxy ...
Java HotSpot(TM) 64-Bit Server VM warning: JVM cannot use large page memory
because it does not have enough privilege to lock pages in memory.
Thanks for using Atomikos! This installation is not registered yet.
REGISTER FOR FREE at http://www.atomikos.com/Main/RegisterYourDownload and
receive:
- tips & advice
- working demos
- access to the full documentation
- special exclusive bonus offers not available to others
- everything you need to get the most out of using Atomikos!
[INFO ] 2022-10-10 11:46:58.201 [main]
o.a.s.d.p.c.l.PipelineContextManagerLifecycleListener - mode type is not
Cluster, mode type='Standalone', ignore
[INFO ] 2022-10-10 11:46:58.239 [main] o.a.s.p.v.ShardingSphereProxyVersion
- Database name is `MySQL`, version is `5.7.36`, database name is `tenant_db`
[INFO ] 2022-10-10 11:46:58.830 [main] o.a.s.p.frontend.ShardingSphereProxy
- ShardingSphere-Proxy Standalone mode started successfully
[INFO ] 2022-10-10 11:47:00.634 [Connection-1-ThreadExecutor]
ShardingSphere-SQL - Logic SQL: /* ShardingSphere hint:
dataSourceName=tenant_db_1 */ SELECT * FROM user;
[INFO ] 2022-10-10 11:47:00.634 [Connection-1-ThreadExecutor]
ShardingSphere-SQL - SQLStatement:
MySQLSelectStatement(super=SelectStatement(super=AbstractSQLStatement(parameterCount=0,
parameterMarkerSegments=[], commentSegments=[CommentSegment(text=/*
ShardingSphere hint: dataSourceName=tenant_db_1 */, startIndex=0,
stopIndex=52)]), projections=ProjectionsSegment(startIndex=61, stopIndex=61,
projections=[ShorthandProjectionSegment(startIndex=61, stopIndex=61,
owner=Optional.empty, alias=Optional.empty)], distinctRow=false),
from=SimpleTableSegment(tableName=TableNameSegment(startIndex=68, stopIndex=71,
identifier=IdentifierValue(value=user, quoteCharacter=NONE)),
owner=Optional.empty, alias=Optional.empty), where=Optional.empty,
groupBy=Optional.empty, having=Optional.empty, orderBy=Optional.empty,
combines=[]), table=Optional.empty, limit=Optional.empty, lock=Optional.empty,
window=Optional.empty)
[INFO ] 2022-10-10 11:47:00.636 [Connection-1-ThreadExecutor]
ShardingSphere-SQL - Actual SQL: tenant_db_1 ::: /* ShardingSphere hint:
dataSourceName=tenant_db_1 */ SELECT * FROM user;
[INFO ] 2022-10-10 11:47:00.636 [Connection-1-ThreadExecutor]
ShardingSphere-SQL - Actual SQL: tenant_db_2 ::: /* ShardingSphere hint:
dataSourceName=tenant_db_1 */ SELECT * FROM user;
--
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:
[email protected]
For queries about this service, please contact Infrastructure at:
[email protected]