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

Throw OptimisticLockException when connection::commit() returns false #7946

Merged

Conversation

chosroes
Copy link
Contributor

@chosroes chosroes commented Dec 6, 2019

Proposal for #7893 in order to handle silently failed commits

Copy link
Member

@SenseException SenseException left a comment

Choose a reason for hiding this comment

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

Thank you for your PR. Please add unit tests that are covering your changes.

@chosroes
Copy link
Contributor Author

Thank you for your PR. Please add unit tests that are covering your changes.

I'd like to but there are currently no tests for exception in commit process, or I should create another connection mock with commit that return false ?

@chosroes chosroes force-pushed the feature/use_dbal_commit_return branch 3 times, most recently from 529d1e4 to 3418aac Compare December 19, 2019 10:33
@chosroes
Copy link
Contributor Author

Tests added and checks passed

@SenseException
Copy link
Member

Thank you for the changes. You introduced changes in .scrutinizer.yml, the travis file and composer.json. Are these changes relevant to your feature?

@chosroes
Copy link
Contributor Author

chosroes commented Jan 2, 2020

Yes since doctrine/dbal now needs at least php 7.2

Copy link
Member

@ostrolucky ostrolucky left a comment

Choose a reason for hiding this comment

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

Lot of tests fail for me locally. Not sure why travis did not start here, but tests must run

@chosroes chosroes force-pushed the feature/use_dbal_commit_return branch from 8d976c8 to 06df782 Compare January 6, 2020 09:14
@chosroes
Copy link
Contributor Author

chosroes commented Jan 6, 2020

@ostrolucky I think there is a problem with travis. The request is in status "Abuse detected"...
I had no account in travis CI. I created one just now...
https://travis-ci.org/doctrine/orm/requests?utm_medium=notification&utm_source=github_status

By the way, I changed my unit test. There was already lot of tests failures in the 2.8.x branch for me locally. So I don't know what to do with that.

@chosroes chosroes force-pushed the feature/use_dbal_commit_return branch from 8381c9b to fe4a5c1 Compare January 6, 2020 12:47
@greg0ire greg0ire closed this Jan 6, 2020
@greg0ire greg0ire reopened this Jan 6, 2020
@greg0ire
Copy link
Member

greg0ire commented Jan 6, 2020

Apparently the issue was transient, here is your build!

@ostrolucky
Copy link
Member

ostrolucky commented Jan 6, 2020

Aand it shows failures I mentioned. I guess UPGRADE.md should also be upgraded, since this is minor BC break.

@chosroes chosroes force-pushed the feature/use_dbal_commit_return branch from fe4a5c1 to 720f9eb Compare January 7, 2020 09:11
@chosroes chosroes closed this Jan 7, 2020
@chosroes chosroes reopened this Jan 7, 2020
@chosroes
Copy link
Contributor Author

chosroes commented Jan 7, 2020

I can't get travis to work with me...
(It works after contacting travais support)

@chosroes chosroes force-pushed the feature/use_dbal_commit_return branch from 720f9eb to 479f8c8 Compare January 7, 2020 11:04
@chosroes chosroes closed this Jan 7, 2020
@chosroes chosroes reopened this Jan 7, 2020
@chosroes chosroes force-pushed the feature/use_dbal_commit_return branch 2 times, most recently from 57185bb to d19e1c0 Compare January 7, 2020 14:22
@chosroes chosroes force-pushed the feature/use_dbal_commit_return branch from d19e1c0 to 09868c8 Compare January 7, 2020 14:28
@chosroes chosroes closed this Jan 7, 2020
@chosroes chosroes reopened this Jan 7, 2020
@greg0ire greg0ire requested a review from ostrolucky January 7, 2020 22:16
@chosroes chosroes force-pushed the feature/use_dbal_commit_return branch from 2b6f1ee to e83b91b Compare January 9, 2020 08:38
@chosroes chosroes force-pushed the feature/use_dbal_commit_return branch from e83b91b to 8e39aa9 Compare January 23, 2020 15:55
@chosroes chosroes force-pushed the feature/use_dbal_commit_return branch from 8e39aa9 to 21bf46c Compare January 23, 2020 15:57
@SenseException
Copy link
Member

Is this still considered a WIP?

@chosroes
Copy link
Contributor Author

@SenseException Not for me

@chosroes
Copy link
Contributor Author

chosroes commented Feb 6, 2020

Any update ?

@SenseException
Copy link
Member

I'm undecided for the usage of $conn->commit() === false. It introduces the usage of an already existing boolean return value in that method. It is true that 3.x is still using it, but master has changed it to void. Maybe I'm planning to far into the future, because we can deprecate it in the last release of 3.x or respectively implement that optimistic lock case differently in master. //cc @ostrolucky

Otherwise I'm fine with the changes.

@chosroes
Copy link
Contributor Author

@SenseException I don't know for master, the current commit without error may have be solve. But meanwhile, we have to do with the current interface that can return false

Copy link
Member

@ostrolucky ostrolucky left a comment

Choose a reason for hiding this comment

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

master has changed it to void

Good point. Fortunately that won't break this code, just make bool condition dead. I expect phpstan will alert us on it in future so we can remove it then.

Copy link
Member

@SenseException SenseException left a comment

Choose a reason for hiding this comment

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

If postponing the issue with bool -> void is acceptable for this PR, then I'll give my approval.

@ostrolucky ostrolucky self-assigned this Feb 29, 2020
@ostrolucky ostrolucky added this to the 2.8.0 milestone Feb 29, 2020
@ostrolucky ostrolucky merged commit 1da002c into doctrine:2.8.x Feb 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants