pkg/encoded: add encoding capabilities package for TiFlash dictionary encoding (Phases 1-4)#2
Open
devin-ai-integration[bot] wants to merge 2 commits into
Conversation
Adds PD-side tracking of TiFlash encoding capabilities: - StoreEncodingCapabilities: tracks per-store encoding support (dictionary encoding, encoded filter/group-by/bloom filter/star join) - ClusterEncodingStatus: cluster-wide view with AllStoresReady flag for safe dictionary encoding enablement - Registry: thread-safe store for encoding capability reporting - Handler: HTTP API endpoints for encoding status and registration (GET /pd/api/v1/encoding/status, POST /pd/api/v1/encoding/capabilities) - ComputeClusterStatus: computes min encoding version across stores - Comprehensive unit tests for all functionality This enables TiDB's planner to query PD for cluster encoding readiness before enabling dictionary-encoded operations on TiFlash nodes. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Adds: - NewFullEncodingCapabilities(): creates v3 store with all 5 capabilities - PhaseCapabilities map: phase→capabilities mapping - SupportsPhase()/ClusterSupportsPhase(): phase version checks - OperationFeasibility struct: per-operation cluster readiness - CheckOperationFeasibility()/AllOperationsFeasibility(): checks if all TiFlash stores support specific encoded operations 13 tests covering full capability lifecycle. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What problem does this PR solve?
Issue Number: ref #xxx
PD needs to track which TiFlash stores support dictionary-encoded operations (Phases 1-4) so TiDB can make informed decisions about enabling encoded query paths cluster-wide.
What is changed and how does it work?
Phase 1 — Base Capabilities:
StoreEncodingCapabilities: per-store capability tracking (version, capabilities list, max cardinality)ClusterEncodingStatus: cluster-wide view withAllStoresReadyflag andMinEncodingVersionComputeClusterStatus(): aggregates individual store reports/pd/api/v1/tiflash/encoding-statusPhases 2-4 — Extended Capabilities:
NewFullEncodingCapabilities(): creates v3 store with all 5 capabilities (dict, filter, group-by, bloom, star-join)PhaseCapabilitiesmap: maps encoding version → supported capabilitiesSupportsPhase()/ClusterSupportsPhase(): version-based phase checksOperationFeasibility: per-operation cluster readiness with stores_ready/stores_totalCheckOperationFeasibility()/AllOperationsFeasibility(): checks if specific ops can run on all storesCheck List
Tests
Code changes
/pd/api/v1/tiflash/encoding-statusendpoint)Side effects
Release note
Link to Devin session: https://6sense.devinenterprise.com/sessions/3710f99abca4415ba59b856f0a5588fc
Requested by: @premal