Skip to content

Adds new state to know that a diff has failed early#4209

Merged
sougou merged 1 commit intovitessio:masterfrom
systay:diff-failed-state
Nov 4, 2018
Merged

Adds new state to know that a diff has failed early#4209
sougou merged 1 commit intovitessio:masterfrom
systay:diff-failed-state

Conversation

@systay
Copy link
Copy Markdown
Collaborator

@systay systay commented Sep 21, 2018

This makes it easy to see on the worker UI if a diff has failed without having to look through the log, even before it has finished running.

@systay
Copy link
Copy Markdown
Collaborator Author

systay commented Sep 21, 2018

/cc @tirsen

Copy link
Copy Markdown
Contributor

@sougou sougou left a comment

Choose a reason for hiding this comment

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

This looks good.
@rafael want to eyeball this before I merge?

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.

nit: I suggest to rename "recorder" to "er" to be consistent with the rest of the code base.

@systay
Copy link
Copy Markdown
Collaborator Author

systay commented Sep 25, 2018

I added a commit to respond to the review comments. Do you want me to squash it up into a single commit?

@sougou
Copy link
Copy Markdown
Contributor

sougou commented Sep 30, 2018

@michael-berlin: Looks like comments are addressed.

Copy link
Copy Markdown
Contributor

@michael-berlin michael-berlin left a comment

Choose a reason for hiding this comment

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

General change LGTM. Just a couple minor comments.

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.

This is redundant and should be removed.

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.

Here you're not handling the "err == nil" case: If err == nil, then rec.RecordError() returned early and nothing happened.

There are similar comments below.

In practice what probably happens here is:

  • your new code runs and sets the state to "diff is about to fail"
  • diff actually finishes all the way to the end and then state is set to success

Ideally, the state transition code shouldn't allow that in the first place. But so far it's just doing simple overrides and no fancy checks.

To keep things simple, I suggest the following: Call your new method here only if err != nil.

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.

Same comment as above: Please only call here if err != nil.

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.

Skip err == nil case. Same comment as in the other file.

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.

Skip err == nil case. Same comment as in the other file.

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.

Technically, this doesn't mark the worker as failed.

Do you mind renaming it to "markAsWillFail"? That's closer to what's happening?

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.

Same comment as in the other file: Can you please rename to "markAsWillFail"?

@systay
Copy link
Copy Markdown
Collaborator Author

systay commented Oct 16, 2018

Hi again @sougou and @michael-berlin.

Good comments, thanks for catching that. Sorry for not fixing the comments sooner.

Should I squash it up into a single commit?

@systay
Copy link
Copy Markdown
Collaborator Author

systay commented Oct 25, 2018

bump @sougou @michael-berlin

@sougou
Copy link
Copy Markdown
Contributor

sougou commented Oct 28, 2018

This looks good. Can you resolve the conflicts?

@systay systay force-pushed the diff-failed-state branch from c83c77a to 5b08f0d Compare October 29, 2018 15:16
@systay
Copy link
Copy Markdown
Collaborator Author

systay commented Oct 29, 2018

Rebased and squashed. :bowtie:

go/apa.go Outdated
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.

Looks like you caught this stray file.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Oops.

Signed-off-by: Andres Taylor <antaylor@squareup.com>
@systay systay force-pushed the diff-failed-state branch from 5b08f0d to b9abb67 Compare October 31, 2018 07:07
@sougou sougou dismissed michael-berlin’s stale review November 4, 2018 16:26

Comments addressed.

@sougou sougou merged commit 9e40c49 into vitessio:master Nov 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants