Files
mirror-3x-ui/internal/database/model/node_pending_client_delete.go
T
Hamed 2e0c751a80 fix(nodes): order client pushes outside inbound mutation locks (#7314)
Release inbound mutation locks after durable local commit and reserve conflicting remote dispatch turns in writer commit order. Allow independent inbounds to progress concurrently while reconciliation and full client deletes retain node-wide ordering. Bound queue waits and live batches separately, advance dirty revisions strictly, and invalidate only affected remote fingerprints.

Persist permanent-delete intents transactionally per node/email and replay bounded pages during reconciliation. Match acknowledgements to the queued generation and retain failed/ambiguous deliveries. Supersede pending deletes only when the client is desired on the target node, so recreation on another node does not leave an old orphan record. Preserve pending rows during database migration and accept legacy backups without the outbox table.

Validation: reproduced the cross-node orphan on the previous head; fixed regression passed locally on Lenovo with focused SQLite (9/9) and PostgreSQL 16 (7/7). All 12 CI jobs passed on 5459316fbd (run 46862646487), including race, PostgreSQL migration and durable-first, and node/Xray E2E. PostgreSQL logs confirm all seven ordering tests including cross-node recreation, lost acknowledgement and bulk recovery after database reopen. Branch is up to date with main. No measured production latency claim; requests still wait for their own bounded ordered remote apply. Coordinate overlapping #7308 before its integration.

Fixes #7304.
2026-12-02 14:23:45 +03:30

11 lines
482 B
Go

package model
// NodePendingClientDelete tracks a permanent delete that the node has not confirmed.
type NodePendingClientDelete struct {
NodeId int `gorm:"primaryKey;autoIncrement:false;index:idx_node_delete_order,priority:1"`
Email string `gorm:"primaryKey;index:idx_node_delete_order,priority:3"`
ClientId int `gorm:"not null"`
Generation string `gorm:"not null"`
LastAttemptAt int64 `gorm:"not null;index:idx_node_delete_order,priority:2"`
}