You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2020/01/08 13:08:40 UTC

[GitHub] [incubator-shardingsphere] yanyzy opened a new pull request #3906: Make the shadow feature more complete

yanyzy opened a new pull request #3906: Make the shadow feature more complete
URL: https://github.com/apache/incubator-shardingsphere/pull/3906
 
 
   Changes proposed in this pull request:
   - make the shadow connection and statement more complete
   - refactor shadow condition and judgement engine
   - add test for shadow judgement engine
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] coveralls edited a comment on issue #3906: Make the shadow feature more complete

Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on issue #3906: Make the shadow feature more complete
URL: https://github.com/apache/incubator-shardingsphere/pull/3906#issuecomment-572079585
 
 
   ## Pull Request Test Coverage Report for [Build 1333](https://coveralls.io/builds/28022288)
   
   * **13** of **30**   **(43.33%)**  changed or added relevant lines in **5** files are covered.
   * **136** unchanged lines in **12** files lost coverage.
   * Overall coverage increased (+**0.4%**) to **66.094%**
   
   ---
   
   |  Changes Missing Coverage | Covered Lines | Changed/Added Lines | % |
   | :-----|--------------|--------|---: |
   | [shadow-core/shadow-core-rewrite/src/main/java/org/apache/shardingsphere/shadow/rewrite/condition/ShadowCondition.java](https://coveralls.io/builds/28022288/source?filename=shadow-core%2Fshadow-core-rewrite%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fshadow%2Frewrite%2Fcondition%2FShadowCondition.java#L61) | 2 | 3 | 66.67%
   | [sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/jdbc/core/statement/ShadowStatement.java](https://coveralls.io/builds/28022288/source?filename=sharding-jdbc%2Fsharding-jdbc-core%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fshardingjdbc%2Fjdbc%2Fcore%2Fstatement%2FShadowStatement.java#L238) | 6 | 8 | 75.0%
   | [sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/jdbc/core/statement/ShadowPreparedStatement.java](https://coveralls.io/builds/28022288/source?filename=sharding-jdbc%2Fsharding-jdbc-core%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fshardingjdbc%2Fjdbc%2Fcore%2Fstatement%2FShadowPreparedStatement.java#L282) | 4 | 9 | 44.44%
   | [sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/jdbc/core/connection/ShadowConnection.java](https://coveralls.io/builds/28022288/source?filename=sharding-jdbc%2Fsharding-jdbc-core%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fshardingjdbc%2Fjdbc%2Fcore%2Fconnection%2FShadowConnection.java#L104) | 0 | 9 | 0.0%
   <!-- | **Total:** | **13** | **30** | **43.33%** | -->
   
   |  Files with Coverage Reduction | New Missed Lines | % |
   | :-----|--------------|--: |
   | [encrypt-core/encrypt-core-rewrite/src/main/java/org/apache/shardingsphere/encrypt/rewrite/parameter/impl/EncryptInsertOnDuplicateKeyUpdateValueParameterRewriter.java](https://coveralls.io/builds/28022288/source?filename=encrypt-core%2Fencrypt-core-rewrite%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fencrypt%2Frewrite%2Fparameter%2Fimpl%2FEncryptInsertOnDuplicateKeyUpdateValueParameterRewriter.java#L58) | 1 | 95.65% |
   | [sharding-core/sharding-core-route/src/main/java/org/apache/shardingsphere/core/route/PreparedStatementRoutingEngine.java](https://coveralls.io/builds/28022288/source?filename=sharding-core%2Fsharding-core-route%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fcore%2Froute%2FPreparedStatementRoutingEngine.java#L58) | 2 | 80.0% |
   | [sharding-core/sharding-core-route/src/main/java/org/apache/shardingsphere/core/route/StatementRoutingEngine.java](https://coveralls.io/builds/28022288/source?filename=sharding-core%2Fsharding-core-route%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fcore%2Froute%2FStatementRoutingEngine.java#L55) | 2 | 77.78% |
   | [shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/core/extractor/impl/dml/insert/OnDuplicateKeyColumnsExtractor.java](https://coveralls.io/builds/28022288/source?filename=shardingsphere-sql-parser%2Fshardingsphere-sql-parser-engine%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fsql%2Fparser%2Fcore%2Fextractor%2Fimpl%2Fdml%2Finsert%2FOnDuplicateKeyColumnsExtractor.java#L50) | 3 | 16.67% |
   | [sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/response/query/QueryHeader.java](https://coveralls.io/builds/28022288/source?filename=sharding-proxy%2Fsharding-proxy-backend%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fshardingproxy%2Fbackend%2Fresponse%2Fquery%2FQueryHeader.java#L79) | 4 | 73.08% |
   | [sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/jdbc/core/statement/ShardingPreparedStatement.java](https://coveralls.io/builds/28022288/source?filename=sharding-jdbc%2Fsharding-jdbc-core%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fshardingjdbc%2Fjdbc%2Fcore%2Fstatement%2FShardingPreparedStatement.java#L254) | 5 | 84.48% |
   | [sharding-core/sharding-core-route/src/main/java/org/apache/shardingsphere/core/route/router/sharding/ShardingRouter.java](https://coveralls.io/builds/28022288/source?filename=sharding-core%2Fsharding-core-route%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fcore%2Froute%2Frouter%2Fsharding%2FShardingRouter.java#L64) | 8 | 88.57% |
   | [sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/communication/jdbc/wrapper/StatementExecutorWrapper.java](https://coveralls.io/builds/28022288/source?filename=sharding-proxy%2Fsharding-proxy-backend%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fshardingproxy%2Fbackend%2Fcommunication%2Fjdbc%2Fwrapper%2FStatementExecutorWrapper.java#L69) | 16 | 2.38% |
   | [sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/communication/jdbc/wrapper/PreparedStatementExecutorWrapper.java](https://coveralls.io/builds/28022288/source?filename=sharding-proxy%2Fsharding-proxy-backend%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fshardingproxy%2Fbackend%2Fcommunication%2Fjdbc%2Fwrapper%2FPreparedStatementExecutorWrapper.java#L72) | 17 | 2.22% |
   | [sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/executor/AbstractStatementExecutor.java](https://coveralls.io/builds/28022288/source?filename=sharding-jdbc%2Fsharding-jdbc-core%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fshardingjdbc%2Fexecutor%2FAbstractStatementExecutor.java#L191) | 20 | 47.92% |
   <!-- | **Total:** | **136** |  | -->
   
   |  Totals | [![Coverage Status](https://coveralls.io/builds/28022288/badge)](https://coveralls.io/builds/28022288) |
   | :-- | --: |
   | Change from base [Build 659](https://coveralls.io/builds/27980616): |  0.4% |
   | Covered Lines: | 10819 |
   | Relevant Lines: | 16369 |
   
   ---
   ##### 💛  - [Coveralls](https://coveralls.io)
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] coveralls edited a comment on issue #3906: Make the shadow feature more complete

Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on issue #3906: Make the shadow feature more complete
URL: https://github.com/apache/incubator-shardingsphere/pull/3906#issuecomment-572079585
 
 
   ## Pull Request Test Coverage Report for [Build 1334](https://coveralls.io/builds/28025727)
   
   * **13** of **27**   **(48.15%)**  changed or added relevant lines in **5** files are covered.
   * **136** unchanged lines in **12** files lost coverage.
   * Overall coverage increased (+**0.4%**) to **66.107%**
   
   ---
   
   |  Changes Missing Coverage | Covered Lines | Changed/Added Lines | % |
   | :-----|--------------|--------|---: |
   | [shadow-core/shadow-core-rewrite/src/main/java/org/apache/shardingsphere/shadow/rewrite/condition/ShadowCondition.java](https://coveralls.io/builds/28025727/source?filename=shadow-core%2Fshadow-core-rewrite%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fshadow%2Frewrite%2Fcondition%2FShadowCondition.java#L61) | 2 | 3 | 66.67%
   | [sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/jdbc/core/statement/ShadowStatement.java](https://coveralls.io/builds/28025727/source?filename=sharding-jdbc%2Fsharding-jdbc-core%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fshardingjdbc%2Fjdbc%2Fcore%2Fstatement%2FShadowStatement.java#L238) | 6 | 8 | 75.0%
   | [sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/jdbc/core/statement/ShadowPreparedStatement.java](https://coveralls.io/builds/28025727/source?filename=sharding-jdbc%2Fsharding-jdbc-core%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fshardingjdbc%2Fjdbc%2Fcore%2Fstatement%2FShadowPreparedStatement.java#L282) | 4 | 9 | 44.44%
   | [sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/jdbc/core/connection/ShadowConnection.java](https://coveralls.io/builds/28025727/source?filename=sharding-jdbc%2Fsharding-jdbc-core%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fshardingjdbc%2Fjdbc%2Fcore%2Fconnection%2FShadowConnection.java#L104) | 0 | 6 | 0.0%
   <!-- | **Total:** | **13** | **27** | **48.15%** | -->
   
   |  Files with Coverage Reduction | New Missed Lines | % |
   | :-----|--------------|--: |
   | [encrypt-core/encrypt-core-rewrite/src/main/java/org/apache/shardingsphere/encrypt/rewrite/parameter/impl/EncryptInsertOnDuplicateKeyUpdateValueParameterRewriter.java](https://coveralls.io/builds/28025727/source?filename=encrypt-core%2Fencrypt-core-rewrite%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fencrypt%2Frewrite%2Fparameter%2Fimpl%2FEncryptInsertOnDuplicateKeyUpdateValueParameterRewriter.java#L58) | 1 | 95.65% |
   | [sharding-core/sharding-core-route/src/main/java/org/apache/shardingsphere/core/route/PreparedStatementRoutingEngine.java](https://coveralls.io/builds/28025727/source?filename=sharding-core%2Fsharding-core-route%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fcore%2Froute%2FPreparedStatementRoutingEngine.java#L58) | 2 | 80.0% |
   | [sharding-core/sharding-core-route/src/main/java/org/apache/shardingsphere/core/route/StatementRoutingEngine.java](https://coveralls.io/builds/28025727/source?filename=sharding-core%2Fsharding-core-route%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fcore%2Froute%2FStatementRoutingEngine.java#L55) | 2 | 77.78% |
   | [shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/core/extractor/impl/dml/insert/OnDuplicateKeyColumnsExtractor.java](https://coveralls.io/builds/28025727/source?filename=shardingsphere-sql-parser%2Fshardingsphere-sql-parser-engine%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fsql%2Fparser%2Fcore%2Fextractor%2Fimpl%2Fdml%2Finsert%2FOnDuplicateKeyColumnsExtractor.java#L50) | 3 | 16.67% |
   | [sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/response/query/QueryHeader.java](https://coveralls.io/builds/28025727/source?filename=sharding-proxy%2Fsharding-proxy-backend%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fshardingproxy%2Fbackend%2Fresponse%2Fquery%2FQueryHeader.java#L79) | 4 | 73.08% |
   | [sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/jdbc/core/statement/ShardingPreparedStatement.java](https://coveralls.io/builds/28025727/source?filename=sharding-jdbc%2Fsharding-jdbc-core%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fshardingjdbc%2Fjdbc%2Fcore%2Fstatement%2FShardingPreparedStatement.java#L254) | 5 | 84.48% |
   | [sharding-core/sharding-core-route/src/main/java/org/apache/shardingsphere/core/route/router/sharding/ShardingRouter.java](https://coveralls.io/builds/28025727/source?filename=sharding-core%2Fsharding-core-route%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fcore%2Froute%2Frouter%2Fsharding%2FShardingRouter.java#L64) | 8 | 88.57% |
   | [sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/communication/jdbc/wrapper/StatementExecutorWrapper.java](https://coveralls.io/builds/28025727/source?filename=sharding-proxy%2Fsharding-proxy-backend%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fshardingproxy%2Fbackend%2Fcommunication%2Fjdbc%2Fwrapper%2FStatementExecutorWrapper.java#L69) | 16 | 2.38% |
   | [sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/communication/jdbc/wrapper/PreparedStatementExecutorWrapper.java](https://coveralls.io/builds/28025727/source?filename=sharding-proxy%2Fsharding-proxy-backend%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fshardingproxy%2Fbackend%2Fcommunication%2Fjdbc%2Fwrapper%2FPreparedStatementExecutorWrapper.java#L72) | 17 | 2.22% |
   | [sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/executor/AbstractStatementExecutor.java](https://coveralls.io/builds/28025727/source?filename=sharding-jdbc%2Fsharding-jdbc-core%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fshardingjdbc%2Fexecutor%2FAbstractStatementExecutor.java#L191) | 20 | 47.92% |
   <!-- | **Total:** | **136** |  | -->
   
   |  Totals | [![Coverage Status](https://coveralls.io/builds/28025727/badge)](https://coveralls.io/builds/28025727) |
   | :-- | --: |
   | Change from base [Build 659](https://coveralls.io/builds/27980616): |  0.4% |
   | Covered Lines: | 10819 |
   | Relevant Lines: | 16366 |
   
   ---
   ##### 💛  - [Coveralls](https://coveralls.io)
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] terrymanu commented on a change in pull request #3906: Make the shadow feature more complete

Posted by GitBox <gi...@apache.org>.
terrymanu commented on a change in pull request #3906: Make the shadow feature more complete
URL: https://github.com/apache/incubator-shardingsphere/pull/3906#discussion_r364640344
 
 

 ##########
 File path: sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/jdbc/core/connection/ShadowConnection.java
 ##########
 @@ -132,24 +143,26 @@ public DatabaseMetaData getMetaData() throws SQLException {
     
     @Override
     public void setReadOnly(final boolean readOnly) throws SQLException {
+        this.readOnly = readOnly;
         actualConnection.setReadOnly(readOnly);
         shadowConnection.setReadOnly(readOnly);
     }
     
     @Override
     public boolean isReadOnly() {
-        return false;
+        return readOnly;
     }
 
     @Override
     public void setTransactionIsolation(final int level) throws SQLException {
+        transactionIsolation = level;
         actualConnection.setTransactionIsolation(level);
         shadowConnection.setTransactionIsolation(level);
     }
     
     @Override
     public int getTransactionIsolation() {
-        return 0;
+        return transactionIsolation;
 
 Review comment:
   Can we use lombok's @Getter to instead of it?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] terrymanu merged pull request #3906: Make the shadow feature more complete

Posted by GitBox <gi...@apache.org>.
terrymanu merged pull request #3906: Make the shadow feature more complete
URL: https://github.com/apache/incubator-shardingsphere/pull/3906
 
 
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] terrymanu commented on a change in pull request #3906: Make the shadow feature more complete

Posted by GitBox <gi...@apache.org>.
terrymanu commented on a change in pull request #3906: Make the shadow feature more complete
URL: https://github.com/apache/incubator-shardingsphere/pull/3906#discussion_r364639824
 
 

 ##########
 File path: sharding-integration-test/sharding-jdbc-test/src/test/resources/integrate/env/shadow/sharding-rule.yaml
 ##########
 @@ -36,7 +36,4 @@ shadowRule:
           column: item_id
     defaultDataSourceName: db
     defaultTableStrategy:
-      none:
-
-props:
-  sql.show: true
\ No newline at end of file
+      none:
 
 Review comment:
   We need a blank line for the end of file

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] terrymanu commented on a change in pull request #3906: Make the shadow feature more complete

Posted by GitBox <gi...@apache.org>.
terrymanu commented on a change in pull request #3906: Make the shadow feature more complete
URL: https://github.com/apache/incubator-shardingsphere/pull/3906#discussion_r365185018
 
 

 ##########
 File path: sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/jdbc/core/statement/ShadowStatement.java
 ##########
 @@ -181,8 +183,10 @@ private Statement getStatementAndReplay(final String sql) throws SQLException {
         SQLStatement sqlStatement = connection.getRuntimeContext().getParseEngine().parse(sql, false);
         sqlStatementContext = SQLStatementContextFactory.newInstance(getRelationMetas(connection.getRuntimeContext().getMetaData().getTables()), sql, Collections.emptyList(), sqlStatement);
         ShadowJudgementEngine shadowJudgementEngine = new SimpleJudgementEngine(connection.getRuntimeContext().getRule(), sqlStatementContext);
-        statement = shadowStatementGenerator.createStatement(shadowJudgementEngine);
-        return statement;
+        isShadowSQL = shadowJudgementEngine.isShadowSQL();
+        Statement result = shadowStatementGenerator.createStatement();
+        statement = result;
+        return result;
 
 Review comment:
   How about refactor to `return shadowStatementGenerator.createStatement();`?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] coveralls commented on issue #3906: Make the shadow feature more complete

Posted by GitBox <gi...@apache.org>.
coveralls commented on issue #3906: Make the shadow feature more complete
URL: https://github.com/apache/incubator-shardingsphere/pull/3906#issuecomment-572079585
 
 
   ## Pull Request Test Coverage Report for [Build 1291](https://coveralls.io/builds/27981138)
   
   * **11** of **28**   **(39.29%)**  changed or added relevant lines in **5** files are covered.
   * No unchanged relevant lines lost coverage.
   * Overall coverage increased (+**0.3%**) to **66.023%**
   
   ---
   
   |  Changes Missing Coverage | Covered Lines | Changed/Added Lines | % |
   | :-----|--------------|--------|---: |
   | [shadow-core/shadow-core-rewrite/src/main/java/org/apache/shardingsphere/shadow/rewrite/condition/ShadowCondition.java](https://coveralls.io/builds/27981138/source?filename=shadow-core%2Fshadow-core-rewrite%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fshadow%2Frewrite%2Fcondition%2FShadowCondition.java#L61) | 2 | 3 | 66.67%
   | [sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/jdbc/core/statement/ShadowStatement.java](https://coveralls.io/builds/27981138/source?filename=sharding-jdbc%2Fsharding-jdbc-core%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fshardingjdbc%2Fjdbc%2Fcore%2Fstatement%2FShadowStatement.java#L237) | 4 | 6 | 66.67%
   | [sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/jdbc/core/statement/ShadowPreparedStatement.java](https://coveralls.io/builds/27981138/source?filename=sharding-jdbc%2Fsharding-jdbc-core%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fshardingjdbc%2Fjdbc%2Fcore%2Fstatement%2FShadowPreparedStatement.java#L282) | 4 | 9 | 44.44%
   | [sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/jdbc/core/connection/ShadowConnection.java](https://coveralls.io/builds/27981138/source?filename=sharding-jdbc%2Fsharding-jdbc-core%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fshardingjdbc%2Fjdbc%2Fcore%2Fconnection%2FShadowConnection.java#L105) | 0 | 9 | 0.0%
   <!-- | **Total:** | **11** | **28** | **39.29%** | -->
   
   
   |  Totals | [![Coverage Status](https://coveralls.io/builds/27981138/badge)](https://coveralls.io/builds/27981138) |
   | :-- | --: |
   | Change from base [Build 659](https://coveralls.io/builds/27980616): |  0.3% |
   | Covered Lines: | 10777 |
   | Relevant Lines: | 16323 |
   
   ---
   ##### 💛  - [Coveralls](https://coveralls.io)
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] terrymanu commented on a change in pull request #3906: Make the shadow feature more complete

Posted by GitBox <gi...@apache.org>.
terrymanu commented on a change in pull request #3906: Make the shadow feature more complete
URL: https://github.com/apache/incubator-shardingsphere/pull/3906#discussion_r364640301
 
 

 ##########
 File path: sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/jdbc/core/connection/ShadowConnection.java
 ##########
 @@ -132,24 +143,26 @@ public DatabaseMetaData getMetaData() throws SQLException {
     
     @Override
     public void setReadOnly(final boolean readOnly) throws SQLException {
+        this.readOnly = readOnly;
         actualConnection.setReadOnly(readOnly);
         shadowConnection.setReadOnly(readOnly);
     }
     
     @Override
     public boolean isReadOnly() {
-        return false;
+        return readOnly;
 
 Review comment:
   Can we use lombok's @Getter to instead of it?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] yanyzy commented on a change in pull request #3906: Make the shadow feature more complete

Posted by GitBox <gi...@apache.org>.
yanyzy commented on a change in pull request #3906: Make the shadow feature more complete
URL: https://github.com/apache/incubator-shardingsphere/pull/3906#discussion_r365095228
 
 

 ##########
 File path: sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/jdbc/core/connection/ShadowConnection.java
 ##########
 @@ -93,13 +102,14 @@ public PreparedStatement prepareStatement(final String sql, final String[] colum
     
     @Override
     public void setAutoCommit(final boolean autoCommit) throws SQLException {
+        this.autoCommit = autoCommit;
         actualConnection.setAutoCommit(autoCommit);
         shadowConnection.setAutoCommit(autoCommit);
     }
     
     @Override
     public boolean getAutoCommit() {
-        return false;
+        return autoCommit;
 
 Review comment:
   getAutoCommit()、isClosed()、isReadOnly() extends from Connection interface , can not use 
    lombok's @getter to instead of them.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] terrymanu commented on a change in pull request #3906: Make the shadow feature more complete

Posted by GitBox <gi...@apache.org>.
terrymanu commented on a change in pull request #3906: Make the shadow feature more complete
URL: https://github.com/apache/incubator-shardingsphere/pull/3906#discussion_r364640920
 
 

 ##########
 File path: sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/jdbc/core/statement/ShadowStatement.java
 ##########
 @@ -181,7 +183,8 @@ private Statement getStatementAndReplay(final String sql) throws SQLException {
         SQLStatement sqlStatement = connection.getRuntimeContext().getParseEngine().parse(sql, false);
         sqlStatementContext = SQLStatementContextFactory.newInstance(getRelationMetas(connection.getRuntimeContext().getMetaData().getTables()), sql, Collections.emptyList(), sqlStatement);
         ShadowJudgementEngine shadowJudgementEngine = new SimpleJudgementEngine(connection.getRuntimeContext().getRule(), sqlStatementContext);
-        statement = shadowStatementGenerator.createStatement(shadowJudgementEngine);
+        isShadowSQL = shadowJudgementEngine.isShadowSQL();
+        statement = shadowStatementGenerator.createStatement();
         return statement;
 
 Review comment:
   We should name as `result` for return value

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] terrymanu commented on a change in pull request #3906: Make the shadow feature more complete

Posted by GitBox <gi...@apache.org>.
terrymanu commented on a change in pull request #3906: Make the shadow feature more complete
URL: https://github.com/apache/incubator-shardingsphere/pull/3906#discussion_r364581375
 
 

 ##########
 File path: sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/jdbc/core/statement/ShadowPreparedStatement.java
 ##########
 @@ -66,11 +66,11 @@
     
     private final String sql;
     
-    private ShadowJudgementEngine shadowJudgementEngine;
-    
     private PreparedStatement preparedStatement;
     
     private ResultSet resultSet;
+
+    private boolean isShadowSql;
 
 Review comment:
   `isShadowSql` should name as `isShadowSQL`

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] terrymanu commented on a change in pull request #3906: Make the shadow feature more complete

Posted by GitBox <gi...@apache.org>.
terrymanu commented on a change in pull request #3906: Make the shadow feature more complete
URL: https://github.com/apache/incubator-shardingsphere/pull/3906#discussion_r365185018
 
 

 ##########
 File path: sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/jdbc/core/statement/ShadowStatement.java
 ##########
 @@ -181,8 +183,10 @@ private Statement getStatementAndReplay(final String sql) throws SQLException {
         SQLStatement sqlStatement = connection.getRuntimeContext().getParseEngine().parse(sql, false);
         sqlStatementContext = SQLStatementContextFactory.newInstance(getRelationMetas(connection.getRuntimeContext().getMetaData().getTables()), sql, Collections.emptyList(), sqlStatement);
         ShadowJudgementEngine shadowJudgementEngine = new SimpleJudgementEngine(connection.getRuntimeContext().getRule(), sqlStatementContext);
-        statement = shadowStatementGenerator.createStatement(shadowJudgementEngine);
-        return statement;
+        isShadowSQL = shadowJudgementEngine.isShadowSQL();
+        Statement result = shadowStatementGenerator.createStatement();
+        statement = result;
+        return result;
 
 Review comment:
   How about refactor to `return shadowStatementGenerator.createStatement();`?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] coveralls edited a comment on issue #3906: Make the shadow feature more complete

Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on issue #3906: Make the shadow feature more complete
URL: https://github.com/apache/incubator-shardingsphere/pull/3906#issuecomment-572079585
 
 
   ## Pull Request Test Coverage Report for [Build 1303](https://coveralls.io/builds/27998759)
   
   * **11** of **28**   **(39.29%)**  changed or added relevant lines in **5** files are covered.
   * **123** unchanged lines in **7** files lost coverage.
   * Overall coverage increased (+**0.3%**) to **66.026%**
   
   ---
   
   |  Changes Missing Coverage | Covered Lines | Changed/Added Lines | % |
   | :-----|--------------|--------|---: |
   | [shadow-core/shadow-core-rewrite/src/main/java/org/apache/shardingsphere/shadow/rewrite/condition/ShadowCondition.java](https://coveralls.io/builds/27998759/source?filename=shadow-core%2Fshadow-core-rewrite%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fshadow%2Frewrite%2Fcondition%2FShadowCondition.java#L61) | 2 | 3 | 66.67%
   | [sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/jdbc/core/statement/ShadowStatement.java](https://coveralls.io/builds/27998759/source?filename=sharding-jdbc%2Fsharding-jdbc-core%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fshardingjdbc%2Fjdbc%2Fcore%2Fstatement%2FShadowStatement.java#L237) | 4 | 6 | 66.67%
   | [sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/jdbc/core/statement/ShadowPreparedStatement.java](https://coveralls.io/builds/27998759/source?filename=sharding-jdbc%2Fsharding-jdbc-core%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fshardingjdbc%2Fjdbc%2Fcore%2Fstatement%2FShadowPreparedStatement.java#L282) | 4 | 9 | 44.44%
   | [sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/jdbc/core/connection/ShadowConnection.java](https://coveralls.io/builds/27998759/source?filename=sharding-jdbc%2Fsharding-jdbc-core%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fshardingjdbc%2Fjdbc%2Fcore%2Fconnection%2FShadowConnection.java#L105) | 0 | 9 | 0.0%
   <!-- | **Total:** | **11** | **28** | **39.29%** | -->
   
   |  Files with Coverage Reduction | New Missed Lines | % |
   | :-----|--------------|--: |
   | [sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/jdbc/core/statement/ShardingPreparedStatement.java](https://coveralls.io/builds/27998759/source?filename=sharding-jdbc%2Fsharding-jdbc-core%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fshardingjdbc%2Fjdbc%2Fcore%2Fstatement%2FShardingPreparedStatement.java#L254) | 5 | 84.48% |
   | [sharding-core/sharding-core-route/src/main/java/org/apache/shardingsphere/core/route/router/sharding/ShardingRouter.java](https://coveralls.io/builds/27998759/source?filename=sharding-core%2Fsharding-core-route%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fcore%2Froute%2Frouter%2Fsharding%2FShardingRouter.java#L64) | 7 | 88.57% |
   | [sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/communication/jdbc/wrapper/StatementExecutorWrapper.java](https://coveralls.io/builds/27998759/source?filename=sharding-proxy%2Fsharding-proxy-backend%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fshardingproxy%2Fbackend%2Fcommunication%2Fjdbc%2Fwrapper%2FStatementExecutorWrapper.java#L69) | 16 | 2.38% |
   | [sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/communication/jdbc/wrapper/PreparedStatementExecutorWrapper.java](https://coveralls.io/builds/27998759/source?filename=sharding-proxy%2Fsharding-proxy-backend%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fshardingproxy%2Fbackend%2Fcommunication%2Fjdbc%2Fwrapper%2FPreparedStatementExecutorWrapper.java#L72) | 17 | 2.22% |
   | [sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/executor/AbstractStatementExecutor.java](https://coveralls.io/builds/27998759/source?filename=sharding-jdbc%2Fsharding-jdbc-core%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fshardingjdbc%2Fexecutor%2FAbstractStatementExecutor.java#L191) | 20 | 47.92% |
   | [sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/jdbc/core/statement/MasterSlaveStatement.java](https://coveralls.io/builds/27998759/source?filename=sharding-jdbc%2Fsharding-jdbc-core%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fshardingjdbc%2Fjdbc%2Fcore%2Fstatement%2FMasterSlaveStatement.java#L65) | 27 | 13.68% |
   | [sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/jdbc/core/statement/MasterSlavePreparedStatement.java](https://coveralls.io/builds/27998759/source?filename=sharding-jdbc%2Fsharding-jdbc-core%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fshardingjdbc%2Fjdbc%2Fcore%2Fstatement%2FMasterSlavePreparedStatement.java#L56) | 31 | 6.49% |
   <!-- | **Total:** | **123** |  | -->
   
   |  Totals | [![Coverage Status](https://coveralls.io/builds/27998759/badge)](https://coveralls.io/builds/27998759) |
   | :-- | --: |
   | Change from base [Build 659](https://coveralls.io/builds/27980616): |  0.3% |
   | Covered Lines: | 10780 |
   | Relevant Lines: | 16327 |
   
   ---
   ##### 💛  - [Coveralls](https://coveralls.io)
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] terrymanu commented on a change in pull request #3906: Make the shadow feature more complete

Posted by GitBox <gi...@apache.org>.
terrymanu commented on a change in pull request #3906: Make the shadow feature more complete
URL: https://github.com/apache/incubator-shardingsphere/pull/3906#discussion_r364640621
 
 

 ##########
 File path: sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/jdbc/core/connection/ShadowConnection.java
 ##########
 @@ -169,6 +182,6 @@ public void setHoldability(final int holdability) throws SQLException {
     
     @Override
     public int getHoldability() {
-        return 0;
+        return ResultSet.CLOSE_CURSORS_AT_COMMIT;
 
 Review comment:
   Is it correct for default value forever?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] terrymanu commented on a change in pull request #3906: Make the shadow feature more complete

Posted by GitBox <gi...@apache.org>.
terrymanu commented on a change in pull request #3906: Make the shadow feature more complete
URL: https://github.com/apache/incubator-shardingsphere/pull/3906#discussion_r364640264
 
 

 ##########
 File path: sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/jdbc/core/connection/ShadowConnection.java
 ##########
 @@ -116,13 +126,14 @@ public void rollback() throws SQLException {
     
     @Override
     public void close() throws SQLException {
+        closed = true;
         actualConnection.close();
         shadowConnection.close();
     }
     
     @Override
     public boolean isClosed() {
-        return false;
+        return closed;
 
 Review comment:
   Can we use lombok's @Getter to instead of it?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] terrymanu commented on a change in pull request #3906: Make the shadow feature more complete

Posted by GitBox <gi...@apache.org>.
terrymanu commented on a change in pull request #3906: Make the shadow feature more complete
URL: https://github.com/apache/incubator-shardingsphere/pull/3906#discussion_r364640163
 
 

 ##########
 File path: sharding-jdbc/sharding-jdbc-core/src/main/java/org/apache/shardingsphere/shardingjdbc/jdbc/core/connection/ShadowConnection.java
 ##########
 @@ -93,13 +102,14 @@ public PreparedStatement prepareStatement(final String sql, final String[] colum
     
     @Override
     public void setAutoCommit(final boolean autoCommit) throws SQLException {
+        this.autoCommit = autoCommit;
         actualConnection.setAutoCommit(autoCommit);
         shadowConnection.setAutoCommit(autoCommit);
     }
     
     @Override
     public boolean getAutoCommit() {
-        return false;
+        return autoCommit;
 
 Review comment:
   Can we use lombok's @Getter to instead of it?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services