You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[#23648] YSQL: Intoduce shared data between pggate in parallel leader and workers
Summary:
Current diff is a preparation diff. The fix for the #23648 issue will be landed separately.
The fix of the #23648 issue is required all perform operations has unique serial number. In this case local t-server will be able to wait/reorder operations before execution in case `op_2` will arrive earlier than `op_1`.
The `uint64_t` counter is used to provider serial number for each new perform operation.
But because postgres's background workers uses same `PgClientSession` object (pg worker process uses same `session_id` as parallel leader process) it is required to share this counter among multiple postgres process.
Postgres has the `PROC` structure which is assigned to each process. This structure is stored in shared memory. It is reasonable to place perform serial number counter in this structure.
This diff reserves some amount of raw data inside `PROC` structure (i.e. data plcaceholder) and provide access to this data to `pggate` during initialization.
`pggate` constructs required objects in this raw data and use them as regular C++ structures (i.e. `std::atomic<uint64_t>` for perform serial number counter instead of `pg_atomic_uint64` or similar).
**Note:**
- the diff changes the time when pggate object is destroyed (see the call of `YBOnPostgresBackendShutdown()` function). Because pggate uses data in `PROC` it must be destroyed before this structure will be cleared
- the diff restores original postgres's interface for the `InitPostgres` process (i.e. `session_id` argument is removed).
Upgrade/Rollback safety:
The `pg_client.proto` is used for communication between pggate and local t-server only. So any modification of the this file are upgrade/rollback safe.
Jira: DB-12559
Test Plan: Jenkins
Reviewers: amartsinchyk, pjain, kramanathan, sergei, jason
Reviewed By: amartsinchyk
Subscribers: jason, yql
Tags: #jenkins-ready
Differential Revision: https://phorge.dev.yugabyte.com/D46542
0 commit comments