apache / apache/shardingsphere

LOCK TABLES `table` write failed

Open
#32,289 3 comments 0 reactions 0 assignees View on GitHub
feature: sharding in: proxy status: volunteer wanted
Dominant language
Java
Stars
20.8k
Forks
6.9k
Avg merge
11h 38m
Merged PRs (30d)
326

Description

## Bug Report

**For English only**, other languages will not accept.

Before report a bug, make sure you have:

- Searched open and closed [GitHub issues](https://github.com/apache/shardingsphere/issues).
- Read documentation: [ShardingSphere Doc](https://shardingsphere.apache.org/document/current/en/overview).

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

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the LOCK TABLES statement in ShardingSphere-Proxy with the provided storage-unit, sharding-rule, and table-creation SQL. Trace how the statement resolves the logical table across sbtest_0 and sbtest_1; done means the command succeeds without reporting that sbtest1 is missing.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, mysql, sql
Domain
databases, distributed-systems
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.