This is an automated email from the ASF dual-hosted git repository.
dockerzhang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/inlong.git
The following commit(s) were added to refs/heads/master by this push:
new 119f642643 [INLONG-9698][Agent] Optimize file collection
initialization logic to reduce unnecessary IO (#9699)
119f642643 is described below
commit 119f642643d829b4885c3f2e035944a6512444b0
Author: justinwwhuang <[email protected]>
AuthorDate: Tue Feb 20 16:05:59 2024 +0800
[INLONG-9698][Agent] Optimize file collection initialization logic to
reduce unnecessary IO (#9699)
---
.../java/org/apache/inlong/agent/plugin/sources/LogFileSource.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git
a/inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/sources/LogFileSource.java
b/inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/sources/LogFileSource.java
index c849f0754b..b6dd32b44d 100755
---
a/inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/sources/LogFileSource.java
+++
b/inlong-agent/agent-plugins/src/main/java/org/apache/inlong/agent/plugin/sources/LogFileSource.java
@@ -113,7 +113,7 @@ public class LogFileSource extends AbstractSource {
private final Integer CORE_THREAD_PRINT_INTERVAL_MS = 1000;
private final Integer CACHE_QUEUE_SIZE = 10 * BATCH_READ_LINE_COUNT;
private final Integer SIZE_OF_BUFFER_TO_READ_FILE = 64 * 1024;
- private final Integer EMPTY_CHECK_COUNT_AT_LEAST = 30;
+ private final Integer EMPTY_CHECK_COUNT_AT_LEAST = 5 * 60;
private final Long INODE_UPDATE_INTERVAL_MS = 1000L;
private final Integer READ_WAIT_TIMEOUT_MS = 10;
private final SimpleDateFormat RECORD_TIME_FORMAT = new
SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
@@ -200,10 +200,10 @@ public class LogFileSource extends AbstractSource {
private long getInitLineOffset(boolean isIncrement, String taskId, String
instanceId, String inodeInfo) {
OffsetProfile offsetProfile =
OffsetManager.getInstance().getOffset(taskId, instanceId);
- int fileLineCount = getRealLineCount(instanceId);
long offset = 0;
if (offsetProfile != null &&
offsetProfile.getInodeInfo().compareTo(inodeInfo) == 0) {
offset = offsetProfile.getOffset();
+ int fileLineCount = getRealLineCount(instanceId);
if (fileLineCount < offset) {
LOGGER.info("getInitLineOffset inode no change taskId {} file
rotate, offset set to 0, file {}", taskId,
fileName);