-
Notifications
You must be signed in to change notification settings - Fork 1k
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
When deleting SQL journal entries also delete corresponding metadata entries #3468
When deleting SQL journal entries also delete corresponding metadata entries #3468
Conversation
…ementation also delete the entries in the metadata table. This solves akkadotnet#3205 (violation of primary key constraint when the value already exists) and ensures that there exists at most one entry per PersistenceId value.
3bc556a
to
22c98c0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Do we have any specs to verify that the contents of this table have been cleaned up? cc @Horusiath
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main reason for the metadata table to exist in the first place is keep the information about the latest sequence number for given persistence id - so that we don't accidentally drop track of actor's sequence number when we decide to delete all events.
This PR in it's current implementation, defeats the whole purpose of having that table at all.
Good to know. |
I am pretty sure that it still works as intended since in the methods |
@hirzraimund @Horusiath I'll reopen the PR, but ya'll need to get to the bottom of what's really going on under the covers here before I close it again or merge it :p Unit test it, IMHO. |
@Aaronontheweb @Horusiath @hirzraimund In the current state, maybe it should be advisable for plugins to resolve this with the proper upsert (i.e, a MERGE in Sql Server and Oracle). Another option would be to get rid of the |
@ismaelhamed We could do a proper upsert in metadata table as a separate PR (only there, as event journal is append only). Regarding removal of Metadata table. It could be done' but I'm not sure if we wouldn't break backward compatibility this way. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to see some sort of spec that covers this change in behavior; I'm sure we might already have one but I'd like to look it over before merging this.
LGTM |
…ementation also delete the entries in the metadata table. This solves akkadotnet#3205 (violation of primary key constraint when the value already exists) and ensures that there exists at most one entry per PersistenceId value. (akkadotnet#3468)
When deleting persistence journal entries through the common sql implementation also delete the entries in the metadata table. This solves #3205 (violation of primary key constraint when the value already exists) and ensures that there exists at most one entry per PersistenceId value.
Added @ in front of the parameters for the DeleteBatchSql command to be in line with the other usage of AddParameter.