1
1
/*-------------------------------------------------------------------------
2
2
*
3
- * basic_wal_module .c
3
+ * basic_archive .c
4
4
*
5
5
* This file demonstrates a basic archive library implementation that is
6
6
* roughly equivalent to the following shell command:
20
20
* Copyright (c) 2022-2023, PostgreSQL Global Development Group
21
21
*
22
22
* IDENTIFICATION
23
- * contrib/basic_wal_module/basic_wal_module .c
23
+ * contrib/basic_archive/basic_archive .c
24
24
*
25
25
*-------------------------------------------------------------------------
26
26
*/
41
41
PG_MODULE_MAGIC ;
42
42
43
43
static char * archive_directory = NULL ;
44
- static MemoryContext basic_wal_module_context ;
44
+ static MemoryContext basic_archive_context ;
45
45
46
46
static bool basic_archive_configured (void );
47
47
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);
57
57
void
58
58
_PG_init (void )
59
59
{
60
- DefineCustomStringVariable ("basic_wal_module .archive_directory" ,
60
+ DefineCustomStringVariable ("basic_archive .archive_directory" ,
61
61
gettext_noop ("Archive file destination directory." ),
62
62
NULL ,
63
63
& archive_directory ,
@@ -66,11 +66,11 @@ _PG_init(void)
66
66
0 ,
67
67
check_archive_directory , NULL , NULL );
68
68
69
- MarkGUCPrefixReserved ("basic_wal_module " );
69
+ MarkGUCPrefixReserved ("basic_archive " );
70
70
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 );
74
74
}
75
75
76
76
/*
@@ -156,7 +156,7 @@ basic_archive_file(const char *file, const char *path)
156
156
* we can easily reset it during error recovery (thus avoiding memory
157
157
* leaks).
158
158
*/
159
- oldcontext = MemoryContextSwitchTo (basic_wal_module_context );
159
+ oldcontext = MemoryContextSwitchTo (basic_archive_context );
160
160
161
161
/*
162
162
* Since the archiver operates at the bottom of the exception stack,
@@ -183,7 +183,7 @@ basic_archive_file(const char *file, const char *path)
183
183
184
184
/* Reset our memory context and switch back to the original one */
185
185
MemoryContextSwitchTo (oldcontext );
186
- MemoryContextReset (basic_wal_module_context );
186
+ MemoryContextReset (basic_archive_context );
187
187
188
188
/* Remove our exception handler */
189
189
PG_exception_stack = NULL ;
@@ -206,7 +206,7 @@ basic_archive_file(const char *file, const char *path)
206
206
207
207
/* Reset our memory context and switch back to the original one */
208
208
MemoryContextSwitchTo (oldcontext );
209
- MemoryContextReset (basic_wal_module_context );
209
+ MemoryContextReset (basic_archive_context );
210
210
211
211
return true;
212
212
}
@@ -221,7 +221,7 @@ basic_archive_file_internal(const char *file, const char *path)
221
221
uint64 epoch ; /* milliseconds */
222
222
223
223
ereport (DEBUG3 ,
224
- (errmsg ("archiving \"%s\" via basic_wal_module " , file )));
224
+ (errmsg ("archiving \"%s\" via basic_archive " , file )));
225
225
226
226
snprintf (destination , MAXPGPATH , "%s/%s" , archive_directory , file );
227
227
@@ -285,7 +285,7 @@ basic_archive_file_internal(const char *file, const char *path)
285
285
(void ) durable_rename (temp , destination , ERROR );
286
286
287
287
ereport (DEBUG1 ,
288
- (errmsg ("archived \"%s\" via basic_wal_module " , file )));
288
+ (errmsg ("archived \"%s\" via basic_archive " , file )));
289
289
}
290
290
291
291
/*
0 commit comments