Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

executor: some minor refine for hash join v2 build #54429

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

windtalker
Copy link
Contributor

What problem does this PR solve?

Issue Number: ref #53127

Problem Summary:

What changed and how does it work?

  1. During hash join v2 build, it will pre-allocate maxRowTableSegmentSize(which is 1024) rows for a new rowTableSegment

    func newRowTableSegment() *rowTableSegment {
    return &rowTableSegment{
    // TODO: @XuHuaiyu if joinKeyIsInlined, the cap of rawData can be calculated
    rawData: make([]byte, 0),
    hashValues: make([]uint64, 0, maxRowTableSegmentSize),
    rowStartOffset: make([]uint64, 0, maxRowTableSegmentSize),
    validJoinKeyPos: make([]int, 0, maxRowTableSegmentSize),
    }
    }

    For small queries, it is a waste to pre allocate so many memories and may hurt the performance in high concurrency scenarios.
    In this pr, when constructing a new rowTableSegment, it will use chunk_row_number/partition_number * 1.2 as the row size hint for the first rowTableSegment, but still use maxRowTableSegmentSize as the row size hint for the following rowTableSegment.

  2. Add maxRowTableSegmentByteSize to control the max memory size of a rowTableSegment.

  3. Since rowTableSegment saves rowStartOffset directly, there is no need to save row offset in builder.startPosInRawData, so remove startPosInRawData in rowTableBuilder

  4. rename crrntSizeOfRowTable to rowNumberInCurrentRowTableSeg

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test
    • I checked and no code files have been changed.

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

Please refer to Release Notes Language Style Guide to write a quality release note.

None

@ti-chi-bot ti-chi-bot bot added release-note-none size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jul 4, 2024
Copy link

tiprow bot commented Jul 4, 2024

Hi @windtalker. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@xzhangxian1008
Copy link
Contributor

/assign

Copy link

codecov bot commented Jul 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 55.6712%. Comparing base (634ac69) to head (8aa9eff).
Report is 57 commits behind head on master.

Additional details and impacted files
@@                Coverage Diff                @@
##             master     #54429         +/-   ##
=================================================
- Coverage   72.8354%   55.6712%   -17.1643%     
=================================================
  Files          1535       1657        +122     
  Lines        435896     608187     +172291     
=================================================
+ Hits         317487     338585      +21098     
- Misses        98795     246295     +147500     
- Partials      19614      23307       +3693     
Flag Coverage Δ
integration 23.0628% <0.0000%> (?)
unit 71.8311% <100.0000%> (-0.0063%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 52.9656% <ø> (ø)
parser ∅ <ø> (∅)
br 52.6890% <ø> (+6.6246%) ⬆️

Copy link
Contributor

@xzhangxian1008 xzhangxian1008 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

ti-chi-bot bot commented Jul 8, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: XuHuaiyu, xzhangxian1008

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

The pull request process is described here

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

Copy link

ti-chi-bot bot commented Jul 8, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-07-05 03:03:10.663133375 +0000 UTC m=+1552717.148622205: ☑️ agreed by xzhangxian1008.
  • 2024-07-08 06:37:39.268194276 +0000 UTC m=+253156.503428389: ☑️ agreed by XuHuaiyu.

@hawkingrei
Copy link
Member

/retest

Copy link

ti-chi-bot bot commented Jul 11, 2024

@windtalker: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
idc-jenkins-ci-tidb/check_dev 8aa9eff link true /test check-dev

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm release-note-none 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.

None yet

4 participants