fixed issue #2099 , support user/passwd acl and canal admin operator

This commit is contained in:
agapple
2019-08-26 18:16:33 +08:00
parent e376a129ed
commit 3d4dbc9a8c
54 changed files with 8518 additions and 813 deletions

View File

@@ -12,20 +12,24 @@ public class FileUtils {
private static final Logger logger = LoggerFactory.getLogger(FileUtils.class);
public static String readFileFromOffset(String filename, int l, String charset) {
return readFileFromOffset(filename, l, charset, 4 * 1024 * 1024);
}
public static String readFileFromOffset(String filename, int l, String charset, int maxSize) {
RandomAccessFile rf = null;
StringBuilder res = new StringBuilder();
try {
rf = new RandomAccessFile(filename, "r");
long fileLength = rf.length();
long start = rf.getFilePointer();
long readIndex = start + fileLength - 1;
long minIndex = readIndex - maxSize;
if (minIndex < 0) {
minIndex = 0;
}
String line;
rf.seek(readIndex);
int k = 0;
int c = -1;
while (readIndex > start) {
@@ -48,7 +52,12 @@ public class FileUtils {
readIndex--;
}
readIndex--;
rf.seek(readIndex);
if (readIndex < minIndex) {
break;
} else {
rf.seek(readIndex);
}
if (readIndex == 0) {
readText = rf.readLine();
}

View File

@@ -148,6 +148,7 @@ public class ServerRunningMonitor extends AbstractCanalLifeCycle {
activeData = serverData;
processActiveEnter();// 触发一下事件
mutex.set(true);
release = false;
} catch (ZkNodeExistsException e) {
bytes = zkClient.readData(path, true);
if (bytes == null) {// 如果不存在节点,立即尝试一次