Skip to content

branch-4.0: [fix](audit) serialize audit loader batch assembly #65107#65131

Open
github-actions[bot] wants to merge 1 commit into
branch-4.0from
auto-pick-65107-branch-4.0
Open

branch-4.0: [fix](audit) serialize audit loader batch assembly #65107#65131
github-actions[bot] wants to merge 1 commit into
branch-4.0from
auto-pick-65107-branch-4.0

Conversation

@github-actions

@github-actions github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Cherry-picked from #65107

### What problem does this PR solve?

`AuditLoader.loadIfNecessary()` is synchronized and resets
`auditLogBuffer` after stream load, but `assembleAudit()` appended
events to the same shared `StringBuilder` without holding the same
monitor.

When `call flush_audit_log()` forces a load while the audit loader
worker is assembling a new event, the worker may append to the old
buffer after the payload has already been materialized for stream load
and before `resetBatch()` replaces the buffer. That event is then
neither included in the current load nor retained for the next load.

This can make `flush_audit_log()` miss audit events that have already
reached the audit plugin pipeline, which matches the flaky
`test_audit_log_queue_time` symptom.

Related: DORIS-25958

### Check List

- [x] Added test
- [ ] This is a behavior change and it is documented
- [ ] This is a new feature and it is documented
- [ ] This needs upgrade
- [ ] This needs downgrade

### Release note

None

### Testing

- `git diff --check`
- Not run: `run-fe-ut.sh --run
org.apache.doris.plugin.audit.AuditLoaderTest` because local
`thirdparty/installed/bin/protoc` is missing, and `fe/AGENTS.md`
requires stopping FE build/test in that case.
@github-actions github-actions Bot requested a review from morningman as a code owner July 2, 2026 02:19
@hello-stephen

Copy link
Copy Markdown
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@hello-stephen

Copy link
Copy Markdown
Contributor

run buildall

@hello-stephen

Copy link
Copy Markdown
Contributor

FE UT Coverage Report

Increment line coverage 100% (0/0) 🎉
Increment coverage report
Complete coverage report

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants