EMsnap commented on code in PR #4113:
URL: https://github.com/apache/incubator-inlong/pull/4113#discussion_r867601844


##########
inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/sources/reader/BinlogReader.java:
##########
@@ -253,6 +271,28 @@ private Properties getEngineProps() {
         return props;
     }
 
+    private String serializeOffset() {
+        Map<String, Object> sourceOffset = new HashMap<>();
+        Preconditions.checkNotNull(JOB_DATABASE_OFFSET_SPECIFIC_OFFSET_FILE,
+                JOB_DATABASE_OFFSET_SPECIFIC_OFFSET_FILE + "shouldn't be 
null");
+        sourceOffset.put("file", specificOffsetFile);
+        Preconditions.checkNotNull(JOB_DATABASE_OFFSET_SPECIFIC_OFFSET_POS,
+                JOB_DATABASE_OFFSET_SPECIFIC_OFFSET_POS + " shouldn't be 
null");
+        sourceOffset.put("pos", specificOffsetPos);
+        DebeziumOffset specificOffset = new DebeziumOffset();
+        specificOffset.setSourceOffset(sourceOffset);
+        Map<String, String> sourcePartition = new HashMap<>();
+        sourcePartition.put("server", instanceId);
+        specificOffset.setSourcePartition(sourcePartition);
+        byte[] serializedOffset = new byte[0];
+        try {
+            serializedOffset = 
DebeziumOffsetSerializer.INSTANCE.serialize(specificOffset);

Review Comment:
   Here we can actually implement a DebeziumOffsetSerializer by ourselves



##########
inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/sources/reader/BinlogReader.java:
##########
@@ -228,18 +240,24 @@ private Properties getEngineProps() {
         props.setProperty("table.whitelist", tableWhiteList);
         props.setProperty("database.whitelist", databaseWhiteList);
 
-        props.setProperty("offset.storage", 
FileOffsetBackingStore.class.getCanonicalName());
-        props.setProperty("offset.storage.file.filename", offsetStoreFileName);
         props.setProperty("offset.flush.interval.ms", offsetFlushIntervalMs);
-        props.setProperty("database.history", 
FileDatabaseHistory.class.getCanonicalName());
-        props.setProperty("database.history.file.filename", 
databaseStoreHistoryName);
         props.setProperty("database.snapshot.mode", snapshotMode);
         props.setProperty("database.history.store.only.monitored.tables.ddl", 
historyMonitorDdl);
         props.setProperty("database.allowPublicKeyRetrieval", "true");
         props.setProperty("key.converter.schemas.enable", "false");
         props.setProperty("value.converter.schemas.enable", "false");
         props.setProperty("include.schema.changes", includeSchemaChanges);
         props.setProperty("snapshot.mode", snapshotMode);
+        if ("schema_only_recovery".equals(snapshotMode)) {
+            props.setProperty("offset.storage", 
FlinkOffsetBackingStore.class.getCanonicalName());
+            props.setProperty(FlinkOffsetBackingStore.OFFSET_STATE_VALUE, 
serializeOffset());
+            props.setProperty("database.history", 
FlinkDatabaseHistory.class.getCanonicalName());
+        } else {
+            props.setProperty("offset.storage", 
FileOffsetBackingStore.class.getCanonicalName());

Review Comment:
   no to to include FileDatabaseHistory and FileOffsetBackingStore here



-- 
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]

Reply via email to