Skip to content

flash: handle TiCI estimate count RPC#10826

Open
wshwsh12 wants to merge 4 commits intopingcap:feature/ftsfrom
wshwsh12:wsh/tici-estimate-count
Open

flash: handle TiCI estimate count RPC#10826
wshwsh12 wants to merge 4 commits intopingcap:feature/ftsfrom
wshwsh12:wsh/tici-estimate-count

Conversation

@wshwsh12
Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: None

Problem Summary:

TiDB needs TiFlash to expose TiCI-side estimate count so the optimizer can use sampled TiCI fulltext cardinality instead of relying only on local planner estimates.

What is changed and how it works?

flash: handle GetEstimateTiCICount RPC for TiCI fulltext stats
  • Add FlashService handling for GetEstimateTiCICount.
  • Build TiCI estimate input from the request expression and shard/range list.
  • Return TiCI estimate count to TiDB and ignore missing shards during estimate.
  • Update kvproto to the branch containing the estimate count RPC definitions.

Check List

Tests

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

Manual test:

  • TiUP playground tag: tici-estimate-skew-20260426-2240.
  • Query: EXPLAIN SELECT COUNT(*) FROM estimate_skew WHERE MATCH(content) AGAINST ('heavyhit' IN BOOLEAN MODE);.
  • Result: TiDB used TiCI estimate 4321; exact match count was 4000; total table row count was 9400.
  • Logs confirmed TiFlash GetEstimateTiCICount done, est_count=4321 and TiCI EstimateCountResult { estimated_total_count: 4321, ... }.

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

None

@ti-chi-bot ti-chi-bot Bot added the release-note-none Denotes a PR that doesn't merit a release note. label Apr 27, 2026
@ti-chi-bot
Copy link
Copy Markdown
Contributor

ti-chi-bot Bot commented Apr 27, 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 gengliqi 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

coderabbitai Bot commented Apr 27, 2026

Important

Review skipped

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

🗂️ Base branches to auto review (3)
  • release-8.5
  • release-7.5
  • release-8.1

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: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 14444088-12d5-4f3a-8909-37b1647ac261

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 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-note-none Denotes a PR that doesn't merit a release note. 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.

1 participant