A concurrent duplicate write on a relational engine answers 409, not 500 #319
No reviewers
Labels
No labels
agent
api-regen
agent
architect
agent
coder
agent
console-coder
agent
docs-writer
agent
mechanic
agent
protocol-coder
agent
storage-coder
area/api
area/ci
area/console
area/dhcp
area/dns
area/docs
area/packaging
area/process
area/storage
area/windows
kind
bug
kind
chore
kind
docs
kind
epic
kind
feature
kind
performance
kind
security
kind
test
priority
high
priority
low
priority
medium
resolution
duplicate
resolution
not-a-bug
resolution
wontfix
status
blocked
status
in-progress
status
needs-decision
status
needs-design
status
ready
theme
ad-samba-dns
theme
alternatives-benchmark
theme
console-toolchain
theme
later
theme
parity-devices
theme
parity-query
theme
post-release-fixes
theme
tracker-setup
theme
valkey
theme
windows-installer
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
lantea-one/ninlil!319
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/311-relational-unique-conflict"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
A write that breaks a unique index on SQLite, PostgreSQL, MySQL or SQL Server now answers 409 instead of 500, as MongoDB does since #60. Two concurrent writes both pass a controller's duplicate pre-check; the second used to fail inside SaveChanges with an unmapped
DbUpdateException.EntityFrameworkUnitOfWork.SaveChangesAsynccatches aDbUpdateExceptionwhose inner driver exception is a unique or primary-key violation (UniqueConstraintViolation.IsUniqueViolation): SQLite 19 with extended 2067/1555, PostgreSQL SQLSTATE 23505, MySQL (MySqlConnector) 1062, SQL Server 2601/2627. It logs the driver error at Warning ("A write was rejected by a unique index: …", naming the constraint where the driver gives it) and throwsConflictException, which the controllers answer as 409. Every otherDbUpdateExceptionis rethrown unchanged.IUnitOfWork; no code catchesDbUpdateException, so no handled path changes. BulkExecute*/raw SQL statements do not insert and cannot hit a unique violation.Tests (
UniqueConflictTestsBase, one subclass per engine, Docker ones carryRequiresDocker): a second insert of the same option tag on one scope that bypasses the pre-check throwsConflictExceptionand logs a Warning (red on develop on all four engines); a foreign-key violation still throwsDbUpdateExceptionon all four. Integration.Tests with Docker 515 passed; Web.Tests 2122 (without Docker); Cluster 40 and ClusterSync 47; build 0 warnings; csharpier clean.Closes #311
🤖 Generated with Claude Code
https://claude.ai/code/session_01T33E3pmQvqkTriyQUMNUTK