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

Support Information Functions for MySQL #2235

Closed
tristaZero opened this issue Apr 19, 2019 · 6 comments
Closed

Support Information Functions for MySQL #2235

tristaZero opened this issue Apr 19, 2019 · 6 comments

Comments

@tristaZero
Copy link
Contributor

tristaZero commented Apr 19, 2019

Which version of ShardingSphere did you use?

4.0.0.0-RC1

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

Sharding-Proxy

Expected behavior

  1. input select database();
  2. return current schema name;

Actual behavior

  1. input select database();
  2. return actual data node name, e.g.
mysql> select database();
+-----------------+
| database()      |
+-----------------+
| demo_ds_slave_0 |
+-----------------+

Reason analyze (If you can)

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

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

@Moriadry-zz
Copy link

Hi miss, I am wondering do you guys get a way to integration test sharding-proxy, I don't know how to debug this kind of bugs locally.

@tuohai666
Copy link
Member

@moriadry
Download sharding-proxy from: https://www.apache.org/dyn/closer.cgi?path=incubator/shardingsphere/4.0.0-RC1/apache-shardingsphere-incubating-4.0.0-RC1-sharding-proxy-bin.tar.gz
You can start this binary package locally. Don't forget to copy mysql-connector-java-5.1.47 to lib directory manually.

@Moriadry-zz
Copy link

Get it.

@terrymanu terrymanu self-assigned this May 14, 2019
@terrymanu terrymanu changed the title Return error result for select database(); Support Information Functions for MySQL May 14, 2019
@terrymanu terrymanu added this to the 4.0.0.M2 milestone May 14, 2019
@terrymanu
Copy link
Member

@totalo
Copy link
Member

totalo commented Apr 13, 2021

Hello, I want to try to do this. I want to know whether we aggregate the data of these Informations or choose a table to display. How do we distinguish nodes from different sources when we aggregate?

@sandynz
Copy link
Contributor

sandynz commented Sep 13, 2021

In 5.0.0-RC1, test result:

mysql> select database();
+-------------+
| DATABASE()  |
+-------------+
| sharding_db |
+-------------+

It's already implemented in #8539, related code is ShowCurrentDatabaseExecutor:

    public void execute(final BackendConnection backendConnection) {
        mergedResult = new SingleLocalDataMergedResult(Collections.singleton(backendConnection.getSchemaName()));
    }

It return current connection related schema name.

@sandynz sandynz closed this as completed Sep 13, 2021
@sandynz sandynz added this to the 5.0.0-RC1 milestone Sep 13, 2021
@menghaoranss menghaoranss modified the milestones: 5.0.0-RC1, 5.0.0 Oct 26, 2021
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

7 participants