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

DBZ-6213 Adjust connector restart #4705

Merged
merged 1 commit into from
Aug 8, 2023
Merged

Conversation

vjuranek
Copy link
Member

  • Try to start the connector in BaseSourceTask::start(). This is the root cause of DBZ-6213 as EmbeddedEngine calls start() and assumes it really tries to start the connector.
  • Simplify the code by removing unnecessary checks and restartDelay.hasElapsed() call.

https://issues.redhat.com/browse/DBZ-6213

@github-actions
Copy link

Hi @vjuranek, thanks for your contribution. Please prefix the commit message(s) with the DBZ-xxx JIRA issue key.

@@ -312,7 +301,6 @@ private void stop(boolean restart) {
setTaskState(State.RESTARTING);
if (restartDelay == null) {
restartDelay = ElapsedTimeStrategy.constant(Clock.system(), retriableRestartWait.toMillis());
restartDelay.hasElapsed();
Copy link
Contributor

Choose a reason for hiding this comment

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

IMHO by removing it you ae removing the pause.

Copy link
Member Author

Choose a reason for hiding this comment

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

Right, but only the first one pause:-) This method says, if the delay interval has already elapsed or not. As a side effect it recomputes next timestamp for waiting. This method is very confusing (it's description, side effects and initialization) and IMHO should be also refactored.

However, you are right that removing it is wrong - due to its side effect if this call is removed, the elapsed interval won't be initialized and actually won't do any wait when the strategy is used for the first time. So basically this has to be called every time right after ElapsedTimeStrategy is created.

Copy link
Contributor

Choose a reason for hiding this comment

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

@vjuranek I agree on the refactoring

Copy link
Contributor

@jpechane jpechane left a comment

Choose a reason for hiding this comment

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

@vjuranek LGTM. I left few minor comments.

Copy link
Member Author

@vjuranek vjuranek left a comment

Choose a reason for hiding this comment

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

@jpechane all the issues should be fixed now, thanks for spotting them, especially the one with removing restartDelay.hasElapsed().

@@ -312,7 +301,6 @@ private void stop(boolean restart) {
setTaskState(State.RESTARTING);
if (restartDelay == null) {
restartDelay = ElapsedTimeStrategy.constant(Clock.system(), retriableRestartWait.toMillis());
restartDelay.hasElapsed();
Copy link
Member Author

Choose a reason for hiding this comment

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

Right, but only the first one pause:-) This method says, if the delay interval has already elapsed or not. As a side effect it recomputes next timestamp for waiting. This method is very confusing (it's description, side effects and initialization) and IMHO should be also refactored.

However, you are right that removing it is wrong - due to its side effect if this call is removed, the elapsed interval won't be initialized and actually won't do any wait when the strategy is used for the first time. So basically this has to be called every time right after ElapsedTimeStrategy is created.

@vjuranek vjuranek requested a review from jpechane August 3, 2023 09:46
Copy link
Contributor

@jpechane jpechane left a comment

Choose a reason for hiding this comment

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

Waiting for CI to complete before merging.

* Try to start the connector in BaseSourceTask::start(). This is the
  root cause of DBZ-6213 as EmbeddedEngine calls start() and assumes
  it really tries to start the connector.
* Simplify the code by removing unnecessary checks.
@jpechane jpechane merged commit 41cdaeb into debezium:main Aug 8, 2023
28 of 29 checks passed
@jpechane
Copy link
Contributor

jpechane commented Aug 8, 2023

@vjuranek Applied, thanks a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants