Informatievlaanderen / VSDS-LDESServer4J

Linked Data Event Streams Server for Java
https://informatievlaanderen.github.io/VSDS-LDESServer4J
European Union Public License 1.2
10 stars 10 forks source link

Performance improvement: check unique constraints in db commit #1037

Closed sandervd closed 10 months ago

sandervd commented 10 months ago

Is your feature request related to a problem? Please describe. Checking the uniqueness of a field in code is not performant, and doesn't work in a multithreaded system. As the select and insert are done outside of a transactional context, there is no guarantee that the database is in the same state when the member is inserted as how it was when the constraint was checked. Also, checking the uniqueness requires a round trip to the db, which can be avoided.

Describe the solution you'd like Determine the uniqueness by putting a constraint on the db, and catch the non-unique exception.

Describe alternatives you've considered Keep as-is, as concurrency issue is theoretical. Performance issue is real though.

Additional context image

Tomvbe commented 10 months ago

This is a duplicate of https://github.com/Informatievlaanderen/VSDS-LDESServer4J/issues/998. We already fixed this in https://github.com/Informatievlaanderen/VSDS-LDESServer4J/pull/1004.

jeflaenen commented 10 months ago

Therefor, closed!