apache / apache/shardingsphere

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

Open
#30,603 2 comments 0 reactions 0 assignees View on GitHub
in: proxy type: bug
Dominant language
Java
Stars
20.8k
Forks
6.9k
Avg merge
11h 35m
Merged PRs (30d)
326

Description

## 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.

```yaml
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
```

2. 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).

Contributor guide

Open the contributing guide

Research direction

Start with the server.yaml configuration and reproduce the issue in ShardingSphere-Proxy using SHOW DATABASE, SHOW TABLES, and SELECT * FROM mysql.columns_priv with no storage units. Trace how QueryResultMetaData reaches MySQL protocol handling; done means these queries return empty results without lost-connection or protocol exceptions.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, mysql
Domain
backend-api-design, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.