Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoSuchElementException when execute DALStatement without USE DB #34224

Open
RaigorJiang opened this issue Jan 2, 2025 · 0 comments
Open

NoSuchElementException when execute DALStatement without USE DB #34224

RaigorJiang opened this issue Jan 2, 2025 · 0 comments

Comments

@RaigorJiang
Copy link
Contributor

RaigorJiang commented Jan 2, 2025

Bug Report

Which version of ShardingSphere did you use?

5.5.2-SNAPSHOT a6a09ba

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

ShardingSphere-Proxy

Expected behavior

Query from unicast database

Actual behavior

image

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

  1. Create logical database and register storage unit;
  2. Quit current session;
  3. Connect to Proxy and do not execute USE DB;
  4. Execute SQL
show variables where Variable_name in ('explicit_defaults_for_timestamp', 'sql_mode');
  1. Proxy log
java.util.NoSuchElementException: null
	at java.base/java.util.Collections$EmptyIterator.next(Collections.java:4310)
	at org.apache.shardingsphere.infra.session.query.QueryContext.getUsedDatabase(QueryContext.java:95)
	at org.apache.shardingsphere.proxy.backend.connector.StandardDatabaseConnector.<init>(StandardDatabaseConnector.java:126)
	at org.apache.shardingsphere.proxy.backend.connector.DatabaseConnectorFactory.newInstance(DatabaseConnectorFactory.java:52)
	at org.apache.shardingsphere.proxy.backend.handler.data.impl.UnicastDatabaseBackendHandler.execute(UnicastDatabaseBackendHandler.java:62)
	at org.apache.shardingsphere.proxy.frontend.mysql.command.query.text.query.MySQLComQueryPacketExecutor.execute(MySQLComQueryPacketExecutor.java:93)
	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.doExecuteCommand(CommandExecutorTask.java:126)
	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:121)
	at org.apache.shardingsphere.proxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:78)
	at com.alibaba.ttl.TtlRunnable.run(TtlRunnable.java:60)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:840)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant