Revert "Rename contrib module basic_archive to basic_wal_module"

This reverts commit 0ad3c60, as per feedback from Tom Lane, Robert Haas
and Andres Freund.  The new name used for the module had little
support.

This moves back to basic_archive as module name, and we will likely use
that as template for recovery modules, as well.

Discussion: https://postgr.es/m/CA+TgmoYG5uGOp7DGFT5gzC1kKFWGjkLSj_wOQxGhfMcvVEiKGA@mail.gmail.com
This commit is contained in:
Michael Paquier 2023-01-26 09:13:39 +09:00
parent 1a8e72bff7
commit 9aeff092c0
17 changed files with 78 additions and 105 deletions

View File

@ -9,7 +9,7 @@ SUBDIRS = \
amcheck \ amcheck \
auth_delay \ auth_delay \
auto_explain \ auto_explain \
basic_wal_module \ basic_archive \
basebackup_to_shell \ basebackup_to_shell \
bloom \ bloom \
btree_gin \ btree_gin \

View File

@ -1,11 +1,11 @@
# contrib/basic_wal_module/Makefile # contrib/basic_archive/Makefile
MODULES = basic_wal_module MODULES = basic_archive
PGFILEDESC = "basic_wal_module - basic write-ahead log module" PGFILEDESC = "basic_archive - basic archive module"
REGRESS = basic_wal_module REGRESS = basic_archive
REGRESS_OPTS = --temp-config $(top_srcdir)/contrib/basic_wal_module/basic_wal_module.conf REGRESS_OPTS = --temp-config $(top_srcdir)/contrib/basic_archive/basic_archive.conf
# Disabled because these tests require "shared_preload_libraries=basic_wal_module", # Disabled because these tests require "shared_preload_libraries=basic_archive",
# which typical installcheck users do not have (e.g. buildfarm clients). # which typical installcheck users do not have (e.g. buildfarm clients).
NO_INSTALLCHECK = 1 NO_INSTALLCHECK = 1
@ -14,7 +14,7 @@ PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs) PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS) include $(PGXS)
else else
subdir = contrib/basic_wal_module subdir = contrib/basic_archive
top_builddir = ../.. top_builddir = ../..
include $(top_builddir)/src/Makefile.global include $(top_builddir)/src/Makefile.global
include $(top_srcdir)/contrib/contrib-global.mk include $(top_srcdir)/contrib/contrib-global.mk

View File

@ -1,6 +1,6 @@
/*------------------------------------------------------------------------- /*-------------------------------------------------------------------------
* *
* basic_wal_module.c * basic_archive.c
* *
* This file demonstrates a basic archive library implementation that is * This file demonstrates a basic archive library implementation that is
* roughly equivalent to the following shell command: * roughly equivalent to the following shell command:
@ -20,7 +20,7 @@
* Copyright (c) 2022-2023, PostgreSQL Global Development Group * Copyright (c) 2022-2023, PostgreSQL Global Development Group
* *
* IDENTIFICATION * IDENTIFICATION
* contrib/basic_wal_module/basic_wal_module.c * contrib/basic_archive/basic_archive.c
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -41,7 +41,7 @@
PG_MODULE_MAGIC; PG_MODULE_MAGIC;
static char *archive_directory = NULL; static char *archive_directory = NULL;
static MemoryContext basic_wal_module_context; static MemoryContext basic_archive_context;
static bool basic_archive_configured(void); static bool basic_archive_configured(void);
static bool basic_archive_file(const char *file, const char *path); static bool basic_archive_file(const char *file, const char *path);
@ -57,7 +57,7 @@ static bool compare_files(const char *file1, const char *file2);
void void
_PG_init(void) _PG_init(void)
{ {
DefineCustomStringVariable("basic_wal_module.archive_directory", DefineCustomStringVariable("basic_archive.archive_directory",
gettext_noop("Archive file destination directory."), gettext_noop("Archive file destination directory."),
NULL, NULL,
&archive_directory, &archive_directory,
@ -66,11 +66,11 @@ _PG_init(void)
0, 0,
check_archive_directory, NULL, NULL); check_archive_directory, NULL, NULL);
MarkGUCPrefixReserved("basic_wal_module"); MarkGUCPrefixReserved("basic_archive");
basic_wal_module_context = AllocSetContextCreate(TopMemoryContext, basic_archive_context = AllocSetContextCreate(TopMemoryContext,
"basic_wal_module", "basic_archive",
ALLOCSET_DEFAULT_SIZES); ALLOCSET_DEFAULT_SIZES);
} }
/* /*
@ -156,7 +156,7 @@ basic_archive_file(const char *file, const char *path)
* we can easily reset it during error recovery (thus avoiding memory * we can easily reset it during error recovery (thus avoiding memory
* leaks). * leaks).
*/ */
oldcontext = MemoryContextSwitchTo(basic_wal_module_context); oldcontext = MemoryContextSwitchTo(basic_archive_context);
/* /*
* Since the archiver operates at the bottom of the exception stack, * Since the archiver operates at the bottom of the exception stack,
@ -183,7 +183,7 @@ basic_archive_file(const char *file, const char *path)
/* Reset our memory context and switch back to the original one */ /* Reset our memory context and switch back to the original one */
MemoryContextSwitchTo(oldcontext); MemoryContextSwitchTo(oldcontext);
MemoryContextReset(basic_wal_module_context); MemoryContextReset(basic_archive_context);
/* Remove our exception handler */ /* Remove our exception handler */
PG_exception_stack = NULL; PG_exception_stack = NULL;
@ -206,7 +206,7 @@ basic_archive_file(const char *file, const char *path)
/* Reset our memory context and switch back to the original one */ /* Reset our memory context and switch back to the original one */
MemoryContextSwitchTo(oldcontext); MemoryContextSwitchTo(oldcontext);
MemoryContextReset(basic_wal_module_context); MemoryContextReset(basic_archive_context);
return true; return true;
} }
@ -221,7 +221,7 @@ basic_archive_file_internal(const char *file, const char *path)
uint64 epoch; /* milliseconds */ uint64 epoch; /* milliseconds */
ereport(DEBUG3, ereport(DEBUG3,
(errmsg("archiving \"%s\" via basic_wal_module", file))); (errmsg("archiving \"%s\" via basic_archive", file)));
snprintf(destination, MAXPGPATH, "%s/%s", archive_directory, file); snprintf(destination, MAXPGPATH, "%s/%s", archive_directory, file);
@ -285,7 +285,7 @@ basic_archive_file_internal(const char *file, const char *path)
(void) durable_rename(temp, destination, ERROR); (void) durable_rename(temp, destination, ERROR);
ereport(DEBUG1, ereport(DEBUG1,
(errmsg("archived \"%s\" via basic_wal_module", file))); (errmsg("archived \"%s\" via basic_archive", file)));
} }
/* /*

View File

@ -0,0 +1,4 @@
archive_mode = on
archive_library = 'basic_archive'
basic_archive.archive_directory = '.'
wal_level = replica

View File

@ -0,0 +1,34 @@
# Copyright (c) 2022-2023, PostgreSQL Global Development Group
basic_archive_sources = files(
'basic_archive.c',
)
if host_system == 'windows'
basic_archive_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
'--NAME', 'basic_archive',
'--FILEDESC', 'basic_archive - basic archive module',])
endif
basic_archive = shared_module('basic_archive',
basic_archive_sources,
kwargs: contrib_mod_args,
)
contrib_targets += basic_archive
tests += {
'name': 'basic_archive',
'sd': meson.current_source_dir(),
'bd': meson.current_build_dir(),
'regress': {
'sql': [
'basic_archive',
],
'regress_args': [
'--temp-config', files('basic_archive.conf'),
],
# Disabled because these tests require "shared_preload_libraries=basic_archive",
# which typical runningcheck users do not have (e.g. buildfarm clients).
'runningcheck': false,
},
}

View File

@ -1,4 +0,0 @@
archive_mode = on
archive_library = 'basic_wal_module'
basic_wal_module.archive_directory = '.'
wal_level = replica

View File

@ -1,34 +0,0 @@
# Copyright (c) 2022-2023, PostgreSQL Global Development Group
basic_wal_module_sources = files(
'basic_wal_module.c',
)
if host_system == 'windows'
basic_wal_module_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
'--NAME', 'basic_wal_module',
'--FILEDESC', 'basic_wal_module - basic write-ahead log module',])
endif
basic_wal_module = shared_module('basic_wal_module',
basic_wal_module_sources,
kwargs: contrib_mod_args,
)
contrib_targets += basic_wal_module
tests += {
'name': 'basic_wal_module',
'sd': meson.current_source_dir(),
'bd': meson.current_build_dir(),
'regress': {
'sql': [
'basic_wal_module',
],
'regress_args': [
'--temp-config', files('basic_wal_module.conf'),
],
# Disabled because these tests require "shared_preload_libraries=basic_wal_module",
# which typical runningcheck users do not have (e.g. buildfarm clients).
'runningcheck': false,
},
}

View File

@ -11,7 +11,7 @@ subdir('adminpack')
subdir('amcheck') subdir('amcheck')
subdir('auth_delay') subdir('auth_delay')
subdir('auto_explain') subdir('auto_explain')
subdir('basic_wal_module') subdir('basic_archive')
subdir('bloom') subdir('bloom')
subdir('basebackup_to_shell') subdir('basebackup_to_shell')
subdir('bool_plperl') subdir('bool_plperl')

View File

@ -1,25 +0,0 @@
<!-- doc/src/sgml/appendix-obsolete-basic-archive.sgml -->
<!--
See doc/src/sgml/appendix-obsolete.sgml for why this file exists. Do not change the id attribute.
-->
<sect1 id="basic-archive" xreflabel="basic_archive">
<title><command>basic_archive</command> renamed to <command>basic_wal_module</command></title>
<indexterm>
<primary>basic_archive</primary>
<see>basic_wal_module</see>
</indexterm>
<para>
PostgreSQL 15 provided an archive module named
<filename>basic_archive</filename>
<indexterm><primary>basic_archive</primary></indexterm>.
This module was renamed to <filename>basic_wal_module</filename>. See
<xref linkend="basic-wal-module"/> for documentation of
<filename>basic_wal_module</filename>, and see
<link linkend="release-prior">the release notes for PostgreSQL 16</link>
for details on this change.
</para>
</sect1>

View File

@ -38,6 +38,5 @@
&obsolete-pgxlogdump; &obsolete-pgxlogdump;
&obsolete-pgresetxlog; &obsolete-pgresetxlog;
&obsolete-pgreceivexlog; &obsolete-pgreceivexlog;
&obsolete-basic-archive;
</appendix> </appendix>

View File

@ -32,7 +32,7 @@
</para> </para>
<para> <para>
The <filename>contrib/basic_wal_module</filename> module contains a working The <filename>contrib/basic_archive</filename> module contains a working
example, which demonstrates some useful techniques. example, which demonstrates some useful techniques.
</para> </para>

View File

@ -1,16 +1,16 @@
<!-- doc/src/sgml/basic-wal-module.sgml --> <!-- doc/src/sgml/basic-archive.sgml -->
<sect1 id="basic-wal-module" xreflabel="basic_wal_module"> <sect1 id="basic-archive" xreflabel="basic_archive">
<title>basic_wal_module &mdash; an example write-ahead log module</title> <title>basic_archive &mdash; an example WAL archive module</title>
<indexterm zone="basic-wal-module"> <indexterm zone="basic-archive">
<primary>basic_wal_module</primary> <primary>basic_archive</primary>
</indexterm> </indexterm>
<para> <para>
<filename>basic_wal_module</filename> is an example of an archive module. <filename>basic_archive</filename> is an example of an archive module. This
This module copies completed WAL segment files to the specified directory. module copies completed WAL segment files to the specified directory. This
This may not be especially useful, but it can serve as a starting point for may not be especially useful, but it can serve as a starting point for
developing your own archive module. For more information about archive developing your own archive module. For more information about archive
modules, see <xref linkend="archive-modules"/>. modules, see <xref linkend="archive-modules"/>.
</para> </para>
@ -21,15 +21,15 @@
must be enabled. must be enabled.
</para> </para>
<sect2 id="basic-wal-module-configuration-parameters"> <sect2 id="basic-archive-configuration-parameters">
<title>Configuration Parameters</title> <title>Configuration Parameters</title>
<variablelist> <variablelist>
<varlistentry> <varlistentry>
<term> <term>
<varname>basic_wal_module.archive_directory</varname> (<type>string</type>) <varname>basic_archive.archive_directory</varname> (<type>string</type>)
<indexterm> <indexterm>
<primary><varname>basic_wal_module.archive_directory</varname> configuration parameter</primary> <primary><varname>basic_archive.archive_directory</varname> configuration parameter</primary>
</indexterm> </indexterm>
</term> </term>
<listitem> <listitem>
@ -52,12 +52,12 @@
<programlisting> <programlisting>
# postgresql.conf # postgresql.conf
archive_mode = 'on' archive_mode = 'on'
archive_library = 'basic_wal_module' archive_library = 'basic_archive'
basic_wal_module.archive_directory = '/path/to/archive/directory' basic_archive.archive_directory = '/path/to/archive/directory'
</programlisting> </programlisting>
</sect2> </sect2>
<sect2 id="basic-wal-module-notes"> <sect2 id="basic-archive-notes">
<title>Notes</title> <title>Notes</title>
<para> <para>
@ -70,7 +70,7 @@ basic_wal_module.archive_directory = '/path/to/archive/directory'
</para> </para>
</sect2> </sect2>
<sect2 id="basic-wal-module-author"> <sect2 id="basic-archive-author">
<title>Author</title> <title>Author</title>
<para> <para>

View File

@ -105,7 +105,7 @@ CREATE EXTENSION <replaceable>extension_name</replaceable>;
&auth-delay; &auth-delay;
&auto-explain; &auto-explain;
&basebackup-to-shell; &basebackup-to-shell;
&basic-wal-module; &basic-archive;
&bloom; &bloom;
&btree-gin; &btree-gin;
&btree-gist; &btree-gist;

View File

@ -116,7 +116,7 @@
<!ENTITY amcheck SYSTEM "amcheck.sgml"> <!ENTITY amcheck SYSTEM "amcheck.sgml">
<!ENTITY auth-delay SYSTEM "auth-delay.sgml"> <!ENTITY auth-delay SYSTEM "auth-delay.sgml">
<!ENTITY auto-explain SYSTEM "auto-explain.sgml"> <!ENTITY auto-explain SYSTEM "auto-explain.sgml">
<!ENTITY basic-wal-module SYSTEM "basic-wal-module.sgml"> <!ENTITY basic-archive SYSTEM "basic-archive.sgml">
<!ENTITY basebackup-to-shell SYSTEM "basebackup-to-shell.sgml"> <!ENTITY basebackup-to-shell SYSTEM "basebackup-to-shell.sgml">
<!ENTITY bloom SYSTEM "bloom.sgml"> <!ENTITY bloom SYSTEM "bloom.sgml">
<!ENTITY btree-gin SYSTEM "btree-gin.sgml"> <!ENTITY btree-gin SYSTEM "btree-gin.sgml">
@ -200,4 +200,3 @@
<!ENTITY obsolete-pgxlogdump SYSTEM "appendix-obsolete-pgxlogdump.sgml"> <!ENTITY obsolete-pgxlogdump SYSTEM "appendix-obsolete-pgxlogdump.sgml">
<!ENTITY obsolete-pgresetxlog SYSTEM "appendix-obsolete-pgresetxlog.sgml"> <!ENTITY obsolete-pgresetxlog SYSTEM "appendix-obsolete-pgresetxlog.sgml">
<!ENTITY obsolete-pgreceivexlog SYSTEM "appendix-obsolete-pgreceivexlog.sgml"> <!ENTITY obsolete-pgreceivexlog SYSTEM "appendix-obsolete-pgreceivexlog.sgml">
<!ENTITY obsolete-basic-archive SYSTEM "appendix-obsolete-basic-archive.sgml">