Skip to content

Conversation

bb7133
Copy link
Member

@bb7133 bb7133 commented Sep 22, 2025

What problem does this PR solve?

See #63650

-->

Issue Number: close #63650

Problem Summary:

What changed and how does it work?

This PR introduces new configuration options to control the buffering behavior of the audit log plugin:

  • instance.plugin_audit_log_flush_interval — Defines the interval at which buffered audit logs are flushed to the plugin.
  • instance. plugin_audit_log_buffer_size — Sets the maximum number of audit log entries that can be buffered before a flush is triggered.

So that:

  • Audit log entries are collected in memory until either the flush interval elapses or the buffer reaches its maximum size.
  • Once triggered, all buffered logs are flushed to the audit log plugin in batch.
  • The configuration options can be adjusted in the TiDB config file under the instance section.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
    (To be added)
  • No need to test
    • I checked and no code files have been changed.

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

- Added support for buffered audit logs in the audit log plugin.
  - `instance.plugin_audit_log_flush_interval`: Interval for flushing buffered audit logs.
  - `instance.plugin_audit_log_buffer_size`: Buffer size (in bytes) of plugin audit log, default is 0(buffer disabled)

@ti-chi-bot ti-chi-bot bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Sep 22, 2025
@ti-chi-bot ti-chi-bot bot added the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Sep 22, 2025
@bb7133 bb7133 force-pushed the bb7133/add_buffer_conf branch from e9fcc3b to d841a21 Compare September 22, 2025 02:57
@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Sep 22, 2025
Copy link

ti-chi-bot bot commented Sep 22, 2025

[LGTM Timeline notifier]

Timeline:

  • 2025-09-22 02:48:09.970066015 +0000 UTC m=+238500.040559676: ☑️ agreed by djshow832.
  • 2025-09-22 03:27:56.593941331 +0000 UTC m=+240886.664435013: ☑️ agreed by YangKeao.

@YangKeao
Copy link
Member

YangKeao commented Sep 22, 2025

Let me upload the dependency cache/mirror.

@bb7133
Copy link
Member Author

bb7133 commented Sep 22, 2025

/retest

@YangKeao
Copy link
Member

Let me upload the dependency cache/mirror.

Done.

Copy link

codecov bot commented Sep 22, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.2939%. Comparing base (fb4717d) to head (4b6a7fe).
⚠️ Report is 8 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #63651        +/-   ##
================================================
+ Coverage   72.7810%   73.2939%   +0.5129%     
================================================
  Files          1842       1842                
  Lines        498054     498554       +500     
================================================
+ Hits         362489     365410      +2921     
+ Misses       113580     111291      -2289     
+ Partials      21985      21853       -132     
Flag Coverage Δ
integration 42.2525% <50.0000%> (?)
unit 72.4318% <100.0000%> (+0.1122%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 52.8700% <ø> (ø)
parser ∅ <ø> (∅)
br 46.4649% <ø> (+0.0503%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@bb7133 bb7133 force-pushed the bb7133/add_buffer_conf branch from d841a21 to 4b6a7fe Compare September 22, 2025 18:56
@bb7133
Copy link
Member Author

bb7133 commented Sep 22, 2025

/retest

@songrijie
Copy link

LGTM

Copy link

ti-chi-bot bot commented Sep 23, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: benmeadowcroft, cfzjywxk, djshow832, YangKeao

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added the approved label Sep 23, 2025
@bb7133
Copy link
Member Author

bb7133 commented Sep 23, 2025

/retest

@ti-chi-bot ti-chi-bot bot merged commit eb6cdbb into pingcap:master Sep 23, 2025
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Buffered logs for a lower latency
6 participants