EMsnap commented on code in PR #4113: URL: https://github.com/apache/incubator-inlong/pull/4113#discussion_r871198962
########## inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/utils/DatabaseHistoryUtil.java: ########## @@ -0,0 +1,65 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.inlong.agent.plugin.utils; + +import org.apache.inlong.agent.plugin.message.SchemaRecord; + +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + +/** + * @description + * @date: 2022/5/10 Review Comment: please remove this or update with some comments ########## inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/message/SchemaRecord.java: ########## @@ -0,0 +1,83 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.inlong.agent.plugin.message; + +import io.debezium.document.Document; +import io.debezium.document.DocumentWriter; +import io.debezium.relational.history.HistoryRecord; + +import java.io.IOException; + +/** + * @description Review Comment: please remove this or update with some comments ########## inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/sources/reader/BinlogReader.java: ########## @@ -41,38 +33,54 @@ import org.apache.inlong.agent.plugin.Message; import org.apache.inlong.agent.plugin.Reader; import org.apache.inlong.agent.plugin.sources.snapshot.BinlogSnapshotBase; +import org.apache.inlong.agent.plugin.utils.InLongDatabaseHistory; +import org.apache.inlong.agent.plugin.utils.InLongOffsetBackingStore; import org.apache.inlong.agent.pojo.DebeziumFormat; +import org.apache.inlong.agent.pojo.DebeziumOffset; import org.apache.inlong.agent.utils.AgentUtils; +import org.apache.inlong.agent.utils.DebeziumOffsetSerializer; import org.apache.inlong.common.reporpter.ConfigLogTypeEnum; import org.apache.inlong.common.reporpter.StreamConfigLogMetric; import org.apache.kafka.connect.storage.FileOffsetBackingStore; import org.slf4j.Logger; - import org.slf4j.LoggerFactory; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.LinkedBlockingQueue; + +import static org.apache.inlong.agent.constant.CommonConstants.DEFAULT_MAP_CAPACITY; +import static org.apache.inlong.agent.constant.CommonConstants.PROXY_KEY_DATA; + public class BinlogReader implements Reader { private static final Logger LOGGER = LoggerFactory.getLogger(BinlogReader.class); - private static final String COMPONENT_NAME = "BinlogReader"; - private static final String JOB_DATABASE_USER = "job.binlogJob.user"; - private static final String JOB_DATABASE_PASSWORD = "job.binlogJob.password"; - private static final String JOB_DATABASE_HOSTNAME = "job.binlogJob.hostname"; - private static final String JOB_TABLE_WHITELIST = "job.binlogJob.tableWhiteList"; - private static final String JOB_DATABASE_WHITELIST = "job.binlogJob.databaseWhiteList"; + public static final String COMPONENT_NAME = "BinlogReader"; + public static final String JOB_DATABASE_USER = "job.binlogJob.user"; + public static final String JOB_DATABASE_PASSWORD = "job.binlogJob.password"; + public static final String JOB_DATABASE_HOSTNAME = "job.binlogJob.hostname"; + public static final String JOB_TABLE_WHITELIST = "job.binlogJob.tableWhiteList"; + public static final String JOB_DATABASE_WHITELIST = "job.binlogJob.databaseWhiteList"; - private static final String JOB_DATABASE_OFFSETS = "job.binlogJob.offsets"; - private static final String JOB_DATABASE_OFFSET_FILENAME = "job.binlogJob.offset.filename"; + public static final String JOB_DATABASE_OFFSETS = "job.binlogJob.offsets"; + public static final String JOB_DATABASE_OFFSET_SPECIFIC_OFFSET_FILE = "job.binlogJob.offset.specificOffsetFile"; + public static final String JOB_DATABASE_OFFSET_SPECIFIC_OFFSET_POS = "job.binlogJob.offset.specificOffsetPos"; - private static final String JOB_DATABASE_SERVER_TIME_ZONE = "job.binlogJob.serverTimezone"; - private static final String JOB_DATABASE_STORE_OFFSET_INTERVAL_MS = "job.binlogJob.offset.intervalMs"; + public static final String JOB_DATABASE_SERVER_TIME_ZONE = "job.binlogJob.serverTimezone"; Review Comment: why public this? ########## inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/utils/InLongDatabaseHistory.java: ########## @@ -0,0 +1,95 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.inlong.agent.plugin.utils; + +import io.debezium.config.Configuration; +import io.debezium.relational.history.AbstractDatabaseHistory; +import io.debezium.relational.history.DatabaseHistoryException; +import io.debezium.relational.history.DatabaseHistoryListener; +import io.debezium.relational.history.HistoryRecord; +import io.debezium.relational.history.HistoryRecordComparator; +import org.apache.inlong.agent.plugin.message.SchemaRecord; + +import java.util.Collection; +import java.util.Iterator; +import java.util.concurrent.ConcurrentLinkedQueue; +import java.util.function.Consumer; + +/** + * @description Review Comment: ditto ########## inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/utils/InLongDatabaseHistory.java: ########## @@ -0,0 +1,95 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.inlong.agent.plugin.utils; + +import io.debezium.config.Configuration; +import io.debezium.relational.history.AbstractDatabaseHistory; +import io.debezium.relational.history.DatabaseHistoryException; +import io.debezium.relational.history.DatabaseHistoryListener; +import io.debezium.relational.history.HistoryRecord; +import io.debezium.relational.history.HistoryRecordComparator; +import org.apache.inlong.agent.plugin.message.SchemaRecord; + +import java.util.Collection; +import java.util.Iterator; +import java.util.concurrent.ConcurrentLinkedQueue; +import java.util.function.Consumer; + +/** + * @description Review Comment: remove the date also please -- 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]
