mirror of
https://github.com/alibaba/canal.git
synced 2026-11-04 00:30:15 +08:00
fixed issue #2099 , support user/passwd acl and canal admin operator
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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) {// 如果不存在节点,立即尝试一次
|
||||
|
||||
Reference in New Issue
Block a user