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

No tracing memory usage of shared column data in MPPTask's memory tracker (#8131) #8136

Merged

Conversation

ti-chi-bot
Copy link
Member

@ti-chi-bot ti-chi-bot commented Sep 25, 2023

This is an automated cherry-pick of #8131 and #8137

What problem does this PR solve?

Issue Number: close #8128

What is changed and how it works?

  • In DMFileReader::readCoumn, if there are some concurrent DMFileReader of the same file existing, this column data is likely to be shared, so disable memory tracing by setting current_memory_tracker to nullptr.
  • Mark PODArray the underlying memory of column data to be is_shared_memory and use shared_column_data_mem_tracker to trace its memory.

Before this PR(from issue #8128)

[2023/09/21 09:08:37.087 +08:00] [DEBUG] [MemoryTracker.cpp:101] ["Peak memory usage (for query): 10.48 GiB."] [source=MemoryTracker] [thread_id=269]
[2023/09/21 09:08:37.090 +08:00] [DEBUG] [MemoryTracker.cpp:101] ["Peak memory usage (for query): 288.86 MiB."] [source=MemoryTracker] [thread_id=270]
[2023/09/21 09:08:37.090 +08:00] [DEBUG] [MemoryTracker.cpp:101] ["Peak memory usage (total): 988.18 MiB."] [source=MemoryTracker] [thread_id=270]
[2023/09/21 09:08:38.407 +08:00] [DEBUG] [MemoryTracker.cpp:101] ["Peak memory usage (for query): 8.28 GiB."] [source=MemoryTracker] [thread_id=275]
[2023/09/21 09:08:38.824 +08:00] [DEBUG] [MemoryTracker.cpp:101] ["Peak memory usage (for query): 244.48 MiB."] [source=MemoryTracker] [thread_id=277]
[2023/09/21 09:08:39.801 +08:00] [DEBUG] [MemoryTracker.cpp:101] ["Peak memory usage (for query): 3.79 GiB."] [source=MemoryTracker] [thread_id=280]
[2023/09/21 09:08:40.381 +08:00] [DEBUG] [MemoryTracker.cpp:101] ["Peak memory usage (for query): 288.98 MiB."] [source=MemoryTracker] [thread_id=283]
[2023/09/21 09:08:41.408 +08:00] [DEBUG] [MemoryTracker.cpp:101] ["Peak memory usage (for query): 2.69 GiB."] [source=MemoryTracker] [thread_id=286]
[2023/09/21 09:08:42.029 +08:00] [DEBUG] [MemoryTracker.cpp:101] ["Peak memory usage (for query): 397.90 MiB."] [source=MemoryTracker] [thread_id=289]
[2023/09/21 09:08:43.009 +08:00] [DEBUG] [MemoryTracker.cpp:101] ["Peak memory usage (for query): 4.41 GiB."] [source=MemoryTracker] [thread_id=292]
[2023/09/21 09:08:43.488 +08:00] [DEBUG] [MemoryTracker.cpp:101] ["Peak memory usage (for query): 435.62 MiB."] [source=MemoryTracker] [thread_id=295]
[2023/09/21 09:08:43.488 +08:00] [DEBUG] [MemoryTracker.cpp:101] ["Peak memory usage (total): 8.89 GiB."] [source=MemoryTracker] [thread_id=295]

After this PR:

[2023/09/22 17:20:49.967 +08:00] [DEBUG] [MemoryTracker.cpp:107] ["Peak memory usage (for query): 1.04 GiB."] [source=MemoryTracker] [thread_id=3084]
[2023/09/22 17:20:53.023 +08:00] [DEBUG] [MemoryTracker.cpp:107] ["Peak memory usage (for query): 1.60 GiB."] [source=MemoryTracker] [thread_id=3086]
[2023/09/22 17:20:53.132 +08:00] [DEBUG] [MemoryTracker.cpp:107] ["Peak memory usage (for query): 1.07 GiB."] [source=MemoryTracker] [thread_id=3089]
[2023/09/22 17:20:56.188 +08:00] [DEBUG] [MemoryTracker.cpp:107] ["Peak memory usage (for query): 1.21 GiB."] [source=MemoryTracker] [thread_id=3091]
[2023/09/22 17:20:56.298 +08:00] [DEBUG] [MemoryTracker.cpp:107] ["Peak memory usage (for query): 1.02 GiB."] [source=MemoryTracker] [thread_id=3094]
[2023/09/22 17:20:59.324 +08:00] [DEBUG] [MemoryTracker.cpp:107] ["Peak memory usage (for query): 1.43 GiB."] [source=MemoryTracker] [thread_id=3096]
[2023/09/22 17:20:59.440 +08:00] [DEBUG] [MemoryTracker.cpp:107] ["Peak memory usage (for query): 1.03 GiB."] [source=MemoryTracker] [thread_id=3098]
[2023/09/22 17:21:02.469 +08:00] [DEBUG] [MemoryTracker.cpp:107] ["Peak memory usage (for query): 1.28 GiB."] [source=MemoryTracker] [thread_id=3100]
[2023/09/22 17:21:02.564 +08:00] [DEBUG] [MemoryTracker.cpp:107] ["Peak memory usage (for query): 1.03 GiB."] [source=MemoryTracker] [thread_id=3103]
[2023/09/22 17:21:05.894 +08:00] [DEBUG] [MemoryTracker.cpp:107] ["Peak memory usage (for query): 1.38 GiB."] [source=MemoryTracker] [thread_id=3105]
[2023/09/22 17:21:05.991 +08:00] [DEBUG] [MemoryTracker.cpp:107] ["Peak memory usage (for query): 1.01 GiB."] [source=MemoryTracker] [thread_id=3108]
[2023/09/22 17:21:09.070 +08:00] [DEBUG] [MemoryTracker.cpp:107] ["Peak memory usage (for query): 1.69 GiB."] [source=MemoryTracker] [thread_id=3109]
[2023/09/22 17:21:09.187 +08:00] [DEBUG] [MemoryTracker.cpp:107] ["Peak memory usage (for query): 1.30 GiB."] [source=MemoryTracker] [thread_id=3112]
[2023/09/22 17:21:12.246 +08:00] [DEBUG] [MemoryTracker.cpp:107] ["Peak memory usage (for query): 1.25 GiB."] [source=MemoryTracker] [thread_id=3114]
[2023/09/22 17:21:12.361 +08:00] [DEBUG] [MemoryTracker.cpp:107] ["Peak memory usage (for query): 1.11 GiB."] [source=MemoryTracker] [thread_id=3118]
[2023/09/22 17:21:15.412 +08:00] [DEBUG] [MemoryTracker.cpp:107] ["Peak memory usage (for query): 1.30 GiB."] [source=MemoryTracker] [thread_id=3120]
[2023/09/22 17:21:15.569 +08:00] [DEBUG] [MemoryTracker.cpp:107] ["Peak memory usage (for query): 1.04 GiB."] [source=MemoryTracker] [thread_id=3122]
[2023/09/22 17:21:18.653 +08:00] [DEBUG] [MemoryTracker.cpp:107] ["Peak memory usage (for query): 1.33 GiB."] [source=MemoryTracker] [thread_id=3125]
[2023/09/22 17:21:18.769 +08:00] [DEBUG] [MemoryTracker.cpp:107] ["Peak memory usage (for query): 1.71 GiB."] [source=MemoryTracker] [thread_id=3128]
[2023/09/22 17:21:21.845 +08:00] [DEBUG] [MemoryTracker.cpp:107] ["Peak memory usage (for query): 1.28 GiB."] [source=MemoryTracker] [thread_id=3131]
[2023/09/22 17:21:21.988 +08:00] [DEBUG] [MemoryTracker.cpp:107] ["Peak memory usage (for query): 1.08 GiB."] [source=MemoryTracker] [thread_id=3134]
[2023/09/22 17:21:25.001 +08:00] [DEBUG] [MemoryTracker.cpp:107] ["Peak memory usage (for query): 1.35 GiB."] [source=MemoryTracker] [thread_id=3137]
[2023/09/22 17:21:25.135 +08:00] [DEBUG] [MemoryTracker.cpp:107] ["Peak memory usage (for query): 1.05 GiB."] [source=MemoryTracker] [thread_id=3139]
[2023/09/22 17:21:28.144 +08:00] [DEBUG] [MemoryTracker.cpp:107] ["Peak memory usage (for query): 1.22 GiB."] [source=MemoryTracker] [thread_id=3142]
[2023/09/22 17:21:28.286 +08:00] [DEBUG] [MemoryTracker.cpp:107] ["Peak memory usage (for query): 1.12 GiB."] [source=MemoryTracker] [thread_id=3143]
[2023/09/22 17:21:31.336 +08:00] [DEBUG] [MemoryTracker.cpp:107] ["Peak memory usage (for query): 1.20 GiB."] [source=MemoryTracker] [thread_id=3144]
[2023/09/22 17:21:31.454 +08:00] [DEBUG] [MemoryTracker.cpp:107] ["Peak memory usage (for query): 1.32 GiB."] [source=MemoryTracker] [thread_id=3145]
[2023/09/22 17:21:34.535 +08:00] [DEBUG] [MemoryTracker.cpp:107] ["Peak memory usage (for query): 1.28 GiB."] [source=MemoryTracker] [thread_id=3146]
[2023/09/22 17:21:34.650 +08:00] [DEBUG] [MemoryTracker.cpp:107] ["Peak memory usage (for query): 1023.65 MiB."] [source=MemoryTracker] [thread_id=3148]
[2023/09/22 17:21:37.665 +08:00] [DEBUG] [MemoryTracker.cpp:107] ["Peak memory usage (for query): 1.31 GiB."] [source=MemoryTracker] [thread_id=3151]
[2023/09/22 17:21:37.799 +08:00] [DEBUG] [MemoryTracker.cpp:107] ["Peak memory usage (for query): 1.09 GiB."] [source=MemoryTracker] [thread_id=3153]
[2023/09/22 17:21:40.931 +08:00] [DEBUG] [MemoryTracker.cpp:107] ["Peak memory usage (for query): 1.28 GiB."] [source=MemoryTracker] [thread_id=3155]
[2023/09/22 17:21:41.051 +08:00] [DEBUG] [MemoryTracker.cpp:107] ["Peak memory usage (for query): 1.20 GiB."] [source=MemoryTracker] [thread_id=3157]
[2023/09/22 17:21:44.169 +08:00] [DEBUG] [MemoryTracker.cpp:107] ["Peak memory usage (for query): 1.24 GiB."] [source=MemoryTracker] [thread_id=3159]
[2023/09/22 17:21:44.294 +08:00] [DEBUG] [MemoryTracker.cpp:107] ["Peak memory usage (for query): 1.10 GiB."] [source=MemoryTracker] [thread_id=3162]
[2023/09/22 17:21:47.329 +08:00] [DEBUG] [MemoryTracker.cpp:107] ["Peak memory usage (for query): 1.25 GiB."] [source=MemoryTracker] [thread_id=3165]
[2023/09/22 17:21:47.441 +08:00] [DEBUG] [MemoryTracker.cpp:107] ["Peak memory usage (for query): 1.12 GiB."] [source=MemoryTracker] [thread_id=3167]
[2023/09/22 17:21:50.481 +08:00] [DEBUG] [MemoryTracker.cpp:107] ["Peak memory usage (for query): 1.53 GiB."] [source=MemoryTracker] [thread_id=3170]
[2023/09/22 17:21:50.657 +08:00] [DEBUG] [MemoryTracker.cpp:107] ["Peak memory usage (for query): 998.26 MiB."] [source=MemoryTracker] [thread_id=3171]
[2023/09/22 17:21:53.689 +08:00] [DEBUG] [MemoryTracker.cpp:107] ["Peak memory usage (for query): 1.67 GiB."] [source=MemoryTracker] [thread_id=3173]
[2023/09/22 17:21:53.801 +08:00] [DEBUG] [MemoryTracker.cpp:107] ["Peak memory usage (for query): 1.88 GiB."] [source=MemoryTracker] [thread_id=3176]
[2023/09/22 17:21:56.932 +08:00] [DEBUG] [MemoryTracker.cpp:107] ["Peak memory usage (for query): 1.36 GiB."] [source=MemoryTracker] [thread_id=3179]
[2023/09/22 17:21:57.026 +08:00] [DEBUG] [MemoryTracker.cpp:107] ["Peak memory usage (for query): 1.06 GiB."] [source=MemoryTracker] [thread_id=3181]
[2023/09/22 17:22:00.085 +08:00] [DEBUG] [MemoryTracker.cpp:107] ["Peak memory usage (for query): 1.62 GiB."] [source=MemoryTracker] [thread_id=3183]
[2023/09/22 17:22:00.210 +08:00] [DEBUG] [MemoryTracker.cpp:107] ["Peak memory usage (for query): 1.13 GiB."] [source=MemoryTracker] [thread_id=3185]
[2023/09/22 17:22:03.338 +08:00] [DEBUG] [MemoryTracker.cpp:107] ["Peak memory usage (for query): 1.35 GiB."] [source=MemoryTracker] [thread_id=3186]
[2023/09/22 17:22:03.421 +08:00] [DEBUG] [MemoryTracker.cpp:107] ["Peak memory usage (for query): 1.06 GiB."] [source=MemoryTracker] [thread_id=3188]
[2023/09/22 17:22:06.471 +08:00] [DEBUG] [MemoryTracker.cpp:107] ["Peak memory usage (for query): 1.48 GiB."] [source=MemoryTracker] [thread_id=3191]
[2023/09/22 17:22:06.589 +08:00] [DEBUG] [MemoryTracker.cpp:107] ["Peak memory usage (for query): 1.05 GiB."] [source=MemoryTracker] [thread_id=3193]
[2023/09/22 17:22:06.589 +08:00] [DEBUG] [MemoryTracker.cpp:107] ["Peak memory usage (total): 3.86 GiB."] [source=MemoryTracker] [thread_id=3193]
  • Maybe there are some global PODArray object that are not being traced before, about 12.4MiB.
    image

Check List

Tests

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

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

Fix the issue that memory usage tracking is not accurate

@ti-chi-bot ti-chi-bot added needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Sep 25, 2023
@ti-chi-bot ti-chi-bot added the type/cherry-pick-for-release-7.1 This PR is cherry-picked to release-7.1 from a source PR. label Sep 25, 2023
@ti-chi-bot ti-chi-bot bot added the release-note-none Denotes a PR that doesn't merit a release note. label Sep 25, 2023
@ti-chi-bot ti-chi-bot bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Sep 25, 2023
@ti-chi-bot ti-chi-bot bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Sep 25, 2023
@JinheLin
Copy link
Contributor

/run-all-tests

@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Sep 25, 2023
@ti-chi-bot ti-chi-bot bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Sep 25, 2023
@JaySon-Huang
Copy link
Contributor

/run-all-tests

@JaySon-Huang JaySon-Huang removed the needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. label Sep 25, 2023
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Sep 25, 2023

[APPROVALNOTIFIER] This PR is APPROVED

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

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:
  • OWNERS [JaySon-Huang,Lloyd-Pottiger]

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 Sep 25, 2023
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Sep 25, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-09-25 06:46:58.295983663 +0000 UTC m=+257408.014325880: ☑️ agreed by JaySon-Huang.
  • 2023-09-25 11:34:35.310114831 +0000 UTC m=+274665.028457048: ☑️ agreed by Lloyd-Pottiger.

@ti-chi-bot ti-chi-bot bot merged commit 1b60452 into pingcap:release-7.1 Sep 25, 2023
@ti-chi-bot ti-chi-bot bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-none Denotes a PR that doesn't merit a release note. labels Oct 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved cherry-pick-approved Cherry pick PR approved by release team. lgtm release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. type/cherry-pick-for-release-7.1 This PR is cherry-picked to release-7.1 from a source PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants