apache / shardingsphere

Empowering Data Intelligence with Distributed SQL for Sharding, Scalability, and Security Across All Databases.
Apache License 2.0
19.97k stars 6.75k forks source link

Lost connection exceptions occur when I execute select system tables query in Proxy without any storage units #30603

Open strongduanmu opened 8 months ago

strongduanmu commented 8 months ago

Bug Report

Which version of ShardingSphere did you use?

c6286ee

Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?

ShardingSphere-Proxy

Expected behavior

Return empty result when execute select system tables query in Proxy without any storage units

Actual behavior

image image

Reason analyze (If you can)

QueryResultMetaData return empty columns metadata, this causes a MySQL protocol error.

image

Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.

  1. config server.yaml first.
mode:
  type: Cluster
  repository:
    type: ZooKeeper
    props:
      namespace: governance_ds_os_1122
      server-lists: localhost:2181
      retryIntervalMilliseconds: 500
      timeToLiveSeconds: 60
      maxRetries: 3
      operationTimeoutMilliseconds: 500

authority:
  users:
    - user: root@%
      password: root
    - user: sharding
      password: sharding
  privilege:
    type: ALL_PERMITTED

transaction:
  defaultType: XA
  providerType: Atomikos

sqlParser:
  sqlStatementCache:
    initialCapacity: 2000
    maximumSize: 65535
  parseTreeCache:
    initialCapacity: 128
    maximumSize: 1024

logging:
  loggers:
  - loggerName: org.apache.shardingsphere
    additivity: true
    level: DEBUG
    props:
      enable: true

sqlFederation:
  sqlFederationEnabled: false
  executionPlanCache:
    initialCapacity: 2000
    maximumSize: 65535

props:
  system-log-level: DEBUG
  max-connections-size-per-query: 1
  kernel-executor-size: 16  # Infinite by default.
  proxy-frontend-flush-threshold: 128  # The default value is 128.
  # sql-show is the same as props in logger ShardingSphere-SQL, and its priority is lower than logging rule
  sql-show: false
  check-table-metadata-enabled: false
    # Proxy backend query fetch size. A larger value may increase the memory usage of ShardingSphere Proxy.
    # The default value is -1, which means set the minimum value for different JDBC drivers.
  proxy-backend-query-fetch-size: -1
  proxy-frontend-executor-size: 0 # Proxy frontend executor size. The default value is 0, which means let Netty decide.
  proxy-frontend-max-connections: 0 # Less than or equal to 0 means no limitation.
  proxy-default-port: 3307 # Proxy default port.
  proxy-netty-backlog: 1024 # Proxy netty backlog.
  cdc-server-port: 33071 # CDC server port
  proxy-frontend-ssl-enabled: false
  proxy-frontend-ssl-cipher: ''
  proxy-frontend-ssl-version: TLSv1.2,TLSv1.3
  proxy-meta-data-collector-enabled: true
  1. Then run Proxy and execute SHOW DATABASE, SHOW TABLES, SELECT * FROM mysql.columns_priv sqls, you will get the exception.

Example codes for reproduce this issue (such as a github link).

strongduanmu commented 8 months ago

In addition to MySQL, we also need to pay attention to whether PG and OG are processed correctly.

github-actions[bot] commented 6 months ago

There hasn't been any activity on this issue recently, and in order to prioritize active issues, it will be marked as stale.