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

table: make slices in ColSizeDeltaBuffer private #54539

Merged
merged 1 commit into from
Jul 12, 2024

Conversation

lcwangchao
Copy link
Collaborator

What problem does this PR solve?

Issue Number: close #54392

What changed and how does it work?

The inner slices in ColSizeDeltaBuffer should not be accessed directly for safe. This PR makes inner slices in ColSizeDeltaBuffer private and exposes another method UpdateColSizeMap to update col size.

This PR also removes UpdateDeltaForTableFromColSlice and use a unique function UpdateDeltaForTable to update the table delta.

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 10, 2024
Copy link

tiprow bot commented Jul 10, 2024

Hi @lcwangchao. 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.

@lcwangchao
Copy link
Collaborator Author

/retest

Copy link

tiprow bot commented Jul 10, 2024

@lcwangchao: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

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.

@lcwangchao
Copy link
Collaborator Author

/retest

Copy link

tiprow bot commented Jul 10, 2024

@lcwangchao: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

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.

Copy link

codecov bot commented Jul 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 55.9659%. Comparing base (f158c65) to head (451f164).
Report is 14 commits behind head on master.

Additional details and impacted files
@@                Coverage Diff                @@
##             master     #54539         +/-   ##
=================================================
- Coverage   72.8179%   55.9659%   -16.8520%     
=================================================
  Files          1547       1670        +123     
  Lines        436240     610012     +173772     
=================================================
+ Hits         317661     341399      +23738     
- Misses        99004     245219     +146215     
- Partials      19575      23394       +3819     
Flag Coverage Δ
integration 37.1640% <100.0000%> (?)
unit 71.7810% <100.0000%> (-0.0614%) ⬇️

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

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

@lcwangchao
Copy link
Collaborator Author

/retest

Copy link

tiprow bot commented Jul 10, 2024

@lcwangchao: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

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.

@lcwangchao
Copy link
Collaborator Author

/retest

Copy link

tiprow bot commented Jul 10, 2024

@lcwangchao: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

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.

Copy link
Member

@YangKeao YangKeao 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
Contributor

@ekexium ekexium left a comment

Choose a reason for hiding this comment

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

Have you benchmarked this change? UpdateDeltaForTableFromColSlice was introduced to optimize the heavy cost of maps in UpdateDeltaForTable in #53670

@lcwangchao
Copy link
Collaborator Author

/retest

Copy link

tiprow bot commented Jul 10, 2024

@lcwangchao: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

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.

@lcwangchao
Copy link
Collaborator Author

Have you benchmarked this change? UpdateDeltaForTableFromColSlice was introduced to optimize the heavy cost of maps in UpdateDeltaForTable in #53670

There is no sign significant difference in performance.

In mater:

➜  tidb git:(master) ✗ go test ./pkg/table/tables -run=^$ -bench=AddRecord -benchmem -benchtime=30s -cpuprofile=/tmp/cpu1.pprof
# github.com/pingcap/tidb/pkg/table/tables.test
ld: warning: -bind_at_load is deprecated on macOS
goos: darwin
goarch: arm64
pkg: github.com/pingcap/tidb/pkg/table/tables
BenchmarkAddRecordInPipelinedDML-10    	    2946	  11896529 ns/op	      1190 ns/record	 2742043 B/op	   90310 allocs/op
PASS
ok  	github.com/pingcap/tidb/pkg/table/tables	41.815s

This PR:

➜  tidb git:(delta_cols_buffer) go test ./pkg/table/tables -run=^$ -bench=AddRecord -benchmem -benchtime=30s -cpuprofile=/tmp/cpu2.pprof
# github.com/pingcap/tidb/pkg/table/tables.test
ld: warning: -bind_at_load is deprecated on macOS
goos: darwin
goarch: arm64
pkg: github.com/pingcap/tidb/pkg/table/tables
BenchmarkAddRecordInPipelinedDML-10    	    2943	  11928920 ns/op	      1193 ns/record	 2741946 B/op	   90310 allocs/op
PASS
ok  	github.com/pingcap/tidb/pkg/table/tables	41.889s

What we removed is UpdateDeltaForTable, actually. And then rename UpdateDeltaForTableFromColSlice to UpdateDeltaForTable.

Copy link
Contributor

@ekexium ekexium left a comment

Choose a reason for hiding this comment

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

Okay I see

Copy link

ti-chi-bot bot commented Jul 11, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-07-10 09:55:35.163013585 +0000 UTC m=+437832.398247699: ☑️ agreed by YangKeao.
  • 2024-07-11 04:41:20.234997862 +0000 UTC m=+505377.470231971: ☑️ agreed by ekexium.

@easonn7
Copy link

easonn7 commented Jul 12, 2024

/approve

Copy link

ti-chi-bot bot commented Jul 12, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: easonn7, ekexium, lance6716, tangenta, YangKeao

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

@ti-chi-bot ti-chi-bot bot added the approved label Jul 12, 2024
@ti-chi-bot ti-chi-bot bot merged commit 4fe31ed into pingcap:master Jul 12, 2024
22 checks passed
@lcwangchao lcwangchao deleted the delta_cols_buffer branch July 12, 2024 05:18
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.

refine the buffer code in table package
6 participants