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

Fix issues with deletions and updates in dirty tracked session #3343

Merged
merged 3 commits into from
Aug 15, 2024

Conversation

e-tobi
Copy link
Contributor

@e-tobi e-tobi commented Jul 28, 2024

No description provided.

@@ -26,6 +27,7 @@ public abstract partial class DocumentSessionBase
_workTracker.Add(deletion);

documentStorage.Eject(this, entity);
ChangeTrackers.RemoveAll(x => ReferenceEquals(entity, x.Document));
Copy link
Member

Choose a reason for hiding this comment

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

You've got to do that by document identity and not just the reference equals

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Because what if someone passes the session around and passes a different object with the same id in to delete it which people have absolutely done before even though it sounds weird. What if the document is immutable -- which people absolutely do as well -- so they might have modified the document and hence created a new document that they then passed into the Delete() method.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I get your point. But this should then be done for Eject as well, shouldn't it?

Copy link
Member

Choose a reason for hiding this comment

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

DocumentStorage.Eject() does it by identity

@jeremydmiller
Copy link
Member

@e-tobi I have a magic window of time today to push a Marten release. I'll take it from here. Thanks for doing this!

@jeremydmiller jeremydmiller merged commit cc7fbd5 into JasperFx:master Aug 15, 2024
7 of 10 checks passed
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.

2 participants