How yandex/odyssey works
Odyssey is a multithreaded PostgreSQL connection pooler and request router. Its principal workflow accepts client connections, authenticates them, proxies requests to PostgreSQL through shared pools, and returns backend connections for reuse; transaction tracking supports cancellation and rollback after unexpected disconnects. The README documents these runtime capabilities, while sampled source also confirms an audit callback module and a Prometheus exporter. Most core routing, authentication, and worker implementations were not excerpted, so their detailed call relationships are not asserted.
Main entry points: wchar.c Multibyte support · worker.c Worker processing · shared_pool.c Shared connection pools · reset.c Transaction recovery
Components 27
Connection runtime
- Client frontend
sources/frontend.c - Worker processing
sources/worker.c - Request routing
sources/router.c - Shared connection pools
sources/shared_pool.c - Transaction recovery
sources/reset.c - Pool configuration
sources/cfg/model.c - Query handling
sources/query.c - SQL parsing
sources/sql/full/parser.c
Authentication and security
- Client authentication
sources/auth.c - Auth integrations
sources/external_auth.c - TLS support
sources/tls.c
Operations and integrations
- Audit callbacks
modules/audit_module.c - Prometheus exporter
prometheus/exporter/exporter.go - Module API
sources/include/module.h - Audit module declarations
modules/audit_module.h
Text processing
- SASLprep
sources/common/saslprep.c - Multibyte support
sources/common/wchar.c - Unicode tables
sources/include/common/unicode_nonspacing_table.h - Unicode width table
sources/include/common/unicode_east_asian_fw_table.h - Encoding definitions
sources/include/mb/pg_wchar.h - Common C definitions
sources/include/od_c.h - PostgreSQL compatibility
sources/include/pg_compat.h - ASCII utilities
sources/include/utils/ascii.h - SIMD primitives
sources/include/port/simd.h
Other components
- PostgreSQL clients
- PostgreSQL servers
- Prometheus
Connections 22
- PostgreSQL clients → Client frontend: connects
README.md - Worker processing → Client authentication: authenticates
README.md - Worker processing → Request routing: proxies requests
README.md - Request routing → PostgreSQL servers: forwards requests
README.md - Worker processing → Shared connection pools: shares pools
README.md - Transaction recovery → Shared connection pools: returns connection
README.md - Transaction recovery → PostgreSQL servers: cancels or rolls back
README.md - Pool configuration → Shared connection pools: configures pools
- Client authentication → Auth integrations: delegates authentication
- Client frontend → TLS support: secures connection
- Prometheus exporter → PostgreSQL servers: queries Odyssey
prometheus/exporter/exporter.go - Prometheus exporter → Prometheus: serves metrics
prometheus/exporter/exporter.go - Query handling → SQL parsing: parses SQL
- Audit module declarations → Module API: includes API
modules/audit_module.h - Audit callbacks → Audit module declarations: implements callbacks
modules/audit_module.c - SASLprep → Multibyte support: normalizes text
- Multibyte support → Unicode tables: uses character ranges
sources/common/wchar.c - Multibyte support → Unicode width table: uses width ranges
sources/common/wchar.c - Multibyte support → Encoding definitions: uses encoding definitions
sources/common/wchar.c - Multibyte support → Common C definitions: uses definitions
sources/common/wchar.c - Multibyte support → PostgreSQL compatibility: uses compatibility definitions
sources/common/wchar.c - ASCII utilities → SIMD primitives: uses primitives
sources/include/utils/ascii.h