Контракты ресурсов (fail-closed)
AngaraBase ограничивает ресурсы по принципу restrictive-by-default: при достижении границы запрос отклоняется (или отменяется) детерминированным SQLSTATE, а не деградирует молча. Логика повторов на клиенте и правила алертинга должны строиться по этой таблице.
Границы ресурсов
| Граница | SQLSTATE | Условие | Параметр | Метрика | Wait-event |
|---|---|---|---|---|---|
| Connection limit Stable | 53000 | insufficient_resources | max_connections | angarabase_pgwire_pool_rejected_total | — |
| QoS admission (concurrent queries) Baseline | 53600 | qos_queue_full | — | angarabase_qos_rejected_critical_total | qos_queue |
| Per-transaction write set Baseline | 54023 | configuration_limit_exceeded | txn.max_write_set_bytes | — | — |
| Buffer-pool / commit backpressure Baseline | 53400 | insufficient_resources | buffer_pool.backpressure.mode | angarabase_buffer_pool_backpressure_events_total | buffer_pool_eviction |
| Query memory limit Baseline | 53400 | insufficient_resources | execution.query_memory_limit_mb | — | — |
| Statement timeout Stable | 57014 | query_canceled | statement_timeout | — | — |
| Lock wait timeout Stable | 55P03 | lock_not_available | lock_timeout | angarabase_lock_timeout_total | — |
| Idle-in-transaction timeout Stable | 57P01 | idle_in_transaction_session_timeout | — | angarabase_idle_txn_killed_total | — |
| Snapshot too old (UNDO budget) Baseline | 72000 | snapshot_too_old | — | — | — |
| Disk full Stable | 53100 | disk_full | — | — | — |
Поведение и реакция клиента
Connection limit — 53000
Reject the new connection once max_connections is reached; established sessions are unaffected.
Реакция клиента: Back off and retry; surface the signal to the connection pool / load balancer.
QoS admission (concurrent queries) — 53600
Reject when the per-ServiceLevel concurrency/queue cap is exceeded rather than queueing unboundedly.
Реакция клиента: Exponential back-off with jitter; lower-priority work is shed first. Distinct from 53000 so QoS rejects are safe to retry.
Per-transaction write set — 54023
Reject the DML once the per-transaction write set exceeds its byte/page budget; the transaction must roll back.
Реакция клиента: Roll back and retry with a smaller write batch, or raise txn.max_write_set_bytes / txn.max_write_set_pages.
Buffer-pool / commit backpressure — 53400
Park writers on buffer-pool eviction; once the uncommitted-pages / WAL-queue hard limit is hit, reject the commit with 53400 instead of unbounded buffering.
Реакция клиента: Reduce write batch size and retry after back-off; treat as a capacity signal for the operator. 53400 is transient (retryable).
Query memory limit — 53400
Spill operators (hash join, aggregation) to disk under memory pressure; reject with 53400 only when a spill partition cannot be admitted.
Реакция клиента: Reduce result/intermediate size (add predicates, lower batch size) or raise execution.query_memory_limit_mb.
Statement timeout — 57014
Cancel the running statement once statement_timeout elapses; partial results are discarded and the transaction must roll back.
Реакция клиента: Roll back; review the query plan before retrying the same statement.
Lock wait timeout — 55P03
Abort the lock acquisition once lock_timeout elapses (wait events: row_lock / page_lock / table_lock / transaction_lock).
Реакция клиента: Retry after back-off; reduce contention or shorten the transaction scope.
Idle-in-transaction timeout — 57P01
Terminate a session left idle inside an open transaction beyond the configured timeout.
Реакция клиента: Commit or roll back promptly; do not leave a transaction open while idle.
Snapshot too old (UNDO budget) — 72000
Force-close a reader whose snapshot needs UNDO records already purged under table-budget pressure.
Реакция клиента: Retry the whole transaction from the start; shorten long-running readers.
Disk full — 53100
Reject writes that would exceed available disk; fail-closed with no silent data loss.
Реакция клиента: Free space or extend storage; the write cannot proceed until capacity is available.