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

zhonghongsheng 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 ba88f530937 Use deepEquals instead of equals at MySQLIncrementalDumper 
(#29127)
ba88f530937 is described below

commit ba88f53093702bfbacfac007f1460cfc6dc3d253
Author: Xinze Guo <101622833+aze...@users.noreply.github.com>
AuthorDate: Wed Nov 22 17:25:45 2023 +0800

    Use deepEquals instead of equals at MySQLIncrementalDumper (#29127)
    
    * Use deepEquals instead of equals
    
    * Clean invalid job config
    
    * Persist valid job config
---
 .../data/pipeline/mysql/ingest/MySQLIncrementalDumper.java         | 2 +-
 .../pipeline/core/job/service/GovernanceRepositoryAPIImplTest.java | 7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git 
a/kernel/data-pipeline/dialect/mysql/src/main/java/org/apache/shardingsphere/data/pipeline/mysql/ingest/MySQLIncrementalDumper.java
 
b/kernel/data-pipeline/dialect/mysql/src/main/java/org/apache/shardingsphere/data/pipeline/mysql/ingest/MySQLIncrementalDumper.java
index e3e093d777c..d07019cefc6 100644
--- 
a/kernel/data-pipeline/dialect/mysql/src/main/java/org/apache/shardingsphere/data/pipeline/mysql/ingest/MySQLIncrementalDumper.java
+++ 
b/kernel/data-pipeline/dialect/mysql/src/main/java/org/apache/shardingsphere/data/pipeline/mysql/ingest/MySQLIncrementalDumper.java
@@ -179,7 +179,7 @@ public final class MySQLIncrementalDumper extends 
AbstractPipelineLifecycleRunna
             for (int j = 0; j < beforeValues.length; j++) {
                 Serializable oldValue = beforeValues[j];
                 Serializable newValue = afterValues[j];
-                boolean updated = !Objects.equals(newValue, oldValue);
+                boolean updated = !Objects.deepEquals(newValue, oldValue);
                 PipelineColumnMetaData columnMetaData = 
tableMetaData.getColumnMetaData(j + 1);
                 dataRecord.addColumn(new Column(columnMetaData.getName(),
                         handleValue(columnMetaData, oldValue),
diff --git 
a/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/job/service/GovernanceRepositoryAPIImplTest.java
 
b/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/job/service/GovernanceRepositoryAPIImplTest.java
index cf5203910f4..7806cda61dc 100644
--- 
a/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/job/service/GovernanceRepositoryAPIImplTest.java
+++ 
b/test/it/pipeline/src/test/java/org/apache/shardingsphere/test/it/data/pipeline/core/job/service/GovernanceRepositoryAPIImplTest.java
@@ -31,6 +31,8 @@ import 
org.apache.shardingsphere.data.pipeline.core.task.InventoryTask;
 import org.apache.shardingsphere.data.pipeline.core.task.PipelineTaskUtils;
 import 
org.apache.shardingsphere.data.pipeline.scenario.migration.config.MigrationTaskConfiguration;
 import 
org.apache.shardingsphere.data.pipeline.scenario.migration.context.MigrationJobItemContext;
+import org.apache.shardingsphere.elasticjob.infra.pojo.JobConfigurationPOJO;
+import org.apache.shardingsphere.infra.util.yaml.YamlEngine;
 import org.apache.shardingsphere.mode.event.DataChangedEvent;
 import org.apache.shardingsphere.mode.event.DataChangedEvent.Type;
 import org.apache.shardingsphere.mode.manager.ContextManager;
@@ -85,7 +87,10 @@ class GovernanceRepositoryAPIImplTest {
     @Test
     void assertIsJobConfigurationExisted() {
         
assertFalse(governanceRepositoryAPI.isJobConfigurationExisted("foo_job"));
-        getClusterPersistRepository().persist("/pipeline/jobs/foo_job/config", 
"foo");
+        JobConfigurationPOJO value = new JobConfigurationPOJO();
+        value.setJobName("foo_job");
+        value.setShardingTotalCount(1);
+        getClusterPersistRepository().persist("/pipeline/jobs/foo_job/config", 
YamlEngine.marshal(value));
         
assertTrue(governanceRepositoryAPI.isJobConfigurationExisted("foo_job"));
     }
     

Reply via email to