This is an automated email from the ASF dual-hosted git repository. zhangliang 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 110299f5509 Remove P6spy module and related configurations from project files (#35280) 110299f5509 is described below commit 110299f5509bb86512364dd4e267dadb7d32b154 Author: Liang Zhang <zhangli...@apache.org> AuthorDate: Mon Apr 28 15:15:54 2025 +0800 Remove P6spy module and related configurations from project files (#35280) --- .../unsupported/p6spy/_index.cn.md | 154 -------------------- .../unsupported/p6spy/_index.en.md | 156 --------------------- infra/common/pom.xml | 5 - infra/database/type/p6spy/pom.xml | 43 ------ .../p6spy/type/P6spyMySQLDatabaseType.java | 46 ------ ...ingsphere.infra.database.core.type.DatabaseType | 18 --- .../p6spy/type/P6spyMySQLDatabaseTypeTest.java | 35 ----- infra/database/type/pom.xml | 1 - .../reflect-config.json | 4 - 9 files changed, 462 deletions(-) diff --git a/docs/document/content/user-manual/shardingsphere-jdbc/unsupported/p6spy/_index.cn.md b/docs/document/content/user-manual/shardingsphere-jdbc/unsupported/p6spy/_index.cn.md deleted file mode 100644 index 5c7f25a593a..00000000000 --- a/docs/document/content/user-manual/shardingsphere-jdbc/unsupported/p6spy/_index.cn.md +++ /dev/null @@ -1,154 +0,0 @@ -+++ -title = "P6Spy" -weight = 6 -+++ - -## 背景信息 - -ShardingSphere 通过 `org.apache.shardingsphere:shardingsphere-infra-database-p6spy` 模块, -对 `com.p6spy.engine.spy.P6SpyDriver` 提供部分支持。 - -## 前提条件 - -要在 ShardingSphere 的配置文件为 MySQL Server 数据节点使用 P6Spy, 可能的 Maven 依赖关系如下, - -```xml -<dependencies> - <dependency> - <groupId>org.apache.shardingsphere</groupId> - <artifactId>shardingsphere-jdbc</artifactId> - <version>${shardingsphere.version}</version> - </dependency> - <dependency> - <groupId>p6spy</groupId> - <artifactId>p6spy</artifactId> - <version>3.9.1</version> - </dependency> - <dependency> - <groupId>com.mysql</groupId> - <artifactId>mysql-connector-j</artifactId> - <version>9.1.0</version> - </dependency> -</dependencies> -``` - -## 配置示例 - -### 启动 MySQL Server - -编写 Docker Compose 文件来启动 MySQL Server。 - -```yaml -services: - mysql: - image: mysql:9.1.0 - environment: - MYSQL_ROOT_PASSWORD: example - volumes: - - ./mysql/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d - ports: - - "3306:3306" -``` - -`./docker-entrypoint-initdb.d` 文件夹包含文件为 `init.sh`,内容如下, - -```shell -#!/bin/bash -set -e - -mysql -uroot -p"$MYSQL_ROOT_PASSWORD" <<EOSQL -CREATE DATABASE demo_ds_0; -CREATE DATABASE demo_ds_1; -CREATE DATABASE demo_ds_2; -EOSQL - -for i in "demo_ds_0" "demo_ds_1" "demo_ds_2" -do -mysql -uroot -p"$MYSQL_ROOT_PASSWORD" "$i" <<'EOSQL' -CREATE TABLE IF NOT EXISTS t_order ( - order_id BIGINT NOT NULL AUTO_INCREMENT, - order_type INT(11), - user_id INT NOT NULL, - address_id BIGINT NOT NULL, - status VARCHAR(50), - PRIMARY KEY (order_id) -); -EOSQL -done -``` - -### 在业务项目创建 ShardingSphere 数据源 - -在业务项目引入前提条件涉及的依赖后,在业务项目的 classpath 上编写 ShardingSphere 数据源的配置文件`demo.yaml`, - -```yaml -dataSources: - ds_0: - dataSourceClassName: com.zaxxer.hikari.HikariDataSource - driverClassName: com.p6spy.engine.spy.P6SpyDriver - jdbcUrl: jdbc:p6spy:mysql://localhost:3306/demo_ds_0?sslMode=REQUIRED - username: root - password: example - ds_1: - dataSourceClassName: com.zaxxer.hikari.HikariDataSource - driverClassName: com.p6spy.engine.spy.P6SpyDriver - jdbcUrl: jdbc:p6spy:mysql://localhost:3306/demo_ds_1?sslMode=REQUIRED - username: root - password: example - ds_2: - dataSourceClassName: com.zaxxer.hikari.HikariDataSource - driverClassName: com.p6spy.engine.spy.P6SpyDriver - jdbcUrl: jdbc:p6spy:mysql://localhost:3306/demo_ds_2?sslMode=REQUIRED - username: root - password: example -rules: -- !SHARDING - tables: - t_order: - actualDataNodes: - keyGenerateStrategy: - column: order_id - keyGeneratorName: snowflake - defaultDatabaseStrategy: - standard: - shardingColumn: user_id - shardingAlgorithmName: inline - shardingAlgorithms: - inline: - type: INLINE - props: - algorithm-expression: ds_${user_id % 2} - keyGenerators: - snowflake: - type: SNOWFLAKE -``` - -### 享受集成 - -创建 ShardingSphere 的数据源以享受集成, - -```java -import com.zaxxer.hikari.HikariConfig; -import com.zaxxer.hikari.HikariDataSource; -import java.sql.Connection; -import java.sql.SQLException; -import java.sql.Statement; -public class ExampleUtils { - void test() throws SQLException { - HikariConfig config = new HikariConfig(); - config.setJdbcUrl("jdbc:shardingsphere:classpath:demo.yaml"); - config.setDriverClassName("org.apache.shardingsphere.driver.ShardingSphereDriver"); - try (HikariDataSource dataSource = new HikariDataSource(config); - Connection connection = dataSource.getConnection(); - Statement statement = connection.createStatement()) { - statement.execute("INSERT INTO t_order (user_id, order_type, address_id, status) VALUES (1, 1, 1, 'INSERT_TEST')"); - statement.executeQuery("SELECT * FROM t_order"); - statement.execute("DELETE FROM t_order WHERE order_id=1"); - } - } -} -``` - -## 使用限制 - -目前仅支持为 MySQL JDBC Driver 配置 P6Spy。 diff --git a/docs/document/content/user-manual/shardingsphere-jdbc/unsupported/p6spy/_index.en.md b/docs/document/content/user-manual/shardingsphere-jdbc/unsupported/p6spy/_index.en.md deleted file mode 100644 index 7b07f7dd238..00000000000 --- a/docs/document/content/user-manual/shardingsphere-jdbc/unsupported/p6spy/_index.en.md +++ /dev/null @@ -1,156 +0,0 @@ -+++ -title = "P6Spy" -weight = 6 -+++ - -## Background Information - -ShardingSphere provides partial support for `com.p6spy.engine.spy.P6SpyDriver` through the -`org.apache.shardingsphere:shardingsphere-infra-database-p6spy` module. - -## Prerequisites - -To use P6Spy for MySQL Server data nodes in ShardingSphere's configuration file, -the possible Maven dependencies are as follows, - -```xml -<dependencies> - <dependency> - <groupId>org.apache.shardingsphere</groupId> - <artifactId>shardingsphere-jdbc</artifactId> - <version>${shardingsphere.version}</version> - </dependency> - <dependency> - <groupId>p6spy</groupId> - <artifactId>p6spy</artifactId> - <version>3.9.1</version> - </dependency> - <dependency> - <groupId>com.mysql</groupId> - <artifactId>mysql-connector-j</artifactId> - <version>9.1.0</version> - </dependency> -</dependencies> -``` - -## Configuration Example - -### Start MySQL Server - -Write a Docker Compose file to start MySQL Server. - -```yaml -services: - mysql: - image: mysql:9.1.0 - environment: - MYSQL_ROOT_PASSWORD: example - volumes: - - ./mysql/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d - ports: - - "3306:3306" -``` - -The `./docker-entrypoint-initdb.d` folder contains the file `init.sh`, the content is as follows, - -```shell -#!/bin/bash -set -e - -mysql -uroot -p"$MYSQL_ROOT_PASSWORD" <<EOSQL -CREATE DATABASE demo_ds_0; -CREATE DATABASE demo_ds_1; -CREATE DATABASE demo_ds_2; -EOSQL - -for i in "demo_ds_0" "demo_ds_1" "demo_ds_2" -do -mysql -uroot -p"$MYSQL_ROOT_PASSWORD" "$i" <<'EOSQL' -CREATE TABLE IF NOT EXISTS t_order ( - order_id BIGINT NOT NULL AUTO_INCREMENT, - order_type INT(11), - user_id INT NOT NULL, - address_id BIGINT NOT NULL, - status VARCHAR(50), - PRIMARY KEY (order_id) -); -EOSQL -done -``` - -### Create ShardingSphere data source in business project - -After the business project introduces the dependencies involved in the prerequisites, -write the ShardingSphere data source configuration file `demo.yaml` on the classpath of the business project. - -```yaml -dataSources: - ds_0: - dataSourceClassName: com.zaxxer.hikari.HikariDataSource - driverClassName: com.p6spy.engine.spy.P6SpyDriver - jdbcUrl: jdbc:p6spy:mysql://localhost:3306/demo_ds_0?sslMode=REQUIRED - username: root - password: example - ds_1: - dataSourceClassName: com.zaxxer.hikari.HikariDataSource - driverClassName: com.p6spy.engine.spy.P6SpyDriver - jdbcUrl: jdbc:p6spy:mysql://localhost:3306/demo_ds_1?sslMode=REQUIRED - username: root - password: example - ds_2: - dataSourceClassName: com.zaxxer.hikari.HikariDataSource - driverClassName: com.p6spy.engine.spy.P6SpyDriver - jdbcUrl: jdbc:p6spy:mysql://localhost:3306/demo_ds_2?sslMode=REQUIRED - username: root - password: example -rules: -- !SHARDING - tables: - t_order: - actualDataNodes: - keyGenerateStrategy: - column: order_id - keyGeneratorName: snowflake - defaultDatabaseStrategy: - standard: - shardingColumn: user_id - shardingAlgorithmName: inline - shardingAlgorithms: - inline: - type: INLINE - props: - algorithm-expression: ds_${user_id % 2} - keyGenerators: - snowflake: - type: SNOWFLAKE -``` - -### Enjoy integration - -Create a ShardingSphere data source to enjoy integration, - -```java -import com.zaxxer.hikari.HikariConfig; -import com.zaxxer.hikari.HikariDataSource; -import java.sql.Connection; -import java.sql.SQLException; -import java.sql.Statement; -public class ExampleUtils { - void test() throws SQLException { - HikariConfig config = new HikariConfig(); - config.setJdbcUrl("jdbc:shardingsphere:classpath:demo.yaml"); - config.setDriverClassName("org.apache.shardingsphere.driver.ShardingSphereDriver"); - try (HikariDataSource dataSource = new HikariDataSource(config); - Connection connection = dataSource.getConnection(); - Statement statement = connection.createStatement()) { - statement.execute("INSERT INTO t_order (user_id, order_type, address_id, status) VALUES (1, 1, 1, 'INSERT_TEST')"); - statement.executeQuery("SELECT * FROM t_order"); - statement.execute("DELETE FROM t_order WHERE order_id=1"); - } - } -} -``` - -## Usage Limitations - -Currently only supports configuring P6Spy for MySQL JDBC Driver. diff --git a/infra/common/pom.xml b/infra/common/pom.xml index e85376628b2..df4e9aa1ce6 100644 --- a/infra/common/pom.xml +++ b/infra/common/pom.xml @@ -78,11 +78,6 @@ <artifactId>shardingsphere-infra-database-sql92</artifactId> <version>${project.version}</version> </dependency> - <dependency> - <groupId>org.apache.shardingsphere</groupId> - <artifactId>shardingsphere-infra-database-p6spy</artifactId> - <version>${project.version}</version> - </dependency> <dependency> <groupId>org.apache.shardingsphere</groupId> <artifactId>shardingsphere-infra-database-firebird</artifactId> diff --git a/infra/database/type/p6spy/pom.xml b/infra/database/type/p6spy/pom.xml deleted file mode 100644 index d8de45b856f..00000000000 --- a/infra/database/type/p6spy/pom.xml +++ /dev/null @@ -1,43 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - ~ 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. - --> - -<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>org.apache.shardingsphere</groupId> - <artifactId>shardingsphere-infra-database-type</artifactId> - <version>5.5.3-SNAPSHOT</version> - </parent> - <artifactId>shardingsphere-infra-database-p6spy</artifactId> - <name>${project.artifactId}</name> - - <dependencies> - <dependency> - <groupId>org.apache.shardingsphere</groupId> - <artifactId>shardingsphere-infra-database-core</artifactId> - <version>${project.version}</version> - </dependency> - - <dependency> - <groupId>org.apache.shardingsphere</groupId> - <artifactId>shardingsphere-test-util</artifactId> - <version>${project.version}</version> - <scope>test</scope> - </dependency> - </dependencies> -</project> diff --git a/infra/database/type/p6spy/src/main/java/org/apache/shardingsphere/infra/database/p6spy/type/P6spyMySQLDatabaseType.java b/infra/database/type/p6spy/src/main/java/org/apache/shardingsphere/infra/database/p6spy/type/P6spyMySQLDatabaseType.java deleted file mode 100644 index cefd418c3c9..00000000000 --- a/infra/database/type/p6spy/src/main/java/org/apache/shardingsphere/infra/database/p6spy/type/P6spyMySQLDatabaseType.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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.infra.database.p6spy.type; - -import org.apache.shardingsphere.infra.database.core.type.DatabaseType; -import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; - -import java.util.Collection; -import java.util.Collections; -import java.util.Optional; - -/** - * Database type of MySQL under P6Spy. - */ -public class P6spyMySQLDatabaseType implements DatabaseType { - - @Override - public Collection<String> getJdbcUrlPrefixes() { - return Collections.singletonList("jdbc:p6spy:mysql:"); - } - - @Override - public Optional<DatabaseType> getTrunkDatabaseType() { - return Optional.of(TypedSPILoader.getService(DatabaseType.class, "MySQL")); - } - - @Override - public String getType() { - return "P6spyMySQL"; - } -} diff --git a/infra/database/type/p6spy/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.database.core.type.DatabaseType b/infra/database/type/p6spy/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.database.core.type.DatabaseType deleted file mode 100644 index eda25d0b620..00000000000 --- a/infra/database/type/p6spy/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.database.core.type.DatabaseType +++ /dev/null @@ -1,18 +0,0 @@ -# -# 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. -# - -org.apache.shardingsphere.infra.database.p6spy.type.P6spyMySQLDatabaseType diff --git a/infra/database/type/p6spy/src/test/java/org/apache/shardingsphere/infra/database/p6spy/type/P6spyMySQLDatabaseTypeTest.java b/infra/database/type/p6spy/src/test/java/org/apache/shardingsphere/infra/database/p6spy/type/P6spyMySQLDatabaseTypeTest.java deleted file mode 100644 index a476838e644..00000000000 --- a/infra/database/type/p6spy/src/test/java/org/apache/shardingsphere/infra/database/p6spy/type/P6spyMySQLDatabaseTypeTest.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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.infra.database.p6spy.type; - -import org.apache.shardingsphere.infra.database.core.type.DatabaseType; -import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader; -import org.junit.jupiter.api.Test; - -import java.util.Collections; - -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; - -class P6spyMySQLDatabaseTypeTest { - - @Test - void assertGetJdbcUrlPrefixes() { - assertThat(TypedSPILoader.getService(DatabaseType.class, "P6spyMySQL").getJdbcUrlPrefixes(), is(Collections.singletonList("jdbc:p6spy:mysql:"))); - } -} diff --git a/infra/database/type/pom.xml b/infra/database/type/pom.xml index 2738001a981..8b85aef0fa5 100644 --- a/infra/database/type/pom.xml +++ b/infra/database/type/pom.xml @@ -41,7 +41,6 @@ <module>firebird</module> <module>h2</module> <module>sql92</module> - <module>p6spy</module> <module>testcontainers</module> </modules> </project> diff --git a/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/generated-reachability-metadata/reflect-config.json b/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/generated-reachability-metadata/reflect-config.json index d720675965f..15810edce7e 100644 --- a/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/generated-reachability-metadata/reflect-config.json +++ b/infra/reachability-metadata/src/main/resources/META-INF/native-image/org.apache.shardingsphere/generated-reachability-metadata/reflect-config.json @@ -1525,10 +1525,6 @@ "condition":{"typeReachable":"org.apache.shardingsphere.infra.database.core.type.DatabaseTypeFactory"}, "name":"org.apache.shardingsphere.infra.database.oracle.type.OracleDatabaseType" }, -{ - "condition":{"typeReachable":"org.apache.shardingsphere.infra.database.core.type.DatabaseTypeFactory"}, - "name":"org.apache.shardingsphere.infra.database.p6spy.type.P6spyMySQLDatabaseType" -}, { "condition":{"typeReachable":"org.apache.shardingsphere.transaction.xa.XAShardingSphereTransactionManager"}, "name":"org.apache.shardingsphere.infra.database.postgresql.checker.PostgreSQLDatabasePrivilegeChecker"