Skip to content

*: collect subtask summary for IMPORT INTO tasks#61600

Merged
ti-chi-bot[bot] merged 19 commits into
pingcap:masterfrom
joechenrh:import-summary
Jul 4, 2025
Merged

*: collect subtask summary for IMPORT INTO tasks#61600
ti-chi-bot[bot] merged 19 commits into
pingcap:masterfrom
joechenrh:import-summary

Conversation

@joechenrh

@joechenrh joechenrh commented Jun 9, 2025

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: ref #61088

Problem Summary:

What changed and how does it work?

What does this PR do:

  • add collector for each step executor of IMPORT INTO to collect summary.
  • store update time in summary. This value will be used to track the progress update time for each job.

Previously, imported row is stored in subtask meta, which is not easy to use. After this PR, we no longer need Result in subtask meta, row count can be calculated from all subtask summaries.

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.

This PR doesn't add new unit test, but extend existing tests to verfiy the functionality of each collector.

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 Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jun 9, 2025
@tiprow

tiprow Bot commented Jun 9, 2025

Copy link
Copy Markdown

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

Details

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.

Comment on lines -1526 to -1548
type JobImportResult struct {
Affected uint64
Warnings []contextutil.SQLWarn
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The only used field is Affected, so I removed this struct.

@codecov

codecov Bot commented Jun 9, 2025

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 39.60396% with 122 lines in your changes missing coverage. Please review.

Project coverage is 75.6895%. Comparing base (7487af5) to head (be955b1).
Report is 25 commits behind head on master.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #61600        +/-   ##
================================================
+ Coverage   72.8941%   75.6895%   +2.7954%     
================================================
  Files          1740       1794        +54     
  Lines        482921     499937     +17016     
================================================
+ Hits         352021     378400     +26379     
+ Misses       109294      98696     -10598     
- Partials      21606      22841      +1235     
Flag Coverage Δ
integration 50.1205% <0.0000%> (?)
unit 73.0195% <40.0000%> (+0.8749%) ⬆️

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

Components Coverage Δ
dumpling 52.7804% <ø> (ø)
parser ∅ <ø> (∅)
br 63.7431% <ø> (+17.4099%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@joechenrh joechenrh changed the title *: add summary to IMPORT INTO tasks *: add subtask summary to IMPORT INTO tasks Jun 10, 2025
@ti-chi-bot ti-chi-bot Bot added component/dumpling This is related to Dumpling of TiDB. sig/planner SIG: Planner labels Jun 10, 2025
@joechenrh joechenrh force-pushed the import-summary branch 2 times, most recently from cb6cb2e to 2abb5a4 Compare June 10, 2025 01:39
@joechenrh joechenrh changed the title *: add subtask summary to IMPORT INTO tasks *: collect subtask summary for IMPORT INTO tasks Jun 10, 2025
// updateSubtaskSummaryInterval is the interval for updating the subtask summary to
// subtask table.
updateSubtaskSummaryInterval = 3 * time.Second
updateSubtaskSummaryInterval = 5 * time.Second

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think we don't need to update the summary too frequently.

Comment thread pkg/lightning/metric/metric.go Outdated
StateRestored = "restored" // source data bytes restored during restore engine
StateRestoreWritten = "written" // kv bytes written during restore engine
StateImported = "imported" // kv bytes imported during import engine
StateMerged = "merged" // kv bytes merged during import engine

@joechenrh joechenrh Jun 12, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We can display merge speed in dashboard later

@joechenrh

Copy link
Copy Markdown
Contributor Author

/cc @GMHDBJD @D3Hunter

@ti-chi-bot ti-chi-bot Bot requested review from D3Hunter and GMHDBJD June 12, 2025 03:37

@D3Hunter D3Hunter left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

25/40

Comment thread pkg/lightning/metric/metric.go Outdated
Co-authored-by: D3Hunter <jujj603@gmail.com>
@joechenrh

Copy link
Copy Markdown
Contributor Author

/retest

@tiprow

tiprow Bot commented Jul 3, 2025

Copy link
Copy Markdown

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

Details

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.

@joechenrh

Copy link
Copy Markdown
Contributor Author

/retest

@tiprow

tiprow Bot commented Jul 3, 2025

Copy link
Copy Markdown

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

Details

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.

@joechenrh

Copy link
Copy Markdown
Contributor Author

/retest

@tiprow

tiprow Bot commented Jul 3, 2025

Copy link
Copy Markdown

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

Details

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.

@joechenrh

Copy link
Copy Markdown
Contributor Author

/retest

@tiprow

tiprow Bot commented Jul 3, 2025

Copy link
Copy Markdown

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

Details

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.

@joechenrh

Copy link
Copy Markdown
Contributor Author

/retest

@tiprow

tiprow Bot commented Jul 3, 2025

Copy link
Copy Markdown

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

Details

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.

@joechenrh

Copy link
Copy Markdown
Contributor Author

/retest

@tiprow

tiprow Bot commented Jul 3, 2025

Copy link
Copy Markdown

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

Details

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.

@joechenrh

Copy link
Copy Markdown
Contributor Author

/retest

@tiprow

tiprow Bot commented Jul 3, 2025

Copy link
Copy Markdown

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

Details

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.

@joechenrh

Copy link
Copy Markdown
Contributor Author

/retest

@tiprow

tiprow Bot commented Jul 3, 2025

Copy link
Copy Markdown

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

Details

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.

@joechenrh

Copy link
Copy Markdown
Contributor Author

/retest

@tiprow

tiprow Bot commented Jul 4, 2025

Copy link
Copy Markdown

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

Details

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.

@joechenrh

Copy link
Copy Markdown
Contributor Author

/retest

@tiprow

tiprow Bot commented Jul 4, 2025

Copy link
Copy Markdown

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

Details

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.

@joechenrh

Copy link
Copy Markdown
Contributor Author

/retest

@tiprow

tiprow Bot commented Jul 4, 2025

Copy link
Copy Markdown

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

Details

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.

@joechenrh

Copy link
Copy Markdown
Contributor Author

/retest

@tiprow

tiprow Bot commented Jul 4, 2025

Copy link
Copy Markdown

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

Details

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.

@ti-chi-bot

ti-chi-bot Bot commented Jul 4, 2025

Copy link
Copy Markdown

@joechenrh: 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
non-block-pull-unit-test-next-gen be955b1 link false /test pull-unit-test-next-gen

Full PR test history. Your PR dashboard.

Details

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. I understand the commands that are listed here.

@ti-chi-bot ti-chi-bot Bot merged commit 0a704a4 into pingcap:master Jul 4, 2025
30 of 31 checks passed
morgo added a commit to morgo/tidb that referenced this pull request Jul 7, 2025
* origin/master: (79 commits)
  backend/local: add rate limiter for split region and ingest data (pingcap#61555)
  fix(runaway): resolve the dead channel in UpdateNewAndDoneWatch (pingcap#61795)
  *: collect subtask summary for `IMPORT INTO` tasks (pingcap#61600)
  tests: update vector cluster test result (pingcap#62174)
  planner: change casetest instance-plan-cache test timeout. (pingcap#62195)
  planner: remove data race for instance plan cache (pingcap#62217)
  *: upgrade pd client to fix keyspace issue (pingcap#62189)
  resource_control: support collecting cross AZ traffic in ru consumption (pingcap#62003)
  test: wait for statistics owner to close on exit (pingcap#62198)
  planner: remove the selection above the table dual (pingcap#62193)
  telemetry: add telemetry related code back (pingcap#61753)
  planner: move physical limit related logic into physical op. (pingcap#62187)
  planner: remove useless code (pingcap#61968)
  retry: enhance retry for ingestor on nextgen (pingcap#62191)
  importinto: encode and ingest step use task keyspace in nextgen (pingcap#62138)
  planner: lift the can-push-to-cop check of aggregation/proj (pingcap#62068)
  ddl: cannot panic with failpoint panic in the DDLNotifier (pingcap#62151)
  planner: skip empty expression in the applyPredicateSimplification (pingcap#62178)
  codec: should also return the value even with error because the error may be ignored in the future (pingcap#62175)
  parser: also reduce literal list with charset (pingcap#61484)
  ...
morgo added a commit to morgo/tidb that referenced this pull request Jul 7, 2025
* origin/master: (79 commits)
  backend/local: add rate limiter for split region and ingest data (pingcap#61555)
  fix(runaway): resolve the dead channel in UpdateNewAndDoneWatch (pingcap#61795)
  *: collect subtask summary for `IMPORT INTO` tasks (pingcap#61600)
  tests: update vector cluster test result (pingcap#62174)
  planner: change casetest instance-plan-cache test timeout. (pingcap#62195)
  planner: remove data race for instance plan cache (pingcap#62217)
  *: upgrade pd client to fix keyspace issue (pingcap#62189)
  resource_control: support collecting cross AZ traffic in ru consumption (pingcap#62003)
  test: wait for statistics owner to close on exit (pingcap#62198)
  planner: remove the selection above the table dual (pingcap#62193)
  telemetry: add telemetry related code back (pingcap#61753)
  planner: move physical limit related logic into physical op. (pingcap#62187)
  planner: remove useless code (pingcap#61968)
  retry: enhance retry for ingestor on nextgen (pingcap#62191)
  importinto: encode and ingest step use task keyspace in nextgen (pingcap#62138)
  planner: lift the can-push-to-cop check of aggregation/proj (pingcap#62068)
  ddl: cannot panic with failpoint panic in the DDLNotifier (pingcap#62151)
  planner: skip empty expression in the applyPredicateSimplification (pingcap#62178)
  codec: should also return the value even with error because the error may be ignored in the future (pingcap#62175)
  parser: also reduce literal list with charset (pingcap#61484)
  ...
morgo added a commit to morgo/tidb that referenced this pull request Jul 7, 2025
* origin/master: (79 commits)
  backend/local: add rate limiter for split region and ingest data (pingcap#61555)
  fix(runaway): resolve the dead channel in UpdateNewAndDoneWatch (pingcap#61795)
  *: collect subtask summary for `IMPORT INTO` tasks (pingcap#61600)
  tests: update vector cluster test result (pingcap#62174)
  planner: change casetest instance-plan-cache test timeout. (pingcap#62195)
  planner: remove data race for instance plan cache (pingcap#62217)
  *: upgrade pd client to fix keyspace issue (pingcap#62189)
  resource_control: support collecting cross AZ traffic in ru consumption (pingcap#62003)
  test: wait for statistics owner to close on exit (pingcap#62198)
  planner: remove the selection above the table dual (pingcap#62193)
  telemetry: add telemetry related code back (pingcap#61753)
  planner: move physical limit related logic into physical op. (pingcap#62187)
  planner: remove useless code (pingcap#61968)
  retry: enhance retry for ingestor on nextgen (pingcap#62191)
  importinto: encode and ingest step use task keyspace in nextgen (pingcap#62138)
  planner: lift the can-push-to-cop check of aggregation/proj (pingcap#62068)
  ddl: cannot panic with failpoint panic in the DDLNotifier (pingcap#62151)
  planner: skip empty expression in the applyPredicateSimplification (pingcap#62178)
  codec: should also return the value even with error because the error may be ignored in the future (pingcap#62175)
  parser: also reduce literal list with charset (pingcap#61484)
  ...
@joechenrh joechenrh deleted the import-summary branch July 8, 2025 06:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved component/dumpling This is related to Dumpling of TiDB. lgtm release-note-none Denotes a PR that doesn't merit a release note. sig/planner SIG: Planner size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants