v2-0004-pg_waldump-Rename-directory-creation-routine-for-.patch
application/x-patch
Filename: v2-0004-pg_waldump-Rename-directory-creation-routine-for-.patch
Type: application/x-patch
Part: 3
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: format-patch
Series: patch v2-0004
Subject: pg_waldump: Rename directory creation routine for generalized use.
| File | + | − |
|---|---|---|
| src/bin/pg_waldump/pg_waldump.c | 8 | 4 |
From 4baa0189d624cd4606dcab5f5417cf7d305a8223 Mon Sep 17 00:00:00 2001
From: Amul Sul <sulamul@gmail.com>
Date: Tue, 29 Jul 2025 14:59:01 +0530
Subject: [PATCH v2 4/9] pg_waldump: Rename directory creation routine for
generalized use.
The create_fullpage_directory() function, currently used only for
storing full-page images from WAL records, should be renamed to a more
generalized name. This would allow it to be reused in future patches
for creating other directories as needed.
---
src/bin/pg_waldump/pg_waldump.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/bin/pg_waldump/pg_waldump.c b/src/bin/pg_waldump/pg_waldump.c
index 8d0cd9e7156..4775275c07a 100644
--- a/src/bin/pg_waldump/pg_waldump.c
+++ b/src/bin/pg_waldump/pg_waldump.c
@@ -114,11 +114,11 @@ verify_directory(const char *directory)
}
/*
- * Create if necessary the directory storing the full-page images extracted
- * from the WAL records read.
+ * Create the directory if it doesn't exist. Report an error if creation fails
+ * or if an existing directory is not empty.
*/
static void
-create_fullpage_directory(char *path)
+create_directory(char *path)
{
int ret;
@@ -1112,8 +1112,12 @@ main(int argc, char **argv)
}
}
+ /*
+ * Create if necessary the directory storing the full-page images
+ * extracted from the WAL records read.
+ */
if (config.save_fullpage_path != NULL)
- create_fullpage_directory(config.save_fullpage_path);
+ create_directory(config.save_fullpage_path);
/* parse files as start/end boundaries, extract path if not specified */
if (optind < argc)
--
2.47.1