Skip to content

Remove redundant pack reads during building bitmap filter for stable only#9818

Merged
ti-chi-bot[bot] merged 7 commits intopingcap:masterfrom
gengliqi:fix-bitmap-pack-filter
Jan 24, 2025
Merged

Remove redundant pack reads during building bitmap filter for stable only#9818
ti-chi-bot[bot] merged 7 commits intopingcap:masterfrom
gengliqi:fix-bitmap-pack-filter

Conversation

@gengliqi
Copy link
Contributor

@gengliqi gengliqi commented Jan 23, 2025

What problem does this PR solve?

Issue Number: close #9817

Problem Summary:

In #9738, we reuse pack filter results.

It will not regenerate pack filter results following the value of read_packs inside DMFileBlockInputStreamBuilder, if pack_filter is not null.

if (!pack_filter)
{
pack_filter = DMFilePackFilter::loadFrom(
index_cache,
file_provider,
read_limiter,
scan_context,
dmfile,
true,
rowkey_ranges,
EMPTY_RS_OPERATOR,
read_packs,
tracing_id);
}

What is changed and how it works?

Remove redundant pack reads during building bitmap filter for stable only

Check List

Tests

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

In this PR, for the example in #9817, the mvcc_scanned_rows decreases to approximately its original size.

|                             │       │       └─TableFullScan_101(Probe)            | 600037902.00 | 600037902 | mpp[tiflash] | table:lineitem | tiflash_task:{proc max:1.66s, min:0s, avg: 829.3ms, p80:1.66s, p95:1.66s, iters:9576, tasks:2, threads:72}, tiflash_wait: {pipeline_breaker_wait: 349ms, pipeline_queue_wait: 1077ms}, tiflash_scan:{mvcc_input_rows:0, mvcc_input_bytes:0, mvcc_output_rows:0, lm_skip_rows:0, local_regions:487, remote_regions:0, tot_learner_read:52ms, region_balance:{instance_num: 2, max/min: 244/243=1.004115}, delta_rows:0, delta_bytes:0, segments:821, stale_read_regions:0, tot_build_snapshot:12ms, tot_build_bitmap:4000ms, tot_build_inputstream:4985ms, min_local_stream:0ms, max_local_stream:1610ms, dtfile:{data_scanned_rows:602074789, data_skipped_rows:259726897, mvcc_scanned_rows:4108835, mvcc_skipped_rows:522383366, lm_filter_scanned_rows:0, lm_filter_skipped_rows:0, tot_rs_index_check:195ms, tot_read:118266ms}} | keep order:false

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

Signed-off-by: gengliqi <gengliqiii@gmail.com>
u
Signed-off-by: gengliqi <gengliqiii@gmail.com>
@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-triage-completed 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. labels Jan 23, 2025
@gengliqi
Copy link
Contributor Author

/test pull-integration-test

1 similar comment
@gengliqi
Copy link
Contributor Author

/test pull-integration-test

@purelind
Copy link
Contributor

/retest

Copy link
Contributor

@JaySon-Huang JaySon-Huang left a comment

Choose a reason for hiding this comment

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

Add some comments

Signed-off-by: gengliqi <gengliqiii@gmail.com>
@gengliqi gengliqi force-pushed the fix-bitmap-pack-filter branch from 0aa7601 to c36e602 Compare January 23, 2025 12:36
@JinheLin
Copy link
Contributor

I think we need to check pack_filter and read_packs should not be set at the same time in DMFileBlockInputStreamBuilder.

Copy link
Contributor

@JaySon-Huang JaySon-Huang left a comment

Choose a reason for hiding this comment

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

lgtm

@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Jan 24, 2025
@gengliqi
Copy link
Contributor Author

I think we need to check pack_filter and read_packs should not be set at the same time in DMFileBlockInputStreamBuilder.

Added.

Signed-off-by: gengliqi <gengliqiii@gmail.com>
@gengliqi gengliqi force-pushed the fix-bitmap-pack-filter branch from b261de9 to 8fc5191 Compare January 24, 2025 04:41
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Jan 24, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: JaySon-Huang, JinheLin

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

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [JaySon-Huang,JinheLin]

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 ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Jan 24, 2025
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Jan 24, 2025

[LGTM Timeline notifier]

Timeline:

  • 2025-01-24 02:24:25.823356398 +0000 UTC m=+406793.154275794: ☑️ agreed by JaySon-Huang.
  • 2025-01-24 05:21:01.557144364 +0000 UTC m=+417388.888063768: ☑️ agreed by JinheLin.

Signed-off-by: gengliqi <gengliqiii@gmail.com>
@gengliqi gengliqi force-pushed the fix-bitmap-pack-filter branch from 9c9690e to 0a518a4 Compare January 24, 2025 07:03
@gengliqi
Copy link
Contributor Author

/test pull-integration-test

@ti-chi-bot ti-chi-bot bot merged commit 83e9a14 into pingcap:master Jan 24, 2025
yongman pushed a commit to yongman/tiflash that referenced this pull request Jun 18, 2025
…er for stable only (pingcap#9818)

pingcap#9818

Signed-off-by: Wish <breezewish@outlook.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved lgtm 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.

Performance degradation caused by redundant pack reads during building bitmap filter for stable only

4 participants