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/07/15 04:07:47 UTC

[GitHub] [shardingsphere] xbkaishui opened a new pull request #6352: add p6spy driver support for proxy backend

xbkaishui opened a new pull request #6352:
URL: https://github.com/apache/shardingsphere/pull/6352


   Fixes #6266.
   
   Changes proposed in this pull request:
   - support p6spy driver, p6spy is a wrapper of database driver
   


----------------------------------------------------------------
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



[GitHub] [shardingsphere] tuohai666 commented on a change in pull request #6352: add p6spy driver support for proxy backend

Posted by GitBox <gi...@apache.org>.
tuohai666 commented on a change in pull request #6352:
URL: https://github.com/apache/shardingsphere/pull/6352#discussion_r456735143



##########
File path: shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/recognizer/impl/H2Recognizer.java
##########
@@ -27,9 +28,11 @@
  */
 public final class H2Recognizer implements JDBCDriverURLRecognizer {
     
+    private final H2DatabaseType databaseType = new H2DatabaseType();
+    
     @Override
     public String getDatabaseType() {

Review comment:
       Can this method revert to origin?

##########
File path: shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/resources/spy.properties
##########
@@ -0,0 +1,247 @@
+#################################################################

Review comment:
       Consider delete this file, let user add this is better.




----------------------------------------------------------------
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



[GitHub] [shardingsphere] xbkaishui commented on a change in pull request #6352: add p6spy driver support for proxy backend

Posted by GitBox <gi...@apache.org>.
xbkaishui commented on a change in pull request #6352:
URL: https://github.com/apache/shardingsphere/pull/6352#discussion_r456744338



##########
File path: shardingsphere-proxy/shardingsphere-proxy-bootstrap/src/main/resources/spy.properties
##########
@@ -0,0 +1,247 @@
+#################################################################

Review comment:
       fine




----------------------------------------------------------------
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



[GitHub] [shardingsphere] xbkaishui commented on a change in pull request #6352: add p6spy driver support for proxy backend

Posted by GitBox <gi...@apache.org>.
xbkaishui commented on a change in pull request #6352:
URL: https://github.com/apache/shardingsphere/pull/6352#discussion_r456744464



##########
File path: shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/recognizer/impl/H2Recognizer.java
##########
@@ -27,9 +28,11 @@
  */
 public final class H2Recognizer implements JDBCDriverURLRecognizer {
     
+    private final H2DatabaseType databaseType = new H2DatabaseType();
+    
     @Override
     public String getDatabaseType() {

Review comment:
       I saw our source code contains so many literals of databaseType,  is it better to refers only *DatabaseType class ? 




----------------------------------------------------------------
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



[GitHub] [shardingsphere] tuohai666 commented on a change in pull request #6352: add p6spy driver support for proxy backend

Posted by GitBox <gi...@apache.org>.
tuohai666 commented on a change in pull request #6352:
URL: https://github.com/apache/shardingsphere/pull/6352#discussion_r456386839



##########
File path: shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/recognizer/JDBCDriverURLRecognizerEngine.java
##########
@@ -20,6 +20,7 @@
 import lombok.AccessLevel;
 import lombok.NoArgsConstructor;
 import org.apache.shardingsphere.infra.exception.ShardingSphereException;
+import org.apache.shardingsphere.proxy.backend.communication.jdbc.recognizer.spi.JDBCDriverComposeURLRecognizer;

Review comment:
       add spy.properties




----------------------------------------------------------------
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



[GitHub] [shardingsphere] tristaZero commented on pull request #6352: add p6spy driver support for proxy backend

Posted by GitBox <gi...@apache.org>.
tristaZero commented on pull request #6352:
URL: https://github.com/apache/shardingsphere/pull/6352#issuecomment-659815458


   Hi @xbkaishui Glad to see you again. I believe @tuohai666 will give it a review carefully, so please be patient.
   
   Trista


----------------------------------------------------------------
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



[GitHub] [shardingsphere] tuohai666 merged pull request #6352: add p6spy driver support for proxy backend

Posted by GitBox <gi...@apache.org>.
tuohai666 merged pull request #6352:
URL: https://github.com/apache/shardingsphere/pull/6352


   


----------------------------------------------------------------
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



[GitHub] [shardingsphere] xbkaishui commented on a change in pull request #6352: add p6spy driver support for proxy backend

Posted by GitBox <gi...@apache.org>.
xbkaishui commented on a change in pull request #6352:
URL: https://github.com/apache/shardingsphere/pull/6352#discussion_r456418290



##########
File path: shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/recognizer/impl/PostgreSQLRecognizer.java
##########
@@ -27,9 +28,11 @@
  */
 public final class PostgreSQLRecognizer implements JDBCDriverURLRecognizer {
     
+    private PostgreSQLDatabaseType databaseType = new PostgreSQLDatabaseType();

Review comment:
       done




----------------------------------------------------------------
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



[GitHub] [shardingsphere] xbkaishui commented on pull request #6352: add p6spy driver support for proxy backend

Posted by GitBox <gi...@apache.org>.
xbkaishui commented on pull request #6352:
URL: https://github.com/apache/shardingsphere/pull/6352#issuecomment-659829546


   Yes, no worry, I am very appreciate @tuohai666 can review my code,  I  learned so much from the previous PR comments. 


----------------------------------------------------------------
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



[GitHub] [shardingsphere] xbkaishui commented on a change in pull request #6352: add p6spy driver support for proxy backend

Posted by GitBox <gi...@apache.org>.
xbkaishui commented on a change in pull request #6352:
URL: https://github.com/apache/shardingsphere/pull/6352#discussion_r456744464



##########
File path: shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/recognizer/impl/H2Recognizer.java
##########
@@ -27,9 +28,11 @@
  */
 public final class H2Recognizer implements JDBCDriverURLRecognizer {
     
+    private final H2DatabaseType databaseType = new H2DatabaseType();
+    
     @Override
     public String getDatabaseType() {

Review comment:
       I saw the code contains so many literals of databaseType,  is it better to refers only *DatabaseType class ? 




----------------------------------------------------------------
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



[GitHub] [shardingsphere] tuohai666 commented on a change in pull request #6352: add p6spy driver support for proxy backend

Posted by GitBox <gi...@apache.org>.
tuohai666 commented on a change in pull request #6352:
URL: https://github.com/apache/shardingsphere/pull/6352#discussion_r456240880



##########
File path: shardingsphere-proxy/shardingsphere-proxy-backend/src/main/resources/META-INF/services/org.apache.shardingsphere.proxy.backend.communication.jdbc.recognizer.spi.JDBCDriverURLRecognizer
##########
@@ -20,3 +20,4 @@ org.apache.shardingsphere.proxy.backend.communication.jdbc.recognizer.impl.Postg
 org.apache.shardingsphere.proxy.backend.communication.jdbc.recognizer.impl.OracleRecognizer
 org.apache.shardingsphere.proxy.backend.communication.jdbc.recognizer.impl.SQLServerRecognizer
 org.apache.shardingsphere.proxy.backend.communication.jdbc.recognizer.impl.H2Recognizer
+org.apache.shardingsphere.proxy.backend.communication.jdbc.recognizer.impl.P6SpyDriverRecognizer

Review comment:
       Need an empty line.

##########
File path: shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/recognizer/impl/PostgreSQLRecognizer.java
##########
@@ -27,9 +28,11 @@
  */
 public final class PostgreSQLRecognizer implements JDBCDriverURLRecognizer {
     
+    private PostgreSQLDatabaseType databaseType = new PostgreSQLDatabaseType();

Review comment:
       Field 'databaseType' may be 'final'

##########
File path: shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/recognizer/impl/OracleRecognizer.java
##########
@@ -27,9 +28,11 @@
  */
 public final class OracleRecognizer implements JDBCDriverURLRecognizer {
     
+    private OracleDatabaseType databaseType = new OracleDatabaseType();

Review comment:
       Field 'databaseType' may be 'final'

##########
File path: shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/recognizer/JDBCDriverURLRecognizerEngine.java
##########
@@ -20,6 +20,7 @@
 import lombok.AccessLevel;
 import lombok.NoArgsConstructor;
 import org.apache.shardingsphere.infra.exception.ShardingSphereException;
+import org.apache.shardingsphere.proxy.backend.communication.jdbc.recognizer.spi.JDBCDriverComposeURLRecognizer;

Review comment:
       Please update all config-*.yaml

##########
File path: shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/recognizer/impl/SQLServerRecognizer.java
##########
@@ -27,9 +28,11 @@
  */
 public final class SQLServerRecognizer implements JDBCDriverURLRecognizer {
     
+    private SQLServerDatabaseType databaseType = new SQLServerDatabaseType();

Review comment:
       Field 'databaseType' may be 'final'

##########
File path: shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/recognizer/impl/MySQLRecognizer.java
##########
@@ -27,9 +28,11 @@
  */
 public final class MySQLRecognizer implements JDBCDriverURLRecognizer {
     
+    private MySQLDatabaseType databaseType = new MySQLDatabaseType();

Review comment:
       Field 'databaseType' may be 'final'

##########
File path: shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/recognizer/impl/P6SpyDriverRecognizerTest.java
##########
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.proxy.backend.communication.jdbc.recognizer.impl;
+
+import org.junit.Test;
+
+import java.util.Collections;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+public class P6SpyDriverRecognizerTest {
+    
+    private final P6SpyDriverRecognizer recognizer = new P6SpyDriverRecognizer();
+    
+    @Test
+    public void getURLPrefixes() throws Exception {
+        assertThat(recognizer.getURLPrefixes(), is(Collections.singletonList("jdbc:p6spy:")));
+    }
+    
+    @Test
+    public void getDriverClassName() throws Exception {

Review comment:
       Redundant exception.

##########
File path: shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/recognizer/impl/P6SpyDriverRecognizerTest.java
##########
@@ -0,0 +1,41 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.proxy.backend.communication.jdbc.recognizer.impl;
+
+import org.junit.Test;
+
+import java.util.Collections;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+
+public class P6SpyDriverRecognizerTest {
+    
+    private final P6SpyDriverRecognizer recognizer = new P6SpyDriverRecognizer();
+    
+    @Test
+    public void getURLPrefixes() throws Exception {

Review comment:
       Redundant exception.

##########
File path: shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/jdbc/recognizer/impl/H2Recognizer.java
##########
@@ -27,9 +28,11 @@
  */
 public final class H2Recognizer implements JDBCDriverURLRecognizer {
     
+    private H2DatabaseType databaseType = new H2DatabaseType();

Review comment:
       Field 'databaseType' may be 'final'




----------------------------------------------------------------
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