-
Notifications
You must be signed in to change notification settings - Fork 242
Implement and use UpsertOptimization for groups #513
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
Implement and use UpsertOptimization for groups #513
Conversation
Signed-off-by: Peter Broadhurst <[email protected]>
|
Moving back to draft until we have a good perf run |
|
Seeing multiple errors are startup, no messages being confirmed: |
|
That's a shame, so it looks like PSQL was aborting the transaction on our behalf. So this approach does not allow concurrent insert. |
|
Checking version of postgres in the test, due to this fixed in 9.5: https://www.symmetricds.org/issues/view.php?id=4823#bugnotes |
|
Ah - need to explicitly add |
… with PSQL Signed-off-by: Peter Broadhurst <[email protected]>
|
Got a little complicate, but I believe I'm there 🤞 - I've only changed Group as I wanted to limit the scope of the change. However, this could apply to other upsert optimization cases too. |
Codecov Report
@@ Coverage Diff @@
## main #513 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 275 275
Lines 15788 15812 +24
=========================================
+ Hits 15788 15812 +24
Continue to review full report at Codecov.
|
|
Now only seeing one error on startup. Appears to be an edge case where there is an empty table: |
|
Thanks @eberger727 - this is actually exactly what I hoped for. It proves the fix. This error didn't abort the TX - we can see After it gets that INSERT failure it falls back to SELECT: ... and then update: |
Signed-off-by: Peter Broadhurst <[email protected]>
Signed-off-by: Peter Broadhurst <[email protected]>
Proposed fix for #512
By implementing the
UpsertOptimizationpattern for Groups, it lets us stateUpsertOptimizationNeweverywhere we're currently just trying to do a query-then-insert approach.UpsertOptimizationNewresults in an attempt-insert, then attempt-update approach - which should handle+swallow a duplicate key exception (rather than rolling back the TX).