<h2 dir="auto">Feature Request</h2>
<p dir="auto">4.0.0-RC3 version not support ON DUPLICATE KEY UPDATE parameters<br>
<strong>For English only</strong>, other languages will not accept.</p>
<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 make decision by 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">Is your feature request related to a problem?</h3>
<p dir="auto"><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="505159841" data-permission-text="Title is private" data-url="https://github.com/apache/shardingsphere/issues/3210" data-hovercard-type="issue" data-hovercard-url="/apache/shardingsphere/issues/3210/hovercard" href="https://github.com/apache/shardingsphere/issues/3210">#3210</a><br>
<a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="399233359" data-permission-text="Title is private" data-url="https://github.com/apache/shardingsphere/issues/1756" data-hovercard-type="issue" data-hovercard-url="/apache/shardingsphere/issues/1756/hovercard" href="https://github.com/apache/shardingsphere/issues/1756">#1756</a></p>
<h3 dir="auto">Describe the feature you would like.</h3>
<h2 dir="auto">ON DUPLICATE KEY UPDATE support parameters</h2>
<p dir="auto">this is my implement：</p>
<p dir="auto">add 3 files ：</p>
<p dir="auto">OnDuplicateKeyValuesExtractor.java</p>
<p dir="auto">package org.apache.shardingsphere.core.parse.core.extractor.impl.dml.insert;</p>
<p dir="auto">import java.util.ArrayList;<br>
import java.util.Collection;<br>
import java.util.Collections;<br>
import java.util.LinkedList;<br>
import java.util.List;<br>
import java.util.Map;</p>
<p dir="auto">import com.google.common.base.Optional;<br>
import org.antlr.v4.runtime.ParserRuleContext;<br>
import org.apache.shardingsphere.core.parse.core.extractor.api.CollectionSQLSegmentExtractor;<br>
import org.apache.shardingsphere.core.parse.core.extractor.impl.common.expression.ExpressionExtractor;<br>
import org.apache.shardingsphere.core.parse.core.extractor.util.ExtractorUtils;<br>
import org.apache.shardingsphere.core.parse.core.extractor.util.RuleName;<br>
import org.apache.shardingsphere.core.parse.sql.segment.dml.assignment.OnDuplicateKeyValuesSegment;<br>
import org.apache.shardingsphere.core.parse.sql.segment.dml.expr.ExpressionSegment;</p>
<p dir="auto">/**</p>
<ul dir="auto">
<li>
<p dir="auto">On duplicate key values extractor.</p>
</li>
<li></li>
<li>
<p dir="auto"><a class="user-mention notranslate" data-hovercard-type="organization" data-hovercard-url="/orgs/author/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/author">@author</a> sonny.zhao<br>
*/<br>
public final class OnDuplicateKeyValuesExtractor implements CollectionSQLSegmentExtractor {</p>
<p dir="auto">private final ExpressionExtractor expressionExtractor = new ExpressionExtractor();</p>
<p dir="auto"><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/OverRide/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/OverRide">@OverRide</a><br>
public Collection extract(final ParserRuleContext ancestorNode, final Map&lt;ParserRuleContext, Integer&gt; parameterMarkerIndexes) {<br>
Optional onDuplicateKeyValuesClauseNode = ExtractorUtils.findFirstChildNode(ancestorNode, RuleName.ON_DUPLICATE_KEY_CLAUSE);<br>
if (!onDuplicateKeyValuesClauseNode.isPresent()) {<br>
return Collections.emptyList();<br>
}<br>
Collection result = new LinkedList&lt;&gt;();<br>
result.add(new OnDuplicateKeyValuesSegment(onDuplicateKeyValuesClauseNode.get().getStart().getStartIndex(), onDuplicateKeyValuesClauseNode.get().getStop().getStopIndex(), extractExpressionSegments(onDuplicateKeyValuesClauseNode.get(), parameterMarkerIndexes)));<br>
return result;<br>
}</p>
<p dir="auto">private List extractExpressionSegments(final ParserRuleContext assignmentValuesNode, final Map&lt;ParserRuleContext, Integer&gt; parameterMarkerIndexes) {<br>
Collection parserRuleContexts = ExtractorUtils.getAllDescendantNodes(assignmentValuesNode, RuleName.PARAMETER_MARKER);<br>
List result = new ArrayList&lt;&gt;(parserRuleContexts.size());<br>
for (ParserRuleContext each : parserRuleContexts) {<br>
Optional&lt;? extends ExpressionSegment&gt; expressionSegment = expressionExtractor.extract(each, parameterMarkerIndexes);<br>
if (expressionSegment.isPresent()) {<br>
result.add(expressionSegment.get());<br>
}<br>
}<br>
return result;<br>
}<br>
}</p>
</li>
</ul>
<hr>
<p dir="auto">OnDuplicateKeyValuesFiller.java</p>
<p dir="auto">package org.apache.shardingsphere.core.parse.core.filler.impl.dml;</p>
<p dir="auto">import org.apache.shardingsphere.core.parse.core.filler.SQLSegmentFiller;<br>
import org.apache.shardingsphere.core.parse.sql.segment.dml.assignment.OnDuplicateKeyValuesSegment;<br>
import org.apache.shardingsphere.core.parse.sql.statement.SQLStatement;<br>
import org.apache.shardingsphere.core.parse.sql.statement.dml.InsertStatement;</p>
<p dir="auto">/**</p>
<ul dir="auto">
<li>
<p dir="auto">OnDuplicateKey values filler.</p>
</li>
<li></li>
<li>
<p dir="auto"><a class="user-mention notranslate" data-hovercard-type="organization" data-hovercard-url="/orgs/author/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/author">@author</a> sonny.zhao<br>
*/<br>
public final class OnDuplicateKeyValuesFiller implements SQLSegmentFiller {</p>
<p dir="auto"><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/OverRide/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/OverRide">@OverRide</a><br>
public void fill(final OnDuplicateKeyValuesSegment sqlSegment, final SQLStatement sqlStatement) {<br>
((InsertStatement) sqlStatement).getOnDuplicateKeyValues().add(sqlSegment);<br>
}<br>
}</p>
</li>
</ul>
<hr>
<p dir="auto">OnDuplicateKeyValueContext.java</p>
<p dir="auto">package org.apache.shardingsphere.core.preprocessor.segment.insert;</p>
<p dir="auto">import java.util.ArrayList;<br>
import java.util.Collection;<br>
import java.util.Collections;<br>
import java.util.List;</p>
<p dir="auto">import lombok.Getter;<br>
import lombok.ToString;<br>
import org.apache.shardingsphere.core.exception.ShardingException;<br>
import org.apache.shardingsphere.core.parse.sql.segment.dml.expr.ExpressionSegment;<br>
import org.apache.shardingsphere.core.parse.sql.segment.dml.expr.simple.LiteralExpressionSegment;<br>
import org.apache.shardingsphere.core.parse.sql.segment.dml.expr.simple.ParameterMarkerExpressionSegment;</p>
<p dir="auto">/**</p>
<ul dir="auto">
<li>
<p dir="auto">OnDuplicateKey value context.</p>
</li>
<li></li>
<li>
<p dir="auto"><a class="user-mention notranslate" data-hovercard-type="organization" data-hovercard-url="/orgs/author/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/author">@author</a> sonny.zhao<br>
*/<br>
<a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/getter/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/getter">@getter</a><br>
<a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/tostring/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/tostring">@tostring</a><br>
public final class OnDuplicateKeyValueContext {</p>
<p dir="auto">private final int parametersCount;</p>
<p dir="auto">private final List valueExpressions;</p>
<p dir="auto">private final List parameters;</p><p dir="auto"></p>
<p dir="auto">public OnDuplicateKeyValueContext(final Collection assignments, final List parameters, final int parametersOffset) {<br>
parametersCount = calculateParametersCount(assignments);<br>
valueExpressions = getValueExpressions(assignments);<br>
this.parameters = getParameters(parameters, parametersOffset);<br>
}</p><p dir="auto"></p>
<p dir="auto">private int calculateParametersCount(final Collection assignments) {<br>
int result = 0;<br>
for (ExpressionSegment each : assignments) {<br>
if (each instanceof ParameterMarkerExpressionSegment) {<br>
result++;<br>
}<br>
}<br>
return result;<br>
}</p>
<p dir="auto">private List getValueExpressions(final Collection assignments) {<br>
List result = new ArrayList&lt;&gt;(assignments.size());<br>
result.addAll(assignments);<br>
return result;<br>
}</p>
<p dir="auto">private List getParameters(final List parameters, final int parametersOffset) {<br>
if (0 == parametersCount) {<br>
return Collections.emptyList();<br>
}<br>
List result = new ArrayList&lt;&gt;(parametersCount);<br>
result.addAll(parameters.subList(parametersOffset, parametersOffset + parametersCount));<br>
return result;<br>
}</p><p dir="auto"></p>
<p dir="auto">/**</p>
<ul dir="auto">
<li>Get value.</li>
<li></li>
<li><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/param/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/param">@param</a> index index</li>
<li><a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/return/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/return">@return</a> value<br>
*/<br>
public Object getValue(final int index) {<br>
ExpressionSegment valueExpression = valueExpressions.get(index);<br>
return valueExpression instanceof ParameterMarkerExpressionSegment ? parameters.get(getParameterIndex(valueExpression)) : ((LiteralExpressionSegment) valueExpression).getLiterals();<br>
}</li>
</ul>
<p dir="auto">private int getParameterIndex(final ExpressionSegment valueExpression) {<br>
int result = 0;<br>
for (ExpressionSegment each : valueExpressions) {<br>
if (valueExpression == each) {<br>
return result;<br>
}<br>
if (each instanceof ParameterMarkerExpressionSegment) {<br>
result++;<br>
}<br>
}<br>
throw new ShardingException("Can not get parameter index.");<br>
}<br>
}</p>


<hr>
<h2 dir="auto">modify 5 files</h2>
<p dir="auto">extractor-rule-definition.xml</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=" &lt;extractor-rule id=&quot;onDuplicateKeyValuesColumns&quot; extractor-class=&quot;org.apache.shardingsphere.core.parse.core.extractor.impl.dml.insert.OnDuplicateKeyValuesExtractor&quot; /&gt;	"><pre class="notranslate"><code class="notranslate"> &lt;extractor-rule id="onDuplicateKeyValuesColumns" extractor-class="org.apache.shardingsphere.core.parse.core.extractor.impl.dml.insert.OnDuplicateKeyValuesExtractor" /&gt;	
</code></pre></div>
<hr>
<p dir="auto">filler-rule-definition.xml</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&lt;filler-rule sql-segment-class=&quot;org.apache.shardingsphere.core.parse.sql.segment.dml.assignment.OnDuplicateKeyValuesSegment&quot; filler-class=&quot;org.apache.shardingsphere.core.parse.core.filler.impl.dml.OnDuplicateKeyValuesFiller&quot; /&gt;"><pre class="notranslate"><code class="notranslate">&lt;filler-rule sql-segment-class="org.apache.shardingsphere.core.parse.sql.segment.dml.assignment.OnDuplicateKeyValuesSegment" filler-class="org.apache.shardingsphere.core.parse.core.filler.impl.dml.OnDuplicateKeyValuesFiller" /&gt;
</code></pre></div>
<hr>
<p dir="auto">sql-statement-rule-definition.xml</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&lt;sql-statement-rule context=&quot;insert&quot; sql-statement-class=&quot;org.apache.shardingsphere.core.parse.sql.statement.dml.InsertStatement&quot; extractor-rule-refs=&quot;table, columns, insertColumns, insertValues, setAssignments, onDuplicateKeyColumns, onDuplicateKeyValuesColumns&quot; /&gt;"><pre class="notranslate"><code class="notranslate">&lt;sql-statement-rule context="insert" sql-statement-class="org.apache.shardingsphere.core.parse.sql.statement.dml.InsertStatement" extractor-rule-refs="table, columns, insertColumns, insertValues, setAssignments, onDuplicateKeyColumns, onDuplicateKeyValuesColumns" /&gt;
</code></pre></div>
<hr>
<p dir="auto">InsertStatement.java</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="private final Collection&lt;OnDuplicateKeyValuesSegment&gt; onDuplicateKeyValues = new LinkedList&lt;&gt;();


public List&lt;List&lt;ExpressionSegment&gt;&gt; getAllOnDuplicateKeyValueExpressions() {
    return null == setAssignment ? OnDuplicateKeyValueExpressionsFromValues() : Collections.singletonList(getAllOnDuplicateKeyValueExpressionsFromSetAssignment());
}

private List&lt;List&lt;ExpressionSegment&gt;&gt; OnDuplicateKeyValueExpressionsFromValues() {
    List&lt;List&lt;ExpressionSegment&gt;&gt; result = new ArrayList&lt;&gt;(onDuplicateKeyValues.size());
    for (OnDuplicateKeyValuesSegment each : onDuplicateKeyValues) {
        result.add(each.getValues());
    }
    return result;
}

private List&lt;ExpressionSegment&gt; getAllOnDuplicateKeyValueExpressionsFromSetAssignment() {
    List&lt;ExpressionSegment&gt; result = new ArrayList&lt;&gt;(setAssignment.getAssignments().size());
    for (AssignmentSegment each : setAssignment.getAssignments()) {
        result.add(each.getValue());
    }
    return result;
}"><pre class="notranslate"><code class="notranslate">private final Collection&lt;OnDuplicateKeyValuesSegment&gt; onDuplicateKeyValues = new LinkedList&lt;&gt;();


public List&lt;List&lt;ExpressionSegment&gt;&gt; getAllOnDuplicateKeyValueExpressions() {
    return null == setAssignment ? OnDuplicateKeyValueExpressionsFromValues() : Collections.singletonList(getAllOnDuplicateKeyValueExpressionsFromSetAssignment());
}

private List&lt;List&lt;ExpressionSegment&gt;&gt; OnDuplicateKeyValueExpressionsFromValues() {
    List&lt;List&lt;ExpressionSegment&gt;&gt; result = new ArrayList&lt;&gt;(onDuplicateKeyValues.size());
    for (OnDuplicateKeyValuesSegment each : onDuplicateKeyValues) {
        result.add(each.getValues());
    }
    return result;
}

private List&lt;ExpressionSegment&gt; getAllOnDuplicateKeyValueExpressionsFromSetAssignment() {
    List&lt;ExpressionSegment&gt; result = new ArrayList&lt;&gt;(setAssignment.getAssignments().size());
    for (AssignmentSegment each : setAssignment.getAssignments()) {
        result.add(each.getValue());
    }
    return result;
}
</code></pre></div>
<hr>
<p dir="auto">InsertSQLStatementContext.java</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="private final List&lt;OnDuplicateKeyValueContext&gt; onDuplicateKeyValueContexts;

public InsertSQLStatementContext(final TableMetas tableMetas, final List&lt;Object&gt; parameters, final InsertStatement sqlStatement) {
    super(sqlStatement);
    columnNames = sqlStatement.useDefaultColumns() ? tableMetas.getAllColumnNames(getTablesContext().getSingleTableName()) : sqlStatement.getColumnNames();
    insertValueContexts = getInsertValueContexts(parameters);
    onDuplicateKeyValueContexts = getOnDuplicateKeyValueContexts(parameters); // add this row
}

private List&lt;OnDuplicateKeyValueContext&gt; getOnDuplicateKeyValueContexts(final List&lt;Object&gt; parameters) {
    List&lt;OnDuplicateKeyValueContext&gt; result = new LinkedList&lt;&gt;();
    int parametersOffset = 0;
    for (Collection&lt;ExpressionSegment&gt; each : ((InsertStatement) getSqlStatement()).getAllOnDuplicateKeyValueExpressions()) {
        OnDuplicateKeyValueContext onDuplicateKeyValueContext = new OnDuplicateKeyValueContext(each, parameters, parametersOffset);
        result.add(onDuplicateKeyValueContext);
        parametersOffset += onDuplicateKeyValueContext.getParametersCount();
    }
    return result;
}

//  this look like not grace , but two List not compatibility shardingConditions
public List&lt;List&lt;Object&gt;&gt; getGroupedParameters() {
    List&lt;List&lt;Object&gt;&gt; result = new LinkedList&lt;&gt;();
    List&lt;Object&gt; parameters = new ArrayList&lt;&gt;();

    for (InsertValueContext each : insertValueContexts) {
        parameters.addAll(each.getParameters());
    }

    for (OnDuplicateKeyValueContext each : onDuplicateKeyValueContexts) {
        parameters.addAll(each.getParameters());
    }
    result.add(parameters);
    return result;
}"><pre class="notranslate"><code class="notranslate">private final List&lt;OnDuplicateKeyValueContext&gt; onDuplicateKeyValueContexts;

public InsertSQLStatementContext(final TableMetas tableMetas, final List&lt;Object&gt; parameters, final InsertStatement sqlStatement) {
    super(sqlStatement);
    columnNames = sqlStatement.useDefaultColumns() ? tableMetas.getAllColumnNames(getTablesContext().getSingleTableName()) : sqlStatement.getColumnNames();
    insertValueContexts = getInsertValueContexts(parameters);
    onDuplicateKeyValueContexts = getOnDuplicateKeyValueContexts(parameters); // add this row
}

private List&lt;OnDuplicateKeyValueContext&gt; getOnDuplicateKeyValueContexts(final List&lt;Object&gt; parameters) {
    List&lt;OnDuplicateKeyValueContext&gt; result = new LinkedList&lt;&gt;();
    int parametersOffset = 0;
    for (Collection&lt;ExpressionSegment&gt; each : ((InsertStatement) getSqlStatement()).getAllOnDuplicateKeyValueExpressions()) {
        OnDuplicateKeyValueContext onDuplicateKeyValueContext = new OnDuplicateKeyValueContext(each, parameters, parametersOffset);
        result.add(onDuplicateKeyValueContext);
        parametersOffset += onDuplicateKeyValueContext.getParametersCount();
    }
    return result;
}

//  this look like not grace , but two List not compatibility shardingConditions
public List&lt;List&lt;Object&gt;&gt; getGroupedParameters() {
    List&lt;List&lt;Object&gt;&gt; result = new LinkedList&lt;&gt;();
    List&lt;Object&gt; parameters = new ArrayList&lt;&gt;();

    for (InsertValueContext each : insertValueContexts) {
        parameters.addAll(each.getParameters());
    }

    for (OnDuplicateKeyValueContext each : onDuplicateKeyValueContexts) {
        parameters.addAll(each.getParameters());
    }
    result.add(parameters);
    return result;
}
</code></pre></div>
<hr>
<p dir="auto">it worked  , but not perfect  ,please reference</p><p></p><p></p><p></p></li></ul>
<h3 dir="auto">Which version of ShardingSphere did you use?</h3>
<p dir="auto">master.</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">first time set proxy props take effect.</p>
<h3 dir="auto">Actual behavior</h3>
<p dir="auto">not take effect.</p>
<h3 dir="auto">Reason analyze (If you can)</h3>
<p dir="auto">Maybe less one event.</p>
<h3 dir="auto">Intuitive performance</h3>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/33742097/147039897-639b4b76-f385-4389-b312-6e840753dbc8.png"><img src="https://user-images.githubusercontent.com/33742097/147039897-639b4b76-f385-4389-b312-6e840753dbc8.png" alt="image" style="max-width: 100%;"></a></p>
<h3 dir="auto">Proxy configuration</h3>
<p dir="auto"><code class="notranslate">server.yaml:</code></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="mode:
  type: Cluster
  repository:
    type: ZooKeeper
    props:
      namespace: database_discovery
      server-lists: localhost:2181
      retryIntervalMilliseconds: 500
      timeToLiveSeconds: 60
      maxRetries: 3
      operationTimeoutMilliseconds: 500
  overwrite: true

rules:
  - !AUTHORITY
    users:
      - root@%:root
      - sharding@:sharding
    provider:
      type: ALL_PRIVILEGES_PERMITTED
#  - !TRANSACTION
#    defaultType: XA
#    providerType: Atomikos
#  - !SQL_PARSER
#    sqlCommentParseEnabled: true
#    sqlStatementCache:
#      initialCapacity: 2000
#      maximumSize: 65535
#      concurrencyLevel: 4
#    parserTreeCache:
#      initialCapacity: 128
#      maximumSize: 1024
#      concurrencyLevel: 4

#props:
#  max-connections-size-per-query: 1
#  kernel-executor-size: 16  # Infinite by default.
#  proxy-frontend-flush-threshold: 128  # The default value is 128.
#  proxy-opentracing-enabled: false
#  proxy-hint-enabled: false
#  sql-show: true
#  check-table-metadata-enabled: false
#  show-process-list-enabled: false
#    # Proxy backend query fetch size. A larger value may increase the memory usage of ShardingSphere Proxy.
#    # The default value is -1, which means set the minimum value for different JDBC drivers.
#  proxy-backend-query-fetch-size: -1
#  check-duplicate-table-enabled: false
#  sql-comment-parse-enabled: false
#  proxy-frontend-executor-size: 0 # Proxy frontend executor size. The default value is 0, which means let Netty decide.
#    # Available options of proxy backend executor suitable: OLAP(default), OLTP. The OLTP option may reduce time cost of writing packets to client, but it may increase the latency of SQL execution
#    # if client connections are more than proxy-frontend-netty-executor-size, especially executing slow SQL.
#  proxy-backend-executor-suitable: OLAP
#  proxy-frontend-max-connections: 0 # Less than or equal to 0 means no limitation.
#  sql-federation-enabled: false"><pre class="notranslate"><code class="notranslate">mode:
  type: Cluster
  repository:
    type: ZooKeeper
    props:
      namespace: database_discovery
      server-lists: localhost:2181
      retryIntervalMilliseconds: 500
      timeToLiveSeconds: 60
      maxRetries: 3
      operationTimeoutMilliseconds: 500
  overwrite: true

rules:
  - !AUTHORITY
    users:
      - root@%:root
      - sharding@:sharding
    provider:
      type: ALL_PRIVILEGES_PERMITTED
#  - !TRANSACTION
#    defaultType: XA
#    providerType: Atomikos
#  - !SQL_PARSER
#    sqlCommentParseEnabled: true
#    sqlStatementCache:
#      initialCapacity: 2000
#      maximumSize: 65535
#      concurrencyLevel: 4
#    parserTreeCache:
#      initialCapacity: 128
#      maximumSize: 1024
#      concurrencyLevel: 4

#props:
#  max-connections-size-per-query: 1
#  kernel-executor-size: 16  # Infinite by default.
#  proxy-frontend-flush-threshold: 128  # The default value is 128.
#  proxy-opentracing-enabled: false
#  proxy-hint-enabled: false
#  sql-show: true
#  check-table-metadata-enabled: false
#  show-process-list-enabled: false
#    # Proxy backend query fetch size. A larger value may increase the memory usage of ShardingSphere Proxy.
#    # The default value is -1, which means set the minimum value for different JDBC drivers.
#  proxy-backend-query-fetch-size: -1
#  check-duplicate-table-enabled: false
#  sql-comment-parse-enabled: false
#  proxy-frontend-executor-size: 0 # Proxy frontend executor size. The default value is 0, which means let Netty decide.
#    # Available options of proxy backend executor suitable: OLAP(default), OLTP. The OLTP option may reduce time cost of writing packets to client, but it may increase the latency of SQL execution
#    # if client connections are more than proxy-frontend-netty-executor-size, especially executing slow SQL.
#  proxy-backend-executor-suitable: OLAP
#  proxy-frontend-max-connections: 0 # Less than or equal to 0 means no limitation.
#  sql-federation-enabled: false
</code></pre></div>
<p dir="auto"><code class="notranslate">config-database-discovery.yaml:</code></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="schemaName: database_discovery_db

dataSources:
  ds_0:
    url: jdbc:mysql://127.0.0.1:13306/demo_primary_ds?serverTimezone=UTC&amp;useSSL=false
    username: root
    password: 123456
    connectionTimeoutMilliseconds: 3000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 1800000
    maxPoolSize: 50
    minPoolSize: 1
  ds_1:
    url: jdbc:mysql://127.0.0.1:13307/demo_primary_ds?serverTimezone=UTC&amp;useSSL=false
    username: root
    password: 123456
    connectionTimeoutMilliseconds: 3000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 1800000
    maxPoolSize: 50
    minPoolSize: 1
  ds_2:
    url: jdbc:mysql://127.0.0.1:13308/demo_primary_ds?serverTimezone=UTC&amp;useSSL=false
    username: root
    password: 123456
    connectionTimeoutMilliseconds: 3000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 1800000
    maxPoolSize: 50
    minPoolSize: 1

rules:
- !READWRITE_SPLITTING
  dataSources:
    rd_rs:
      autoAwareDataSourceName: pr_ds
- !DB_DISCOVERY
  dataSources:
    pr_ds:
      dataSourceNames:
        - ds_0
        - ds_1
        - ds_2
      discoveryHeartbeatName: mgr-heartbeat
      discoveryTypeName: mgr
  discoveryHeartbeats:
    mgr-heartbeat:
      props:
        keep-alive-cron: '0/5 * * * * ?'
  discoveryTypes:
    mgr:
      type: MGR
      props:
        group-name: b13df29e-90b6-11e8-8d1b-525400fc3996"><pre class="notranslate"><code class="notranslate">schemaName: database_discovery_db

dataSources:
  ds_0:
    url: jdbc:mysql://127.0.0.1:13306/demo_primary_ds?serverTimezone=UTC&amp;useSSL=false
    username: root
    password: 123456
    connectionTimeoutMilliseconds: 3000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 1800000
    maxPoolSize: 50
    minPoolSize: 1
  ds_1:
    url: jdbc:mysql://127.0.0.1:13307/demo_primary_ds?serverTimezone=UTC&amp;useSSL=false
    username: root
    password: 123456
    connectionTimeoutMilliseconds: 3000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 1800000
    maxPoolSize: 50
    minPoolSize: 1
  ds_2:
    url: jdbc:mysql://127.0.0.1:13308/demo_primary_ds?serverTimezone=UTC&amp;useSSL=false
    username: root
    password: 123456
    connectionTimeoutMilliseconds: 3000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 1800000
    maxPoolSize: 50
    minPoolSize: 1

rules:
- !READWRITE_SPLITTING
  dataSources:
    rd_rs:
      autoAwareDataSourceName: pr_ds
- !DB_DISCOVERY
  dataSources:
    pr_ds:
      dataSourceNames:
        - ds_0
        - ds_1
        - ds_2
      discoveryHeartbeatName: mgr-heartbeat
      discoveryTypeName: mgr
  discoveryHeartbeats:
    mgr-heartbeat:
      props:
        keep-alive-cron: '0/5 * * * * ?'
  discoveryTypes:
    mgr:
      type: MGR
      props:
        group-name: b13df29e-90b6-11e8-8d1b-525400fc3996
</code></pre></div>