Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 210d164

Browse files
michaelpqpull[bot]
authored andcommitted
Rename contrib module basic_archive to basic_wal_module
This rename is in preparation for the introduction of recovery modules, where basic_wal_module will be used as a base template for the set of callbacks introduced. The former name did not really reflect all that. Author: Nathan Bossart Discussion: https://postgr.es/m/20221227192449.GA3672473@nathanxps13
1 parent 1c61206 commit 210d164

17 files changed

+105
-78
lines changed

contrib/Makefile

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

contrib/basic_archive/basic_archive.conf

Lines changed: 0 additions & 4 deletions
This file was deleted.

contrib/basic_archive/meson.build

Lines changed: 0 additions & 34 deletions
This file was deleted.

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
# contrib/basic_archive/Makefile
1+
# contrib/basic_wal_module/Makefile
22

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

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",
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",
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_archive
17+
subdir = contrib/basic_wal_module
1818
top_builddir = ../..
1919
include $(top_builddir)/src/Makefile.global
2020
include $(top_srcdir)/contrib/contrib-global.mk

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

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*-------------------------------------------------------------------------
22
*
3-
* basic_archive.c
3+
* basic_wal_module.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_archive/basic_archive.c
23+
* contrib/basic_wal_module/basic_wal_module.c
2424
*
2525
*-------------------------------------------------------------------------
2626
*/
@@ -41,7 +41,7 @@
4141
PG_MODULE_MAGIC;
4242

4343
static char *archive_directory = NULL;
44-
static MemoryContext basic_archive_context;
44+
static MemoryContext basic_wal_module_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_archive.archive_directory",
60+
DefineCustomStringVariable("basic_wal_module.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_archive");
69+
MarkGUCPrefixReserved("basic_wal_module");
7070

71-
basic_archive_context = AllocSetContextCreate(TopMemoryContext,
72-
"basic_archive",
73-
ALLOCSET_DEFAULT_SIZES);
71+
basic_wal_module_context = AllocSetContextCreate(TopMemoryContext,
72+
"basic_wal_module",
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_archive_context);
159+
oldcontext = MemoryContextSwitchTo(basic_wal_module_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_archive_context);
186+
MemoryContextReset(basic_wal_module_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_archive_context);
209+
MemoryContextReset(basic_wal_module_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_archive", file)));
224+
(errmsg("archiving \"%s\" via basic_wal_module", 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_archive", file)));
288+
(errmsg("archived \"%s\" via basic_wal_module", file)));
289289
}
290290

291291
/*
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
archive_mode = on
2+
archive_library = 'basic_wal_module'
3+
basic_wal_module.archive_directory = '.'
4+
wal_level = replica

contrib/basic_wal_module/meson.build

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

0 commit comments

Comments
 (0)