Commit b5077bd8 by y1sa

修复已知问题

parent 1cfb6b60
......@@ -8,6 +8,8 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
......@@ -45,7 +47,18 @@ public abstract class AbstractCdcEngine<T extends AbstractCdcEngine<T>> {
private Runnable errorHandler;
private static void safeDelete(String file) {
try {
Files.delete(Paths.get(file));
} catch (IOException e) {
}
}
public AbstractCdcEngine(BaseCdcEngineProperties props) {
if (props.isDeleteCdcFile()) {
safeDelete(props.getNamespace() + "_his.dat");
safeDelete(props.getNamespace() + "_off.dat");
}
debeziumProps.setProperty(Constants.DATABASE_HISTORY_FILE_FILENAME_PROP, props.getNamespace() + "_his.dat");
debeziumProps.setProperty(Constants.OFFSET_STORAGE_FILE_FILENAME_PROP, props.getNamespace() + "_off.dat");
debeziumProps.setProperty("snapshot.mode", "schema_only");
......
......@@ -7,6 +7,15 @@ public class BaseCdcEngineProperties {
private int port;
private String username;
private String password;
private boolean deleteCdcFile = true;
public boolean isDeleteCdcFile() {
return deleteCdcFile;
}
public void setDeleteCdcFile(boolean deleteCdcFile) {
this.deleteCdcFile = deleteCdcFile;
}
public String getNamespace() {
return namespace;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment