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

Optimistic @Version is increased when update fails due MongoSocketOpenException #4576

Closed
michaldo opened this issue Nov 30, 2023 · 3 comments
Labels
for: stackoverflow A question that's better suited to stackoverflow.com

Comments

@michaldo
Copy link

Actual:
On save attempt @Version attribute is increased. When save fails due MongoSocketOpenException, @Version attribute is not restored
As result, when socket connection is back, save fails due OptimisticLockingFailureException

Expected:
when save fails, @Version attribute should be restored. When socket connection is back, save should succeeded.

spring-data-mongodb 4.1.5

SO question: https://stackoverflow.com/questions/77498546/optimistic-version-is-increased-when-update-fails-due-mongosocketopenexception

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Nov 30, 2023
@christophstrobl
Copy link
Member

If you'd like us to spend some time investigating, please take the time to provide a complete minimal sample (something that we can unzip or git clone, build, and deploy) that reproduces the problem.

@christophstrobl christophstrobl added status: waiting-for-feedback We need additional information before we can continue and removed status: waiting-for-triage An issue we've not yet triaged labels Nov 30, 2023
@michaldo
Copy link
Author

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Nov 30, 2023
@mp911de
Copy link
Member

mp911de commented Oct 24, 2024

If you encounter an I/O failure, then you cannot make any assumptions over the integrity of your underlying domain model. During saving, we're updating the object eagerly and deriving query and update information. If a save operation terminates while running the save command, you're left with an unknown state.

The only thing to recover is to retry the unit of work and potentially reload the object from the database (i.e. making your process idempotent).

@mp911de mp911de closed this as not planned Won't fix, can't repro, duplicate, stale Oct 24, 2024
@mp911de mp911de added for: stackoverflow A question that's better suited to stackoverflow.com and removed status: feedback-provided Feedback has been provided labels Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: stackoverflow A question that's better suited to stackoverflow.com
Projects
None yet
Development

No branches or pull requests

4 participants