Re: [HACKERS] make async slave to wait for lsn to be replayed
| От | Kartyshov Ivan |
|---|---|
| Тема | Re: [HACKERS] make async slave to wait for lsn to be replayed |
| Дата | |
| Msg-id | b460b4b6aeca68fbe2b0c705d82bb60e@postgrespro.ru обсуждение исходный текст |
| Ответ на | Re: [HACKERS] make async slave to wait for lsn to be replayed (Alexander Korotkov <aekorotkov@gmail.com>) |
| Ответы |
Re: [HACKERS] make async slave to wait for lsn to be replayed
|
| Список | pgsql-hackers |
Intro ========== The main purpose of the feature is to achieve read-your-writes-consistency, while using async replica for reads and primary for writes. In that case lsn of last modification is stored inside application. We cannot store this lsn inside database, since reads are distributed across all replicas and primary. Procedure style implementation ========== https://www.postgresql.org/message-id/27171.1586439221%40sss.pgh.pa.us https://www.postgresql.org/message-id/20210121.173009.235021120161403875.horikyota.ntt%40gmail.com CALL pg_wait_lsn(‘LSN’, timeout); Examples ========== primary standby ------- -------- postgresql.conf recovery_min_apply_delay = 10s CREATE TABLE tbl AS SELECT generate_series(1,10) AS a; INSERT INTO tbl VALUES (generate_series(11, 20)); SELECT pg_current_wal_lsn(); CALL pg_wait_lsn('0/3002AE8', 10000); BEGIN; SELECT * FROM tbl; // read fresh insertions COMMIT; Fixed and ready to review. -- Ivan Kartyshov Postgres Professional: www.postgrespro.com
Вложения
В списке pgsql-hackers по дате отправления: