This is an automated email from the ASF dual-hosted git repository.
tuichenchuxin 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 759dfaf7954 Create new algorithm module in infra and move snowflake,
uuid to this module (#29066)
759dfaf7954 is described below
commit 759dfaf79547ae6af135fa192ad6706d9cf0b411
Author: Zhengqiang Duan <[email protected]>
AuthorDate: Fri Nov 17 15:39:22 2023 +0800
Create new algorithm module in infra and move snowflake, uuid to this
module (#29066)
* Create new algorithm module in infra and move snowflake, uuid to this
module
* add uuid spi config
* add algorithm module to infra pom
---
features/sharding/core/pom.xml | 10 +++++
.../shardingsphere/sharding/rule/ShardingRule.java | 4 +-
...hardingsphere.sharding.spi.KeyGenerateAlgorithm | 19 ---------
.../AutoIncrementKeyGenerateAlgorithmFixture.java | 2 +-
.../sharding/rule/ShardingRuleTest.java | 6 +--
...ere.keygen.core.algorithm.KeyGenerateAlgorithm} | 0
.../checker/ShardingTableRuleStatementChecker.java | 2 +-
.../keygen/DistSQLKeyGenerateAlgorithmFixture.java | 2 +-
...ere.keygen.core.algorithm.KeyGenerateAlgorithm} | 0
infra/{ => algorithm/key-generator/core}/pom.xml | 39 ++++++++----------
.../core/algorithm}/KeyGenerateAlgorithm.java | 2 +-
.../core/exception/KeyGenerateSQLException.java | 18 ++++----
.../GenerateKeyStrategyNotFoundException.java | 6 +--
...eyGenerateAlgorithmInitializationException.java | 8 ++--
infra/{ => algorithm/key-generator}/pom.xml | 24 ++---------
infra/{ => algorithm/key-generator/type}/pom.xml | 24 ++---------
.../key-generator/type/snowflake}/pom.xml | 48 +++++++++++-----------
.../algorithm}/SnowflakeKeyGenerateAlgorithm.java | 10 ++---
.../keygen/snowflake/algorithm}/TimeService.java | 2 +-
.../SnowflakeClockMoveBackException.java | 8 ++--
...here.keygen.core.algorithm.KeyGenerateAlgorithm | 2 +-
.../SnowflakeKeyGenerateAlgorithmTest.java | 14 +++----
.../snowflake}/fixture/FixedTimeService.java | 6 +--
.../fixture/WorkerIdGeneratorFixture.java | 2 +-
.../key-generator/type/uuid}/pom.xml | 48 +++++++++++-----------
.../uuid/algorithm}/UUIDKeyGenerateAlgorithm.java | 4 +-
...here.keygen.core.algorithm.KeyGenerateAlgorithm | 2 +-
.../algorithm}/UUIDKeyGenerateAlgorithmTest.java | 2 +-
infra/{ => algorithm}/pom.xml | 23 ++---------
infra/pom.xml | 1 +
.../ShardingRuleConfigurationImportChecker.java | 6 +--
.../IncrementKeyGenerateAlgorithmFixture.java | 2 +-
.../ResetIncrementKeyGenerateAlgorithmFixture.java | 2 +-
...ere.keygen.core.algorithm.KeyGenerateAlgorithm} | 0
...ITAutoIncrementKeyGenerateAlgorithmFixture.java | 2 +-
.../e2e/fixture/ITKeyGenerateAlgorithmFixture.java | 2 +-
...ere.keygen.core.algorithm.KeyGenerateAlgorithm} | 0
.../test/e2e/data/pipeline/cases/cdc/CDCE2EIT.java | 2 +-
.../general/MySQLMigrationGeneralE2EIT.java | 2 +-
.../general/PostgreSQLMigrationGeneralE2EIT.java | 2 +-
.../migration/general/RulesMigrationE2EIT.java | 2 +-
.../primarykey/IndexesMigrationE2EIT.java | 4 +-
.../primarykey/MariaDBMigrationE2EIT.java | 4 +-
.../primarykey/TextPrimaryKeyMigrationE2EIT.java | 2 +-
.../pipeline/cases/task/E2EIncrementalTask.java | 2 +-
.../pipeline/cases/task/MySQLIncrementTask.java | 2 +-
.../cases/task/PostgreSQLIncrementTask.java | 4 +-
.../framework/helper/PipelineCaseHelper.java | 2 +-
.../util/AutoIncrementKeyGenerateAlgorithm.java | 2 +-
.../keygen/RewriteKeyGenerateAlgorithmFixture.java | 2 +-
...ere.keygen.core.algorithm.KeyGenerateAlgorithm} | 0
51 files changed, 163 insertions(+), 221 deletions(-)
diff --git a/features/sharding/core/pom.xml b/features/sharding/core/pom.xml
index 00a10e4d655..ccfb28a8a39 100644
--- a/features/sharding/core/pom.xml
+++ b/features/sharding/core/pom.xml
@@ -83,6 +83,16 @@
<artifactId>shardingsphere-infra-expr-core</artifactId>
<version>${project.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-infra-key-generator-uuid</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+
<artifactId>shardingsphere-infra-key-generator-snowflake</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<dependency>
<groupId>org.apache.shardingsphere</groupId>
diff --git
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/rule/ShardingRule.java
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/rule/ShardingRule.java
index 2b38f3e591e..e1f69d89567 100644
---
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/rule/ShardingRule.java
+++
b/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/rule/ShardingRule.java
@@ -36,6 +36,8 @@ import
org.apache.shardingsphere.infra.rule.identifier.type.TableContainedRule;
import org.apache.shardingsphere.infra.rule.identifier.type.TableNamesMapper;
import
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
+import org.apache.shardingsphere.keygen.core.algorithm.KeyGenerateAlgorithm;
+import
org.apache.shardingsphere.keygen.core.exception.algorithm.GenerateKeyStrategyNotFoundException;
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
import
org.apache.shardingsphere.sharding.api.config.rule.ShardingAutoTableRuleConfiguration;
import
org.apache.shardingsphere.sharding.api.config.rule.ShardingTableReferenceRuleConfiguration;
@@ -48,11 +50,9 @@ import
org.apache.shardingsphere.sharding.api.config.strategy.sharding.ShardingS
import
org.apache.shardingsphere.sharding.api.config.strategy.sharding.StandardShardingStrategyConfiguration;
import
org.apache.shardingsphere.sharding.api.sharding.ShardingAutoTableAlgorithm;
import org.apache.shardingsphere.sharding.cache.ShardingCache;
-import
org.apache.shardingsphere.sharding.exception.algorithm.keygen.GenerateKeyStrategyNotFoundException;
import
org.apache.shardingsphere.sharding.exception.algorithm.sharding.ShardingAlgorithmInitializationException;
import
org.apache.shardingsphere.sharding.exception.metadata.InvalidBindingTablesException;
import
org.apache.shardingsphere.sharding.exception.metadata.ShardingTableRuleNotFoundException;
-import org.apache.shardingsphere.sharding.spi.KeyGenerateAlgorithm;
import org.apache.shardingsphere.sharding.spi.ShardingAlgorithm;
import org.apache.shardingsphere.sharding.spi.ShardingAuditAlgorithm;
import
org.apache.shardingsphere.sql.parser.sql.common.segment.dml.column.ColumnSegment;
diff --git
a/features/sharding/core/src/main/resources/META-INF/services/org.apache.shardingsphere.sharding.spi.KeyGenerateAlgorithm
b/features/sharding/core/src/main/resources/META-INF/services/org.apache.shardingsphere.sharding.spi.KeyGenerateAlgorithm
deleted file mode 100644
index 3ce4e58b0d4..00000000000
---
a/features/sharding/core/src/main/resources/META-INF/services/org.apache.shardingsphere.sharding.spi.KeyGenerateAlgorithm
+++ /dev/null
@@ -1,19 +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.sharding.algorithm.keygen.SnowflakeKeyGenerateAlgorithm
-org.apache.shardingsphere.sharding.algorithm.keygen.UUIDKeyGenerateAlgorithm
diff --git
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/algorithm/keygen/fixture/AutoIncrementKeyGenerateAlgorithmFixture.java
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/algorithm/keygen/fixture/AutoIncrementKeyGenerateAlgorithmFixture.java
index f593618cf17..a2533d6c055 100644
---
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/algorithm/keygen/fixture/AutoIncrementKeyGenerateAlgorithmFixture.java
+++
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/algorithm/keygen/fixture/AutoIncrementKeyGenerateAlgorithmFixture.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.sharding.algorithm.keygen.fixture;
import lombok.Getter;
-import org.apache.shardingsphere.sharding.spi.KeyGenerateAlgorithm;
+import org.apache.shardingsphere.keygen.core.algorithm.KeyGenerateAlgorithm;
import java.util.concurrent.atomic.AtomicInteger;
diff --git
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/rule/ShardingRuleTest.java
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/rule/ShardingRuleTest.java
index 2281e541c40..8ec0df9b69f 100644
---
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/rule/ShardingRuleTest.java
+++
b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/rule/ShardingRuleTest.java
@@ -29,9 +29,10 @@ import
org.apache.shardingsphere.infra.instance.InstanceContext;
import
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import
org.apache.shardingsphere.infra.metadata.database.schema.model.ShardingSphereSchema;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
+import
org.apache.shardingsphere.keygen.core.exception.algorithm.GenerateKeyStrategyNotFoundException;
+import
org.apache.shardingsphere.keygen.snowflake.algorithm.SnowflakeKeyGenerateAlgorithm;
+import
org.apache.shardingsphere.keygen.uuid.algorithm.UUIDKeyGenerateAlgorithm;
import
org.apache.shardingsphere.sharding.algorithm.audit.DMLShardingConditionsShardingAuditAlgorithm;
-import
org.apache.shardingsphere.sharding.algorithm.keygen.SnowflakeKeyGenerateAlgorithm;
-import
org.apache.shardingsphere.sharding.algorithm.keygen.UUIDKeyGenerateAlgorithm;
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
import
org.apache.shardingsphere.sharding.api.config.rule.ShardingAutoTableRuleConfiguration;
import
org.apache.shardingsphere.sharding.api.config.rule.ShardingTableReferenceRuleConfiguration;
@@ -42,7 +43,6 @@ import
org.apache.shardingsphere.sharding.api.config.strategy.sharding.ComplexSh
import
org.apache.shardingsphere.sharding.api.config.strategy.sharding.NoneShardingStrategyConfiguration;
import
org.apache.shardingsphere.sharding.api.config.strategy.sharding.ShardingStrategyConfiguration;
import
org.apache.shardingsphere.sharding.api.config.strategy.sharding.StandardShardingStrategyConfiguration;
-import
org.apache.shardingsphere.sharding.exception.algorithm.keygen.GenerateKeyStrategyNotFoundException;
import
org.apache.shardingsphere.sharding.exception.algorithm.sharding.ShardingAlgorithmInitializationException;
import
org.apache.shardingsphere.sharding.exception.metadata.InvalidBindingTablesException;
import
org.apache.shardingsphere.sharding.exception.metadata.ShardingTableRuleNotFoundException;
diff --git
a/features/sharding/core/src/test/resources/META-INF/services/org.apache.shardingsphere.sharding.spi.KeyGenerateAlgorithm
b/features/sharding/core/src/test/resources/META-INF/services/org.apache.shardingsphere.keygen.core.algorithm.KeyGenerateAlgorithm
similarity index 100%
rename from
features/sharding/core/src/test/resources/META-INF/services/org.apache.shardingsphere.sharding.spi.KeyGenerateAlgorithm
rename to
features/sharding/core/src/test/resources/META-INF/services/org.apache.shardingsphere.keygen.core.algorithm.KeyGenerateAlgorithm
diff --git
a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/checker/ShardingTableRuleStatementChecker.java
b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/checker/ShardingTableRuleStatementChecker.java
index 22dfe5cfca0..deed64a6b8c 100644
---
a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/checker/ShardingTableRuleStatementChecker.java
+++
b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/checker/ShardingTableRuleStatementChecker.java
@@ -32,6 +32,7 @@ import
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import
org.apache.shardingsphere.infra.rule.identifier.type.DataSourceContainedRule;
import
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
+import org.apache.shardingsphere.keygen.core.algorithm.KeyGenerateAlgorithm;
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
import
org.apache.shardingsphere.sharding.api.config.rule.ShardingAutoTableRuleConfiguration;
import
org.apache.shardingsphere.sharding.api.config.rule.ShardingTableReferenceRuleConfiguration;
@@ -56,7 +57,6 @@ import
org.apache.shardingsphere.sharding.exception.metadata.ShardingTableRuleNo
import
org.apache.shardingsphere.sharding.exception.strategy.InvalidShardingStrategyConfigurationException;
import
org.apache.shardingsphere.sharding.rule.BindingTableCheckedConfiguration;
import org.apache.shardingsphere.sharding.rule.TableRule;
-import org.apache.shardingsphere.sharding.spi.KeyGenerateAlgorithm;
import org.apache.shardingsphere.sharding.spi.ShardingAlgorithm;
import org.apache.shardingsphere.sharding.spi.ShardingAuditAlgorithm;
diff --git
a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/fixture/keygen/DistSQLKeyGenerateAlgorithmFixture.java
b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/fixture/keygen/DistSQLKeyGenerateAlgorithmFixture.java
index 6afc3738e04..4bbd012d604 100644
---
a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/fixture/keygen/DistSQLKeyGenerateAlgorithmFixture.java
+++
b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/fixture/keygen/DistSQLKeyGenerateAlgorithmFixture.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.sharding.distsql.fixture.keygen;
-import org.apache.shardingsphere.sharding.spi.KeyGenerateAlgorithm;
+import org.apache.shardingsphere.keygen.core.algorithm.KeyGenerateAlgorithm;
public final class DistSQLKeyGenerateAlgorithmFixture implements
KeyGenerateAlgorithm {
diff --git
a/features/sharding/distsql/handler/src/test/resources/META-INF/services/org.apache.shardingsphere.sharding.spi.KeyGenerateAlgorithm
b/features/sharding/distsql/handler/src/test/resources/META-INF/services/org.apache.shardingsphere.keygen.core.algorithm.KeyGenerateAlgorithm
similarity index 100%
rename from
features/sharding/distsql/handler/src/test/resources/META-INF/services/org.apache.shardingsphere.sharding.spi.KeyGenerateAlgorithm
rename to
features/sharding/distsql/handler/src/test/resources/META-INF/services/org.apache.shardingsphere.keygen.core.algorithm.KeyGenerateAlgorithm
diff --git a/infra/pom.xml b/infra/algorithm/key-generator/core/pom.xml
similarity index 62%
copy from infra/pom.xml
copy to infra/algorithm/key-generator/core/pom.xml
index 61cf88285b3..5128f2bdafa 100644
--- a/infra/pom.xml
+++ b/infra/algorithm/key-generator/core/pom.xml
@@ -20,31 +20,24 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere</artifactId>
+ <artifactId>shardingsphere-infra-key-generator</artifactId>
<version>5.4.2-SNAPSHOT</version>
</parent>
- <artifactId>shardingsphere-infra</artifactId>
- <packaging>pom</packaging>
+ <artifactId>shardingsphere-infra-key-generator-core</artifactId>
<name>${project.artifactId}</name>
- <modules>
- <module>spi</module>
- <module>exception</module>
- <module>database</module>
- <module>data-source-pool</module>
- <module>common</module>
- <module>context</module>
- <module>distsql-handler</module>
- <module>parser</module>
- <module>binder</module>
- <module>rewrite</module>
- <module>route</module>
- <module>merge</module>
- <module>executor</module>
- <module>session</module>
- <module>expr</module>
- <module>util</module>
- <module>reachability-metadata</module>
- <module>nativetest</module>
- </modules>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-infra-common</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/features/sharding/api/src/main/java/org/apache/shardingsphere/sharding/spi/KeyGenerateAlgorithm.java
b/infra/algorithm/key-generator/core/src/main/java/org/apache/shardingsphere/keygen/core/algorithm/KeyGenerateAlgorithm.java
similarity index 95%
rename from
features/sharding/api/src/main/java/org/apache/shardingsphere/sharding/spi/KeyGenerateAlgorithm.java
rename to
infra/algorithm/key-generator/core/src/main/java/org/apache/shardingsphere/keygen/core/algorithm/KeyGenerateAlgorithm.java
index 8b147fa5c35..638636a960b 100644
---
a/features/sharding/api/src/main/java/org/apache/shardingsphere/sharding/spi/KeyGenerateAlgorithm.java
+++
b/infra/algorithm/key-generator/core/src/main/java/org/apache/shardingsphere/keygen/core/algorithm/KeyGenerateAlgorithm.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.sharding.spi;
+package org.apache.shardingsphere.keygen.core.algorithm;
import org.apache.shardingsphere.infra.algorithm.ShardingSphereAlgorithm;
diff --git
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/exception/algorithm/keygen/GenerateKeyStrategyNotFoundException.java
b/infra/algorithm/key-generator/core/src/main/java/org/apache/shardingsphere/keygen/core/exception/KeyGenerateSQLException.java
similarity index 59%
copy from
features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/exception/algorithm/keygen/GenerateKeyStrategyNotFoundException.java
copy to
infra/algorithm/key-generator/core/src/main/java/org/apache/shardingsphere/keygen/core/exception/KeyGenerateSQLException.java
index d0c30a9ac9c..ab7a70f033b 100644
---
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/exception/algorithm/keygen/GenerateKeyStrategyNotFoundException.java
+++
b/infra/algorithm/key-generator/core/src/main/java/org/apache/shardingsphere/keygen/core/exception/KeyGenerateSQLException.java
@@ -15,19 +15,21 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.sharding.exception.algorithm.keygen;
+package org.apache.shardingsphere.keygen.core.exception;
-import
org.apache.shardingsphere.infra.exception.core.external.sql.sqlstate.XOpenSQLState;
-import org.apache.shardingsphere.sharding.exception.ShardingSQLException;
+import
org.apache.shardingsphere.infra.exception.core.external.sql.sqlstate.SQLState;
+import
org.apache.shardingsphere.infra.exception.core.external.sql.type.feature.FeatureSQLException;
/**
- * Generate key strategy not found exception.
+ * Key generate SQL exception.
*/
-public final class GenerateKeyStrategyNotFoundException extends
ShardingSQLException {
+public abstract class KeyGenerateSQLException extends FeatureSQLException {
- private static final long serialVersionUID = 7456922260524630374L;
+ private static final int FEATURE_CODE = 11;
- public GenerateKeyStrategyNotFoundException(final String tableName) {
- super(XOpenSQLState.CHECK_OPTION_VIOLATION, 90, "Can not find strategy
for generate keys with table `%s`.", tableName);
+ private static final long serialVersionUID = 3124409584064186239L;
+
+ protected KeyGenerateSQLException(final SQLState sqlState, final int
errorCode, final String reason, final Object... messageArgs) {
+ super(sqlState, FEATURE_CODE, errorCode, reason, messageArgs);
}
}
diff --git
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/exception/algorithm/keygen/GenerateKeyStrategyNotFoundException.java
b/infra/algorithm/key-generator/core/src/main/java/org/apache/shardingsphere/keygen/core/exception/algorithm/GenerateKeyStrategyNotFoundException.java
similarity index 88%
rename from
features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/exception/algorithm/keygen/GenerateKeyStrategyNotFoundException.java
rename to
infra/algorithm/key-generator/core/src/main/java/org/apache/shardingsphere/keygen/core/exception/algorithm/GenerateKeyStrategyNotFoundException.java
index d0c30a9ac9c..2fb7b0634ff 100644
---
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/exception/algorithm/keygen/GenerateKeyStrategyNotFoundException.java
+++
b/infra/algorithm/key-generator/core/src/main/java/org/apache/shardingsphere/keygen/core/exception/algorithm/GenerateKeyStrategyNotFoundException.java
@@ -15,15 +15,15 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.sharding.exception.algorithm.keygen;
+package org.apache.shardingsphere.keygen.core.exception.algorithm;
import
org.apache.shardingsphere.infra.exception.core.external.sql.sqlstate.XOpenSQLState;
-import org.apache.shardingsphere.sharding.exception.ShardingSQLException;
+import org.apache.shardingsphere.keygen.core.exception.KeyGenerateSQLException;
/**
* Generate key strategy not found exception.
*/
-public final class GenerateKeyStrategyNotFoundException extends
ShardingSQLException {
+public final class GenerateKeyStrategyNotFoundException extends
KeyGenerateSQLException {
private static final long serialVersionUID = 7456922260524630374L;
diff --git
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/exception/algorithm/keygen/KeyGenerateAlgorithmInitializationException.java
b/infra/algorithm/key-generator/core/src/main/java/org/apache/shardingsphere/keygen/core/exception/algorithm/KeyGenerateAlgorithmInitializationException.java
similarity index 83%
rename from
features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/exception/algorithm/keygen/KeyGenerateAlgorithmInitializationException.java
rename to
infra/algorithm/key-generator/core/src/main/java/org/apache/shardingsphere/keygen/core/exception/algorithm/KeyGenerateAlgorithmInitializationException.java
index b585a8e1a41..df32efacacd 100644
---
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/exception/algorithm/keygen/KeyGenerateAlgorithmInitializationException.java
+++
b/infra/algorithm/key-generator/core/src/main/java/org/apache/shardingsphere/keygen/core/exception/algorithm/KeyGenerateAlgorithmInitializationException.java
@@ -15,17 +15,17 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.sharding.exception.algorithm.keygen;
+package org.apache.shardingsphere.keygen.core.exception.algorithm;
import
org.apache.shardingsphere.infra.exception.core.external.sql.sqlstate.XOpenSQLState;
-import org.apache.shardingsphere.sharding.exception.ShardingSQLException;
+import org.apache.shardingsphere.keygen.core.exception.KeyGenerateSQLException;
/**
* Key generate algorithm initialization exception.
*/
-public final class KeyGenerateAlgorithmInitializationException extends
ShardingSQLException {
+public final class KeyGenerateAlgorithmInitializationException extends
KeyGenerateSQLException {
- private static final long serialVersionUID = -9046956561006694072L;
+ private static final long serialVersionUID = 4137100879778822323L;
public KeyGenerateAlgorithmInitializationException(final String
keyGenerateType, final String reason) {
super(XOpenSQLState.GENERAL_ERROR, 91, "Key generate algorithm `%s`
initialization failed, reason is: %s.", keyGenerateType, reason);
diff --git a/infra/pom.xml b/infra/algorithm/key-generator/pom.xml
similarity index 65%
copy from infra/pom.xml
copy to infra/algorithm/key-generator/pom.xml
index 61cf88285b3..d737f6fdffb 100644
--- a/infra/pom.xml
+++ b/infra/algorithm/key-generator/pom.xml
@@ -20,31 +20,15 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere</artifactId>
+ <artifactId>shardingsphere-infra-algorithm</artifactId>
<version>5.4.2-SNAPSHOT</version>
</parent>
- <artifactId>shardingsphere-infra</artifactId>
+ <artifactId>shardingsphere-infra-key-generator</artifactId>
<packaging>pom</packaging>
<name>${project.artifactId}</name>
<modules>
- <module>spi</module>
- <module>exception</module>
- <module>database</module>
- <module>data-source-pool</module>
- <module>common</module>
- <module>context</module>
- <module>distsql-handler</module>
- <module>parser</module>
- <module>binder</module>
- <module>rewrite</module>
- <module>route</module>
- <module>merge</module>
- <module>executor</module>
- <module>session</module>
- <module>expr</module>
- <module>util</module>
- <module>reachability-metadata</module>
- <module>nativetest</module>
+ <module>core</module>
+ <module>type</module>
</modules>
</project>
diff --git a/infra/pom.xml b/infra/algorithm/key-generator/type/pom.xml
similarity index 65%
copy from infra/pom.xml
copy to infra/algorithm/key-generator/type/pom.xml
index 61cf88285b3..47c37fc365b 100644
--- a/infra/pom.xml
+++ b/infra/algorithm/key-generator/type/pom.xml
@@ -20,31 +20,15 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere</artifactId>
+ <artifactId>shardingsphere-infra-key-generator</artifactId>
<version>5.4.2-SNAPSHOT</version>
</parent>
- <artifactId>shardingsphere-infra</artifactId>
+ <artifactId>shardingsphere-infra-key-generator-type</artifactId>
<packaging>pom</packaging>
<name>${project.artifactId}</name>
<modules>
- <module>spi</module>
- <module>exception</module>
- <module>database</module>
- <module>data-source-pool</module>
- <module>common</module>
- <module>context</module>
- <module>distsql-handler</module>
- <module>parser</module>
- <module>binder</module>
- <module>rewrite</module>
- <module>route</module>
- <module>merge</module>
- <module>executor</module>
- <module>session</module>
- <module>expr</module>
- <module>util</module>
- <module>reachability-metadata</module>
- <module>nativetest</module>
+ <module>snowflake</module>
+ <module>uuid</module>
</modules>
</project>
diff --git a/infra/pom.xml
b/infra/algorithm/key-generator/type/snowflake/pom.xml
similarity index 55%
copy from infra/pom.xml
copy to infra/algorithm/key-generator/type/snowflake/pom.xml
index 61cf88285b3..74a8b23ead4 100644
--- a/infra/pom.xml
+++ b/infra/algorithm/key-generator/type/snowflake/pom.xml
@@ -20,31 +20,33 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere</artifactId>
+ <artifactId>shardingsphere-infra-key-generator-type</artifactId>
<version>5.4.2-SNAPSHOT</version>
</parent>
- <artifactId>shardingsphere-infra</artifactId>
- <packaging>pom</packaging>
+ <artifactId>shardingsphere-infra-key-generator-snowflake</artifactId>
<name>${project.artifactId}</name>
- <modules>
- <module>spi</module>
- <module>exception</module>
- <module>database</module>
- <module>data-source-pool</module>
- <module>common</module>
- <module>context</module>
- <module>distsql-handler</module>
- <module>parser</module>
- <module>binder</module>
- <module>rewrite</module>
- <module>route</module>
- <module>merge</module>
- <module>executor</module>
- <module>session</module>
- <module>expr</module>
- <module>util</module>
- <module>reachability-metadata</module>
- <module>nativetest</module>
- </modules>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-infra-common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-infra-key-generator-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>
+ <dependency>
+ <groupId>org.awaitility</groupId>
+ <artifactId>awaitility</artifactId>
+ </dependency>
+ </dependencies>
</project>
diff --git
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/keygen/SnowflakeKeyGenerateAlgorithm.java
b/infra/algorithm/key-generator/type/snowflake/src/main/java/org/apache/shardingsphere/keygen/snowflake/algorithm/SnowflakeKeyGenerateAlgorithm.java
similarity index 95%
rename from
features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/keygen/SnowflakeKeyGenerateAlgorithm.java
rename to
infra/algorithm/key-generator/type/snowflake/src/main/java/org/apache/shardingsphere/keygen/snowflake/algorithm/SnowflakeKeyGenerateAlgorithm.java
index 0d5e4a2b2d5..95fe29dcca2 100644
---
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/keygen/SnowflakeKeyGenerateAlgorithm.java
+++
b/infra/algorithm/key-generator/type/snowflake/src/main/java/org/apache/shardingsphere/keygen/snowflake/algorithm/SnowflakeKeyGenerateAlgorithm.java
@@ -15,16 +15,16 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.sharding.algorithm.keygen;
+package org.apache.shardingsphere.keygen.snowflake.algorithm;
import lombok.Setter;
import lombok.SneakyThrows;
+import
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
import org.apache.shardingsphere.infra.instance.InstanceContext;
import org.apache.shardingsphere.infra.instance.InstanceContextAware;
-import
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
-import
org.apache.shardingsphere.sharding.exception.algorithm.keygen.KeyGenerateAlgorithmInitializationException;
-import
org.apache.shardingsphere.sharding.exception.algorithm.keygen.SnowflakeClockMoveBackException;
-import org.apache.shardingsphere.sharding.spi.KeyGenerateAlgorithm;
+import org.apache.shardingsphere.keygen.core.algorithm.KeyGenerateAlgorithm;
+import
org.apache.shardingsphere.keygen.core.exception.algorithm.KeyGenerateAlgorithmInitializationException;
+import
org.apache.shardingsphere.keygen.snowflake.exception.SnowflakeClockMoveBackException;
import java.time.Instant;
import java.time.LocalDateTime;
diff --git
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/keygen/TimeService.java
b/infra/algorithm/key-generator/type/snowflake/src/main/java/org/apache/shardingsphere/keygen/snowflake/algorithm/TimeService.java
similarity index 94%
rename from
features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/keygen/TimeService.java
rename to
infra/algorithm/key-generator/type/snowflake/src/main/java/org/apache/shardingsphere/keygen/snowflake/algorithm/TimeService.java
index a2dcbf49019..5468a8ac456 100644
---
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/keygen/TimeService.java
+++
b/infra/algorithm/key-generator/type/snowflake/src/main/java/org/apache/shardingsphere/keygen/snowflake/algorithm/TimeService.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.sharding.algorithm.keygen;
+package org.apache.shardingsphere.keygen.snowflake.algorithm;
/**
* Time service.
diff --git
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/exception/algorithm/keygen/SnowflakeClockMoveBackException.java
b/infra/algorithm/key-generator/type/snowflake/src/main/java/org/apache/shardingsphere/keygen/snowflake/exception/SnowflakeClockMoveBackException.java
similarity index 80%
rename from
features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/exception/algorithm/keygen/SnowflakeClockMoveBackException.java
rename to
infra/algorithm/key-generator/type/snowflake/src/main/java/org/apache/shardingsphere/keygen/snowflake/exception/SnowflakeClockMoveBackException.java
index ca5adbaa68d..823a0e359d2 100644
---
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/exception/algorithm/keygen/SnowflakeClockMoveBackException.java
+++
b/infra/algorithm/key-generator/type/snowflake/src/main/java/org/apache/shardingsphere/keygen/snowflake/exception/SnowflakeClockMoveBackException.java
@@ -15,17 +15,17 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.sharding.exception.algorithm.keygen;
+package org.apache.shardingsphere.keygen.snowflake.exception;
import
org.apache.shardingsphere.infra.exception.core.external.sql.sqlstate.XOpenSQLState;
-import org.apache.shardingsphere.sharding.exception.ShardingSQLException;
+import org.apache.shardingsphere.keygen.core.exception.KeyGenerateSQLException;
/**
* Snowflake clock move back exception.
*/
-public final class SnowflakeClockMoveBackException extends
ShardingSQLException {
+public final class SnowflakeClockMoveBackException extends
KeyGenerateSQLException {
- private static final long serialVersionUID = -2435731376659956566L;
+ private static final long serialVersionUID = 3076059285632288623L;
public SnowflakeClockMoveBackException(final long lastMillis, final long
currentMillis) {
super(XOpenSQLState.GENERAL_ERROR, 92, "Clock is moving backwards,
last time is %d milliseconds, current time is %d milliseconds.", lastMillis,
currentMillis);
diff --git
a/test/it/rewriter/src/test/resources/META-INF/services/org.apache.shardingsphere.sharding.spi.KeyGenerateAlgorithm
b/infra/algorithm/key-generator/type/snowflake/src/main/resources/META-INF/services/org.apache.shardingsphere.keygen.core.algorithm.KeyGenerateAlgorithm
similarity index 89%
copy from
test/it/rewriter/src/test/resources/META-INF/services/org.apache.shardingsphere.sharding.spi.KeyGenerateAlgorithm
copy to
infra/algorithm/key-generator/type/snowflake/src/main/resources/META-INF/services/org.apache.shardingsphere.keygen.core.algorithm.KeyGenerateAlgorithm
index 3190ee2cad1..e61918401f5 100644
---
a/test/it/rewriter/src/test/resources/META-INF/services/org.apache.shardingsphere.sharding.spi.KeyGenerateAlgorithm
+++
b/infra/algorithm/key-generator/type/snowflake/src/main/resources/META-INF/services/org.apache.shardingsphere.keygen.core.algorithm.KeyGenerateAlgorithm
@@ -15,4 +15,4 @@
# limitations under the License.
#
-org.apache.shardingsphere.test.it.rewrite.fixture.keygen.RewriteKeyGenerateAlgorithmFixture
+org.apache.shardingsphere.keygen.snowflake.algorithm.SnowflakeKeyGenerateAlgorithm
diff --git
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/algorithm/keygen/SnowflakeKeyGenerateAlgorithmTest.java
b/infra/algorithm/key-generator/type/snowflake/src/test/java/org/apache/shardingsphere/keygen/snowflake/algorithm/SnowflakeKeyGenerateAlgorithmTest.java
similarity index 96%
rename from
features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/algorithm/keygen/SnowflakeKeyGenerateAlgorithmTest.java
rename to
infra/algorithm/key-generator/type/snowflake/src/test/java/org/apache/shardingsphere/keygen/snowflake/algorithm/SnowflakeKeyGenerateAlgorithmTest.java
index 95bae0f3de1..d5ff80bed73 100644
---
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/algorithm/keygen/SnowflakeKeyGenerateAlgorithmTest.java
+++
b/infra/algorithm/key-generator/type/snowflake/src/test/java/org/apache/shardingsphere/keygen/snowflake/algorithm/SnowflakeKeyGenerateAlgorithmTest.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.sharding.algorithm.keygen;
+package org.apache.shardingsphere.keygen.snowflake.algorithm;
import lombok.SneakyThrows;
import org.apache.shardingsphere.infra.config.mode.ModeConfiguration;
@@ -25,13 +25,13 @@ import
org.apache.shardingsphere.infra.instance.InstanceContextAware;
import org.apache.shardingsphere.infra.instance.metadata.InstanceMetaData;
import org.apache.shardingsphere.infra.instance.mode.ModeContextManager;
import org.apache.shardingsphere.infra.lock.LockContext;
-import org.apache.shardingsphere.infra.util.eventbus.EventBusContext;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
-import
org.apache.shardingsphere.sharding.algorithm.keygen.fixture.FixedTimeService;
-import
org.apache.shardingsphere.sharding.algorithm.keygen.fixture.WorkerIdGeneratorFixture;
-import
org.apache.shardingsphere.sharding.exception.algorithm.keygen.KeyGenerateAlgorithmInitializationException;
-import
org.apache.shardingsphere.sharding.exception.algorithm.keygen.SnowflakeClockMoveBackException;
-import org.apache.shardingsphere.sharding.spi.KeyGenerateAlgorithm;
+import org.apache.shardingsphere.infra.util.eventbus.EventBusContext;
+import org.apache.shardingsphere.keygen.core.algorithm.KeyGenerateAlgorithm;
+import
org.apache.shardingsphere.keygen.core.exception.algorithm.KeyGenerateAlgorithmInitializationException;
+import
org.apache.shardingsphere.keygen.snowflake.exception.SnowflakeClockMoveBackException;
+import org.apache.shardingsphere.keygen.snowflake.fixture.FixedTimeService;
+import
org.apache.shardingsphere.keygen.snowflake.fixture.WorkerIdGeneratorFixture;
import org.apache.shardingsphere.test.util.PropertiesBuilder;
import org.apache.shardingsphere.test.util.PropertiesBuilder.Property;
import org.awaitility.Awaitility;
diff --git
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/algorithm/keygen/fixture/FixedTimeService.java
b/infra/algorithm/key-generator/type/snowflake/src/test/java/org/apache/shardingsphere/keygen/snowflake/fixture/FixedTimeService.java
similarity index 85%
rename from
features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/algorithm/keygen/fixture/FixedTimeService.java
rename to
infra/algorithm/key-generator/type/snowflake/src/test/java/org/apache/shardingsphere/keygen/snowflake/fixture/FixedTimeService.java
index 0546c9c6880..990e4643629 100644
---
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/algorithm/keygen/fixture/FixedTimeService.java
+++
b/infra/algorithm/key-generator/type/snowflake/src/test/java/org/apache/shardingsphere/keygen/snowflake/fixture/FixedTimeService.java
@@ -15,11 +15,11 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.sharding.algorithm.keygen.fixture;
+package org.apache.shardingsphere.keygen.snowflake.fixture;
import lombok.RequiredArgsConstructor;
-import
org.apache.shardingsphere.sharding.algorithm.keygen.SnowflakeKeyGenerateAlgorithm;
-import org.apache.shardingsphere.sharding.algorithm.keygen.TimeService;
+import
org.apache.shardingsphere.keygen.snowflake.algorithm.SnowflakeKeyGenerateAlgorithm;
+import org.apache.shardingsphere.keygen.snowflake.algorithm.TimeService;
import java.util.concurrent.atomic.AtomicInteger;
diff --git
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/algorithm/keygen/fixture/WorkerIdGeneratorFixture.java
b/infra/algorithm/key-generator/type/snowflake/src/test/java/org/apache/shardingsphere/keygen/snowflake/fixture/WorkerIdGeneratorFixture.java
similarity index 95%
rename from
features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/algorithm/keygen/fixture/WorkerIdGeneratorFixture.java
rename to
infra/algorithm/key-generator/type/snowflake/src/test/java/org/apache/shardingsphere/keygen/snowflake/fixture/WorkerIdGeneratorFixture.java
index 10218a80bb4..88628abb557 100644
---
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/algorithm/keygen/fixture/WorkerIdGeneratorFixture.java
+++
b/infra/algorithm/key-generator/type/snowflake/src/test/java/org/apache/shardingsphere/keygen/snowflake/fixture/WorkerIdGeneratorFixture.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.sharding.algorithm.keygen.fixture;
+package org.apache.shardingsphere.keygen.snowflake.fixture;
import com.google.common.base.Preconditions;
import lombok.RequiredArgsConstructor;
diff --git a/infra/pom.xml b/infra/algorithm/key-generator/type/uuid/pom.xml
similarity index 55%
copy from infra/pom.xml
copy to infra/algorithm/key-generator/type/uuid/pom.xml
index 61cf88285b3..cdeef599b33 100644
--- a/infra/pom.xml
+++ b/infra/algorithm/key-generator/type/uuid/pom.xml
@@ -20,31 +20,33 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere</artifactId>
+ <artifactId>shardingsphere-infra-key-generator-type</artifactId>
<version>5.4.2-SNAPSHOT</version>
</parent>
- <artifactId>shardingsphere-infra</artifactId>
- <packaging>pom</packaging>
+ <artifactId>shardingsphere-infra-key-generator-uuid</artifactId>
<name>${project.artifactId}</name>
- <modules>
- <module>spi</module>
- <module>exception</module>
- <module>database</module>
- <module>data-source-pool</module>
- <module>common</module>
- <module>context</module>
- <module>distsql-handler</module>
- <module>parser</module>
- <module>binder</module>
- <module>rewrite</module>
- <module>route</module>
- <module>merge</module>
- <module>executor</module>
- <module>session</module>
- <module>expr</module>
- <module>util</module>
- <module>reachability-metadata</module>
- <module>nativetest</module>
- </modules>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-infra-common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.shardingsphere</groupId>
+ <artifactId>shardingsphere-infra-key-generator-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>
+ <dependency>
+ <groupId>org.awaitility</groupId>
+ <artifactId>awaitility</artifactId>
+ </dependency>
+ </dependencies>
</project>
diff --git
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/keygen/UUIDKeyGenerateAlgorithm.java
b/infra/algorithm/key-generator/type/uuid/src/main/java/org/apache/shardingsphere/keygen/uuid/algorithm/UUIDKeyGenerateAlgorithm.java
similarity index 90%
rename from
features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/keygen/UUIDKeyGenerateAlgorithm.java
rename to
infra/algorithm/key-generator/type/uuid/src/main/java/org/apache/shardingsphere/keygen/uuid/algorithm/UUIDKeyGenerateAlgorithm.java
index b9b96b4ae50..01cfa43b9c4 100644
---
a/features/sharding/core/src/main/java/org/apache/shardingsphere/sharding/algorithm/keygen/UUIDKeyGenerateAlgorithm.java
+++
b/infra/algorithm/key-generator/type/uuid/src/main/java/org/apache/shardingsphere/keygen/uuid/algorithm/UUIDKeyGenerateAlgorithm.java
@@ -15,9 +15,9 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.sharding.algorithm.keygen;
+package org.apache.shardingsphere.keygen.uuid.algorithm;
-import org.apache.shardingsphere.sharding.spi.KeyGenerateAlgorithm;
+import org.apache.shardingsphere.keygen.core.algorithm.KeyGenerateAlgorithm;
import java.util.UUID;
import java.util.concurrent.ThreadLocalRandom;
diff --git
a/test/it/rewriter/src/test/resources/META-INF/services/org.apache.shardingsphere.sharding.spi.KeyGenerateAlgorithm
b/infra/algorithm/key-generator/type/uuid/src/main/resources/META-INF/services/org.apache.shardingsphere.keygen.core.algorithm.KeyGenerateAlgorithm
similarity index 89%
copy from
test/it/rewriter/src/test/resources/META-INF/services/org.apache.shardingsphere.sharding.spi.KeyGenerateAlgorithm
copy to
infra/algorithm/key-generator/type/uuid/src/main/resources/META-INF/services/org.apache.shardingsphere.keygen.core.algorithm.KeyGenerateAlgorithm
index 3190ee2cad1..ce91df42f29 100644
---
a/test/it/rewriter/src/test/resources/META-INF/services/org.apache.shardingsphere.sharding.spi.KeyGenerateAlgorithm
+++
b/infra/algorithm/key-generator/type/uuid/src/main/resources/META-INF/services/org.apache.shardingsphere.keygen.core.algorithm.KeyGenerateAlgorithm
@@ -15,4 +15,4 @@
# limitations under the License.
#
-org.apache.shardingsphere.test.it.rewrite.fixture.keygen.RewriteKeyGenerateAlgorithmFixture
+org.apache.shardingsphere.keygen.uuid.algorithm.UUIDKeyGenerateAlgorithm
diff --git
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/algorithm/keygen/UUIDKeyGenerateAlgorithmTest.java
b/infra/algorithm/key-generator/type/uuid/src/test/java/org/apache/shardingsphere/keygen/uuid/algorithm/UUIDKeyGenerateAlgorithmTest.java
similarity index 95%
rename from
features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/algorithm/keygen/UUIDKeyGenerateAlgorithmTest.java
rename to
infra/algorithm/key-generator/type/uuid/src/test/java/org/apache/shardingsphere/keygen/uuid/algorithm/UUIDKeyGenerateAlgorithmTest.java
index 9cde0bc22e2..b8c65e0eff7 100644
---
a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/algorithm/keygen/UUIDKeyGenerateAlgorithmTest.java
+++
b/infra/algorithm/key-generator/type/uuid/src/test/java/org/apache/shardingsphere/keygen/uuid/algorithm/UUIDKeyGenerateAlgorithmTest.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.sharding.algorithm.keygen;
+package org.apache.shardingsphere.keygen.uuid.algorithm;
import org.junit.jupiter.api.Test;
diff --git a/infra/pom.xml b/infra/algorithm/pom.xml
similarity index 65%
copy from infra/pom.xml
copy to infra/algorithm/pom.xml
index 61cf88285b3..50db5cd9cd9 100644
--- a/infra/pom.xml
+++ b/infra/algorithm/pom.xml
@@ -20,31 +20,14 @@
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.shardingsphere</groupId>
- <artifactId>shardingsphere</artifactId>
+ <artifactId>shardingsphere-infra</artifactId>
<version>5.4.2-SNAPSHOT</version>
</parent>
- <artifactId>shardingsphere-infra</artifactId>
+ <artifactId>shardingsphere-infra-algorithm</artifactId>
<packaging>pom</packaging>
<name>${project.artifactId}</name>
<modules>
- <module>spi</module>
- <module>exception</module>
- <module>database</module>
- <module>data-source-pool</module>
- <module>common</module>
- <module>context</module>
- <module>distsql-handler</module>
- <module>parser</module>
- <module>binder</module>
- <module>rewrite</module>
- <module>route</module>
- <module>merge</module>
- <module>executor</module>
- <module>session</module>
- <module>expr</module>
- <module>util</module>
- <module>reachability-metadata</module>
- <module>nativetest</module>
+ <module>key-generator</module>
</modules>
</project>
diff --git a/infra/pom.xml b/infra/pom.xml
index 61cf88285b3..755c1f805ff 100644
--- a/infra/pom.xml
+++ b/infra/pom.xml
@@ -46,5 +46,6 @@
<module>util</module>
<module>reachability-metadata</module>
<module>nativetest</module>
+ <module>algorithm</module>
</modules>
</project>
diff --git
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/checker/ShardingRuleConfigurationImportChecker.java
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/checker/ShardingRuleConfigurationImportChecker.java
index 6d95d37e16f..2dc87ee451a 100644
---
a/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/checker/ShardingRuleConfigurationImportChecker.java
+++
b/proxy/backend/core/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/checker/ShardingRuleConfigurationImportChecker.java
@@ -21,15 +21,15 @@ import
org.apache.shardingsphere.distsql.handler.exception.rule.DuplicateRuleExc
import
org.apache.shardingsphere.distsql.handler.exception.storageunit.MissingRequiredStorageUnitsException;
import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
import org.apache.shardingsphere.infra.datanode.DataNode;
-import
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
-import
org.apache.shardingsphere.infra.rule.identifier.type.DataSourceContainedRule;
import
org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions;
import org.apache.shardingsphere.infra.expr.core.InlineExpressionParserFactory;
+import
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
+import
org.apache.shardingsphere.infra.rule.identifier.type.DataSourceContainedRule;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
+import org.apache.shardingsphere.keygen.core.algorithm.KeyGenerateAlgorithm;
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
import
org.apache.shardingsphere.sharding.api.config.rule.ShardingAutoTableRuleConfiguration;
import
org.apache.shardingsphere.sharding.api.config.rule.ShardingTableRuleConfiguration;
-import org.apache.shardingsphere.sharding.spi.KeyGenerateAlgorithm;
import org.apache.shardingsphere.sharding.spi.ShardingAlgorithm;
import java.util.Collection;
diff --git
a/test/e2e/driver/src/test/java/org/apache/shardingsphere/test/e2e/driver/fixture/keygen/IncrementKeyGenerateAlgorithmFixture.java
b/test/e2e/driver/src/test/java/org/apache/shardingsphere/test/e2e/driver/fixture/keygen/IncrementKeyGenerateAlgorithmFixture.java
index 14a2b343efe..fa7a62222e3 100644
---
a/test/e2e/driver/src/test/java/org/apache/shardingsphere/test/e2e/driver/fixture/keygen/IncrementKeyGenerateAlgorithmFixture.java
+++
b/test/e2e/driver/src/test/java/org/apache/shardingsphere/test/e2e/driver/fixture/keygen/IncrementKeyGenerateAlgorithmFixture.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.test.e2e.driver.fixture.keygen;
-import org.apache.shardingsphere.sharding.spi.KeyGenerateAlgorithm;
+import org.apache.shardingsphere.keygen.core.algorithm.KeyGenerateAlgorithm;
import java.util.concurrent.atomic.AtomicInteger;
diff --git
a/test/e2e/driver/src/test/java/org/apache/shardingsphere/test/e2e/driver/fixture/keygen/ResetIncrementKeyGenerateAlgorithmFixture.java
b/test/e2e/driver/src/test/java/org/apache/shardingsphere/test/e2e/driver/fixture/keygen/ResetIncrementKeyGenerateAlgorithmFixture.java
index ad28cb02c87..86fbc1e85b5 100644
---
a/test/e2e/driver/src/test/java/org/apache/shardingsphere/test/e2e/driver/fixture/keygen/ResetIncrementKeyGenerateAlgorithmFixture.java
+++
b/test/e2e/driver/src/test/java/org/apache/shardingsphere/test/e2e/driver/fixture/keygen/ResetIncrementKeyGenerateAlgorithmFixture.java
@@ -18,7 +18,7 @@
package org.apache.shardingsphere.test.e2e.driver.fixture.keygen;
import lombok.Getter;
-import org.apache.shardingsphere.sharding.spi.KeyGenerateAlgorithm;
+import org.apache.shardingsphere.keygen.core.algorithm.KeyGenerateAlgorithm;
import java.util.concurrent.atomic.AtomicInteger;
diff --git
a/test/e2e/driver/src/test/resources/META-INF/services/org.apache.shardingsphere.sharding.spi.KeyGenerateAlgorithm
b/test/e2e/driver/src/test/resources/META-INF/services/org.apache.shardingsphere.keygen.core.algorithm.KeyGenerateAlgorithm
similarity index 100%
rename from
test/e2e/driver/src/test/resources/META-INF/services/org.apache.shardingsphere.sharding.spi.KeyGenerateAlgorithm
rename to
test/e2e/driver/src/test/resources/META-INF/services/org.apache.shardingsphere.keygen.core.algorithm.KeyGenerateAlgorithm
diff --git
a/test/e2e/fixture/src/test/java/org/apache/shardingsphere/test/e2e/fixture/ITAutoIncrementKeyGenerateAlgorithmFixture.java
b/test/e2e/fixture/src/test/java/org/apache/shardingsphere/test/e2e/fixture/ITAutoIncrementKeyGenerateAlgorithmFixture.java
index 97ceb6fe977..2610a331769 100644
---
a/test/e2e/fixture/src/test/java/org/apache/shardingsphere/test/e2e/fixture/ITAutoIncrementKeyGenerateAlgorithmFixture.java
+++
b/test/e2e/fixture/src/test/java/org/apache/shardingsphere/test/e2e/fixture/ITAutoIncrementKeyGenerateAlgorithmFixture.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.test.e2e.fixture;
-import org.apache.shardingsphere.sharding.spi.KeyGenerateAlgorithm;
+import org.apache.shardingsphere.keygen.core.algorithm.KeyGenerateAlgorithm;
import java.util.concurrent.atomic.AtomicLong;
diff --git
a/test/e2e/fixture/src/test/java/org/apache/shardingsphere/test/e2e/fixture/ITKeyGenerateAlgorithmFixture.java
b/test/e2e/fixture/src/test/java/org/apache/shardingsphere/test/e2e/fixture/ITKeyGenerateAlgorithmFixture.java
index 8bc4fd2825e..ecb8baedbc9 100644
---
a/test/e2e/fixture/src/test/java/org/apache/shardingsphere/test/e2e/fixture/ITKeyGenerateAlgorithmFixture.java
+++
b/test/e2e/fixture/src/test/java/org/apache/shardingsphere/test/e2e/fixture/ITKeyGenerateAlgorithmFixture.java
@@ -19,7 +19,7 @@ package org.apache.shardingsphere.test.e2e.fixture;
import org.apache.shardingsphere.infra.instance.InstanceContext;
import org.apache.shardingsphere.infra.instance.InstanceContextAware;
-import org.apache.shardingsphere.sharding.spi.KeyGenerateAlgorithm;
+import org.apache.shardingsphere.keygen.core.algorithm.KeyGenerateAlgorithm;
import java.util.Properties;
diff --git
a/test/e2e/fixture/src/test/resources/META-INF/services/org.apache.shardingsphere.sharding.spi.KeyGenerateAlgorithm
b/test/e2e/fixture/src/test/resources/META-INF/services/org.apache.shardingsphere.keygen.core.algorithm.KeyGenerateAlgorithm
similarity index 100%
rename from
test/e2e/fixture/src/test/resources/META-INF/services/org.apache.shardingsphere.sharding.spi.KeyGenerateAlgorithm
rename to
test/e2e/fixture/src/test/resources/META-INF/services/org.apache.shardingsphere.keygen.core.algorithm.KeyGenerateAlgorithm
diff --git
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/cdc/CDCE2EIT.java
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/cdc/CDCE2EIT.java
index 4bc5536b2bc..ef3f723d6c0 100644
---
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/cdc/CDCE2EIT.java
+++
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/cdc/CDCE2EIT.java
@@ -41,7 +41,7 @@ import
org.apache.shardingsphere.infra.database.core.metadata.database.DialectDa
import org.apache.shardingsphere.infra.database.core.type.DatabaseType;
import org.apache.shardingsphere.infra.database.core.type.DatabaseTypeRegistry;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
-import
org.apache.shardingsphere.sharding.algorithm.keygen.SnowflakeKeyGenerateAlgorithm;
+import
org.apache.shardingsphere.keygen.snowflake.algorithm.SnowflakeKeyGenerateAlgorithm;
import
org.apache.shardingsphere.test.e2e.data.pipeline.cases.PipelineContainerComposer;
import
org.apache.shardingsphere.test.e2e.data.pipeline.cases.task.E2EIncrementalTask;
import
org.apache.shardingsphere.test.e2e.data.pipeline.framework.helper.PipelineCaseHelper;
diff --git
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/general/MySQLMigrationGeneralE2EIT.java
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/general/MySQLMigrationGeneralE2EIT.java
index e48d3d4c572..b5af3630465 100644
---
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/general/MySQLMigrationGeneralE2EIT.java
+++
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/general/MySQLMigrationGeneralE2EIT.java
@@ -22,7 +22,7 @@ import org.apache.commons.lang3.tuple.Pair;
import
org.apache.shardingsphere.data.pipeline.scenario.migration.MigrationJobType;
import org.apache.shardingsphere.infra.database.core.type.DatabaseType;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
-import
org.apache.shardingsphere.sharding.algorithm.keygen.SnowflakeKeyGenerateAlgorithm;
+import
org.apache.shardingsphere.keygen.snowflake.algorithm.SnowflakeKeyGenerateAlgorithm;
import
org.apache.shardingsphere.test.e2e.data.pipeline.cases.PipelineContainerComposer;
import
org.apache.shardingsphere.test.e2e.data.pipeline.cases.migration.AbstractMigrationE2EIT;
import
org.apache.shardingsphere.test.e2e.data.pipeline.cases.task.E2EIncrementalTask;
diff --git
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/general/PostgreSQLMigrationGeneralE2EIT.java
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/general/PostgreSQLMigrationGeneralE2EIT.java
index b56c1a933a9..fa75ea6ec13 100644
---
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/general/PostgreSQLMigrationGeneralE2EIT.java
+++
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/general/PostgreSQLMigrationGeneralE2EIT.java
@@ -22,7 +22,7 @@ import org.apache.commons.lang3.tuple.Pair;
import
org.apache.shardingsphere.data.pipeline.scenario.migration.MigrationJobType;
import org.apache.shardingsphere.infra.database.core.type.DatabaseType;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
-import
org.apache.shardingsphere.sharding.algorithm.keygen.SnowflakeKeyGenerateAlgorithm;
+import
org.apache.shardingsphere.keygen.snowflake.algorithm.SnowflakeKeyGenerateAlgorithm;
import
org.apache.shardingsphere.test.e2e.data.pipeline.cases.PipelineContainerComposer;
import
org.apache.shardingsphere.test.e2e.data.pipeline.cases.migration.AbstractMigrationE2EIT;
import
org.apache.shardingsphere.test.e2e.data.pipeline.cases.task.E2EIncrementalTask;
diff --git
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/general/RulesMigrationE2EIT.java
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/general/RulesMigrationE2EIT.java
index 89f41cb98db..9149435984d 100644
---
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/general/RulesMigrationE2EIT.java
+++
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/general/RulesMigrationE2EIT.java
@@ -20,7 +20,7 @@ package
org.apache.shardingsphere.test.e2e.data.pipeline.cases.migration.general
import
org.apache.shardingsphere.data.pipeline.scenario.migration.MigrationJobType;
import org.apache.shardingsphere.infra.database.core.type.DatabaseType;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
-import
org.apache.shardingsphere.sharding.algorithm.keygen.UUIDKeyGenerateAlgorithm;
+import
org.apache.shardingsphere.keygen.uuid.algorithm.UUIDKeyGenerateAlgorithm;
import
org.apache.shardingsphere.test.e2e.data.pipeline.cases.PipelineContainerComposer;
import
org.apache.shardingsphere.test.e2e.data.pipeline.cases.migration.AbstractMigrationE2EIT;
import
org.apache.shardingsphere.test.e2e.data.pipeline.framework.helper.PipelineCaseHelper;
diff --git
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/primarykey/IndexesMigrationE2EIT.java
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/primarykey/IndexesMigrationE2EIT.java
index d4b01eee705..02d96b941df 100644
---
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/primarykey/IndexesMigrationE2EIT.java
+++
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/primarykey/IndexesMigrationE2EIT.java
@@ -25,8 +25,8 @@ import
org.apache.shardingsphere.infra.database.mysql.type.MySQLDatabaseType;
import
org.apache.shardingsphere.infra.database.postgresql.type.PostgreSQLDatabaseType;
import
org.apache.shardingsphere.infra.exception.core.external.sql.type.wrapper.SQLWrapperException;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
-import
org.apache.shardingsphere.sharding.algorithm.keygen.UUIDKeyGenerateAlgorithm;
-import org.apache.shardingsphere.sharding.spi.KeyGenerateAlgorithm;
+import org.apache.shardingsphere.keygen.core.algorithm.KeyGenerateAlgorithm;
+import
org.apache.shardingsphere.keygen.uuid.algorithm.UUIDKeyGenerateAlgorithm;
import
org.apache.shardingsphere.test.e2e.data.pipeline.cases.PipelineContainerComposer;
import
org.apache.shardingsphere.test.e2e.data.pipeline.cases.migration.AbstractMigrationE2EIT;
import
org.apache.shardingsphere.test.e2e.data.pipeline.framework.helper.PipelineCaseHelper;
diff --git
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/primarykey/MariaDBMigrationE2EIT.java
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/primarykey/MariaDBMigrationE2EIT.java
index 98165c23924..2537bf62dd9 100644
---
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/primarykey/MariaDBMigrationE2EIT.java
+++
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/primarykey/MariaDBMigrationE2EIT.java
@@ -21,8 +21,8 @@ import lombok.extern.slf4j.Slf4j;
import
org.apache.shardingsphere.data.pipeline.scenario.migration.MigrationJobType;
import org.apache.shardingsphere.infra.database.core.type.DatabaseType;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
-import
org.apache.shardingsphere.sharding.algorithm.keygen.UUIDKeyGenerateAlgorithm;
-import org.apache.shardingsphere.sharding.spi.KeyGenerateAlgorithm;
+import org.apache.shardingsphere.keygen.core.algorithm.KeyGenerateAlgorithm;
+import
org.apache.shardingsphere.keygen.uuid.algorithm.UUIDKeyGenerateAlgorithm;
import
org.apache.shardingsphere.test.e2e.data.pipeline.cases.PipelineContainerComposer;
import
org.apache.shardingsphere.test.e2e.data.pipeline.cases.migration.AbstractMigrationE2EIT;
import
org.apache.shardingsphere.test.e2e.data.pipeline.framework.helper.PipelineCaseHelper;
diff --git
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/primarykey/TextPrimaryKeyMigrationE2EIT.java
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/primarykey/TextPrimaryKeyMigrationE2EIT.java
index fe5d3d025c0..89239b86062 100644
---
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/primarykey/TextPrimaryKeyMigrationE2EIT.java
+++
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/migration/primarykey/TextPrimaryKeyMigrationE2EIT.java
@@ -21,7 +21,7 @@ import
org.apache.shardingsphere.data.pipeline.scenario.migration.MigrationJobTy
import org.apache.shardingsphere.infra.database.mysql.type.MySQLDatabaseType;
import org.apache.shardingsphere.infra.database.core.type.DatabaseType;
import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
-import
org.apache.shardingsphere.sharding.algorithm.keygen.UUIDKeyGenerateAlgorithm;
+import
org.apache.shardingsphere.keygen.uuid.algorithm.UUIDKeyGenerateAlgorithm;
import
org.apache.shardingsphere.test.e2e.data.pipeline.cases.PipelineContainerComposer;
import
org.apache.shardingsphere.test.e2e.data.pipeline.cases.migration.AbstractMigrationE2EIT;
import
org.apache.shardingsphere.test.e2e.data.pipeline.framework.helper.PipelineCaseHelper;
diff --git
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/task/E2EIncrementalTask.java
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/task/E2EIncrementalTask.java
index 4e03016e24f..07108123858 100644
---
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/task/E2EIncrementalTask.java
+++
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/task/E2EIncrementalTask.java
@@ -24,7 +24,7 @@ import
org.apache.shardingsphere.infra.database.core.type.DatabaseType;
import org.apache.shardingsphere.infra.database.mysql.type.MySQLDatabaseType;
import
org.apache.shardingsphere.infra.database.opengauss.type.OpenGaussDatabaseType;
import
org.apache.shardingsphere.infra.database.postgresql.type.PostgreSQLDatabaseType;
-import org.apache.shardingsphere.sharding.spi.KeyGenerateAlgorithm;
+import org.apache.shardingsphere.keygen.core.algorithm.KeyGenerateAlgorithm;
import
org.apache.shardingsphere.test.e2e.data.pipeline.cases.base.BaseIncrementTask;
import
org.apache.shardingsphere.test.e2e.data.pipeline.framework.helper.PipelineCaseHelper;
import
org.apache.shardingsphere.test.e2e.data.pipeline.util.DataSourceExecuteUtils;
diff --git
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/task/MySQLIncrementTask.java
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/task/MySQLIncrementTask.java
index 46c80f15126..5d9377152f0 100644
---
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/task/MySQLIncrementTask.java
+++
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/task/MySQLIncrementTask.java
@@ -19,7 +19,7 @@ package
org.apache.shardingsphere.test.e2e.data.pipeline.cases.task;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
-import org.apache.shardingsphere.sharding.spi.KeyGenerateAlgorithm;
+import org.apache.shardingsphere.keygen.core.algorithm.KeyGenerateAlgorithm;
import
org.apache.shardingsphere.test.e2e.data.pipeline.cases.base.BaseIncrementTask;
import
org.apache.shardingsphere.test.e2e.data.pipeline.util.DataSourceExecuteUtils;
diff --git
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/task/PostgreSQLIncrementTask.java
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/task/PostgreSQLIncrementTask.java
index f63298ecd5c..e574eb68e83 100644
---
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/task/PostgreSQLIncrementTask.java
+++
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/cases/task/PostgreSQLIncrementTask.java
@@ -20,8 +20,8 @@ package
org.apache.shardingsphere.test.e2e.data.pipeline.cases.task;
import com.google.common.base.Strings;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
-import
org.apache.shardingsphere.sharding.algorithm.keygen.SnowflakeKeyGenerateAlgorithm;
-import org.apache.shardingsphere.sharding.spi.KeyGenerateAlgorithm;
+import org.apache.shardingsphere.keygen.core.algorithm.KeyGenerateAlgorithm;
+import
org.apache.shardingsphere.keygen.snowflake.algorithm.SnowflakeKeyGenerateAlgorithm;
import
org.apache.shardingsphere.test.e2e.data.pipeline.cases.base.BaseIncrementTask;
import
org.apache.shardingsphere.test.e2e.data.pipeline.framework.helper.PipelineCaseHelper;
import
org.apache.shardingsphere.test.e2e.data.pipeline.util.DataSourceExecuteUtils;
diff --git
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/framework/helper/PipelineCaseHelper.java
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/framework/helper/PipelineCaseHelper.java
index f243f5c3fed..b70464dda11 100644
---
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/framework/helper/PipelineCaseHelper.java
+++
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/framework/helper/PipelineCaseHelper.java
@@ -28,7 +28,7 @@ import
org.apache.shardingsphere.infra.database.core.type.DatabaseType;
import org.apache.shardingsphere.infra.database.mysql.type.MySQLDatabaseType;
import
org.apache.shardingsphere.infra.database.opengauss.type.OpenGaussDatabaseType;
import
org.apache.shardingsphere.infra.database.postgresql.type.PostgreSQLDatabaseType;
-import org.apache.shardingsphere.sharding.spi.KeyGenerateAlgorithm;
+import org.apache.shardingsphere.keygen.core.algorithm.KeyGenerateAlgorithm;
import
org.apache.shardingsphere.test.e2e.data.pipeline.util.AutoIncrementKeyGenerateAlgorithm;
import java.math.BigDecimal;
diff --git
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/util/AutoIncrementKeyGenerateAlgorithm.java
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/util/AutoIncrementKeyGenerateAlgorithm.java
index bf9dbc5bbd6..ea95b2413e9 100644
---
a/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/util/AutoIncrementKeyGenerateAlgorithm.java
+++
b/test/e2e/operation/pipeline/src/test/java/org/apache/shardingsphere/test/e2e/data/pipeline/util/AutoIncrementKeyGenerateAlgorithm.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.test.e2e.data.pipeline.util;
-import org.apache.shardingsphere.sharding.spi.KeyGenerateAlgorithm;
+import org.apache.shardingsphere.keygen.core.algorithm.KeyGenerateAlgorithm;
import java.util.concurrent.atomic.AtomicInteger;
diff --git
a/test/it/rewriter/src/test/java/org/apache/shardingsphere/test/it/rewrite/fixture/keygen/RewriteKeyGenerateAlgorithmFixture.java
b/test/it/rewriter/src/test/java/org/apache/shardingsphere/test/it/rewrite/fixture/keygen/RewriteKeyGenerateAlgorithmFixture.java
index de7c6400802..40820915117 100644
---
a/test/it/rewriter/src/test/java/org/apache/shardingsphere/test/it/rewrite/fixture/keygen/RewriteKeyGenerateAlgorithmFixture.java
+++
b/test/it/rewriter/src/test/java/org/apache/shardingsphere/test/it/rewrite/fixture/keygen/RewriteKeyGenerateAlgorithmFixture.java
@@ -17,7 +17,7 @@
package org.apache.shardingsphere.test.it.rewrite.fixture.keygen;
-import org.apache.shardingsphere.sharding.spi.KeyGenerateAlgorithm;
+import org.apache.shardingsphere.keygen.core.algorithm.KeyGenerateAlgorithm;
public final class RewriteKeyGenerateAlgorithmFixture implements
KeyGenerateAlgorithm {
diff --git
a/test/it/rewriter/src/test/resources/META-INF/services/org.apache.shardingsphere.sharding.spi.KeyGenerateAlgorithm
b/test/it/rewriter/src/test/resources/META-INF/services/org.apache.shardingsphere.keygen.core.algorithm.KeyGenerateAlgorithm
similarity index 100%
rename from
test/it/rewriter/src/test/resources/META-INF/services/org.apache.shardingsphere.sharding.spi.KeyGenerateAlgorithm
rename to
test/it/rewriter/src/test/resources/META-INF/services/org.apache.shardingsphere.keygen.core.algorithm.KeyGenerateAlgorithm