Skip to content
New issue

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

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

Already on GitHub? # to your account

Fix: Delete mSourceKeyOverwritten in processorParseApsaraNative to prevent concurrency issues. #1305

Merged
merged 1 commit into from
Jan 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions core/processor/ProcessorParseApsaraNative.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ bool ProcessorParseApsaraNative::ProcessEvent(const StringView& logPath,
if (!sourceEvent.HasContent(mSourceKey)) {
return true;
}
mSourceKeyOverwritten = false;
bool sourceKeyOverwritten = false;
Copy link
Collaborator

Choose a reason for hiding this comment

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

修改后,测试下

StringView buffer = sourceEvent.GetContent(mSourceKey);
if (buffer.size() == 0) {
return true;
Expand Down Expand Up @@ -210,7 +210,7 @@ bool ProcessorParseApsaraNative::ProcessEvent(const StringView& logPath,
StringView data(buffer.data() + colon_index + 1, index - colon_index - 1);
AddLog(key, data, sourceEvent);
if (key == mSourceKey) {
mSourceKeyOverwritten = true;
sourceKeyOverwritten = true;
}
colon_index = -1;
}
Expand All @@ -228,7 +228,7 @@ bool ProcessorParseApsaraNative::ProcessEvent(const StringView& logPath,
sb.size = std::min(20, snprintf(sb.data, sb.capacity, "%lld", logTime_in_micro));
#endif
AddLog("microtime", StringView(sb.data, sb.size), sourceEvent);
if (!mSourceKeyOverwritten) {
if (!sourceKeyOverwritten) {
sourceEvent.DelContent(mSourceKey);
}
if (mCommonParserOptions.ShouldAddSourceContent(true)) {
Expand Down
1 change: 0 additions & 1 deletion core/processor/ProcessorParseApsaraNative.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ class ProcessorParseApsaraNative : public Processor {
int32_t ParseApsaraBaseFields(const StringView& buffer, LogEvent& sourceEvent);

int32_t mLogTimeZoneOffsetSecond = 0;
bool mSourceKeyOverwritten = false;

int* mLogGroupSize = nullptr;
int* mParseFailures = nullptr;
Expand Down
Loading