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

Ignore option inserts if they fail at MySQL level #14931

Merged
merged 1 commit into from Oct 2, 2019

Conversation

tsteur
Copy link
Member

@tsteur tsteur commented Oct 1, 2019

Problem I'm having is that I'm using a different DB backend which logs/shows errors in their DB layer. In this case what happens is that we're often calling Option::set() and the value doesn't actually change. In this case because no row changed, the update $result will be 0 and therefore it will try to insert the value which will fail because of duplicate entry.
I know we're catching the exception but in this case we can as well IGNORE any failure when we catch any exception anyway. This way there will be no more errors shown in the UI when using a different DB layer. I know the same problem can happen in other queries we do as well but it's particularly annoying with the option queries currently.

Problem I'm having is that I'm using a different DB backend which logs/shows errors in their DB layer. In this case what happens is that we're often calling `Option::set()` and the value doesn't actually change. In this case because no row changed, the update `$result` will be `0` and therefore it will try to insert the value which will fail because of duplicate entry.
 I know we're catching the exception but in this case we can as well IGNORE any failure when we catch any exception anyway. This way there will be no more errors shown in the UI when using a different DB layer. I know the same problem can happen in other queries we do as well but it's particularly annoying with the option queries currently.
@tsteur tsteur added not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. Needs Review PRs that need a code review labels Oct 1, 2019
@tsteur tsteur added this to the 3.12.0 milestone Oct 1, 2019
@tsteur tsteur added the Help wanted Beginner friendly issues or issues where we'd highly appreciate community's help and involvement. label Oct 1, 2019
@tsteur tsteur merged commit 458fd5c into 3.x-dev Oct 2, 2019
@tsteur tsteur deleted the insert_option_ignore branch October 2, 2019 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Help wanted Beginner friendly issues or issues where we'd highly appreciate community's help and involvement. Needs Review PRs that need a code review not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant