<h2 dir="auto">Bug Report</h2>
<h3 dir="auto">Which version of ShardingSphere did you use?</h3>
<p dir="auto">master - <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/apache/shardingsphere/commit/06834bbe4079a25b256c2467c5d857192162b8b0/hovercard" href="https://github.com/apache/shardingsphere/commit/06834bbe4079a25b256c2467c5d857192162b8b0"><tt>06834bb</tt></a></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">zk get latest content</p>
<h3 dir="auto">Actual behavior</h3>
<p dir="auto">zk doesn't get latest content</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>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="mode:
  type: Cluster
  repository:
    type: ZooKeeper
    props:
      namespace: governance_ds
      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
    # When the provider type is Narayana, the following properties can be configured or not
    props:
      recoveryStoreUrl: jdbc:mysql://127.0.0.1:3306/jbossts
      recoveryStoreDataSource: com.mysql.jdbc.jdbc2.optional.MysqlDataSource
      recoveryStoreUser: root
      recoveryStorePassword: 12345678
  - !SQL_PARSER
    sqlCommentParseEnabled: true
    sqlStatementCache:
      initialCapacity: 2000
      maximumSize: 65535
      concurrencyLevel: 4
    parseTreeCache:
      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-hint-enabled: false
  sql-show: true
  check-table-metadata-enabled: false
  show-process-list-enabled: true
    # 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
  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
    # and block other clients if client connections are more than `proxy-frontend-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
    # Available proxy backend driver type: JDBC (default), ExperimentalVertx
  proxy-backend-driver-type: JDBC"><pre class="notranslate"><code class="notranslate">mode:
  type: Cluster
  repository:
    type: ZooKeeper
    props:
      namespace: governance_ds
      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
    # When the provider type is Narayana, the following properties can be configured or not
    props:
      recoveryStoreUrl: jdbc:mysql://127.0.0.1:3306/jbossts
      recoveryStoreDataSource: com.mysql.jdbc.jdbc2.optional.MysqlDataSource
      recoveryStoreUser: root
      recoveryStorePassword: 12345678
  - !SQL_PARSER
    sqlCommentParseEnabled: true
    sqlStatementCache:
      initialCapacity: 2000
      maximumSize: 65535
      concurrencyLevel: 4
    parseTreeCache:
      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-hint-enabled: false
  sql-show: true
  check-table-metadata-enabled: false
  show-process-list-enabled: true
    # 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
  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
    # and block other clients if client connections are more than `proxy-frontend-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
    # Available proxy backend driver type: JDBC (default), ExperimentalVertx
  proxy-backend-driver-type: JDBC
</code></pre></div>
<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:3306/demo_ds_0?serverTimezone=UTC&amp;useSSL=false
    username: root
    password: 123456
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 1800000
    maxPoolSize: 50
    minPoolSize: 1
  ds_1:
    url: jdbc:mysql://127.0.0.1:3306/demo_ds_1?serverTimezone=UTC&amp;useSSL=false
    username: root
    password: 123456
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 1800000
    maxPoolSize: 50
    minPoolSize: 1

rules:
- !SHARDING
  tables:
    t_order:
      actualDataNodes: ds_${0..1}.t_order_${0..1}
      tableStrategy:
        standard:
          shardingColumn: order_id
          shardingAlgorithmName: t_order_inline
      keyGenerateStrategy:
        column: order_id
        keyGeneratorName: snowflake
    t_order_item:
      actualDataNodes: ds_${0..1}.t_order_item_${0..1}
      tableStrategy:
        standard:
          shardingColumn: order_id
          shardingAlgorithmName: t_order_item_inline
      keyGenerateStrategy:
        column: order_item_id
        keyGeneratorName: snowflake
  bindingTables:
    - t_order,t_order_item
  defaultDatabaseStrategy:
    standard:
      shardingColumn: user_id
      shardingAlgorithmName: database_inline
  defaultTableStrategy:
    none:

  shardingAlgorithms:
    database_inline:
      type: INLINE
      props:
        algorithm-expression: ds_${user_id % 2}
    t_order_inline:
      type: INLINE
      props:
        algorithm-expression: t_order_${order_id % 2}
    t_order_item_inline:
      type: INLINE
      props:
        algorithm-expression: t_order_item_${order_id % 2}

  keyGenerators:
    snowflake:
      type: SNOWFLAKE

  scalingName: default_scaling
  scaling:
    default_scaling:
      input:
        workerThread: 40
        batchSize: 1000
      output:
        workerThread: 40
        batchSize: 1000
      streamChannel:
        type: MEMORY
        props:
          block-queue-size: 10000
      completionDetector:
        type: IDLE
        props:
          incremental-task-idle-minute-threshold: 30
      dataConsistencyChecker:
        type: DATA_MATCH
        props:
          chunk-size: 1000
"><pre class="notranslate"><code class="notranslate">
schemaName: sharding_db

dataSources:
  ds_0:
    url: jdbc:mysql://127.0.0.1:3306/demo_ds_0?serverTimezone=UTC&amp;useSSL=false
    username: root
    password: 123456
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 1800000
    maxPoolSize: 50
    minPoolSize: 1
  ds_1:
    url: jdbc:mysql://127.0.0.1:3306/demo_ds_1?serverTimezone=UTC&amp;useSSL=false
    username: root
    password: 123456
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 1800000
    maxPoolSize: 50
    minPoolSize: 1

rules:
- !SHARDING
  tables:
    t_order:
      actualDataNodes: ds_${0..1}.t_order_${0..1}
      tableStrategy:
        standard:
          shardingColumn: order_id
          shardingAlgorithmName: t_order_inline
      keyGenerateStrategy:
        column: order_id
        keyGeneratorName: snowflake
    t_order_item:
      actualDataNodes: ds_${0..1}.t_order_item_${0..1}
      tableStrategy:
        standard:
          shardingColumn: order_id
          shardingAlgorithmName: t_order_item_inline
      keyGenerateStrategy:
        column: order_item_id
        keyGeneratorName: snowflake
  bindingTables:
    - t_order,t_order_item
  defaultDatabaseStrategy:
    standard:
      shardingColumn: user_id
      shardingAlgorithmName: database_inline
  defaultTableStrategy:
    none:

  shardingAlgorithms:
    database_inline:
      type: INLINE
      props:
        algorithm-expression: ds_${user_id % 2}
    t_order_inline:
      type: INLINE
      props:
        algorithm-expression: t_order_${order_id % 2}
    t_order_item_inline:
      type: INLINE
      props:
        algorithm-expression: t_order_item_${order_id % 2}

  keyGenerators:
    snowflake:
      type: SNOWFLAKE

  scalingName: default_scaling
  scaling:
    default_scaling:
      input:
        workerThread: 40
        batchSize: 1000
      output:
        workerThread: 40
        batchSize: 1000
      streamChannel:
        type: MEMORY
        props:
          block-queue-size: 10000
      completionDetector:
        type: IDLE
        props:
          incremental-task-idle-minute-threshold: 30
      dataConsistencyChecker:
        type: DATA_MATCH
        props:
          chunk-size: 1000

</code></pre></div>
<ul dir="auto">
<li>execute</li>
</ul>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="select * from t_order;
show processlist;"><pre class="notranslate"><code class="notranslate">select * from t_order;
show processlist;
</code></pre></div>
<p dir="auto">found this</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="mysql&gt; show processlist;
+--------------------------------------+------+-----------+-------------+---------+------+---------------+-----------------------+
| Id                                   | User | Host      | db          | Command | Time | State         | Info                  |
+--------------------------------------+------+-----------+-------------+---------+------+---------------+-----------------------+
| 55d2551d-57ed-8810-ee00-f177853a6fdb | root | 127.0.0.1 | sharding_db | Execute | 1    | Executing 1/2 | select * from t_order |
+--------------------------------------+------+-----------+-------------+---------+------+---------------+-----------------------+"><pre class="notranslate"><code class="notranslate">mysql&gt; show processlist;
+--------------------------------------+------+-----------+-------------+---------+------+---------------+-----------------------+
| Id                                   | User | Host      | db          | Command | Time | State         | Info                  |
+--------------------------------------+------+-----------+-------------+---------+------+---------------+-----------------------+
| 55d2551d-57ed-8810-ee00-f177853a6fdb | root | 127.0.0.1 | sharding_db | Execute | 1    | Executing 1/2 | select * from t_order |
+--------------------------------------+------+-----------+-------------+---------+------+---------------+-----------------------+
</code></pre></div>
<p dir="auto">But, it should be removed.</p>
<h3 dir="auto">analyze</h3>
<p dir="auto">Debug <code class="notranslate">ProcessRegistrySubscriber</code>  <code class="notranslate">reportExecuteProcessUnit</code> method<br>
I found first thread save successfully. But second thread didn't get the latest content.<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/86938616/157629374-d066bfa7-be8e-4a6f-a98d-4267d4f919f2.png"><img src="https://user-images.githubusercontent.com/86938616/157629374-d066bfa7-be8e-4a6f-a98d-4267d4f919f2.png" alt="image" style="max-width: 100%;"></a></p>
<p dir="auto">Please answer these questions before submitting your issue. Thanks!</p>
<p dir="auto">使用读写分离配置，alter表的时候，应该只更新master 连接对应的表就可以，现在是同时还会更新slave对应的表</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="private Collection&lt;PreparedStatement&gt; generatePreparedStatementForDDL(final SQLExecutionUnit sqlExecutionUnit) throws SQLException {
    Collection&lt;PreparedStatement&gt; result = new LinkedList&lt;&gt;();
    Collection&lt;Connection&gt; connections = getConnection().getAllConnections(sqlExecutionUnit.getDataSource());
    for (Connection each : connections) {
        result.add(each.prepareStatement(sqlExecutionUnit.getSql(), resultSetType, resultSetConcurrency, resultSetHoldability));
    }
    return result;
}"><pre class="notranslate"><code class="notranslate">private Collection&lt;PreparedStatement&gt; generatePreparedStatementForDDL(final SQLExecutionUnit sqlExecutionUnit) throws SQLException {
    Collection&lt;PreparedStatement&gt; result = new LinkedList&lt;&gt;();
    Collection&lt;Connection&gt; connections = getConnection().getAllConnections(sqlExecutionUnit.getDataSource());
    for (Connection each : connections) {
        result.add(each.prepareStatement(sqlExecutionUnit.getSql(), resultSetType, resultSetConcurrency, resultSetHoldability));
    }
    return result;
}
</code></pre></div>
<h3 dir="auto">Which version of Sharding-Jdbc do you using?</h3>
<p dir="auto">2.0.2</p>
<h3 dir="auto">Expected behavior</h3>
<p dir="auto">只更新master表结构</p>
<h3 dir="auto">Actual behavior</h3>
<h3 dir="auto">Steps to reproduce the behavior</h3>
<h3 dir="auto">Please provide the reproduce example codes (such as github link)</h3>
<p dir="auto">Code should based on <a href="https://github.com/shardingjdbc/sharding-jdbc-example">https://github.com/shardingjdbc/sharding-jdbc-example</a></p>