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

workload: Ignore transaction restart errors. #75244

Merged
merged 1 commit into from
Jan 22, 2022
Merged

Conversation

miretskiy
Copy link
Contributor

Update pgx helpers to ignore "restart transactions" errors.
Previsouly, these were sent via a "msg" portion of the Log call.
It appears that these messages may also arrive in the "data".

Release Notes: None

@miretskiy miretskiy requested a review from rafiss January 20, 2022 20:48
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Collaborator

@rafiss rafiss left a comment

Choose a reason for hiding this comment

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

ah, nice find!

// data may contain error with "restart transaction" -- skip those as well.
if data != nil {
ev := data["err"]
if err, ok := ev.(error); ok && strings.Contains(err.Error(), "restart transaction") {
Copy link
Collaborator

Choose a reason for hiding this comment

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

if you'd like, the check could be done once after formatting the message we log

i.e. check the resulting string from fmt.Sprintf("pgx logger [%s]: %s logParams=%v", level.String(), msg, data)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That makes sense, I suppose; but this way it's more explicit... I'll keep it as is for now; but maybe we'll have to do this trick in the future.

@miretskiy
Copy link
Contributor Author

bors r+

@craig
Copy link
Contributor

craig bot commented Jan 21, 2022

Canceled.

@miretskiy
Copy link
Contributor Author

Bors r+

@craig
Copy link
Contributor

craig bot commented Jan 21, 2022

Build failed:

@miretskiy
Copy link
Contributor Author

Bors r+

@craig
Copy link
Contributor

craig bot commented Jan 21, 2022

Build failed:

@miretskiy
Copy link
Contributor Author

bors r+

@craig
Copy link
Contributor

craig bot commented Jan 21, 2022

Build failed:

Update pgx helpers to ignore "restart transactions" errors.
Previsouly, these were sent via a "msg" portion of the Log call.
It appears that these messages may also arrive in the "data".

Release Notes: None
@miretskiy
Copy link
Contributor Author

bors+

@miretskiy
Copy link
Contributor Author

bors r+

@craig
Copy link
Contributor

craig bot commented Jan 21, 2022

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Jan 21, 2022

This PR was included in a batch that was canceled, it will be automatically retried

@craig
Copy link
Contributor

craig bot commented Jan 21, 2022

Build failed (retrying...):

@craig
Copy link
Contributor

craig bot commented Jan 22, 2022

Build succeeded:

@craig craig bot merged commit b88739e into cockroachdb:master Jan 22, 2022
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