Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 9aeff09

Browse files
committed
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
1 parent 1a8e72b commit 9aeff09

17 files changed

+78
-105
lines changed

contrib/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ SUBDIRS = \
99
amcheck \
1010
auth_delay \
1111
auto_explain \
12-
basic_wal_module \
12+
basic_archive \
1313
basebackup_to_shell \
1414
bloom \
1515
btree_gin \

contrib/basic_wal_module/Makefile renamed to contrib/basic_archive/Makefile

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
# contrib/basic_wal_module/Makefile
1+
# contrib/basic_archive/Makefile
22

3-
MODULES = basic_wal_module
4-
PGFILEDESC = "basic_wal_module - basic write-ahead log module"
3+
MODULES = basic_archive
4+
PGFILEDESC = "basic_archive - basic archive module"
55

6-
REGRESS = basic_wal_module
7-
REGRESS_OPTS = --temp-config $(top_srcdir)/contrib/basic_wal_module/basic_wal_module.conf
8-
# Disabled because these tests require "shared_preload_libraries=basic_wal_module",
6+
REGRESS = basic_archive
7+
REGRESS_OPTS = --temp-config $(top_srcdir)/contrib/basic_archive/basic_archive.conf
8+
# Disabled because these tests require "shared_preload_libraries=basic_archive",
99
# which typical installcheck users do not have (e.g. buildfarm clients).
1010
NO_INSTALLCHECK = 1
1111

@@ -14,7 +14,7 @@ PG_CONFIG = pg_config
1414
PGXS := $(shell $(PG_CONFIG) --pgxs)
1515
include $(PGXS)
1616
else
17-
subdir = contrib/basic_wal_module
17+
subdir = contrib/basic_archive
1818
top_builddir = ../..
1919
include $(top_builddir)/src/Makefile.global
2020
include $(top_srcdir)/contrib/contrib-global.mk

contrib/basic_wal_module/basic_wal_module.c renamed to contrib/basic_archive/basic_archive.c

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*-------------------------------------------------------------------------
22
*
3-
* basic_wal_module.c
3+
* basic_archive.c
44
*
55
* This file demonstrates a basic archive library implementation that is
66
* roughly equivalent to the following shell command:
@@ -20,7 +20,7 @@
2020
* Copyright (c) 2022-2023, PostgreSQL Global Development Group
2121
*
2222
* IDENTIFICATION
23-
* contrib/basic_wal_module/basic_wal_module.c
23+
* contrib/basic_archive/basic_archive.c
2424
*
2525
*-------------------------------------------------------------------------
2626
*/
@@ -41,7 +41,7 @@
4141
PG_MODULE_MAGIC;
4242

4343
static char *archive_directory = NULL;
44-
static MemoryContext basic_wal_module_context;
44+
static MemoryContext basic_archive_context;
4545

4646
static bool basic_archive_configured(void);
4747
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);
5757
void
5858
_PG_init(void)
5959
{
60-
DefineCustomStringVariable("basic_wal_module.archive_directory",
60+
DefineCustomStringVariable("basic_archive.archive_directory",
6161
gettext_noop("Archive file destination directory."),
6262
NULL,
6363
&archive_directory,
@@ -66,11 +66,11 @@ _PG_init(void)
6666
0,
6767
check_archive_directory, NULL, NULL);
6868

69-
MarkGUCPrefixReserved("basic_wal_module");
69+
MarkGUCPrefixReserved("basic_archive");
7070

71-
basic_wal_module_context = AllocSetContextCreate(TopMemoryContext,
72-
"basic_wal_module",
73-
ALLOCSET_DEFAULT_SIZES);
71+
basic_archive_context = AllocSetContextCreate(TopMemoryContext,
72+
"basic_archive",
73+
ALLOCSET_DEFAULT_SIZES);
7474
}
7575

7676
/*
@@ -156,7 +156,7 @@ basic_archive_file(const char *file, const char *path)
156156
* we can easily reset it during error recovery (thus avoiding memory
157157
* leaks).
158158
*/
159-
oldcontext = MemoryContextSwitchTo(basic_wal_module_context);
159+
oldcontext = MemoryContextSwitchTo(basic_archive_context);
160160

161161
/*
162162
* Since the archiver operates at the bottom of the exception stack,
@@ -183,7 +183,7 @@ basic_archive_file(const char *file, const char *path)
183183

184184
/* Reset our memory context and switch back to the original one */
185185
MemoryContextSwitchTo(oldcontext);
186-
MemoryContextReset(basic_wal_module_context);
186+
MemoryContextReset(basic_archive_context);
187187

188188
/* Remove our exception handler */
189189
PG_exception_stack = NULL;
@@ -206,7 +206,7 @@ basic_archive_file(const char *file, const char *path)
206206

207207
/* Reset our memory context and switch back to the original one */
208208
MemoryContextSwitchTo(oldcontext);
209-
MemoryContextReset(basic_wal_module_context);
209+
MemoryContextReset(basic_archive_context);
210210

211211
return true;
212212
}
@@ -221,7 +221,7 @@ basic_archive_file_internal(const char *file, const char *path)
221221
uint64 epoch; /* milliseconds */
222222

223223
ereport(DEBUG3,
224-
(errmsg("archiving \"%s\" via basic_wal_module", file)));
224+
(errmsg("archiving \"%s\" via basic_archive", file)));
225225

226226
snprintf(destination, MAXPGPATH, "%s/%s", archive_directory, file);
227227

@@ -285,7 +285,7 @@ basic_archive_file_internal(const char *file, const char *path)
285285
(void) durable_rename(temp, destination, ERROR);
286286

287287
ereport(DEBUG1,
288-
(errmsg("archived \"%s\" via basic_wal_module", file)));
288+
(errmsg("archived \"%s\" via basic_archive", file)));
289289
}
290290

291291
/*
+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
archive_mode = on
2+
archive_library = 'basic_archive'
3+
basic_archive.archive_directory = '.'
4+
wal_level = replica

contrib/basic_archive/meson.build

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Copyright (c) 2022-2023, PostgreSQL Global Development Group
2+
3+
basic_archive_sources = files(
4+
'basic_archive.c',
5+
)
6+
7+
if host_system == 'windows'
8+
basic_archive_sources += rc_lib_gen.process(win32ver_rc, extra_args: [
9+
'--NAME', 'basic_archive',
10+
'--FILEDESC', 'basic_archive - basic archive module',])
11+
endif
12+
13+
basic_archive = shared_module('basic_archive',
14+
basic_archive_sources,
15+
kwargs: contrib_mod_args,
16+
)
17+
contrib_targets += basic_archive
18+
19+
tests += {
20+
'name': 'basic_archive',
21+
'sd': meson.current_source_dir(),
22+
'bd': meson.current_build_dir(),
23+
'regress': {
24+
'sql': [
25+
'basic_archive',
26+
],
27+
'regress_args': [
28+
'--temp-config', files('basic_archive.conf'),
29+
],
30+
# Disabled because these tests require "shared_preload_libraries=basic_archive",
31+
# which typical runningcheck users do not have (e.g. buildfarm clients).
32+
'runningcheck': false,
33+
},
34+
}

contrib/basic_wal_module/basic_wal_module.conf

-4
This file was deleted.

contrib/basic_wal_module/meson.build

-34
This file was deleted.

contrib/meson.build

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ subdir('adminpack')
1111
subdir('amcheck')
1212
subdir('auth_delay')
1313
subdir('auto_explain')
14-
subdir('basic_wal_module')
14+
subdir('basic_archive')
1515
subdir('bloom')
1616
subdir('basebackup_to_shell')
1717
subdir('bool_plperl')

doc/src/sgml/appendix-obsolete-basic-archive.sgml

-25
This file was deleted.

doc/src/sgml/appendix-obsolete.sgml

-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,5 @@
3838
&obsolete-pgxlogdump;
3939
&obsolete-pgresetxlog;
4040
&obsolete-pgreceivexlog;
41-
&obsolete-basic-archive;
4241

4342
</appendix>

doc/src/sgml/archive-modules.sgml

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
</para>
3333

3434
<para>
35-
The <filename>contrib/basic_wal_module</filename> module contains a working
35+
The <filename>contrib/basic_archive</filename> module contains a working
3636
example, which demonstrates some useful techniques.
3737
</para>
3838

doc/src/sgml/basic-wal-module.sgml renamed to doc/src/sgml/basic-archive.sgml

+15-15
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
<!-- doc/src/sgml/basic-wal-module.sgml -->
1+
<!-- doc/src/sgml/basic-archive.sgml -->
22

3-
<sect1 id="basic-wal-module" xreflabel="basic_wal_module">
4-
<title>basic_wal_module &mdash; an example write-ahead log module</title>
3+
<sect1 id="basic-archive" xreflabel="basic_archive">
4+
<title>basic_archive &mdash; an example WAL archive module</title>
55

6-
<indexterm zone="basic-wal-module">
7-
<primary>basic_wal_module</primary>
6+
<indexterm zone="basic-archive">
7+
<primary>basic_archive</primary>
88
</indexterm>
99

1010
<para>
11-
<filename>basic_wal_module</filename> is an example of an archive module.
12-
This module copies completed WAL segment files to the specified directory.
13-
This may not be especially useful, but it can serve as a starting point for
11+
<filename>basic_archive</filename> is an example of an archive module. This
12+
module copies completed WAL segment files to the specified directory. This
13+
may not be especially useful, but it can serve as a starting point for
1414
developing your own archive module. For more information about archive
1515
modules, see <xref linkend="archive-modules"/>.
1616
</para>
@@ -21,15 +21,15 @@
2121
must be enabled.
2222
</para>
2323

24-
<sect2 id="basic-wal-module-configuration-parameters">
24+
<sect2 id="basic-archive-configuration-parameters">
2525
<title>Configuration Parameters</title>
2626

2727
<variablelist>
2828
<varlistentry>
2929
<term>
30-
<varname>basic_wal_module.archive_directory</varname> (<type>string</type>)
30+
<varname>basic_archive.archive_directory</varname> (<type>string</type>)
3131
<indexterm>
32-
<primary><varname>basic_wal_module.archive_directory</varname> configuration parameter</primary>
32+
<primary><varname>basic_archive.archive_directory</varname> configuration parameter</primary>
3333
</indexterm>
3434
</term>
3535
<listitem>
@@ -52,12 +52,12 @@
5252
<programlisting>
5353
# postgresql.conf
5454
archive_mode = 'on'
55-
archive_library = 'basic_wal_module'
56-
basic_wal_module.archive_directory = '/path/to/archive/directory'
55+
archive_library = 'basic_archive'
56+
basic_archive.archive_directory = '/path/to/archive/directory'
5757
</programlisting>
5858
</sect2>
5959

60-
<sect2 id="basic-wal-module-notes">
60+
<sect2 id="basic-archive-notes">
6161
<title>Notes</title>
6262

6363
<para>
@@ -70,7 +70,7 @@ basic_wal_module.archive_directory = '/path/to/archive/directory'
7070
</para>
7171
</sect2>
7272

73-
<sect2 id="basic-wal-module-author">
73+
<sect2 id="basic-archive-author">
7474
<title>Author</title>
7575

7676
<para>

doc/src/sgml/contrib.sgml

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ CREATE EXTENSION <replaceable>extension_name</replaceable>;
105105
&auth-delay;
106106
&auto-explain;
107107
&basebackup-to-shell;
108-
&basic-wal-module;
108+
&basic-archive;
109109
&bloom;
110110
&btree-gin;
111111
&btree-gist;

doc/src/sgml/filelist.sgml

+1-2
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@
116116
<!ENTITY amcheck SYSTEM "amcheck.sgml">
117117
<!ENTITY auth-delay SYSTEM "auth-delay.sgml">
118118
<!ENTITY auto-explain SYSTEM "auto-explain.sgml">
119-
<!ENTITY basic-wal-module SYSTEM "basic-wal-module.sgml">
119+
<!ENTITY basic-archive SYSTEM "basic-archive.sgml">
120120
<!ENTITY basebackup-to-shell SYSTEM "basebackup-to-shell.sgml">
121121
<!ENTITY bloom SYSTEM "bloom.sgml">
122122
<!ENTITY btree-gin SYSTEM "btree-gin.sgml">
@@ -200,4 +200,3 @@
200200
<!ENTITY obsolete-pgxlogdump SYSTEM "appendix-obsolete-pgxlogdump.sgml">
201201
<!ENTITY obsolete-pgresetxlog SYSTEM "appendix-obsolete-pgresetxlog.sgml">
202202
<!ENTITY obsolete-pgreceivexlog SYSTEM "appendix-obsolete-pgreceivexlog.sgml">
203-
<!ENTITY obsolete-basic-archive SYSTEM "appendix-obsolete-basic-archive.sgml">

0 commit comments

Comments
 (0)