|
204 | 204 | target table can have additional columns not provided by the published
|
205 | 205 | table. Those will be filled with their default values.
|
206 | 206 | </para>
|
| 207 | + |
| 208 | + <sect2 id="logical-replication-subscription-slot"> |
| 209 | + <title>Replication Slot Management</title> |
| 210 | + |
| 211 | + <para> |
| 212 | + As mentioned earlier, each (active) subscription receives changes from a |
| 213 | + replication slot on the remote (publishing) side. Normally, the remote |
| 214 | + replication slot is created automatically when the subscription is created |
| 215 | + using <command>CREATE SUBSCRIPTION</command> and it is dropped |
| 216 | + automatically when the subscription is dropped using <command>DROP |
| 217 | + SUBSCRIPTION</command>. In some situations, however, it can be useful or |
| 218 | + necessary to manipulate the subscription and the underlying replication |
| 219 | + slot separately. Here are some scenarios: |
| 220 | + |
| 221 | + <itemizedlist> |
| 222 | + <listitem> |
| 223 | + <para> |
| 224 | + When creating a subscription, the replication slot already exists. In |
| 225 | + that case, the subscription can be created using the <literal>NOCREATE |
| 226 | + SLOT</literal> option to associate with the existing slot. |
| 227 | + </para> |
| 228 | + </listitem> |
| 229 | + |
| 230 | + <listitem> |
| 231 | + <para> |
| 232 | + When creating a subscription, the remote host is not reachable or in an |
| 233 | + unclear state. In that case, the subscription can be created using |
| 234 | + the <literal>NOCONNECT</literal> option. The remote host will then not |
| 235 | + be contacted at all. This is what <application>pg_dump</application> |
| 236 | + uses. The remote replication slot will then have to be created |
| 237 | + manually before the subscription can be activated. |
| 238 | + </para> |
| 239 | + </listitem> |
| 240 | + |
| 241 | + <listitem> |
| 242 | + <para> |
| 243 | + When dropping a subscription, the replication slot should be kept. |
| 244 | + This could be useful when the subscriber database is being moved to a |
| 245 | + different host and will be activated from there. In that case, |
| 246 | + disassociate the slot from the subscription using <command>ALTER |
| 247 | + SUBSCRIPTION</command> before attempting to drop the subscription. |
| 248 | + </para> |
| 249 | + </listitem> |
| 250 | + |
| 251 | + <listitem> |
| 252 | + <para> |
| 253 | + When dropping a subscription, the remote host is not reachable. In |
| 254 | + that case, disassociate the slot from the subscription |
| 255 | + using <command>ALTER SUBSCRIPTION</command> before attempting to drop |
| 256 | + the subscription. If the remote database instance no longer exists, no |
| 257 | + further action is then necessary. If, however, the remote database |
| 258 | + instance is just unreachable, the replication slot should then be |
| 259 | + dropped manually; otherwise it would continue to reserve WAL and might |
| 260 | + eventually cause the disk to fill up. Such cases should be carefully |
| 261 | + investigated. |
| 262 | + </para> |
| 263 | + </listitem> |
| 264 | + </itemizedlist> |
| 265 | + </para> |
| 266 | + </sect2> |
207 | 267 | </sect1>
|
208 | 268 |
|
209 | 269 | <sect1 id="logical-replication-conflicts">
|
|
0 commit comments