{"Entry":{"collection":"waitevent","key":"lwlock/SyncRep","name":"SyncRep","aliases":["SyncRep","SyncRepLock"],"metadata":{"aliases":["SyncRep","SyncRepLock"],"changed_in":["10","13"],"changes":[{"from":"9.6","moved":{"from":"LWLockNamed","to":"LWLock"},"renamed":null,"reworded":null,"status":"changed","to":"10"},{"from":"12","moved":null,"renamed":{"from":"SyncRepLock","to":"SyncRep"},"reworded":{"from":"Waiting to read or update information about synchronous replicas.","to":"Waiting to read or update information about the state of synchronous replication."},"status":"changed","to":"13"}],"content_hash":"2a4832fd045082820d42e40efaa15ef2beab89e4f16316b6315db1c88aa995ff","dossier":{"actions":{"en":["Separate LWLock/SyncRep from IPC/SyncRep and replication-lag waits.","Inspect synchronous standby health, sender churn, and commit rate.","Stabilize replication and smooth commit bursts; change durability policy only with explicit incident authority."],"zh":["区分 LWLock/SyncRep、IPC/SyncRep 与复制延迟等待。","检查同步备库健康度、sender 抖动与提交速率。","稳定复制并平滑提交突发；只有获得明确事故授权时才改变持久性策略。"]},"diagnostic_sql":[{"id":"sessions","min_version":"13","sql":"SELECT pid, backend_type, usename, datname, application_name,\n       state, now() - query_start AS query_age,\n       now() - xact_start AS xact_age,\n       wait_event_type, wait_event,\n       pg_blocking_pids(pid) AS blocking_pids,\n       left(query, 160) AS query\nFROM pg_stat_activity\nWHERE wait_event_type = 'LWLock'\n  AND wait_event = 'SyncRep'\nORDER BY query_age DESC NULLS LAST;","title":"Sessions waiting on LWLock/SyncRep","title_zh":"正在等待 LWLock/SyncRep 的会话"},{"id":"cohort","min_version":"13","sql":"SELECT wait_event, count(*) AS waiting_sessions,\n       count(*) FILTER (WHERE state = 'active') AS active_waiters,\n       max(now() - query_start) AS oldest_query\nFROM pg_stat_activity\nWHERE wait_event_type = 'LWLock'\nGROUP BY wait_event\nORDER BY waiting_sessions DESC, wait_event;","title":"Current LWLock cohort","title_zh":"当前 LWLock 等待分布"},{"id":"lock_objects","min_version":"13","sql":"SELECT a.pid, l.locktype, l.mode, l.granted, l.fastpath,\n       d.datname, n.nspname, c.relname,\n       l.page, l.tuple, l.virtualxid, l.transactionid,\n       l.classid, l.objid, l.objsubid\nFROM pg_stat_activity AS a\nLEFT JOIN pg_locks AS l ON l.pid = a.pid\nLEFT JOIN pg_database AS d ON d.oid = l.database\nLEFT JOIN pg_class AS c\n  ON c.oid = l.relation\n AND l.database = (\n       SELECT oid FROM pg_database WHERE datname = current_database()\n     )\nLEFT JOIN pg_namespace AS n ON n.oid = c.relnamespace\nWHERE a.wait_event_type = 'LWLock'\n  AND a.wait_event = 'SyncRep'\nORDER BY a.pid, l.granted, l.locktype, l.mode;","title":"Lock and relation context for these sessions","title_zh":"这些会话的锁与关系上下文"}],"emission":{"status":"active","verified_release":"18.6"},"gucs":["synchronous_standby_names","synchronous_commit","wal_sender_timeout"],"incident_pattern":{"en":"A standby flaps while a burst of synchronous committers repeatedly enters and leaves the wait queue, making queue coordination visible as LWLock/SyncRep.","zh":"备库反复抖动，大量同步提交者频繁进出等待队列，使队列协调本身表现为 LWLock/SyncRep。"},"mechanism":{"en":"SyncRepLock protects synchronous-replication queues and shared sender state. Committers enqueue or inspect their wait position while WAL senders update which LSNs the configured synchronous standbys have acknowledged.","zh":"SyncRepLock 保护同步复制队列与共享 sender 状态。提交会话入队或检查等待位置，WAL sender 则更新已被同步备库确认的 LSN。"},"metrics":["waiting_sessions","wait_event_share","replication_flush_lag","commit_latency"],"normal":{"en":"Small bursts occur as synchronous commits queue and WAL senders publish acknowledgements.","zh":"同步提交排队、WAL sender 发布确认位置时会有小规模突发。"},"official_descriptions":{"13":"Waiting to read or update information about the state of synchronous replication.","14":"Waiting to read or update information about the state of synchronous replication.","15":"Waiting to read or update information about the state of synchronous replication.","16":"Waiting to read or update information about the state of synchronous replication.","17":"Waiting to read or update information about the state of synchronous replication","18":"Waiting to read or update information about the state of synchronous replication"},"record_kind":"event","source_locations":[{"commit":"724edf9bde9d356724ad384a2e196edc3c9f80f7","excerpt":"LWLockAcquire(SyncRepLock, LW_EXCLUSIVE);","grep_pattern":"SyncRep","grep_verified":true,"kind":"resource_path","line":192,"major":18,"path":"src/backend/replication/syncrep.c","status":"dynamic_trigger","symbol":"SyncRep","tag":"REL_18_6","url":"https://github.com/postgres/postgres/blob/REL_18_6/src/backend/replication/syncrep.c#L192","version":"18.6"},{"commit":"724edf9bde9d356724ad384a2e196edc3c9f80f7","excerpt":"pgstat_report_wait_start(PG_WAIT_LWLOCK | lock-\u003etranche);","grep_pattern":"pgstat_report_wait_start","grep_verified":true,"kind":"generic_reporter","line":739,"major":18,"path":"src/backend/storage/lmgr/lwlock.c","status":"dynamic_trigger","symbol":"pgstat_report_wait_start","tag":"REL_18_6","url":"https://github.com/postgres/postgres/blob/REL_18_6/src/backend/storage/lmgr/lwlock.c#L739","version":"18.6"},{"commit":"724edf9bde9d356724ad384a2e196edc3c9f80f7","excerpt":"SyncRep\t\"Waiting to read or update information about the state of synchronous replication.\"","grep_pattern":"SyncRep","grep_verified":true,"kind":"catalog_definition","line":337,"major":18,"path":"src/backend/utils/activity/wait_event_names.txt","status":"dynamic_trigger","symbol":"SyncRep","tag":"REL_18_6","url":"https://github.com/postgres/postgres/blob/REL_18_6/src/backend/utils/activity/wait_event_names.txt#L337","version":"18.6"}],"source_status":"dynamic_trigger","trouble":{"en":"Sustained SyncRep LWLock contention is different from waiting for a standby acknowledgement: it means queue/state coordination itself is hot, usually under extreme commit concurrency or sender churn.","zh":"持续的 SyncRep LWLock 竞争不同于等待备库确认：它表示队列/状态协调本身过热，通常发生在极高提交并发或 sender 抖动时。"}},"first_version":"9.6","has_dossier":true,"imported_at":"2026-09-27T17:57:33.063277+08:00","key":"lwlock/syncrep","last_version":"20","name":"SyncRep","position":277,"present_in":["9.6","10","11","12","13","14","15","16","17","18","19","20"],"slug":"sync-rep","source_rev":"english-manuals:e59907030f0007819403b9f7d8b3672c055f930597e19699f382c1215519ec30","summary":"Waiting to read or update information about the state of synchronous replication.","summary_zh":"","type":"LWLock","type_slug":"lwlock","type_variants":["LWLock","LWLockNamed"]}},"Definition":{"Collection":"waitevent","Key":"lwlock/SyncRep","SourceDatabase":"center","Version":"18","SourceTable":"waitevent","SourceKey":"lwlock/syncrep","SourceRevision":"english-manuals:e59907030f0007819403b9f7d8b3672c055f930597e19699f382c1215519ec30","Facts":{"description":"Waiting to read or update information about the state of synchronous replication.","description_zh":"","doc":{"anchor":"WAIT-EVENT-LWLOCK-TABLE","file":"monitoring-stats.html","lang":"en","sha256":"aa979eed08627fbf715a9d792094a162a73671db5af810f3ab2aad3e073d5722","slug":"18"},"lang":"en","name":"SyncRep","source":"english-manual","type":"LWLock","zh_from":""},"ManualEvidence":{"doc":{"anchor":"WAIT-EVENT-LWLOCK-TABLE","file":"monitoring-stats.html","lang":"en","sha256":"aa979eed08627fbf715a9d792094a162a73671db5af810f3ab2aad3e073d5722","slug":"18"}},"MeasuredEvidence":{}},"Text":{"Collection":"waitevent","Key":"lwlock/SyncRep","SourceDatabase":"pgweb","Version":"18","Locale":"zh-Hans","Title":"SyncRep","Summary":"等待读取或更新有关同步复制状态的信息。","BodyHTML":"\u003cp\u003e等待读取或更新有关同步复制状态的信息。\u003c/p\u003e","SourceRevision":"2026-08-31@34d13c8","ContentHash":"e66fc277b2be23526b466e3e10879462fe698085881bf491bd8ee99e52339a26","Payload":{"description_zh":"等待读取或更新有关同步复制状态的信息。","zh_from":"doc"}},"RequestedLocale":"zh-Hans","Fallback":false,"Versions":["10","11","12","13","14","15","16","17","18","19","20","9.6"],"Locales":["en","zh-Hans"],"Signatures":null,"Spellings":null,"SQLState":null,"Evidence":null}
