MrCong233 opened a new issue, #22207:
URL: https://github.com/apache/shardingsphere/issues/22207

   ## Bug Report
   
   When grafana connects shardingsphere, a  error that the time format is 
incorrect reports regularly.
   
   ### Which version of ShardingSphere did you use?
   
   shardingsphere-5.2.1, commit id:85541320133e8049027e922557636fe32c58625c
   
   grafana-7.1.3 with opengauss-gdbc
   
   openGauss-3.1.0,create a MySQL compatible database(create database 
DBCOMPATIBILITY='B';)
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   
   proxy
   
   ### Expected behavior
   
   execute successfully.
   
   ### Actual behavior
   
   ```
   java.lang.IllegalArgumentException: Timestamp format must be yyyy-mm-dd 
hh:mm:ss[.fffffffff]
        at java.sql.Timestamp.valueOf(Timestamp.java:251)
        at 
org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.extended.bind.protocol.PostgreSQLTextTimestampUtils.parse(PostgreSQLTextTimestampUtils.java:52)
        at 
org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.extended.bind.PostgreSQLComBindPacket.getTextParameters(PostgreSQLComBindPacket.java:133)
        at 
org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.extended.bind.PostgreSQLComBindPacket.getTextParameters(PostgreSQLComBindPacket.java:99)
        at 
org.apache.shardingsphere.db.protocol.postgresql.packet.command.query.extended.bind.PostgreSQLComBindPacket.readParameters(PostgreSQLComBindPacket.java:80)
        at 
org.apache.shardingsphere.proxy.frontend.postgresql.command.query.extended.bind.PostgreSQLComBindExecutor.execute(PostgreSQLComBindExecutor.java:51)
        at 
org.apache.shardingsphere.proxy.frontend.postgresql.command.query.extended.PostgreSQLAggregatedCommandExecutor.execute(PostgreSQLAggregatedCommandExecutor.java:41)
        at 
org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:111)
        at 
org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:78)
        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
   ```
   
   the error statement retrieved from the stack
   
   ```sql
   SELECT (SELECT COUNT(*) FROM "user") AS users,(SELECT COUNT(*) FROM "org") 
AS orgs,(SELECT COUNT(*) FROM "dashboard") AS dashboards,(SELECT COUNT(*) FROM 
"data_source") AS datasources,(SELECT COUNT(*) FROM "star") AS stars,(SELECT 
COUNT(*) FROM "playlist") AS playlists,(SELECT COUNT(*) FROM "alert") AS 
alerts,(SELECT COUNT(*) FROM "user" WHERE last_seen_at > ?) AS 
active_users,(SELECT COUNT(id) FROM "dashboard" WHERE is_folder = ?) AS 
folders,(
                SELECT COUNT(acl.id)
                FROM "dashboard_acl" AS acl
                        INNER JOIN "dashboard" AS d
                        ON d.id = acl.dashboard_id
                WHERE d.is_folder = ?
        ) AS dashboard_permissions,(
                SELECT COUNT(acl.id)
                FROM "dashboard_acl" AS acl
                        INNER JOIN "dashboard" AS d
                        ON d.id = acl.dashboard_id
                WHERE d.is_folder = ?
        ) AS folder_permissions,(SELECT COUNT(id) FROM 
"dashboard_provisioning") AS provisioned_dashboards,(SELECT COUNT(id) FROM 
"dashboard_snapshot") AS snapshots,(SELECT COUNT(id) FROM "dashboard_version") 
AS dashboard_versions,(SELECT COUNT(id) FROM "annotation") AS 
annotations,(SELECT COUNT(id) FROM "team") AS teams,(SELECT COUNT(id) FROM 
"user_auth_token") AS auth_tokens,
                (
                        SELECT COUNT(DISTINCT u.id)
                        FROM "user" AS u, org_user
                        WHERE u.last_seen_at > ? AND ( org_user.user_id=u.id 
AND org_user.role='Viewer' )
                ) AS active_viewers,
                (
                        SELECT COUNT(DISTINCT u.id)
                        FROM "user" AS u, org_user
                        WHERE ( org_user.user_id=u.id AND 
org_user.role='Viewer' )
                ) AS viewers,
                (
                        SELECT COUNT(DISTINCT u.id)
                        FROM "user" AS u, org_user
                        WHERE u.last_seen_at > ? AND ( org_user.user_id=u.id 
AND org_user.role='Editor' )
                ) AS active_editors,
                (
                        SELECT COUNT(DISTINCT u.id)
                        FROM "user" AS u, org_user
                        WHERE ( org_user.user_id=u.id AND 
org_user.role='Editor' )
                ) AS editors,
                (
                        SELECT COUNT(DISTINCT u.id)
                        FROM "user" AS u, org_user
                        WHERE u.last_seen_at > ? AND ( org_user.user_id=u.id 
AND org_user.role='Admin' )
                ) AS active_admins,
                (
                        SELECT COUNT(DISTINCT u.id)
                        FROM "user" AS u, org_user
                        WHERE ( org_user.user_id=u.id AND org_user.role='Admin' 
)
                ) AS admins
   ```
   
   ### Reason analyze (If you can)
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule 
configuration, when exception occur etc.
   
   ### Example codes for reproduce this issue (such as a github link).
   
   ## 
   
   ```
   rules:
     - !AUTHORITY
       users:
         - root@%:root
         - sharding@:sharding
       provider:
         type: ALL_PRIVILEGES_PERMITTED
     - !TRANSACTION
       defaultType: local
       providerType: Atomikos
       #providerType: Narayana
   props:
     max-connections-size-per-query: 1
     executor-size: 16  # Infinite by default.
     sql-show: true
     proxy-frontend-flush-threshold: 128  # The default value is 128.
     proxy.transaction.type: XA
     sql-federation-type: ADVANCED
     
   ```
   
   ```yaml
   databaseName: grafana
   
   dataSources:
     ds_0:
       url: 
jdbc:opengauss://192.168.0.129:56666/grafana?serverTimezone=UTC&useSSL=false&connectTimeout=10&batchMode=on&loggerLevel=OFF
       username: grafana
       password: Huawei@123
       connectionTimeoutMilliseconds: 30000
       idleTimeoutMilliseconds: 60000
       maxLifetimeMilliseconds: 1800000
       maxPoolSize: 50
       minPoolSize: 1
   rules:
     - !SHARDING
       defaultDatabaseStrategy:
         standard:
           shardingAlgorithmName: database_default_inline
           shardingColumn: id
       #      none: null
       defaultTableStrategy:
         none: null
       shardingAlgorithms:
         database_default_inline:
           props:
             algorithm-expression: ds_0
           type: INLINE
         ds_t1_alg:
           props:
             algorithm-expression: ds_${ds_id % 1}
           type: INLINE
         ts_t1_alg:
           props:
             algorithm-expression: ts_${ts_id % 1}
           type: INLINE
       tables:
         t1:
           actualDataNodes: ds_${0..0}.ts_${0..0}
           databaseStrategy:
             standard:
               shardingAlgorithmName: ds_t1_alg
               shardingColumn: ds_id
           tableStrategy:
             standard:
               shardingAlgorithmName: ts_t1_alg
               shardingColumn: ts_id
   ```
   
   


-- 
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]

Reply via email to