You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@inlong.apache.org by GitBox <gi...@apache.org> on 2022/05/09 03:11:21 UTC
[GitHub] [incubator-inlong] EMsnap commented on a diff in pull request #4113: [INLONG-4112][Agent] Support collect data from the specified position for MySQL binlog
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: commits-unsubscribe@inlong.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org