LIU created FLINK-36579:
---------------------------

             Summary: mysql cdc charset collation sort not equals java string 
compare.
                 Key: FLINK-36579
                 URL: https://issues.apache.org/jira/browse/FLINK-36579
             Project: Flink
          Issue Type: Improvement
          Components: Flink CDC
    Affects Versions: cdc-3.2.0
         Environment: mysql 8.0
mysql-cdc 3.2
            Reporter: LIU
             Fix For: cdc-3.2.0


Use id VARCHAR(255) NOT NULL PRIMARY KEY COLLATE utf8mb3_general_ci as 
ChunkSplitKey.

Once data for id is
{code:java}
aGGGGGG
GbGGGGG
GGcGGGG
GGGdGGG
GGGGeGG
GGGGGfG
GGGGGGg{code}
mysql sort order is unchanged.

but java string compare sort becomes reverse order.

 
{code:java}
    if (ObjectUtils.compare(chunkEnd, max) >= 0) {
        return null;
    } else {
        return chunkEnd;
    }

public static int compare(Object obj1, Object obj2) {
    if (obj1 instanceof Comparable && obj1.getClass().equals(obj2.getClass())) {
        return ((Comparable) obj1).compareTo(obj2);
    } else {
        return obj1.toString().compareTo(obj2.toString());
    }
}

{code}
 

mysql-cdc queryNextChunkMax will return null. so current snapshotSplit is 
[null, null].

It will cause the read task to read all data in the table. and make current 
read task hang out for a long time.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to