Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor logic of last matched line #1426

Merged
merged 7 commits into from
Apr 2, 2024

Conversation

Abingcbc
Copy link
Collaborator

@Abingcbc Abingcbc commented Mar 29, 2024

之前的日志回退逻辑假设尽可能少的回退,因此造成代码较为复杂。
现在日志回退逻辑仅保证回退到的位置之前的日志一定是完整的,简化了逻辑,并且修复了一个corner case

配置 start_regex, end_regex
start -------------------------|
start                          |
unmatch <-- 当前读取的位置       | 完整日志
end ---------------------------|

这种情况下应当回退到第一个start前,而不是第二个start

Copy link
Collaborator

@henryzhx8 henryzhx8 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LastMatchedLine改为RemoveLastIncompleteLog,然后标注一下返回值的意义,是剩余的字节数。

core/reader/LogFileReader.h Outdated Show resolved Hide resolved
core/reader/LogFileReader.cpp Outdated Show resolved Hide resolved
core/reader/LogFileReader.cpp Outdated Show resolved Hide resolved
@Abingcbc Abingcbc requested a review from henryzhx8 April 1, 2024 03:51
core/reader/LogFileReader.cpp Outdated Show resolved Hide resolved
core/reader/LogFileReader.cpp Show resolved Hide resolved
core/reader/LogFileReader.cpp Outdated Show resolved Hide resolved
core/reader/LogFileReader.cpp Outdated Show resolved Hide resolved
core/reader/LogFileReader.cpp Outdated Show resolved Hide resolved
@Abingcbc Abingcbc requested a review from henryzhx8 April 1, 2024 10:49
core/reader/LogFileReader.h Outdated Show resolved Hide resolved
@henryzhx8 henryzhx8 added the bug Something isn't working label Apr 2, 2024
@yyuuttaaoo yyuuttaaoo merged commit 5f46b4e into alibaba:main Apr 2, 2024
15 checks passed
@yyuuttaaoo yyuuttaaoo added this to the v2.0 milestone Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants