<h2 dir="auto">Bug Report</h2>
<p dir="auto">i use shardingsphere-proxy for 5 mysql shard<br>
use proxy for making id by showflake<br>
but insert data is not correct<br>
data insert to wrong shard</p>
<p dir="auto">this is my table</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="CREATE TABLE `person` (
  `id` varchar(32) NOT NULL,
  `name` varchar(16) DEFAULT NULL,
  `age` int(2) DEFAULT NULL,
  `gender` varchar(2) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
"><pre class="notranslate"><code class="notranslate">CREATE TABLE `person` (
  `id` varchar(32) NOT NULL,
  `name` varchar(16) DEFAULT NULL,
  `age` int(2) DEFAULT NULL,
  `gender` varchar(2) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

</code></pre></div>
<p dir="auto">this is my insert sql</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="insert `person` (`name`, `age`) VALUES ('a',1),('a',1),('a',1),('a',1),('a',1),('a',1),('a',1),('a',1),('a',1),('a',1)"><pre class="notranslate"><code class="notranslate">insert `person` (`name`, `age`) VALUES ('a',1),('a',1),('a',1),('a',1),('a',1),('a',1),('a',1),('a',1),('a',1),('a',1)
</code></pre></div>
<p dir="auto">and this is the log</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[INFO ] 14:14:12.246 [ShardingSphere-Command-1] ShardingSphere-SQL - Actual SQL: ds_4 ::: insert `person` (`name`, `age`, id) VALUES ('a', 1, 452837411152461833), ('a', 1, 452837411152461828)
[INFO ] 14:14:12.246 [ShardingSphere-Command-1] ShardingSphere-SQL - Actual SQL: ds_0 ::: insert `person` (`name`, `age`, id) VALUES ('a', 1, 452837411152461832), ('a', 1, 452837411152461827)
[INFO ] 14:14:12.246 [ShardingSphere-Command-1] ShardingSphere-SQL - Actual SQL: ds_1 ::: insert `person` (`name`, `age`, id) VALUES ('a', 1, 452837411152461831), ('a', 1, 452837411152461826)
[INFO ] 14:14:12.246 [ShardingSphere-Command-1] ShardingSphere-SQL - Actual SQL: ds_2 ::: insert `person` (`name`, `age`, id) VALUES ('a', 1, 452837411152461830), ('a', 1, 452837411152461825)
[INFO ] 14:14:12.246 [ShardingSphere-Command-1] ShardingSphere-SQL - Actual SQL: ds_3 ::: insert `person` (`name`, `age`, id) VALUES ('a', 1, 452837411152461829), ('a', 1, 452837411152461824)
"><pre class="notranslate"><code class="notranslate">[INFO ] 14:14:12.246 [ShardingSphere-Command-1] ShardingSphere-SQL - Actual SQL: ds_4 ::: insert `person` (`name`, `age`, id) VALUES ('a', 1, 452837411152461833), ('a', 1, 452837411152461828)
[INFO ] 14:14:12.246 [ShardingSphere-Command-1] ShardingSphere-SQL - Actual SQL: ds_0 ::: insert `person` (`name`, `age`, id) VALUES ('a', 1, 452837411152461832), ('a', 1, 452837411152461827)
[INFO ] 14:14:12.246 [ShardingSphere-Command-1] ShardingSphere-SQL - Actual SQL: ds_1 ::: insert `person` (`name`, `age`, id) VALUES ('a', 1, 452837411152461831), ('a', 1, 452837411152461826)
[INFO ] 14:14:12.246 [ShardingSphere-Command-1] ShardingSphere-SQL - Actual SQL: ds_2 ::: insert `person` (`name`, `age`, id) VALUES ('a', 1, 452837411152461830), ('a', 1, 452837411152461825)
[INFO ] 14:14:12.246 [ShardingSphere-Command-1] ShardingSphere-SQL - Actual SQL: ds_3 ::: insert `person` (`name`, `age`, id) VALUES ('a', 1, 452837411152461829), ('a', 1, 452837411152461824)

</code></pre></div>
<p dir="auto">only mod=1 is correct<br>
so, I cannot select result from this table, such as</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="select * from person where `id` = '452837411152461832'"><pre class="notranslate"><code class="notranslate">select * from person where `id` = '452837411152461832'
</code></pre></div>
<p dir="auto">this is my config</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="schemaName: sharding_db


dataSources:
  ds_0:
    url: jdbc:mysql://127.0.0.1:13386/shardingsphere?allowMultiQueries=true&amp;useUnicode=true&amp;characterEncoding=UTF-8
    username: root
    password: 123456
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 1800000
    maxPoolSize: 65
  ds_1:
    url: jdbc:mysql://127.0.0.1:13387/shardingsphere?allowMultiQueries=true&amp;useUnicode=true&amp;characterEncoding=UTF-8
    username: root
    password: 123456
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 1800000
    maxPoolSize: 65
  ds_2:
    url: jdbc:mysql://127.0.0.1:13388/shardingsphere?allowMultiQueries=true&amp;useUnicode=true&amp;characterEncoding=UTF-8
    username: root
    password: 123456
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 1800000
    maxPoolSize: 65
  ds_3:
    url: jdbc:mysql://127.0.0.1:13389/shardingsphere?allowMultiQueries=true&amp;useUnicode=true&amp;characterEncoding=UTF-8
    username: root
    password: 123456
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 1800000
    maxPoolSize: 65
  ds_4:
    url: jdbc:mysql://127.0.0.1:13390/shardingsphere?allowMultiQueries=true&amp;useUnicode=true&amp;characterEncoding=UTF-8
    username: root
    password: 123456
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 1800000
    maxPoolSize: 65

shardingRule:
  tables:
    person:
      actualDataNodes: ds_${0..4}.person
      databaseStrategy:
        inline:
          shardingColumn: id
          algorithmExpression: ds_${id.toLong() % 5}
#          algorithmExpression: ds${id % 2}
      keyGenerator:
        type: SNOWFLAKE
        column: id"><pre class="notranslate"><code class="notranslate">schemaName: sharding_db


dataSources:
  ds_0:
    url: jdbc:mysql://127.0.0.1:13386/shardingsphere?allowMultiQueries=true&amp;useUnicode=true&amp;characterEncoding=UTF-8
    username: root
    password: 123456
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 1800000
    maxPoolSize: 65
  ds_1:
    url: jdbc:mysql://127.0.0.1:13387/shardingsphere?allowMultiQueries=true&amp;useUnicode=true&amp;characterEncoding=UTF-8
    username: root
    password: 123456
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 1800000
    maxPoolSize: 65
  ds_2:
    url: jdbc:mysql://127.0.0.1:13388/shardingsphere?allowMultiQueries=true&amp;useUnicode=true&amp;characterEncoding=UTF-8
    username: root
    password: 123456
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 1800000
    maxPoolSize: 65
  ds_3:
    url: jdbc:mysql://127.0.0.1:13389/shardingsphere?allowMultiQueries=true&amp;useUnicode=true&amp;characterEncoding=UTF-8
    username: root
    password: 123456
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 1800000
    maxPoolSize: 65
  ds_4:
    url: jdbc:mysql://127.0.0.1:13390/shardingsphere?allowMultiQueries=true&amp;useUnicode=true&amp;characterEncoding=UTF-8
    username: root
    password: 123456
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 1800000
    maxPoolSize: 65

shardingRule:
  tables:
    person:
      actualDataNodes: ds_${0..4}.person
      databaseStrategy:
        inline:
          shardingColumn: id
          algorithmExpression: ds_${id.toLong() % 5}
#          algorithmExpression: ds${id % 2}
      keyGenerator:
        type: SNOWFLAKE
        column: id
</code></pre></div>
<h3 dir="auto">Which version of ShardingSphere did you use?</h3>
<p dir="auto">4.0.0</p>
<h3 dir="auto">Which project did you use? Sharding-JDBC or Sharding-Proxy?</h3>
<p dir="auto">Sharding-Proxy</p>
<h3 dir="auto">Expected behavior</h3>
<p dir="auto">insert to right sharding</p>
<h3 dir="auto">Actual behavior</h3>
<p dir="auto">insert to incorrect sharding</p>
<h3 dir="auto">Reason analyze (If you can)</h3>
<h3 dir="auto">Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.</h3>
<h3 dir="auto">Example codes for reproduce this issue (such as a github link).</h3>
<h2 dir="auto">Bug Report</h2>
<p dir="auto"><strong>For English only</strong>, other languages will not accept.</p>
<p dir="auto">Before report a bug, make sure you have:</p>
<ul dir="auto">
<li>Searched open and closed <a href="https://github.com/apache/shardingsphere/issues">GitHub issues</a>.</li>
<li>Read documentation: <a href="https://shardingsphere.apache.org/document/current/en/overview" rel="nofollow">ShardingSphere Doc</a>.</li>
</ul>
<p dir="auto">Please pay attention on issues you submitted, because we maybe need more details.<br>
If no response <strong>more than 7 days</strong> and we cannot reproduce it on current information, we will <strong>close it</strong>.</p>
<p dir="auto">Please answer these questions before submitting your issue. Thanks!</p>
<h3 dir="auto">Which version of ShardingSphere did you use?</h3>
<p dir="auto">4.1.0</p>
<h3 dir="auto">Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?</h3>
<p dir="auto">ShardingSphere-Proxy</p>
<h3 dir="auto">Expected behavior</h3>
<p dir="auto">MySQL Server is 8.0.20<br>
MySQL Connector/J 8.X Above version connection success</p>
<h3 dir="auto">Actual behavior</h3>
<p dir="auto">java.sql.SQLException: Unknown system variable 'query_cache_size'</p>
<h3 dir="auto">Reason analyze (If you can)</h3>
<p dir="auto"><a href="url">https://github.com/apache/shardingsphere/blob/master/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLServerInfo.java</a> file constant SERVER_VERSION.This constant is returned by the handshake protocol. In java client jar file com.mysql.cj.NativeSession will determine the version number of the server.Code is:<br>
if (!versionMeetsMinimum(8, 0, 3)) {<br>
queryBuf.append(", @@query_cache_size AS query_cache_size");<br>
queryBuf.append(", @@query_cache_type AS query_cache_type");<br>
}<br>
But mysql server 8 abandon ‘query_cache_size’</p>
<h3 dir="auto">Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.</h3>
<p dir="auto">Mysql server 8.0.20</p>
<p dir="auto">Java client maven import</p>
<div class="highlight highlight-text-xml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&lt;dependency&gt;
    &lt;groupId&gt;mysql&lt;/groupId&gt;
    &lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt;
    &lt;version&gt;8.0.20&lt;/version&gt;
&lt;/dependency&gt;"><pre class="notranslate">&lt;<span class="pl-ent">dependency</span>&gt;
    &lt;<span class="pl-ent">groupId</span>&gt;mysql&lt;/<span class="pl-ent">groupId</span>&gt;
    &lt;<span class="pl-ent">artifactId</span>&gt;mysql-connector-java&lt;/<span class="pl-ent">artifactId</span>&gt;
    &lt;<span class="pl-ent">version</span>&gt;8.0.20&lt;/<span class="pl-ent">version</span>&gt;
&lt;/<span class="pl-ent">dependency</span>&gt;</pre></div>
<h3 dir="auto">Example codes for reproduce this issue (such as a github link).</h3>