mirror of
https://gitee.com/dromara/dbswitch.git
synced 2025-08-29 00:44:19 +00:00
version for 1.9.10
This commit is contained in:
@@ -6,6 +6,7 @@ body:
|
||||
attributes:
|
||||
label: dbswitch版本
|
||||
options:
|
||||
- "1.9.10"
|
||||
- "1.9.9"
|
||||
- "1.9.8"
|
||||
- "1.9.7"
|
||||
|
@@ -3,7 +3,7 @@
|
||||

|
||||

|
||||
|
||||

|
||||

|
||||
|
||||
## 一、工具介绍
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
set -e
|
||||
|
||||
DBSWITCH_VERSION=1.9.9
|
||||
DBSWITCH_VERSION=1.9.10
|
||||
BUILD_DOCKER_DIR="$( cd "$( dirname "$0" )" && pwd )"
|
||||
PROJECT_ROOT_DIR=$( dirname "$BUILD_DOCKER_DIR")
|
||||
DOCKER_DBSWITCH_DIR=$BUILD_DOCKER_DIR/dbswitch
|
||||
|
@@ -1,7 +1,7 @@
|
||||
services:
|
||||
mysqldb:
|
||||
container_name: dbswitch_mysqldb
|
||||
image: mysql:5.7
|
||||
image: registry.cn-hangzhou.aliyuncs.com/inrgihc/mysql:5.7
|
||||
volumes:
|
||||
- "/data/mysql:/var/lib/mysql"
|
||||
environment:
|
||||
|
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>com.gitee.dbswitch</groupId>
|
||||
<artifactId>dbswitch-parent</artifactId>
|
||||
<version>1.9.9</version>
|
||||
<version>1.9.10</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>dbswitch-admin</artifactId>
|
||||
|
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>com.gitee.dbswitch</groupId>
|
||||
<artifactId>dbswitch-parent</artifactId>
|
||||
<version>1.9.9</version>
|
||||
<version>1.9.10</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>dbswitch-common</artifactId>
|
||||
|
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>com.gitee.dbswitch</groupId>
|
||||
<artifactId>dbswitch-parent</artifactId>
|
||||
<version>1.9.9</version>
|
||||
<version>1.9.10</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>dbswitch-core</artifactId>
|
||||
|
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>com.gitee.dbswitch</groupId>
|
||||
<artifactId>dbswitch-parent</artifactId>
|
||||
<version>1.9.9</version>
|
||||
<version>1.9.10</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>dbswitch-data</artifactId>
|
||||
|
@@ -13,16 +13,14 @@ import cn.hutool.core.util.ClassLoaderUtil;
|
||||
import com.gitee.dbswitch.common.entity.CloseableDataSource;
|
||||
import com.gitee.dbswitch.common.entity.InvisibleDataSource;
|
||||
import com.gitee.dbswitch.common.entity.JarClassLoader;
|
||||
import com.gitee.dbswitch.common.type.ProductTypeEnum;
|
||||
import com.gitee.dbswitch.common.util.ExamineUtils;
|
||||
import com.gitee.dbswitch.common.util.ProductTypeUtils;
|
||||
import com.gitee.dbswitch.data.domain.WrapCommonDataSource;
|
||||
import com.gitee.dbswitch.data.domain.WrapHikariDataSource;
|
||||
import com.gitee.dbswitch.data.entity.SourceDataSourceProperties;
|
||||
import com.gitee.dbswitch.data.entity.TargetDataSourceProperties;
|
||||
import com.zaxxer.hikari.HikariDataSource;
|
||||
import java.net.URLClassLoader;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@@ -130,15 +128,9 @@ public final class DataSourceUtils {
|
||||
);
|
||||
|
||||
// 如果是Greenplum数据库,这里需要关闭会话的查询优化器
|
||||
if (properties.getDriverClassName().contains("postgresql")) {
|
||||
try (Connection connection = dataSource.getConnection()) {
|
||||
if (ProductTypeUtils.isGreenplum(connection)) {
|
||||
ds.setConnectionInitSql("set optimizer to 'off'");
|
||||
log.info("Greenplum: Close Optimizer now: set optimizer to 'off'");
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
if (ProductTypeEnum.GREENPLUM == properties.getType()) {
|
||||
ds.setConnectionInitSql("set optimizer to 'off'");
|
||||
log.info("Greenplum: Close Optimizer now: set optimizer to 'off'");
|
||||
}
|
||||
|
||||
ds.setDataSource(dataSource);
|
||||
|
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>com.gitee.dbswitch</groupId>
|
||||
<artifactId>dbswitch-parent</artifactId>
|
||||
<version>1.9.9</version>
|
||||
<version>1.9.10</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>dbswitch-dist</artifactId>
|
||||
|
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>dbswitch-product</artifactId>
|
||||
<groupId>com.gitee.dbswitch</groupId>
|
||||
<version>1.9.9</version>
|
||||
<version>1.9.10</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>dbswitch-product</artifactId>
|
||||
<groupId>com.gitee.dbswitch</groupId>
|
||||
<version>1.9.9</version>
|
||||
<version>1.9.10</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>dbswitch-product</artifactId>
|
||||
<groupId>com.gitee.dbswitch</groupId>
|
||||
<version>1.9.9</version>
|
||||
<version>1.9.10</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>dbswitch-product-dm</artifactId>
|
||||
|
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>dbswitch-product</artifactId>
|
||||
<groupId>com.gitee.dbswitch</groupId>
|
||||
<version>1.9.9</version>
|
||||
<version>1.9.10</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>dbswitch-product-doris</artifactId>
|
||||
|
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>dbswitch-product</artifactId>
|
||||
<groupId>com.gitee.dbswitch</groupId>
|
||||
<version>1.9.9</version>
|
||||
<version>1.9.10</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>dbswitch-product-elasticsearch</artifactId>
|
||||
|
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>dbswitch-product</artifactId>
|
||||
<groupId>com.gitee.dbswitch</groupId>
|
||||
<version>1.9.9</version>
|
||||
<version>1.9.10</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>dbswitch-product</artifactId>
|
||||
<groupId>com.gitee.dbswitch</groupId>
|
||||
<version>1.9.9</version>
|
||||
<version>1.9.10</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>dbswitch-product</artifactId>
|
||||
<groupId>com.gitee.dbswitch</groupId>
|
||||
<version>1.9.9</version>
|
||||
<version>1.9.10</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>dbswitch-product</artifactId>
|
||||
<groupId>com.gitee.dbswitch</groupId>
|
||||
<version>1.9.9</version>
|
||||
<version>1.9.10</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>dbswitch-product</artifactId>
|
||||
<groupId>com.gitee.dbswitch</groupId>
|
||||
<version>1.9.9</version>
|
||||
<version>1.9.10</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>dbswitch-product</artifactId>
|
||||
<groupId>com.gitee.dbswitch</groupId>
|
||||
<version>1.9.9</version>
|
||||
<version>1.9.10</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>dbswitch-product</artifactId>
|
||||
<groupId>com.gitee.dbswitch</groupId>
|
||||
<version>1.9.9</version>
|
||||
<version>1.9.10</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>dbswitch-product-mongodb</artifactId>
|
||||
|
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>dbswitch-product</artifactId>
|
||||
<groupId>com.gitee.dbswitch</groupId>
|
||||
<version>1.9.9</version>
|
||||
<version>1.9.10</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>dbswitch-product-mysql</artifactId>
|
||||
|
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>dbswitch-product</artifactId>
|
||||
<groupId>com.gitee.dbswitch</groupId>
|
||||
<version>1.9.9</version>
|
||||
<version>1.9.10</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>dbswitch-product-oceanbase</artifactId>
|
||||
|
@@ -11,7 +11,6 @@ package com.gitee.dbswitch.product.oceanbase;
|
||||
|
||||
import com.gitee.dbswitch.annotation.Product;
|
||||
import com.gitee.dbswitch.common.type.ProductTypeEnum;
|
||||
import com.gitee.dbswitch.common.util.ProductTypeUtils;
|
||||
import com.gitee.dbswitch.features.DefaultProductFeatures;
|
||||
import com.gitee.dbswitch.features.ProductFeatures;
|
||||
import com.gitee.dbswitch.product.mysql.MysqlFeatures;
|
||||
@@ -43,7 +42,7 @@ public class OceanbaseFactoryProvider extends AbstractFactoryProvider {
|
||||
super(dataSource);
|
||||
|
||||
try (Connection connection = getDataSource().getConnection()) {
|
||||
this.isMySqlMode = ProductTypeUtils.isOceanBaseUseMysqlMode(connection);
|
||||
this.isMySqlMode = OceanbaseUtils.isOceanBaseUseMysqlMode(connection);
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("#### Target OceanBase is {} Mode ", this.isMySqlMode ? "MySQL" : "Oracle");
|
||||
}
|
||||
|
@@ -7,52 +7,19 @@
|
||||
// Date : 2020/1/2
|
||||
// Location: beijing , china
|
||||
/////////////////////////////////////////////////////////////
|
||||
package com.gitee.dbswitch.common.util;
|
||||
package com.gitee.dbswitch.product.oceanbase;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.util.Objects;
|
||||
import lombok.experimental.UtilityClass;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
public final class ProductTypeUtils {
|
||||
|
||||
public static boolean isGreenplum(Connection connection) {
|
||||
try (PreparedStatement statement = connection.prepareStatement("SELECT version()")) {
|
||||
try (ResultSet resultSet = statement.executeQuery()) {
|
||||
if (resultSet.next()) {
|
||||
String version = resultSet.getString(1);
|
||||
if (Objects.nonNull(version) && version.contains("Greenplum")) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("#### Target database is Greenplum Cluster");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (SQLException sqlException) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("#### Failed to execute sql :select version(), and guesses it is not Greenplum datasource!");
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isStarRocks(Connection connection) {
|
||||
// 此查询语句是StarRocks查询be节点是否存活,可以用来判断是否是StarRocks数据源
|
||||
String sql = "SHOW BACKENDS";
|
||||
try (Statement statement = connection.createStatement()) {
|
||||
return statement.execute(sql);
|
||||
} catch (SQLException sqlException) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Failed to execute sql :show backends, and guesses it is mysql datasource!");
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@UtilityClass
|
||||
public class OceanbaseUtils {
|
||||
|
||||
public static boolean isOceanBaseUseMysqlMode(Connection connection) {
|
||||
String sql = "show global variables where variable_name = 'ob_compatibility_mode'";
|
||||
@@ -80,5 +47,4 @@ public final class ProductTypeUtils {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>dbswitch-product</artifactId>
|
||||
<groupId>com.gitee.dbswitch</groupId>
|
||||
<version>1.9.9</version>
|
||||
<version>1.9.10</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>dbswitch-product</artifactId>
|
||||
<groupId>com.gitee.dbswitch</groupId>
|
||||
<version>1.9.9</version>
|
||||
<version>1.9.10</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>dbswitch-product</artifactId>
|
||||
<groupId>com.gitee.dbswitch</groupId>
|
||||
<version>1.9.9</version>
|
||||
<version>1.9.10</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>dbswitch-product</artifactId>
|
||||
<groupId>com.gitee.dbswitch</groupId>
|
||||
<version>1.9.9</version>
|
||||
<version>1.9.10</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>dbswitch-product</artifactId>
|
||||
<groupId>com.gitee.dbswitch</groupId>
|
||||
<version>1.9.9</version>
|
||||
<version>1.9.10</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>dbswitch-product</artifactId>
|
||||
<groupId>com.gitee.dbswitch</groupId>
|
||||
<version>1.9.9</version>
|
||||
<version>1.9.10</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>dbswitch-product</artifactId>
|
||||
<groupId>com.gitee.dbswitch</groupId>
|
||||
<version>1.9.9</version>
|
||||
<version>1.9.10</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>dbswitch-product-starrocks</artifactId>
|
||||
|
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>dbswitch-product</artifactId>
|
||||
<groupId>com.gitee.dbswitch</groupId>
|
||||
<version>1.9.9</version>
|
||||
<version>1.9.10</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>dbswitch-product</artifactId>
|
||||
<groupId>com.gitee.dbswitch</groupId>
|
||||
<version>1.9.9</version>
|
||||
<version>1.9.10</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>dbswitch-parent</artifactId>
|
||||
<groupId>com.gitee.dbswitch</groupId>
|
||||
<version>1.9.9</version>
|
||||
<version>1.9.10</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>dbswitch-product</artifactId>
|
||||
|
@@ -1,30 +1,14 @@
|
||||
<!--
|
||||
|
||||
Copyright 2010-2020 Redgate Software Ltd
|
||||
|
||||
Licensed 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.
|
||||
|
||||
-->
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.gitee.dbswitch</groupId>
|
||||
<artifactId>dbswitch-parent</artifactId>
|
||||
<version>1.9.9</version>
|
||||
<version>1.9.10</version>
|
||||
</parent>
|
||||
<artifactId>flyway-core</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
@@ -57,8 +41,6 @@
|
||||
<artifactId>postgresql</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
@@ -166,5 +148,4 @@
|
||||
</plugins>
|
||||
</reporting>
|
||||
|
||||
|
||||
</project>
|
BIN
images/dbswitch-logo.png
Normal file
BIN
images/dbswitch-logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 27 KiB |
2
pom.xml
2
pom.xml
@@ -4,7 +4,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.gitee.dbswitch</groupId>
|
||||
<artifactId>dbswitch-parent</artifactId>
|
||||
<version>1.9.9</version>
|
||||
<version>1.9.10</version>
|
||||
<packaging>pom</packaging>
|
||||
<name>dbswitch</name>
|
||||
<description>database switch project</description>
|
||||
|
@@ -1,6 +1,6 @@
|
||||
@echo off
|
||||
|
||||
set APP_VERSION=1.9.9
|
||||
set APP_VERSION=1.9.10
|
||||
|
||||
echo "Clean Project ..."
|
||||
call mvn clean -f pom.xml
|
||||
|
Reference in New Issue
Block a user