Skip to content

Commit c10d427

Browse files
amulsulCommitfest Bot
authored andcommitted
Refactor: pg_waldump: Move some declarations to new pg_waldump.h
This change prepares for a second source file in this directory to support reading WAL from tar files. Common structures, declarations, and functions are being exported through this include file so they can be used in both files.
1 parent 16edc1b commit c10d427

File tree

2 files changed

+29
-9
lines changed

2 files changed

+29
-9
lines changed

src/bin/pg_waldump/pg_waldump.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "common/logging.h"
3030
#include "common/relpath.h"
3131
#include "getopt_long.h"
32+
#include "pg_waldump.h"
3233
#include "rmgrdesc.h"
3334
#include "storage/bufpage.h"
3435

@@ -39,19 +40,11 @@
3940

4041
static const char *progname;
4142

42-
static int WalSegSz;
43+
int WalSegSz = DEFAULT_XLOG_SEG_SIZE;
4344
static volatile sig_atomic_t time_to_stop = false;
4445

4546
static const RelFileLocator emptyRelFileLocator = {0, 0, 0};
4647

47-
typedef struct XLogDumpPrivate
48-
{
49-
TimeLineID timeline;
50-
XLogRecPtr startptr;
51-
XLogRecPtr endptr;
52-
bool endptr_reached;
53-
} XLogDumpPrivate;
54-
5548
typedef struct XLogDumpConfig
5649
{
5750
/* display options */

src/bin/pg_waldump/pg_waldump.h

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* pg_waldump.h - decode and display WAL
4+
*
5+
* Copyright (c) 2013-2025, PostgreSQL Global Development Group
6+
*
7+
* IDENTIFICATION
8+
* src/bin/pg_waldump/pg_waldump.h
9+
*-------------------------------------------------------------------------
10+
*/
11+
#ifndef PG_WALDUMP_H
12+
#define PG_WALDUMP_H
13+
14+
#include "access/xlogdefs.h"
15+
16+
extern int WalSegSz;
17+
18+
/* Contains the necessary information to drive WAL decoding */
19+
typedef struct XLogDumpPrivate
20+
{
21+
TimeLineID timeline;
22+
XLogRecPtr startptr;
23+
XLogRecPtr endptr;
24+
bool endptr_reached;
25+
} XLogDumpPrivate;
26+
27+
#endif /* end of PG_WALDUMP_H */

0 commit comments

Comments
 (0)