codekingpro/portable-devtools
115k
1<?xml version="1.0" encoding="UTF-8" standalone="no"?>2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Chapter 51. Archive Modules</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="replication-origins.html" title="Chapter 50. Replication Progress Tracking" /><link rel="next" href="archive-module-init.html" title="51.1. Initialization Functions" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">Chapter 51. Archive Modules</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="replication-origins.html" title="Chapter 50. Replication Progress Tracking">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="server-programming.html" title="Part V. Server Programming">Up</a></td><th width="60%" align="center">Part V. Server Programming</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 16.3 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="archive-module-init.html" title="51.1. Initialization Functions">Next</a></td></tr></table><hr /></div><div class="chapter" id="ARCHIVE-MODULES"><div class="titlepage"><div><div><h2 class="title">Chapter 51. Archive Modules</h2></div></div></div><div class="toc"><p><strong>Table of Contents</strong></p><dl class="toc"><dt><span class="sect1"><a href="archive-module-init.html">51.1. Initialization Functions</a></span></dt><dt><span class="sect1"><a href="archive-module-callbacks.html">51.2. Archive Module Callbacks</a></span></dt><dd><dl><dt><span class="sect2"><a href="archive-module-callbacks.html#ARCHIVE-MODULE-STARTUP">51.2.1. Startup Callback</a></span></dt><dt><span class="sect2"><a href="archive-module-callbacks.html#ARCHIVE-MODULE-CHECK">51.2.2. Check Callback</a></span></dt><dt><span class="sect2"><a href="archive-module-callbacks.html#ARCHIVE-MODULE-ARCHIVE">51.2.3. Archive Callback</a></span></dt><dt><span class="sect2"><a href="archive-module-callbacks.html#ARCHIVE-MODULE-SHUTDOWN">51.2.4. Shutdown Callback</a></span></dt></dl></dd></dl></div><a id="id-1.8.16.2" class="indexterm"></a><p>3 PostgreSQL provides infrastructure to create custom modules for continuous4 archiving (see <a class="xref" href="continuous-archiving.html" title="26.3. Continuous Archiving and Point-in-Time Recovery (PITR)">Section 26.3</a>). While archiving via5 a shell command (i.e., <a class="xref" href="runtime-config-wal.html#GUC-ARCHIVE-COMMAND">archive_command</a>) is much6 simpler, a custom archive module will often be considerably more robust and7 performant.8 </p><p>9 When a custom <a class="xref" href="runtime-config-wal.html#GUC-ARCHIVE-LIBRARY">archive_library</a> is configured, PostgreSQL10 will submit completed WAL files to the module, and the server will avoid11 recycling or removing these WAL files until the module indicates that the files12 were successfully archived. It is ultimately up to the module to decide what13 to do with each WAL file, but many recommendations are listed at14 <a class="xref" href="continuous-archiving.html#BACKUP-ARCHIVING-WAL" title="26.3.1. Setting Up WAL Archiving">Section 26.3.1</a>.15 </p><p>16 Archiving modules must at least consist of an initialization function (see17 <a class="xref" href="archive-module-init.html" title="51.1. Initialization Functions">Section 51.1</a>) and the required callbacks (see18 <a class="xref" href="archive-module-callbacks.html" title="51.2. Archive Module Callbacks">Section 51.2</a>). However, archive modules are19 also permitted to do much more (e.g., declare GUCs and register background20 workers).21 </p><p>22 The <code class="filename">contrib/basic_archive</code> module contains a working23 example, which demonstrates some useful techniques.24 </p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="replication-origins.html" title="Chapter 50. Replication Progress Tracking">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="server-programming.html" title="Part V. Server Programming">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="archive-module-init.html" title="51.1. Initialization Functions">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 50. Replication Progress Tracking </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 16.3 Documentation">Home</a></td><td width="40%" align="right" valign="top"> 51.1. Initialization Functions</td></tr></table></div></body></html>