mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 16:04:50 +03:00
38452eacf5
Prevent inbound data migration from waiting behind concurrent PostgreSQL node/client writes: acquire the complete write-table set with EXCLUSIVE NOWAIT before any DML, use ACCESS EXCLUSIVE only for tables requiring legacy DDL, and surface SQLSTATE 55P03 as retryable contention. Plain SELECT remains compatible with the normal lock set. Commit inbound normalization, orphan traffic cleanup and Vision flow repair together; propagate failures to CLI and restore callers and record transaction duration. Keep the reopened database pool private during host-settings restoration and inbound migration, with bounded retries of lock acquisition. Remove duplicate post-start migration and fail installation/update before service startup when migration fails. Preserve the stopped/disabled service unit so systemd and OpenRC updates can be retried; replace the unit only after successful migration. Verified reviewed head56e0372a09: all 12 CI jobs passed, including PostgreSQL contention/reader/private-pool regressions and Go/race. Detached test merge against maind6afe0ef3cwas conflict-free and git diff --check passed. Integrated local targeted tests passed for private pool, telemetry migration, SQLite rollback, and shared descendant selection (all eight subcases); PostgreSQL-specific tests skipped locally and verified in PR CI. Full integrated CI and live service-manager testing were not rerun. This is a scoped fix, not an atomic whole-database restore or proof of resolution of the historical 41-second SQL tail. Persistent external writers or post-import migration errors can still leave an already committed import requiring recovery; broader schema/restore maintenance coordination and writer occupancy investigation remain open. Review: https://github.com/MHSanaei/3x-ui/pull/7321#issuecomment-7364094359 Refs #7305 (keep open).