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

jiangmaolin pushed a commit to branch dev-5.5.1
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git

commit a4e5658c875bbb6d61c742c30365236340a1675c
Author: Haoran Meng <[email protected]>
AuthorDate: Thu Oct 24 11:41:47 2024 +0800

    Merge pom
---
 .../infra/version/SphereExVersionRangeChecker.java | 64 ---------------------
 .../infra/spi/reshard/ReshardingType.java          | 26 +++++++++
 jdbc/pom.xml                                       |  7 +++
 kernel/schedule/core/pom.xml                       |  8 ++-
 .../cluster/version/ClusterVersionChecker.java     | 67 ----------------------
 .../EnterpriseClusterContextManagerBuilder.java    |  2 -
 .../cluster/repository/provider/zookeeper/pom.xml  |  8 ++-
 proxy/backend/core/pom.xml                         |  7 +++
 proxy/bootstrap/pom.xml                            |  7 +++
 9 files changed, 61 insertions(+), 135 deletions(-)

diff --git 
a/infra/common/src/main/java/com/sphereex/dbplusengine/infra/version/SphereExVersionRangeChecker.java
 
b/infra/common/src/main/java/com/sphereex/dbplusengine/infra/version/SphereExVersionRangeChecker.java
deleted file mode 100644
index 7d56b592473..00000000000
--- 
a/infra/common/src/main/java/com/sphereex/dbplusengine/infra/version/SphereExVersionRangeChecker.java
+++ /dev/null
@@ -1,64 +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 com.sphereex.dbplusengine.infra.version;
-
-import lombok.AccessLevel;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-
-import java.util.Arrays;
-import java.util.List;
-import java.util.stream.Collectors;
-
-/**
- * SphereEx version range checker.
- */
-@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class SphereExVersionRangeChecker {
-    
-    /**
-     * Check is valid version.
-     *
-     * @param clusterVersion cluster version
-     * @param versionRange version range
-     * @return valid or invalid version
-     */
-    public static boolean check(final String clusterVersion, final String 
versionRange) {
-        long versionNumber = Long.parseLong(clusterVersion.replaceAll("\\.", 
""));
-        String[] pairs = versionRange.split(",");
-        SphereExVersionRange range = new 
SphereExVersionRange(Arrays.stream(pairs).map(optional -> 
optional.replaceAll("[(|)|\\[|\\]]", "").trim()).collect(Collectors.toList()));
-        return (null == range.getStartVersion() || (pairs[0].startsWith("[") ? 
versionNumber >= range.getStartVersion() : versionNumber > 
range.getStartVersion()))
-                && (null == range.getEndVersion() || (pairs[1].endsWith("]") ? 
versionNumber <= range.getEndVersion() : versionNumber < 
range.getEndVersion()));
-    }
-    
-    /**
-     * SphereEx version range.
-     */
-    @Getter
-    public static class SphereExVersionRange {
-        
-        private final Long startVersion;
-        
-        private final Long endVersion;
-        
-        public SphereExVersionRange(final List<String> versionRange) {
-            this.startVersion = "".equals(versionRange.get(0)) ? null : 
Long.valueOf(versionRange.get(0).replaceAll("\\.", ""));
-            this.endVersion = "".equals(versionRange.get(1)) ? null : 
Long.valueOf(versionRange.get(1).replaceAll("\\.", ""));
-        }
-    }
-}
diff --git 
a/infra/spi/src/main/java/com/sphereex/dbplusengine/infra/spi/reshard/ReshardingType.java
 
b/infra/spi/src/main/java/com/sphereex/dbplusengine/infra/spi/reshard/ReshardingType.java
new file mode 100644
index 00000000000..46e4deb6949
--- /dev/null
+++ 
b/infra/spi/src/main/java/com/sphereex/dbplusengine/infra/spi/reshard/ReshardingType.java
@@ -0,0 +1,26 @@
+/*
+ * 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 com.sphereex.dbplusengine.infra.spi.reshard;
+
+/**
+ * Resharding type.
+ */
+public enum ReshardingType {
+    
+    SINGLE_TO_BROADCAST, TO_SHARDING, BROADCAST_TO_BROADCAST
+}
diff --git a/jdbc/pom.xml b/jdbc/pom.xml
index 81c46dfcac3..9659393b41e 100644
--- a/jdbc/pom.xml
+++ b/jdbc/pom.xml
@@ -129,6 +129,13 @@
             <artifactId>shardingsphere-cluster-mode-core</artifactId>
             <version>${project.version}</version>
         </dependency>
+        <!-- SPEX ADDED: BEGIN -->
+        <dependency>
+            <groupId>com.sphere-ex</groupId>
+            <artifactId>dbplusengine-cluster-mode-enterprise</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <!-- SPEX ADDED: END -->
         <dependency>
             <groupId>org.apache.shardingsphere</groupId>
             <artifactId>shardingsphere-sharding-core</artifactId>
diff --git a/kernel/schedule/core/pom.xml b/kernel/schedule/core/pom.xml
index 70d6aeabfef..60919a1633c 100644
--- a/kernel/schedule/core/pom.xml
+++ b/kernel/schedule/core/pom.xml
@@ -32,7 +32,13 @@
             <artifactId>shardingsphere-cluster-mode-core</artifactId>
             <version>${project.version}</version>
         </dependency>
-        
+        <!-- SPEX ADDED: BEGIN -->
+        <dependency>
+            <groupId>com.sphere-ex</groupId>
+            <artifactId>dbplusengine-cluster-mode-enterprise</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <!-- SPEX ADDED: END -->
         <dependency>
             <groupId>org.apache.shardingsphere</groupId>
             <artifactId>shardingsphere-test-util</artifactId>
diff --git 
a/mode/type/cluster/core/src/main/java/com/sphereex/dbplusengine/mode/manager/cluster/version/ClusterVersionChecker.java
 
b/mode/type/cluster/core/src/main/java/com/sphereex/dbplusengine/mode/manager/cluster/version/ClusterVersionChecker.java
deleted file mode 100644
index c041b3cfd1e..00000000000
--- 
a/mode/type/cluster/core/src/main/java/com/sphereex/dbplusengine/mode/manager/cluster/version/ClusterVersionChecker.java
+++ /dev/null
@@ -1,67 +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 com.sphereex.dbplusengine.mode.manager.cluster.version;
-
-import com.google.common.base.Preconditions;
-import com.sphereex.dbplusengine.infra.version.SphereExVersionRangeChecker;
-import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.infra.autogen.version.ShardingSphereVersion;
-import 
org.apache.shardingsphere.infra.metadata.statistics.ShardingSphereDatabaseData;
-import 
org.apache.shardingsphere.infra.metadata.statistics.ShardingSphereSchemaData;
-import 
org.apache.shardingsphere.infra.metadata.statistics.ShardingSphereTableData;
-import org.apache.shardingsphere.mode.metadata.MetaDataContexts;
-
-import java.util.Optional;
-
-/**
- * Cluster version checker.
- */
-@RequiredArgsConstructor
-public final class ClusterVersionChecker {
-    
-    private final MetaDataContexts metaDataContexts;
-    
-    /**
-     * check instance version validity.
-     */
-    public void checkInstanceVersionValidity() {
-        if (metaDataContexts.getStatistics().getDatabaseData().isEmpty()) {
-            return;
-        }
-        Optional<ShardingSphereSchemaData> shardingSphereSchema = 
getShardingSphereSchemaData("shardingsphere");
-        Preconditions.checkState(shardingSphereSchema.isPresent(), 
"`shardingsphere` schema does not exist, current instance not allowed join the 
cluster.");
-        checkIsCompatibleClusterVersion(shardingSphereSchema.get());
-    }
-    
-    private Optional<ShardingSphereSchemaData> 
getShardingSphereSchemaData(final String schemaName) {
-        for (ShardingSphereDatabaseData each : 
metaDataContexts.getStatistics().getDatabaseData().values()) {
-            if (null != each.getSchema(schemaName)) {
-                return Optional.of(each.getSchema(schemaName));
-            }
-        }
-        return Optional.empty();
-    }
-    
-    private void checkIsCompatibleClusterVersion(final 
ShardingSphereSchemaData schemaData) {
-        ShardingSphereTableData tableData = 
schemaData.getTableData().get("cluster_information");
-        String clusterVersion = (String) 
tableData.getRows().iterator().next().getRows().iterator().next();
-        
Preconditions.checkState(SphereExVersionRangeChecker.check(clusterVersion.contains("-SNAPSHOT")
-                ? clusterVersion.replaceAll("-SNAPSHOT", "")
-                : clusterVersion, ShardingSphereVersion.getVersionRange()), 
"Current instance version not allowed join the cluster.");
-    }
-}
diff --git 
a/mode/type/cluster/enterprise/src/main/java/com/sphereex/dbplusengine/mode/manager/cluster/enterprise/EnterpriseClusterContextManagerBuilder.java
 
b/mode/type/cluster/enterprise/src/main/java/com/sphereex/dbplusengine/mode/manager/cluster/enterprise/EnterpriseClusterContextManagerBuilder.java
index d03c4030ebf..9a6afb5cab1 100644
--- 
a/mode/type/cluster/enterprise/src/main/java/com/sphereex/dbplusengine/mode/manager/cluster/enterprise/EnterpriseClusterContextManagerBuilder.java
+++ 
b/mode/type/cluster/enterprise/src/main/java/com/sphereex/dbplusengine/mode/manager/cluster/enterprise/EnterpriseClusterContextManagerBuilder.java
@@ -24,7 +24,6 @@ import 
com.sphereex.dbplusengine.mode.manager.cluster.enterprise.event.subscribe
 import 
com.sphereex.dbplusengine.mode.manager.cluster.enterprise.event.subscriber.registry.EnterpriseClusterDispatchEventSubscriberRegistry;
 import 
com.sphereex.dbplusengine.mode.manager.cluster.lock.ClusterResourceLockQualificationService;
 import 
com.sphereex.dbplusengine.mode.manager.cluster.lock.ResourceLockPersistService;
-import 
com.sphereex.dbplusengine.mode.manager.cluster.version.ClusterVersionChecker;
 import org.apache.shardingsphere.infra.config.mode.ModeConfiguration;
 import org.apache.shardingsphere.infra.config.props.ConfigurationProperties;
 import 
org.apache.shardingsphere.infra.config.props.temporary.TemporaryConfigurationProperties;
@@ -76,7 +75,6 @@ public final class EnterpriseClusterContextManagerBuilder 
implements ContextMana
         eventSubscriberRegistry.register(new 
EnterpriseClusterDeliverEventSubscriberRegistry(repository, 
eventBusContext).getSubscribers());
         MetaDataContexts metaDataContexts = MetaDataContextsFactory.create(
                 metaDataPersistService, param, computeNodeInstanceContext, new 
QualifiedDataSourceStatePersistService(repository).load());
-        new 
ClusterVersionChecker(metaDataContexts).checkInstanceVersionValidity();
         ContextManager result = new ContextManager(metaDataContexts, 
computeNodeInstanceContext, repository);
         registerOnline(computeNodeInstanceContext, param, result, 
eventSubscriberRegistry);
         return result;
diff --git a/mode/type/cluster/repository/provider/zookeeper/pom.xml 
b/mode/type/cluster/repository/provider/zookeeper/pom.xml
index 73125b6ddce..e3c77e386cd 100644
--- a/mode/type/cluster/repository/provider/zookeeper/pom.xml
+++ b/mode/type/cluster/repository/provider/zookeeper/pom.xml
@@ -37,7 +37,13 @@
             <artifactId>shardingsphere-cluster-mode-core</artifactId>
             <version>${project.version}</version>
         </dependency>
-        
+        <!-- SPEX ADDED: BEGIN -->
+        <dependency>
+            <groupId>com.sphere-ex</groupId>
+            <artifactId>dbplusengine-cluster-mode-enterprise</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <!-- SPEX ADDED: END -->
         <dependency>
             <groupId>org.apache.shardingsphere</groupId>
             <artifactId>shardingsphere-test-util</artifactId>
diff --git a/proxy/backend/core/pom.xml b/proxy/backend/core/pom.xml
index c5fb48c6852..aee4288ec70 100644
--- a/proxy/backend/core/pom.xml
+++ b/proxy/backend/core/pom.xml
@@ -77,6 +77,13 @@
             <artifactId>shardingsphere-cluster-mode-core</artifactId>
             <version>${project.version}</version>
         </dependency>
+        <!-- SPEX ADDED: BEGIN -->
+        <dependency>
+            <groupId>com.sphere-ex</groupId>
+            <artifactId>dbplusengine-cluster-mode-enterprise</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <!-- SPEX ADDED: END -->
         <dependency>
             <groupId>org.apache.shardingsphere</groupId>
             <artifactId>shardingsphere-sharding-distsql-handler</artifactId>
diff --git a/proxy/bootstrap/pom.xml b/proxy/bootstrap/pom.xml
index 89e957e98e4..7d429cb2d12 100644
--- a/proxy/bootstrap/pom.xml
+++ b/proxy/bootstrap/pom.xml
@@ -72,6 +72,13 @@
             <artifactId>shardingsphere-proxy-backend-core</artifactId>
             <version>${project.version}</version>
         </dependency>
+        <!-- SPEX ADDED: BEGIN -->
+        <dependency>
+            <groupId>com.sphere-ex</groupId>
+            <artifactId>dbplusengine-proxy-backend-enterprise</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <!-- SPEX ADDED: END -->
         <dependency>
             <groupId>org.apache.shardingsphere</groupId>
             <artifactId>shardingsphere-standalone-mode-core</artifactId>

Reply via email to