Skip to content

eventstore: optimize event store SST file filtering#4984

Open
lidezhu wants to merge 14 commits intomasterfrom
ldz/optimize-event-store0506
Open

eventstore: optimize event store SST file filtering#4984
lidezhu wants to merge 14 commits intomasterfrom
ldz/optimize-event-store0506

Conversation

@lidezhu
Copy link
Copy Markdown
Collaborator

@lidezhu lidezhu commented May 2, 2026

What problem does this PR solve?

Issue Number: close #4939

What is changed and how it works?

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Questions

Will it cause performance regression or break compatibility?
Do you need to update user documentation, design documentation or monitoring documentation?

Release note

Please refer to [Release Notes Language Style Guide](https://pingcap.github.io/tidb-dev-guide/contribute-to-tidb/release-notes-style-guide.html) to write a quality release note.

If you don't think this PR needs a release note then fill it with `None`.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 2, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a7f7068f-a18f-4466-84c5-b91eb73ea57a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ldz/optimize-event-store0506

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@lidezhu lidezhu changed the title eventstore: add event store sst file filtering eventstore: optimize event store SST file filtering May 2, 2026
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request implements SST file filtering for the event store by introducing a custom Pebble table property collector to track transaction commit timestamps, optimizing read performance. Feedback suggests handling potential errors from db.NewIter to prevent panics and optimizing metrics collection within the filter closure by pre-fetching Prometheus counters to reduce overhead.

Comment on lines 928 to 935
iter, _ := db.NewIter(&pebble.IterOptions{
LowerBound: start,
UpperBound: end,
TableFilter: newEventStoreSSTFileFilter(
lowerTs,
dataRange.CommitTsEnd,
),
})
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

The error returned by db.NewIter is ignored. If an error occurs (e.g., due to invalid bounds if CommitTsStart > CommitTsEnd), iter will be nil, which will cause a panic when iter.First() is called on line 939. It is recommended to handle the error and return early to avoid a potential crash.

Suggested change
iter, _ := db.NewIter(&pebble.IterOptions{
LowerBound: start,
UpperBound: end,
TableFilter: newEventStoreSSTFileFilter(
lowerTs,
dataRange.CommitTsEnd,
),
})
iter, err := db.NewIter(&pebble.IterOptions{
LowerBound: start,
UpperBound: end,
TableFilter: newEventStoreSSTFileFilter(
lowerTs,
dataRange.CommitTsEnd,
),
})
if err != nil {
log.Error("failed to create pebble iterator",
zap.Stringer("dispatcherID", dispatcherID),
zap.Error(err))
return nil
}

Comment thread logservice/eventstore/table_properties.go
@ti-chi-bot
Copy link
Copy Markdown

ti-chi-bot Bot commented May 3, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign charlescheung96 for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

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

Details 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

4 similar comments
@ti-chi-bot
Copy link
Copy Markdown

ti-chi-bot Bot commented May 3, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign charlescheung96 for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

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

Details 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
Copy link
Copy Markdown

ti-chi-bot Bot commented May 3, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign charlescheung96 for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

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

Details 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
Copy link
Copy Markdown

ti-chi-bot Bot commented May 3, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign charlescheung96 for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

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

Details 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
Copy link
Copy Markdown

ti-chi-bot Bot commented May 3, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign charlescheung96 for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

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

Details 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

Base automatically changed from ldz/optimize-event-store0429 to master May 7, 2026 00:38
@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/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels May 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Optimize performance by adjusting PebbleDB options

1 participant