[wip]#4946
Conversation
|
Skipping CI for Draft Pull Request. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
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.
| minTableCRTsLabel = "minCRTs" | ||
| maxTableCRTsLabel = "maxCRTs" | ||
| tableCRTsCollectorName = "table-crts-collector" |
There was a problem hiding this comment.
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.
| 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]) |
There was a problem hiding this comment.
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])
What problem does this PR solve?
Issue Number: close #4939
What is changed and how it works?
Check List
Tests
Questions
Will it cause performance regression or break compatibility?
Do you need to update user documentation, design documentation or monitoring documentation?
Release note