From 2d1bf0c5481b9dec334a292b83809e4facc9033b Mon Sep 17 00:00:00 2001 From: quzard <1191890118@qq.com> Date: Mon, 30 Dec 2024 12:52:24 +0000 Subject: [PATCH] fix --- core/file_server/reader/LogFileReader.cpp | 26 ++++++++++++++++------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/core/file_server/reader/LogFileReader.cpp b/core/file_server/reader/LogFileReader.cpp index 1757775dda..d4c178e21d 100644 --- a/core/file_server/reader/LogFileReader.cpp +++ b/core/file_server/reader/LogFileReader.cpp @@ -2239,14 +2239,19 @@ LineInfo DockerJsonFileParser::GetLastLine(StringView buffer, LineInfo line; parseLine(rawLine, line); + int32_t rollbackLineFeedCount = 0; + int32_t forceRollbackLineFeedCount = 0; if (line.fullLine) { - line.forceRollbackLineFeedCount = finalLine.forceRollbackLineFeedCount; - line.rollbackLineFeedCount = finalLine.rollbackLineFeedCount + line.rollbackLineFeedCount; + rollbackLineFeedCount = line.rollbackLineFeedCount; + forceRollbackLineFeedCount = finalLine.forceRollbackLineFeedCount; } else { - line.forceRollbackLineFeedCount = finalLine.forceRollbackLineFeedCount + line.rollbackLineFeedCount; - line.rollbackLineFeedCount = finalLine.rollbackLineFeedCount; + forceRollbackLineFeedCount + = finalLine.forceRollbackLineFeedCount + line.forceRollbackLineFeedCount + line.rollbackLineFeedCount; + rollbackLineFeedCount = 0; } finalLine = std::move(line); + finalLine.rollbackLineFeedCount = rollbackLineFeedCount; + finalLine.forceRollbackLineFeedCount = forceRollbackLineFeedCount; if (!finalLine.fullLine) { if (finalLine.lineBegin == 0) { return LineInfo( @@ -2321,14 +2326,19 @@ LineInfo ContainerdTextParser::GetLastLine(StringView buffer, LineInfo line; parseLine(rawLine, line); + int32_t rollbackLineFeedCount = 0; + int32_t forceRollbackLineFeedCount = 0; if (line.fullLine) { - line.forceRollbackLineFeedCount = finalLine.forceRollbackLineFeedCount; - line.rollbackLineFeedCount = finalLine.rollbackLineFeedCount + line.rollbackLineFeedCount; + rollbackLineFeedCount = line.rollbackLineFeedCount; + forceRollbackLineFeedCount = finalLine.forceRollbackLineFeedCount; } else { - line.forceRollbackLineFeedCount = finalLine.forceRollbackLineFeedCount + line.rollbackLineFeedCount; - line.rollbackLineFeedCount = finalLine.rollbackLineFeedCount; + forceRollbackLineFeedCount + = finalLine.forceRollbackLineFeedCount + line.forceRollbackLineFeedCount + line.rollbackLineFeedCount; + rollbackLineFeedCount = 0; } finalLine = std::move(line); + finalLine.rollbackLineFeedCount = rollbackLineFeedCount; + finalLine.forceRollbackLineFeedCount = forceRollbackLineFeedCount; mergeLines(finalLine, finalLine, true); if (!finalLine.fullLine) { if (finalLine.lineBegin == 0) {