Issue Description
With plan:
{"@type":"destroy","object":"MemoryLookupKey","value":{"namespace":"spam-traps"}}
{"@type":"upsert","matchOn":["namespace","key"],"object":"MemoryLookupKey","value":{"lk-a":{"key":"[email protected]","namespace":"spam-traps"}}}
{"@type":"upsert","matchOn":["namespace","key"],"object":"MemoryLookupKey","value":{"lk-a":{"key":"[email protected]","namespace":"spam-traps"}}}
! stalwart-cli apply --file plan.ndjson
Plan: 1 destroy, 0 update, 0 create, 2 upsert, 0 reconcile (2 objects)
✓ destroyed MemoryLookupKey (1)
✓ upserted MemoryLookupKey (1)
✗ upsert MemoryLookupKey: MemoryLookupKey: create failed for lk-a (operation #3): error: primaryKeyViolation | Properties: namespace | Object id: MemoryLookupKey#i2i9w2lsbkqa
Done: 1 destroyed, 0 updated, 1 created (1 failed)
error: MemoryLookupKey: create failed for lk-a (operation #3): error: primaryKeyViolation | Properties: namespace | Object id: MemoryLookupKey#i2i9w2lsbkqa
same happens when there is only a single upsert, and multiple applies happen, two upserts in a single plan is just for reference.
primaryKeyViolation is an error that occurs when upsert tries to create same object multiple times from what I understood, but, upsert shouldn’t create it multiple times, that is why upsert exists, to not error like that…
For other objects upsert works, I had no issues, but for this one doesn’t for some reason.
Expected Behavior
upsert should be Idempotent
Stalwart Version
v0.16.x
Installation Method
NixOS
Database Backend
RocksDB
Blob Storage
RocksDB
Search Engine
Internal
Directory Backend
Internal
I have reviewed the documentation and FAQ and confirm that my issue is NOT addressed there.
on
I have searched this support forum (open and closed topics) and confirm this is not a duplicate.
on
I understand that topics in this category are triaged by a bot first but a human reply will follow up. If I’d prefer a human-only reply, I’ll add the no-ai tag to my topic.
on