question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

When use DistSQL excute 'preview select * from e;' ,Showing unexpected results

See original GitHub issue

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?

we find java version: java8, full_version=1.8.0_312
ShardingSphere-5.1.3-SNAPSHOT
Commit ID: dirty-7bfa655d42754ec1144d26af7089962703d840e6
Commit Message: Optimize sharding tables route logic when execute cursor statement (#18413)
Branch: 7bfa655d42754ec1144d26af7089962703d840e6
Build time: 2022-06-20T10:04:48+0800

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

ShardingSphere-Proxy

Expected behavior

sharding_db=>       preview select * from  e;
      preview select * from  f;
      preview select * from  g; data_source_name |    actual_sql
------------------+------------------
 ds_1             | select * from  e
(1 row)

sharding_db=>  data_source_name |    actual_sql
------------------+------------------
 ds_2            | select * from  f
(1 row)

sharding_db=>
 data_source_name |    actual_sql
------------------+------------------
 ds_3             | select * from  g
(1 row)

Actual behavior

sharding_db=>       preview select * from  e;
      preview select * from  f;
      preview select * from  g; data_source_name |    actual_sql
------------------+------------------
 ds_1             | select * from  e
(1 row)

sharding_db=>  data_source_name |    actual_sql
------------------+------------------
 ds_1             | select * from  f
(1 row)

sharding_db=>
 data_source_name |    actual_sql
------------------+------------------
 ds_2             | select * from  g
(1 row)

Reason analyze (If you can)

use yaml Show the normal but use distsql ‘ALTER SQL_PARSER RULE SQL_COMMENT_PARSE_ENABLE=true;’ ,Showing unexpected results maybe distsql have bug?

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

server.yaml

mode:
  type: Cluster
  repository:
    type: ZooKeeper
    props:
      namespace: 630_dzq
      server-lists: ip:2181
      retryIntervalMilliseconds: 500
      timeToLiveSeconds: 60
      maxRetries: 3
      operationTimeoutMilliseconds: 500
  overwrite: true

rules:
  - !AUTHORITY
    users:
      - root@%:root
    provider:
      type: ALL_PERMITTED

props:
  sql-show: true

sql

/* ShardingSphere hint: dataSourceName=ds_1 */ CREATE TABLE e(id int, name char);
INSERT INTO e(id, name) VALUES(1, '1'), (2, '2'), (3, '3');

/* ShardingSphere hint: dataSourceName=ds_2 */ CREATE TABLE f(id int, name char);
INSERT INTO f(id, name) VALUES(1, '1'), (2, '2'), (3, '3');

/* ShardingSphere hint: dataSourceName=ds_3 */ CREATE TABLE g(id int, name char);
INSERT INTO g(id, name) VALUES(1, '1'), (2, '2'), (3, '3');

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

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
wsm12138commented, Jun 21, 2022

@lanchengx @RaigorJiang please take a look

0reactions
RaigorJiangcommented, Jul 20, 2022

OK, thank you @tuichenchuxin

Read more comments on GitHub >

github_iconTop Results From Across the Web

What's New in v22.1 | CockroachDB Docs
#87874; On the SQL Activity "Session Details" page, the "Most Recent Statement" column now shows the last active query instead of "No Active...
Read more >
RELEASE-NOTES.md · ShardingSphere/Apache ... - Gitee
... Fix the NPE when the CREATE SHARDING TABLE RULE statement does not specify the sub-database and sub-table strategy; Fix NPE when PREVIEW...
Read more >
Distributed Functions of DB2 for z/OS and OS/390 - IDUG
iSeries Query Manager and SQL Development Kit licensed programs to use the DRDA support or to run programs with embedded SQL statements on...
Read more >
Socrates: The New SQL Server in the Cloud (Sigmod 2019)
Figure 2 shows the Socrates architecture. ... This result is not unexpected for a service in preview, especially considering that HADR has ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found