mirror of
https://github.com/postgres/postgres.git
synced 2025-11-07 19:06:32 +03:00
Before this patch, streaming replication would refuse to start replicating if the timeline in the primary doesn't exactly match the standby. The situation where it doesn't match is when you have a master, and two standbys, and you promote one of the standbys to become new master. Promoting bumps up the timeline ID, and after that bump, the other standby would refuse to continue. There's significantly more timeline related logic in streaming replication now. First of all, when a standby connects to primary, it will ask the primary for any timeline history files that are missing from the standby. The missing files are sent using a new replication command TIMELINE_HISTORY, and stored in standby's pg_xlog directory. Using the timeline history files, the standby can follow the latest timeline present in the primary (recovery_target_timeline='latest'), just as it can follow new timelines appearing in an archive directory. START_REPLICATION now takes a TIMELINE parameter, to specify exactly which timeline to stream WAL from. This allows the standby to request the primary to send over WAL that precedes the promotion. The replication protocol is changed slightly (in a backwards-compatible way although there's little hope of streaming replication working across major versions anyway), to allow replication to stop when the end of timeline reached, putting the walsender back into accepting a replication command. Many thanks to Amit Kapila for testing and reviewing various versions of this patch.
<!-- doc/src/sgml/README.links --> Linking within SGML documents can be confusing, so here is a summary: Intra-document Linking ---------------------- <xref> use to get chapter/section # from the title of the target link, or xreflabel if defined at the target; has no close tag http://www.oasis-open.org/docbook/documentation/reference/html/xref.html <link> use to supply text for the link, requires </link> http://www.oasis-open.org/docbook/documentation/reference/html/link.html linkend= controls the target of the link/xref, required endterm= for <xref>, allows the text of the link/xref to be taken from a different link target title External Linking ---------------- <ulink> like <link>, but uses a URL (not a document target); requires </ulink>; if no text is specified, the URL appears as the link text http://www.oasis-open.org/docbook/documentation/reference/html/ulink.html url= used by <ulink> to specify the URL, required Guidelines ---------- o If you want to supply text, use <link>, else <xref> o Do not use text with <ulink> so the URL appears in printed output o Specific nouns like GUC variables, SQL commands, and contrib modules usually have xreflabels