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

processor(ticdc): Extract all closures to make code maintainable #8337

Merged

Conversation

Rustin170506
Copy link
Member

@Rustin170506 Rustin170506 commented Feb 22, 2023

What problem does this PR solve?

Issue Number: ref #8132

What is changed and how it works?

  • Extract all closures to make code maintainable
  • We should not pass the table sink back to the sink manager. getUpperBound only needs minimal info about the table sink. All we need is sroterResolvedTs

Check List

Tests

Unit Test

Questions

Will it cause performance regression or break compatibility?

No

Do you need to update user documentation, design documentation or monitoring documentation?

No

Release note

None

@ti-chi-bot
Copy link
Member

ti-chi-bot commented Feb 22, 2023

[REVIEW NOTIFICATION]

This pull request has been approved by:

  • amyangfei
  • hicqu

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

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

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-bot added 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 Feb 22, 2023
@Rustin170506 Rustin170506 marked this pull request as draft February 22, 2023 08:49
@ti-chi-bot ti-chi-bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 22, 2023
@ti-chi-bot ti-chi-bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Feb 23, 2023
@Rustin170506 Rustin170506 marked this pull request as ready for review February 23, 2023 08:54
@ti-chi-bot ti-chi-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 23, 2023
@Rustin170506 Rustin170506 changed the title processor(ticdc): do not pass the table sink back to sink manager processor(ticdc): Extract all closures to make code maintainable Feb 23, 2023
@Rustin170506 Rustin170506 added component/sink Sink component. area/ticdc Issues or PRs related to TiCDC. labels Feb 23, 2023
noSplitTxnEmitCondition
}

func (w *sinkWorker) doEmitAndAdvance(
Copy link
Contributor

Choose a reason for hiding this comment

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

How about

type TableSinkAdvancer struct {
    	events []*model.RowChangedEvent
        currTxnCommitTs uint64,
	lastTxnCommitTs uint64,
	lastPos engine.Position,
	batchID uint64,
	committedTxnSize uint64,
	pendingTxnSize uint64,
}

func (a *TableSinkAdvancer) advance(task *sinkTask, w *worker) {
}
func (a *TableSinkAdvancer) onTaskFinish(task *sinkTask) {
    // handles logic about isLastTime.
}

So we can store TableSinkAdvancer into TableSinkWrapper, so we can do more boundary checks about task range. For example, Task boundaries should be contiguous.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeap! We can do it in the next PR. Thanks!

@hicqu
Copy link
Contributor

hicqu commented Feb 23, 2023

Rest LGTM. Thank you very much!

@Rustin170506 Rustin170506 requested a review from hicqu February 23, 2023 09:42
@ti-chi-bot ti-chi-bot added the status/LGT1 Indicates that a PR has LGTM 1. label Feb 23, 2023
@Rustin170506
Copy link
Member Author

/run-all-tests

@Rustin170506
Copy link
Member Author

/run-all-tests

3 similar comments
@Rustin170506
Copy link
Member Author

/run-all-tests

@Rustin170506
Copy link
Member Author

/run-all-tests

@Rustin170506
Copy link
Member Author

/run-all-tests

@Rustin170506
Copy link
Member Author

/run-kafka-integration-test

[2023-02-23T12:29:15.357Z] signal: segmentation fault (core dumped)

@Rustin170506
Copy link
Member Author

/run-kafka-integration-test

[2023-02-23T12:29:15.357Z] signal: segmentation fault (core dumped)

@ti-chi-bot ti-chi-bot added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels Feb 24, 2023
@amyangfei
Copy link
Contributor

BTW, will these refactors be cherry-picked to release-6.5?

@Rustin170506
Copy link
Member Author

BTW, will these refactors be cherry-picked to release-6.5?

I think it is better to do it. Because we need to maintain 6.5 for a long time. So we can cherry-pick all changes and tests after I finished all work on the master.

@Rustin170506
Copy link
Member Author

Thanks for your review! 💚 💙 💜 💛 ❤️

/merge

@ti-chi-bot
Copy link
Member

This pull request has been accepted and is ready to merge.

Commit hash: 6a52872

@ti-chi-bot ti-chi-bot added the status/can-merge Indicates a PR has been approved by a committer. label Feb 24, 2023
@ti-chi-bot
Copy link
Member

@hi-rustin: Your PR was out of date, I have automatically updated it for you.

At the same time I will also trigger all tests for you:

/run-all-tests

trigger some heavy tests which will not run always when PR updated.

If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

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 ti-community-infra/tichi repository.

@Rustin170506
Copy link
Member Author

/run-integration-test

Network issue

@Rustin170506
Copy link
Member Author

/run-integration-test

[2023-02-24T03:01:39.158Z] wait process cdc.test exit timeout

[2023-02-24T03:01:39.158Z] count(*) 5000

[2023-02-24T03:01:39.158Z] Exiting on signal: INTERRUPT

@Rustin170506
Copy link
Member Author

/run-integration-test

unstable test

@ti-chi-bot ti-chi-bot merged commit c9f207d into pingcap:master Feb 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ticdc Issues or PRs related to TiCDC. component/sink Sink component. 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. status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants