<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/incubator-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.0.0-RC3-SNAPSHOT</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">Transaction terminate correctly.</p>
<h3 dir="auto">Actual behavior</h3>
<p dir="auto">[WARN ] 13:56:35.511 [ShardingSphere-Command-7] o.a.s.s.b.c.j.c.BackendConnection - Current transaction have not terminated, retry count:[3].<br>
[WARN ] 13:56:35.712 [ShardingSphere-Command-7] o.a.s.s.b.c.j.c.BackendConnection - Current transaction have not terminated, retry count:[4].<br>
[WARN ] 13:56:35.912 [ShardingSphere-Command-7] o.a.s.s.b.c.j.c.BackendConnection - Current transaction have not terminated, retry count:[5].<br>
[ERROR] 13:56:35.912 [ShardingSphere-Command-7] o.a.s.s.b.c.j.c.BackendConnection - Cannot do switch, exceed maximum retry count:[5].<br>
[ERROR] 13:56:35.912 [ShardingSphere-Command-7] o.a.s.s.f.c.CommandExecutorTask - Exception occur:<br>
org.apache.shardingsphere.core.exception.ShardingException: Failed to switch schema, please terminate current transaction.<br>
at org.apache.shardingsphere.shardingproxy.backend.communication.jdbc.connection.BackendConnection.setCurrentSchema(BackendConnection.java:107)<br>
at org.apache.shardingsphere.shardingproxy.backend.text.admin.BroadcastBackendHandler.execute(BroadcastBackendHandler.java:53)<br>
at org.apache.shardingsphere.shardingproxy.frontend.mysql.command.query.text.query.MySQLComQueryPacketExecutor.execute(MySQLComQueryPacketExecutor.java:72)<br>
at org.apache.shardingsphere.shardingproxy.frontend.command.CommandExecutorTask.executeCommand(CommandExecutorTask.java:86)<br>
at org.apache.shardingsphere.shardingproxy.frontend.command.CommandExecutorTask.run(CommandExecutorTask.java:66)<br>
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)<br>
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)<br>
at java.lang.Thread.run(Thread.java:748)</p>
<h3 dir="auto">Reason analyze (If you can)</h3>
<p dir="auto">This pr(<a href="https://github.com/apache/incubator-shardingsphere/pull/2119/files">https://github.com/apache/incubator-shardingsphere/pull/2119/files</a>) add setCurrentSchema() which will throw exception when a transaction is not terminated.</p>
<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>
<p dir="auto">For English only, other languages we will close it directly.</p>
<p dir="auto">Please answer these questions before submitting your issue. Thanks!</p>
<h3 dir="auto">Which version of Sharding-Sphere do you using?</h3>
<h3 dir="auto">Which project do you using? Sharding-JDBC or Sharding-Proxy?</h3>
<h3 dir="auto">Expected behavior</h3>
<h3 dir="auto">Actual behavior</h3>
<h3 dir="auto">Reason analyze</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">For bug report, please <em>MUST</em> provide the reproduce example codes (such as a github link).</h3>