Hisoka-X commented on code in PR #9628:
URL: https://github.com/apache/seatunnel/pull/9628#discussion_r2241464119
##########
seatunnel-connectors-v2/connector-cdc/connector-cdc-mysql/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/mysql/utils/MySqlConnectionUtils.java:
##########
@@ -185,4 +192,87 @@ private static Map<String, String> querySystemVariables(
return variables;
}
+
+ public static BinlogOffset findBinlogOffsetBytimestamp(
+ JdbcConnection jdbc, BinaryLogClient client, long timestamp) {
+ final String showBinaryLogStmt = "SHOW BINARY LOGS";
+ List<String> binlogFiles = new ArrayList<>();
+ JdbcConnection.ResultSetConsumer rsc =
+ rs -> {
+ while (rs.next()) {
+ String fileName = rs.getString(1);
+ long fileSize = rs.getLong(2);
+ if (fileSize > 0) {
+ binlogFiles.add(fileName);
+ }
+ }
+ };
+ try {
+ jdbc.query(showBinaryLogStmt, rsc);
+ if (binlogFiles.isEmpty()) {
+ return BinlogOffset.INITIAL_OFFSET;
+ }
+ String binlogName = searchBinlogName(client, timestamp,
binlogFiles);
+ return new BinlogOffset(binlogName, 0);
Review Comment:
Can we achieve accurate reading by filtering the data parsed from binlog?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]