バージョンごとのドキュメント一覧

51.2. アーカイブモジュールコールバック #

<title>Archive Module Callbacks</title>

The archive callbacks define the actual archiving behavior of the module. The server will call them as required to process each individual WAL file. アーカイブコールバックは、モジュールの実際のアーカイブ動作を定義します。 サーバは、個々のWALファイルを処理するために必要に応じてこれらを呼び出します。

51.2.1. スタートアップコールバック #

<title>Startup Callback</title>

The <function>startup_cb</function> callback is called shortly after the module is loaded. This callback can be used to perform any additional initialization required. If the archive module has any state, it can use <structfield>state->private_data</structfield> to store it. startup_cbコールバックは、モジュールがロードされた直後に呼び出されます。 このコールバックは、必要な追加の初期化を実行するために使用できます。 アーカイブモジュールに状態がある場合は、state->private_dataを使用して保存できます。

typedef void (*ArchiveStartupCB) (ArchiveModuleState *state);

51.2.2. チェックコールバック #

<title>Check Callback</title>

The <function>check_configured_cb</function> callback is called to determine whether the module is fully configured and ready to accept WAL files (e.g., its configuration parameters are set to valid values). If no <function>check_configured_cb</function> is defined, the server always assumes the module is configured. check_configured_cbコールバックは、モジュールが完全に設定されていて、WALファイルを受け入れる準備ができているかどうかを判断するために呼び出されます(たとえば、構成パラメータが適切な値に設定されているかどうかを判断します)。 check_configured_cbが定義されていない場合、サーバは常にモジュールが設定されていると想定します。

typedef bool (*ArchiveCheckConfiguredCB) (ArchiveModuleState *state);

If <literal>true</literal> is returned, the server will proceed with archiving the file by calling the <function>archive_file_cb</function> callback. If <literal>false</literal> is returned, archiving will not proceed, and the archiver will emit the following message to the server log: trueが返された場合、サーバはarchive_file_cbコールバックを呼び出してファイルのアーカイブを続行します。 falseが返された場合、アーカイブは続行されず、アーカイバはサーバログに次のメッセージを出力します:

WARNING:  archive_mode enabled, yet archiving is not configured

In the latter case, the server will periodically call this function, and archiving will proceed only when it returns <literal>true</literal>. 後者の場合、サーバは定期的にこの関数を呼び出し、trueが返された場合のみアーカイブが続行されます。

51.2.3. アーカイブコールバック #

<title>Archive Callback</title>

The <function>archive_file_cb</function> callback is called to archive a single WAL file. archive_file_cbコールバックは、単一のWALファイルをアーカイブするために呼び出されます。

typedef bool (*ArchiveFileCB) (ArchiveModuleState *state, const char *file, const char *path);

If <literal>true</literal> is returned, the server proceeds as if the file was successfully archived, which may include recycling or removing the original WAL file. If <literal>false</literal> is returned, the server will keep the original WAL file and retry archiving later. <replaceable>file</replaceable> will contain just the file name of the WAL file to archive, while <replaceable>path</replaceable> contains the full path of the WAL file (including the file name). trueが返された場合、サーバはファイルが正常にアーカイブされたかのように処理を進めます。 これには元のWALファイルのリサイクルまたは削除が含まれる場合があります。 falseが返された場合、サーバは元のWALファイルを保持し、後でアーカイブを再試行します。 fileにはアーカイブするWALファイルのファイル名だけが含まれ、pathにはWALファイルのフルパス(ファイル名を含む)が含まれます。

51.2.4. シャットダウンコールバック #

<title>Shutdown Callback</title>

The <function>shutdown_cb</function> callback is called when the archiver process exits (e.g., after an error) or the value of <xref linkend="guc-archive-library"/> changes. If no <function>shutdown_cb</function> is defined, no special action is taken in these situations. If the archive module has any state, this callback should free it to avoid leaks. shutdown_cbコールバックは、アーカイバプロセスが終了するとき(たとえばエラー後など)、またはarchive_libraryの値が変更されたときに呼び出されます。 shutdown_cbが定義されていない場合、これらの状況では特別な処理は行われません。 アーカイブモジュールが何らかの状態を持っている場合、このコールバックはメモリリークを防ぐためにそれを解放すべきです。

typedef void (*ArchiveShutdownCB) (ArchiveModuleState *state);