You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2022/05/10 06:01:04 UTC

[shardingsphere] branch master updated: Update Scaling ci, combine MySQL and PostgresSQL (#17510)

This is an automated email from the ASF dual-hosted git repository.

zhonghongsheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new 87ab968441e Update Scaling ci, combine MySQL and PostgresSQL (#17510)
87ab968441e is described below

commit 87ab968441eba794f911860b0c87d46feadf9af0
Author: azexcy <10...@users.noreply.github.com>
AuthorDate: Tue May 10 14:00:58 2022 +0800

    Update Scaling ci, combine MySQL and PostgresSQL (#17510)
    
    * Fix codestyle
    
    * Update Scaling ci
    
    * Add quote of schema
---
 .github/workflows/it-scaling.yml                   | 93 +++-------------------
 .../sqlbuilder/PostgreSQLPipelineSQLBuilder.java   |  3 +-
 .../postgresql/util/FreemarkerManager.java         |  2 +-
 .../data/pipeline/cases/BaseITCase.java            |  2 +-
 .../src/test/resources/env/logback.xml             |  2 +-
 .../src/test/resources/logback-test.xml            |  8 +-
 6 files changed, 19 insertions(+), 91 deletions(-)

diff --git a/.github/workflows/it-scaling.yml b/.github/workflows/it-scaling.yml
index a0586619762..633c5951ab0 100644
--- a/.github/workflows/it-scaling.yml
+++ b/.github/workflows/it-scaling.yml
@@ -61,74 +61,14 @@ env:
   MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3 -Dmaven.javadoc.skip=true -Drat.skip=true -Dcheckstyle.skip=true -Dspotless.apply.skip=true -Djacoco.skip=true
 
 jobs:
-  scaling-build-it-image:
-    name: scaling-build-it-image
-    runs-on: ubuntu-latest
-    timeout-minutes: 20
-    steps:
-      - uses: actions/checkout@v2
-      - name: Maven resolve ranges
-        run: ./mvnw versions:resolve-ranges -ntp -Dincludes='org.springframework:*,org.springframework.boot:*'
-      - name: Cache Maven Repos
-        uses: actions/cache@v3
-        with:
-          path: ~/.m2/repository
-          key: shardingsphere-it-cache-${{ github.sha }}
-          restore-keys: |
-            ${{ runner.os }}-maven-
-      - name: Set up JDK 8
-        uses: actions/setup-java@v3
-        with:
-          distribution: 'temurin'
-          java-version: 8
-      - name: Build IT image
-        run: ./mvnw -B clean install -am -pl shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling -Pit.env.docker -DskipTests -Dspotless.apply.skip=true
-      - name: Save IT image
-        run: docker save -o /tmp/shardingsphere-proxy-test.tar apache/shardingsphere-proxy-test:latest
-      - name: Upload IT image
-        uses: actions/upload-artifact@v3
-        with:
-          name: it-image
-          path: /tmp/shardingsphere-proxy-test.tar
-  
-  scaling-mysql-it-test:
-    if: (github.event_name != 'schedule' && github.repository == 'apache/shardingsphere')
-    name: scaling-mysql-it-test
-    runs-on: ubuntu-latest
-    env:
-      mysql_version: mysql:5.7
-    timeout-minutes: 30
-    needs: scaling-build-it-image
-    steps:
-      - uses: actions/checkout@v3
-      - name: Cache Maven Repos
-        uses: actions/cache@v3
-        with:
-          path: ~/.m2/repository
-          key: shardingsphere-it-cache-${{ github.sha }}
-      - name: Set up JDK 8
-        uses: actions/setup-java@v3
-        with:
-          distribution: 'temurin'
-          java-version: 8
-      - name: Download IT image
-        uses: actions/download-artifact@v3
-        with:
-          name: it-image
-          path: /tmp/
-      - name: Load IT image
-        run: docker load -i /tmp/shardingsphere-proxy-test.tar
-      - name: Run Integration Test
-        run: ./mvnw -nsu -B install -f shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/pom.xml -Dcheckstyle.skip=true -Dspotless.apply.skip=true -Dit.cluster.env.type=DOCKER -Dit.env.mysql.version=${{ env.mysql_version }} -Dit.env.postgresql.version=
-  
-  scaling-postgresql-it-test:
+  scaling-it-test:
     if: (github.event_name != 'schedule' && github.repository == 'apache/shardingsphere')
-    name: scaling-postgres-it-test
+    name: scaling-it-test
     runs-on: ubuntu-latest
     env:
       postgresql_version: postgres:12-alpine
+      mysql_version: mysql:5.7
     timeout-minutes: 30
-    needs: scaling-build-it-image
     steps:
       - uses: actions/checkout@v3
       - name: Cache Maven Repos
@@ -141,15 +81,10 @@ jobs:
         with:
           distribution: 'temurin'
           java-version: 8
-      - name: Download IT image
-        uses: actions/download-artifact@v3
-        with:
-          name: it-image
-          path: /tmp/
-      - name: Load IT image
-        run: docker load -i /tmp/shardingsphere-proxy-test.tar
-      - name: Run Integration Test
-        run: ./mvnw -nsu -B install -f shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/pom.xml -Dcheckstyle.skip=true -Dspotless.apply.skip=true -Dit.cluster.env.type=DOCKER -Dit.env.postgresql.version=${{ env.postgresql_version }} -Dit.env.mysql.version=
+      - name: Build Scaling IT image
+        run: ./mvnw -B clean install -am -pl shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling -Pit.env.docker -DskipTests -Dspotless.apply.skip=true -Dcheckstyle.skip=true
+      - name: Run Scaling Integration Test
+        run: ./mvnw -nsu -B install -f shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/pom.xml -Dit.cluster.env.type=DOCKER -Dit.env.mysql.version=${{ env.mysql_version }} -Dit.env.postgresql.version=${{ env.postgresql_version }} -Dspotless.apply.skip=true -Dcheckstyle.skip=true
   
   scaling-daily-it-test:
     if: (github.event_name == 'schedule' && github.repository == 'apache/shardingsphere')
@@ -159,7 +94,6 @@ jobs:
       postgresql_version: postgres:10-alpine,postgres:11-alpine,postgres:12-alpine,postgres:13-alpine,postgres:14-alpine
       mysql_version: mysql:5.7,mysql:8.0
     timeout-minutes: 60
-    needs: scaling-build-it-image
     steps:
       - uses: actions/checkout@v3
       - name: Cache Maven Repos
@@ -172,12 +106,7 @@ jobs:
         with:
           distribution: 'temurin'
           java-version: 8
-      - name: Download IT image
-        uses: actions/download-artifact@v3
-        with:
-          name: it-image
-          path: /tmp/
-      - name: Load IT image
-        run: docker load -i /tmp/shardingsphere-proxy-test.tar
-      - name: Run Integration Test
-        run: ./mvnw -nsu -B install -f shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/pom.xml -Dcheckstyle.skip=true -Dspotless.apply.skip=true -Dit.cluster.env.type=DOCKER -Dit.env.postgresql.version=${{ env.postgresql_version }} -Dit.env.mysql.version=${{ env.mysql_version }}
+      - name: Build Scaling IT image
+        run: ./mvnw -B clean install -am -pl shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling -Pit.env.docker -DskipTests -Dcheckstyle.skip=true -Dspotless.apply.skip=true
+      - name: Run Scaling Daily Integration Test
+        run: ./mvnw -nsu -B install -f shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/pom.xml -Dit.cluster.env.type=DOCKER -Dit.env.postgresql.version=${{ env.postgresql_version }} -Dit.env.mysql.version=${{ env.mysql_version }} -Dspotless.apply.skip=true -Dcheckstyle.skip=true
diff --git a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-dialect/shardingsphere-data-pipeline-postgresql/src/main/java/org/apache/shardingsphere/data/pipeline/postgresql/sqlbuilder/PostgreSQLPipelineSQLBuilder.java b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-dialect/shardingsphere-data-pipeline-postgresql/src/main/java/org/apache/shardingsphere/data/pipeline/postgresql/sqlbuilder/PostgreSQLPipelineSQLBuilder.java
index 197c0a2d712..937bb5bf070 100644
--- a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-dialect/shardingsphere-data-pipeline-postgresql/src/main/java/org/apache/shardingsphere/data/pipeline/postgresql/sqlbuilder/PostgreSQLPipelineSQLBuilder.java
+++ b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-dialect/shardingsphere-data-pipeline-postgresql/src/main/java/org/apache/shardingsphere/data/pipeline/postgresql/sqlbuilder/PostgreSQLPipelineSQLBuilder.java
@@ -33,8 +33,7 @@ public final class PostgreSQLPipelineSQLBuilder extends AbstractPipelineSQLBuild
     
     @Override
     public String buildCreateSchemaSQL(final String schemaName) {
-        // TODO remove first, add when kernel fixed bug.
-        return "CREATE SCHEMA IF NOT EXISTS " + schemaName;
+        return "CREATE SCHEMA IF NOT EXISTS " + quote(schemaName);
     }
     
     @Override
diff --git a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-dialect/shardingsphere-data-pipeline-postgresql/src/main/java/org/apache/shardingsphere/data/pipeline/postgresql/util/FreemarkerManager.java b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-dialect/shardingsphere-data-pipeline-postgresql/src/main/java/org/apache/shardingsphere/data/pipeline/postgresql/util/FreemarkerManager.java
index 605be87b2b2..577e04946f9 100644
--- a/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-dialect/shardingsphere-data-pipeline-postgresql/src/main/java/org/apache/shardingsphere/data/pipeline/postgresql/util/FreemarkerManager.java
+++ b/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-dialect/shardingsphere-data-pipeline-postgresql/src/main/java/org/apache/shardingsphere/data/pipeline/postgresql/util/FreemarkerManager.java
@@ -70,7 +70,7 @@ public final class FreemarkerManager {
     @SneakyThrows
     private Configuration createTemplateConfiguration() {
         Configuration result = new Configuration(Configuration.VERSION_2_3_31);
-        result.setClassForTemplateLoading(this.getClass(), "/template");
+        result.setClassForTemplateLoading(getClass(), "/template");
         result.setDefaultEncoding("UTF-8");
         return result;
     }
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/BaseITCase.java b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/BaseITCase.java
index 460bc18d34e..0f9c5aa625b 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/BaseITCase.java
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/java/org/apache/shardingsphere/integration/data/pipeline/cases/BaseITCase.java
@@ -161,7 +161,7 @@ public abstract class BaseITCase {
         Map<String, String> actualStatusMap = new HashMap<>(2, 1);
         for (int i = 0; i < 100; i++) {
             List<Map<String, Object>> showScalingStatusResMap = jdbcTemplate.queryForList(String.format("SHOW SCALING STATUS %s", jobId));
-            log.warn("actualStatusMap: {}", actualStatusMap);
+            log.info("actualStatusMap: {}", actualStatusMap);
             boolean finished = true;
             for (Map<String, Object> entry : showScalingStatusResMap) {
                 String status = entry.get("status").toString();
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/logback.xml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/logback.xml
index 4f68c6eeb6b..fba0d761476 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/logback.xml
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/env/logback.xml
@@ -22,7 +22,7 @@
             <pattern>[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %logger{36} - %msg%n</pattern>
         </encoder>
     </appender>
-    <logger name="org.apache.shardingsphere" level="warn" additivity="false">
+    <logger name="org.apache.shardingsphere" level="WARN" additivity="false">
         <appender-ref ref="console" />
     </logger>
     
diff --git a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/logback-test.xml b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/logback-test.xml
index 70e539934f3..2240162e76b 100644
--- a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/logback-test.xml
+++ b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-scaling/src/test/resources/logback-test.xml
@@ -22,14 +22,14 @@
             <pattern>[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %logger{36} - %msg%n</pattern>
         </encoder>
     </appender>
-    <logger name="org.apache.shardingsphere" level="warn" additivity="false">
+    <logger name="org.apache.shardingsphere" level="WARN" additivity="false">
         <appender-ref ref="console" />
     </logger>
-    <logger name="org.springframework.jdbc.core.JdbcTemplate" level="debug" additivity="false">
+    <logger name="org.springframework.jdbc.core.JdbcTemplate" level="DEBUG" additivity="false">
         <appender-ref ref="console" />
     </logger>
-    <logger name="com.zaxxer.hikari.pool.ProxyConnection" level="error" />
-    <root level="warn">
+    <logger name="com.zaxxer.hikari.pool.ProxyConnection" level="ERROR" />
+    <root level="WARN">
         <appender-ref ref="console" />
     </root>
 </configuration>