linagora / james-project

Mirror of Apache James Project
Apache License 2.0
70 stars 63 forks source link

[Postgres] Make insert operations in postgres implementation similar to cassandra impl's #5210

Open hungphan227 opened 1 month ago

hungphan227 commented 1 month ago

Currently almost all insert operations in Cassandra implementation act like upsert. Meanwhile, insert operations in Postgres implementation does not allow inserting duplicate key. Probably we should make insert operations in postgres implementation similar to cassandra impl's so that behavior of postgres impl and cassandra impl are the same.

Few concerns:

hungphan227 commented 1 month ago

I have tested the performance of "on conflict do nothing" and it is the same as normal insert. IMO we can use "on conflict do nothing" to make postgres impl's behavior similar to cassandra impl's

Arsnael commented 1 month ago

I disagree honestly. I feel like we have more of a concurrency problem in our tests on tmail. Ignoring a duplicate instead of reporting it as an error isn't the solution I think

chibenwa commented 1 month ago

Indepotence most of the time makes sense except in very specific places...

Arsnael commented 1 month ago

Regarding the states for email and mailbox changes, I don't think it does..?

But for some other tables it might make sense yes