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

LOCK TABLES table write failed #32289

Open
dobet opened this issue Jul 26, 2024 · 2 comments
Open

LOCK TABLES table write failed #32289

dobet opened this issue Jul 26, 2024 · 2 comments

Comments

@dobet
Copy link

dobet commented Jul 26, 2024

Bug Report

For English only, other languages will not accept.

Before report a bug, make sure you have:

Please pay attention on issues you submitted, because we maybe need more details.
If no response anymore and we cannot reproduce it on current information, we will close it.

Please answer these questions before submitting your issue. Thanks!

Which version of ShardingSphere did you use?

5.5.0

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

ShardingSphere-Proxy

Expected behavior

do this success

lock tables `sbtest` write;

Actual behavior

SQL 错误 [1146] [42S02]: Table 'sbtest_1.sbtest1' doesn't exist

Reason analyze (If you can)

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

create database sbtest;

use sbtest;

REGISTER STORAGE UNIT ds_0 (
	HOST="192.168.116.12",
	PORT=3306,
	DB="sbtest_0",
	USER="root",
	PASSWORD="Qwer1234"
);

REGISTER STORAGE UNIT ds_1 (
	HOST="192.168.116.12",
	PORT=3306,
	DB="sbtest_1",
	USER="root",
	PASSWORD="Qwer1234"
);

create sharding table rule sbtest1 (
	STORAGE_UNITS(ds_0,ds_1),
	SHARDING_COLUMN=id,
	TYPE(NAME="hash_mod",PROPERTIES("sharding-count"="2")),
	KEY_GENERATE_STRATEGY(COLUMN=order_id,TYPE(NAME="snowflake"))
)

create table sbtest1 (id int)

lock tables sbtest1 write;

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

@dobet
Copy link
Author

dobet commented Jul 26, 2024

the stack is:

[INFO ] 2024-07-27 00:51:27.190 [ShardingSphere-Command-0] ShardingSphere-SQL - Logic SQL: /* ApplicationName=DBeaver 24.0.0 - SQLEditor <Script-1.sql> */ create table sbtest1 (id int)
[INFO ] 2024-07-27 00:51:27.190 [ShardingSphere-Command-0] ShardingSphere-SQL - Actual SQL: ds_1 ::: /* ApplicationName=DBeaver 24.0.0 - SQLEditor <Script-1.sql> */ create table sbtest1_1 (id int)
[INFO ] 2024-07-27 00:51:27.190 [ShardingSphere-Command-0] ShardingSphere-SQL - Actual SQL: ds_0 ::: /* ApplicationName=DBeaver 24.0.0 - SQLEditor <Script-1.sql> */ create table sbtest1_0 (id int)
[INFO ] 2024-07-27 00:51:31.888 [ShardingSphere-Command-0] ShardingSphere-SQL - Logic SQL: /* ApplicationName=DBeaver 24.0.0 - SQLEditor <Script-1.sql> */ lock tables sbtest1 write
[INFO ] 2024-07-27 00:51:31.888 [ShardingSphere-Command-0] ShardingSphere-SQL - Actual SQL: ds_1 ::: /* ApplicationName=DBeaver 24.0.0 - SQLEditor <Script-1.sql> */ lock tables sbtest1 write
[INFO ] 2024-07-27 00:51:31.888 [ShardingSphere-Command-0] ShardingSphere-SQL - Actual SQL: ds_0 ::: /* ApplicationName=DBeaver 24.0.0 - SQLEditor <Script-1.sql> */ lock tables sbtest1 write
[ERROR] 2024-07-27 00:51:31.898 [ShardingSphere-Command-0] o.a.s.p.f.c.CommandExecutorTask - Exception occur: 
java.sql.SQLSyntaxErrorException: Table 'sbtest_1.sbtest1' doesn't exist
	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:121)
	at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
	at com.mysql.cj.jdbc.StatementImpl.executeInternal(StatementImpl.java:770)
	at com.mysql.cj.jdbc.StatementImpl.execute(StatementImpl.java:787)
	at com.zaxxer.hikari.pool.ProxyStatement.execute(ProxyStatement.java:102)
	at com.zaxxer.hikari.pool.HikariProxyStatement.execute(HikariProxyStatement.java)
	at org.apache.shardingsphere.proxy.backend.connector.jdbc.executor.callback.impl.ProxyStatementExecutorCallback.execute(ProxyStatementExecutorCallback.java:44)
	at org.apache.shardingsphere.proxy.backend.connector.jdbc.executor.callback.ProxyJDBCExecutorCallback.executeSQL(ProxyJDBCExecutorCallback.java:69)
	at org.apache.shardingsphere.proxy.backend.connector.jdbc.executor.callback.ProxyJDBCExecutorCallback.executeSQL(ProxyJDBCExecutorCallback.java:46)
	at org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutorCallback.execute(JDBCExecutorCallback.java:85)
	at org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutorCallback.execute(JDBCExecutorCallback.java:64)
	at org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine.syncExecute(ExecutorEngine.java:99)
	at org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine.parallelExecute(ExecutorEngine.java:95)
	at org.apache.shardingsphere.infra.executor.kernel.ExecutorEngine.execute(ExecutorEngine.java:78)
	at org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutor.execute(JDBCExecutor.java:66)
	at org.apache.shardingsphere.proxy.backend.connector.jdbc.executor.ProxyJDBCExecutor.execute(ProxyJDBCExecutor.java:73)
	at org.apache.shardingsphere.proxy.backend.connector.ProxySQLExecutor.useDriverToExecute(ProxySQLExecutor.java:217)
	at org.apache.shardingsphere.proxy.backend.connector.ProxySQLExecutor.execute(ProxySQLExecutor.java:176)
	at org.apache.shardingsphere.proxy.backend.connector.DatabaseConnector.doExecute(DatabaseConnector.java:220)
	at org.apache.shardingsphere.proxy.backend.connector.DatabaseConnector.execute(DatabaseConnector.java:173)
	at org.apache.shardingsphere.proxy.frontend.mysql.command.query.text.query.MySQLComQueryPacketExecutor.execute(MySQLComQueryPacketExecutor.java:86)
	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:1130)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
	at java.base/java.lang.Thread.run(Thread.java:831)

@dobet
Copy link
Author

dobet commented Jul 26, 2024

maybe is sql router error, because get an " Table 'sbtest_1.sbtest1' doesn't exist", real table is sbtest_1.sbtest1_1.

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

2 participants