Skip to content

[wip]#4946

Draft
wk989898 wants to merge 2 commits intopingcap:masterfrom
wk989898:pebble-option
Draft

[wip]#4946
wk989898 wants to merge 2 commits intopingcap:masterfrom
wk989898:pebble-option

Conversation

@wk989898
Copy link
Copy Markdown
Collaborator

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`.

Signed-off-by: wk989898 <nhsmwk@gmail.com>
@ti-chi-bot
Copy link
Copy Markdown

ti-chi-bot Bot commented Apr 29, 2026

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@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. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Apr 29, 2026
@ti-chi-bot
Copy link
Copy Markdown

ti-chi-bot Bot commented Apr 29, 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 tenfyzhong 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

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 29, 2026

Important

Review skipped

Draft detected.

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: d8264ff8-fe12-4e83-95e6-ff61bc1ab43b

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

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.

@ti-chi-bot ti-chi-bot Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Apr 29, 2026
Signed-off-by: wk989898 <nhsmwk@gmail.com>
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 introduces a tableCRTsCollector to track commit timestamp ranges within Pebble SSTables, enabling the event store iterator to skip irrelevant data via a TableFilter. It also refactors key decoding logic and includes comprehensive tests for the new functionality. Feedback suggests prefixing table property labels to prevent naming collisions and adding defensive bounds checks to the DecodeKeyMetas function to avoid potential panics.

Comment on lines +36 to +38
minTableCRTsLabel = "minCRTs"
maxTableCRTsLabel = "maxCRTs"
tableCRTsCollectorName = "table-crts-collector"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The property labels used here are quite generic (minCRTs, maxCRTs). To avoid potential collisions with other table property collectors that might be added in the future, it is recommended to prefix these labels with the collector name.

Suggested change
minTableCRTsLabel = "minCRTs"
maxTableCRTsLabel = "maxCRTs"
tableCRTsCollectorName = "table-crts-collector"
minTableCRTsLabel = "table-crts-collector.minCRTs"
maxTableCRTsLabel = "table-crts-collector.maxCRTs"
tableCRTsCollectorName = "table-crts-collector"

// DecodeKeyMetas decodes compression type and dml order from the key.
func DecodeKeyMetas(key []byte) (DMLOrder, CompressionType) {
combinedOrder := binary.BigEndian.Uint16(key[32:34]) // The combined order is at offset 32 for 2 bytes.
combinedOrder := binary.BigEndian.Uint16(key[eventStoreKeyMetaOffset : eventStoreKeyMetaOffset+2])
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The DecodeKeyMetas function is exported and performs a slice access key[eventStoreKeyMetaOffset : eventStoreKeyMetaOffset+2] without checking the length of the input key. While internal callers might guarantee the length, as a public function it should be defensive against shorter keys to avoid panics.

func DecodeKeyMetas(key []byte) (DMLOrder, CompressionType) {
	if len(key) < eventStoreKeyMetaOffset+2 {
		return DMLOrderDelete, CompressionNone
	}
	combinedOrder := binary.BigEndian.Uint16(key[eventStoreKeyMetaOffset : eventStoreKeyMetaOffset+2])

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

Labels

do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 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