You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2025/07/10 15:33:16 UTC
(shardingsphere) branch master updated: Move PipelineDataNodeUtils to pipeline-core module (#35946)
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 7152eccf07e Move PipelineDataNodeUtils to pipeline-core module (#35946)
7152eccf07e is described below
commit 7152eccf07e1b277aed596ca023db9d5b70d1c20
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Thu Jul 10 23:33:10 2025 +0800
Move PipelineDataNodeUtils to pipeline-core module (#35946)
---
.../data/pipeline/core/util/PipelineDataNodeUtils.java} | 6 +++---
.../data/pipeline/core/util/PipelineDataNodeUtilsTest.java} | 8 ++++----
.../data/pipeline/cdc/handler/CDCBackendHandler.java | 4 ++--
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/kernel/data-pipeline/scenario/cdc/core/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/util/CDCDataNodeUtils.java b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/util/PipelineDataNodeUtils.java
similarity index 96%
rename from kernel/data-pipeline/scenario/cdc/core/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/util/CDCDataNodeUtils.java
rename to kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/util/PipelineDataNodeUtils.java
index b7afb7fe157..54005c05574 100644
--- a/kernel/data-pipeline/scenario/cdc/core/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/util/CDCDataNodeUtils.java
+++ b/kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/util/PipelineDataNodeUtils.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.data.pipeline.cdc.util;
+package org.apache.shardingsphere.data.pipeline.core.util;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
@@ -33,10 +33,10 @@ import java.util.List;
import java.util.Map;
/**
- * CDC data node utils.
+ * Pipeline data node utils.
*/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class CDCDataNodeUtils {
+public final class PipelineDataNodeUtils {
/**
* Build table and data nodes map.
diff --git a/kernel/data-pipeline/scenario/cdc/core/src/test/java/org/apache/shardingsphere/data/pipeline/cdc/util/CDCDataNodeUtilsTest.java b/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/util/PipelineDataNodeUtilsTest.java
similarity index 91%
rename from kernel/data-pipeline/scenario/cdc/core/src/test/java/org/apache/shardingsphere/data/pipeline/cdc/util/CDCDataNodeUtilsTest.java
rename to kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/util/PipelineDataNodeUtilsTest.java
index afd609d2f40..21050dec929 100644
--- a/kernel/data-pipeline/scenario/cdc/core/src/test/java/org/apache/shardingsphere/data/pipeline/cdc/util/CDCDataNodeUtilsTest.java
+++ b/kernel/data-pipeline/core/src/test/java/org/apache/shardingsphere/data/pipeline/core/util/PipelineDataNodeUtilsTest.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.shardingsphere.data.pipeline.cdc.util;
+package org.apache.shardingsphere.data.pipeline.core.util;
import org.apache.shardingsphere.data.pipeline.core.exception.param.PipelineInvalidParameterException;
import org.apache.shardingsphere.infra.datanode.DataNode;
@@ -35,7 +35,7 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
-class CDCDataNodeUtilsTest {
+class PipelineDataNodeUtilsTest {
@Test
void assertBuildTableAndDataNodesMap() {
@@ -48,7 +48,7 @@ class CDCDataNodeUtilsTest {
when(ruleMetaData.getAttributes(DataNodeRuleAttribute.class)).thenReturn(Arrays.asList(notReplicaBasedDistributionDataNodeRuleAttribute, replicaBasedDistributionDataNodeRuleAttribute));
ShardingSphereDatabase database = mock(ShardingSphereDatabase.class);
when(database.getRuleMetaData()).thenReturn(ruleMetaData);
- Map<String, List<DataNode>> actual = CDCDataNodeUtils.buildTableAndDataNodesMap(database, Arrays.asList("foo_tbl", "bar_tbl"));
+ Map<String, List<DataNode>> actual = PipelineDataNodeUtils.buildTableAndDataNodesMap(database, Arrays.asList("foo_tbl", "bar_tbl"));
assertThat(actual.size(), is(2));
assertThat(actual.get("foo_tbl"), is(Collections.singletonList(new DataNode("foo_ds.foo_tbl"))));
assertThat(actual.get("bar_tbl"), is(Collections.singletonList(new DataNode("foo_ds.bar_tbl"))));
@@ -60,6 +60,6 @@ class CDCDataNodeUtilsTest {
when(ruleMetaData.getAttributes(DataNodeRuleAttribute.class)).thenReturn(Collections.emptyList());
ShardingSphereDatabase database = mock(ShardingSphereDatabase.class);
when(database.getRuleMetaData()).thenReturn(ruleMetaData);
- assertThrows(PipelineInvalidParameterException.class, () -> CDCDataNodeUtils.buildTableAndDataNodesMap(database, Collections.singleton("foo_tbl")));
+ assertThrows(PipelineInvalidParameterException.class, () -> PipelineDataNodeUtils.buildTableAndDataNodesMap(database, Collections.singleton("foo_tbl")));
}
}
diff --git a/kernel/data-pipeline/scenario/cdc/core/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/handler/CDCBackendHandler.java b/kernel/data-pipeline/scenario/cdc/core/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/handler/CDCBackendHandler.java
index 14dc9a05472..c27351249bd 100644
--- a/kernel/data-pipeline/scenario/cdc/core/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/handler/CDCBackendHandler.java
+++ b/kernel/data-pipeline/scenario/cdc/core/src/main/java/org/apache/shardingsphere/data/pipeline/cdc/handler/CDCBackendHandler.java
@@ -42,7 +42,6 @@ import org.apache.shardingsphere.data.pipeline.cdc.protocol.request.StreamDataRe
import org.apache.shardingsphere.data.pipeline.cdc.protocol.response.CDCResponse;
import org.apache.shardingsphere.data.pipeline.cdc.protocol.response.CDCResponse.ResponseCase;
import org.apache.shardingsphere.data.pipeline.cdc.protocol.response.StreamDataResult;
-import org.apache.shardingsphere.data.pipeline.cdc.util.CDCDataNodeUtils;
import org.apache.shardingsphere.data.pipeline.cdc.util.CDCSchemaTableUtils;
import org.apache.shardingsphere.data.pipeline.core.context.PipelineContextManager;
import org.apache.shardingsphere.data.pipeline.core.exception.PipelineInternalException;
@@ -51,6 +50,7 @@ import org.apache.shardingsphere.data.pipeline.core.job.PipelineJobRegistry;
import org.apache.shardingsphere.data.pipeline.core.job.api.TransmissionJobAPI;
import org.apache.shardingsphere.data.pipeline.core.job.id.PipelineJobIdUtils;
import org.apache.shardingsphere.data.pipeline.core.job.service.PipelineJobConfigurationManager;
+import org.apache.shardingsphere.data.pipeline.core.util.PipelineDataNodeUtils;
import org.apache.shardingsphere.infra.database.core.metadata.database.metadata.DialectDatabaseMetaData;
import org.apache.shardingsphere.infra.database.core.type.DatabaseTypeRegistry;
import org.apache.shardingsphere.infra.datanode.DataNode;
@@ -115,7 +115,7 @@ public final class CDCBackendHandler {
tableNames = schemaTableNames;
}
ShardingSpherePreconditions.checkNotEmpty(tableNames, () -> new CDCExceptionWrapper(requestId, new MissingRequiredStreamDataSourceException()));
- Map<String, List<DataNode>> tableAndDataNodesMap = CDCDataNodeUtils.buildTableAndDataNodesMap(database, tableNames);
+ Map<String, List<DataNode>> tableAndDataNodesMap = PipelineDataNodeUtils.buildTableAndDataNodesMap(database, tableNames);
// TODO Add globalCSNSupported to isolate it with isDecodeWithTransaction flag, they're different. And also update CDCJobPreparer needSorting flag.
boolean isDecodeWithTransaction = new DatabaseTypeRegistry(database.getProtocolType()).getDialectDatabaseMetaData().getTransactionOption().isSupportGlobalCSN();
StreamDataParameter parameter = new StreamDataParameter(requestBody.getDatabase(), new ArrayList<>(schemaTableNames), requestBody.getFull(), tableAndDataNodesMap, isDecodeWithTransaction);