PostgreSQL Source Code git master
Loading...
Searching...
No Matches
pg_waldump.c
Go to the documentation of this file.
1/*-------------------------------------------------------------------------
2 *
3 * pg_waldump.c - decode and display WAL
4 *
5 * Copyright (c) 2013-2026, PostgreSQL Global Development Group
6 *
7 * IDENTIFICATION
8 * src/bin/pg_waldump/pg_waldump.c
9 *-------------------------------------------------------------------------
10 */
11
12#define FRONTEND 1
13#include "postgres.h"
14
15#include <dirent.h>
16#include <limits.h>
17#include <signal.h>
18#include <sys/stat.h>
19#include <unistd.h>
20
21#include "access/transam.h"
23#include "access/xlogreader.h"
24#include "access/xlogrecord.h"
25#include "access/xlogstats.h"
26#include "common/fe_memutils.h"
27#include "common/file_perm.h"
28#include "common/file_utils.h"
29#include "common/logging.h"
30#include "common/relpath.h"
31#include "getopt_long.h"
32#include "rmgrdesc.h"
33#include "storage/bufpage.h"
34
35/*
36 * NOTE: For any code change or issue fix here, it is highly recommended to
37 * give a thought about doing the same in pg_walinspect contrib module as well.
38 */
39
40static const char *progname;
41
42static volatile sig_atomic_t time_to_stop = false;
43
44static const RelFileLocator emptyRelFileLocator = {0, 0, 0};
45
53
81
82
83/*
84 * When sigint is called, just tell the system to exit at the next possible
85 * moment.
86 */
87#ifndef WIN32
88
89static void
94#endif
95
96static void
98{
99 int i;
100
101 for (i = 0; i <= RM_MAX_BUILTIN_ID; i++)
102 {
103 printf("%s\n", GetRmgrDesc(i)->rm_name);
104 }
105}
106
107/*
108 * Check whether directory exists and whether we can open it. Keep errno set so
109 * that the caller can report errors somewhat more accurately.
110 */
111static bool
113{
114 DIR *dir = opendir(directory);
115
116 if (dir == NULL)
117 return false;
118 closedir(dir);
119 return true;
120}
121
122/*
123 * Create if necessary the directory storing the full-page images extracted
124 * from the WAL records read.
125 */
126static void
128{
129 int ret;
130
131 switch ((ret = pg_check_dir(path)))
132 {
133 case 0:
134 /* Does not exist, so create it */
135 if (pg_mkdir_p(path, pg_dir_create_mode) < 0)
136 pg_fatal("could not create directory \"%s\": %m", path);
137 break;
138 case 1:
139 /* Present and empty, so do nothing */
140 break;
141 case 2:
142 case 3:
143 case 4:
144 /* Exists and not empty */
145 pg_fatal("directory \"%s\" exists but is not empty", path);
146 break;
147 default:
148 /* Trouble accessing directory */
149 pg_fatal("could not access directory \"%s\": %m", path);
150 }
151}
152
153/*
154 * Split a pathname as dirname(1) and basename(1) would.
155 *
156 * XXX this probably doesn't do very well on Windows. We probably need to
157 * apply canonicalize_path(), at the very least.
158 */
159static void
160split_path(const char *path, char **dir, char **fname)
161{
162 const char *sep;
163
164 /* split filepath into directory & filename */
165 sep = strrchr(path, '/');
166
167 /* directory path */
168 if (sep != NULL)
169 {
170 *dir = pnstrdup(path, sep - path);
171 *fname = pg_strdup(sep + 1);
172 }
173 /* local directory */
174 else
175 {
176 *dir = NULL;
177 *fname = pg_strdup(path);
178 }
179}
180
181/*
182 * Open the file in the valid target directory.
183 *
184 * return a read only fd
185 */
186static int
187open_file_in_directory(const char *directory, const char *fname)
188{
189 int fd = -1;
190 char fpath[MAXPGPATH];
191
193
194 snprintf(fpath, MAXPGPATH, "%s/%s", directory, fname);
195 fd = open(fpath, O_RDONLY | PG_BINARY, 0);
196
197 if (fd < 0 && errno != ENOENT)
198 pg_fatal("could not open file \"%s\": %m", fname);
199 return fd;
200}
201
202/*
203 * Try to find fname in the given directory. Returns true if it is found,
204 * false otherwise. If fname is NULL, search the complete directory for any
205 * file with a valid WAL file name. If file is successfully opened, set
206 * *WaSegSz to the WAL segment size.
207 */
208static bool
209search_directory(const char *directory, const char *fname, int *WalSegSz)
210{
211 int fd = -1;
212 DIR *xldir;
213
214 /* open file if valid filename is provided */
215 if (fname != NULL)
217
218 /*
219 * A valid file name is not passed, so search the complete directory. If
220 * we find any file whose name is a valid WAL file name then try to open
221 * it. If we cannot open it, bail out.
222 */
223 else if ((xldir = opendir(directory)) != NULL)
224 {
225 struct dirent *xlde;
226
227 while ((xlde = readdir(xldir)) != NULL)
228 {
229 if (IsXLogFileName(xlde->d_name))
230 {
232 fname = pg_strdup(xlde->d_name);
233 break;
234 }
235 }
236
238 }
239
240 /* set WalSegSz if file is successfully opened */
241 if (fd >= 0)
242 {
244 int r;
245
246 r = read(fd, buf.data, XLOG_BLCKSZ);
247 if (r == XLOG_BLCKSZ)
248 {
250
251 if (!IsValidWalSegSize(longhdr->xlp_seg_size))
252 {
253 pg_log_error(ngettext("invalid WAL segment size in WAL file \"%s\" (%d byte)",
254 "invalid WAL segment size in WAL file \"%s\" (%d bytes)",
255 longhdr->xlp_seg_size),
256 fname, longhdr->xlp_seg_size);
257 pg_log_error_detail("The WAL segment size must be a power of two between 1 MB and 1 GB.");
258 exit(1);
259 }
260
261 *WalSegSz = longhdr->xlp_seg_size;
262 }
263 else if (r < 0)
264 pg_fatal("could not read file \"%s\": %m",
265 fname);
266 else
267 pg_fatal("could not read file \"%s\": read %d of %d",
268 fname, r, XLOG_BLCKSZ);
269 close(fd);
270 return true;
271 }
272
273 return false;
274}
275
276/*
277 * Identify the target directory.
278 *
279 * Try to find the file in several places:
280 * if directory != NULL:
281 * directory /
282 * directory / XLOGDIR /
283 * else
284 * .
285 * XLOGDIR /
286 * $PGDATA / XLOGDIR /
287 *
288 * The valid target directory is returned, and *WalSegSz is set to the
289 * size of the WAL segment found in that directory.
290 */
291static char *
293{
294 char fpath[MAXPGPATH];
295
296 if (directory != NULL)
297 {
299 return pg_strdup(directory);
300
301 /* directory / XLOGDIR */
303 if (search_directory(fpath, fname, WalSegSz))
304 return pg_strdup(fpath);
305 }
306 else
307 {
308 const char *datadir;
309
310 /* current directory */
311 if (search_directory(".", fname, WalSegSz))
312 return pg_strdup(".");
313 /* XLOGDIR */
314 if (search_directory(XLOGDIR, fname, WalSegSz))
315 return pg_strdup(XLOGDIR);
316
317 datadir = getenv("PGDATA");
318 /* $PGDATA / XLOGDIR */
319 if (datadir != NULL)
320 {
322 if (search_directory(fpath, fname, WalSegSz))
323 return pg_strdup(fpath);
324 }
325 }
326
327 /* could not locate WAL file */
328 if (fname)
329 pg_fatal("could not locate WAL file \"%s\"", fname);
330 else
331 pg_fatal("could not find any WAL file");
332
333 return NULL; /* not reached */
334}
335
336/* pg_waldump's XLogReaderRoutine->segment_open callback */
337static void
340{
341 TimeLineID tli = *tli_p;
342 char fname[MAXPGPATH];
343 int tries;
344
345 XLogFileName(fname, tli, nextSegNo, state->segcxt.ws_segsize);
346
347 /*
348 * In follow mode there is a short period of time after the server has
349 * written the end of the previous file before the new file is available.
350 * So we loop for 5 seconds looking for the file to appear before giving
351 * up.
352 */
353 for (tries = 0; tries < 10; tries++)
354 {
355 state->seg.ws_file = open_file_in_directory(state->segcxt.ws_dir, fname);
356 if (state->seg.ws_file >= 0)
357 return;
358 if (errno == ENOENT)
359 {
360 int save_errno = errno;
361
362 /* File not there yet, try again */
363 pg_usleep(500 * 1000);
364
366 continue;
367 }
368 /* Any other error, fall through and fail */
369 break;
370 }
371
372 pg_fatal("could not find file \"%s\": %m", fname);
373}
374
375/*
376 * pg_waldump's XLogReaderRoutine->segment_close callback. Same as
377 * wal_segment_close
378 */
379static void
381{
382 close(state->seg.ws_file);
383 /* need to check errno? */
384 state->seg.ws_file = -1;
385}
386
387/* pg_waldump's XLogReaderRoutine->page_read callback */
388static int
391{
392 XLogDumpPrivate *private = state->private_data;
393 int count = XLOG_BLCKSZ;
395
396 if (XLogRecPtrIsValid(private->endptr))
397 {
399 count = XLOG_BLCKSZ;
400 else if (targetPagePtr + reqLen <= private->endptr)
401 count = private->endptr - targetPagePtr;
402 else
403 {
404 private->endptr_reached = true;
405 return -1;
406 }
407 }
408
409 if (!WALRead(state, readBuff, targetPagePtr, count, private->timeline,
410 &errinfo))
411 {
412 WALOpenSegment *seg = &errinfo.wre_seg;
413 char fname[MAXPGPATH];
414
415 XLogFileName(fname, seg->ws_tli, seg->ws_segno,
416 state->segcxt.ws_segsize);
417
418 if (errinfo.wre_errno != 0)
419 {
420 errno = errinfo.wre_errno;
421 pg_fatal("could not read from file \"%s\", offset %d: %m",
422 fname, errinfo.wre_off);
423 }
424 else
425 pg_fatal("could not read from file \"%s\", offset %d: read %d of %d",
426 fname, errinfo.wre_off, errinfo.wre_read,
427 errinfo.wre_req);
428 }
429
430 return count;
431}
432
433/*
434 * Boolean to return whether the given WAL record matches a specific relation
435 * and optionally block.
436 */
437static bool
442{
443 int block_id;
444
445 for (block_id = 0; block_id <= XLogRecMaxBlockId(record); block_id++)
446 {
447 RelFileLocator rlocator;
448 ForkNumber forknum;
450
452 &rlocator, &forknum, &blk, NULL))
453 continue;
454
455 if ((matchFork == InvalidForkNumber || matchFork == forknum) &&
459 return true;
460 }
461
462 return false;
463}
464
465/*
466 * Boolean to return whether the given WAL record contains a full page write.
467 */
468static bool
470{
471 int block_id;
472
473 for (block_id = 0; block_id <= XLogRecMaxBlockId(record); block_id++)
474 {
475 if (!XLogRecHasBlockRef(record, block_id))
476 continue;
477
478 if (XLogRecHasBlockImage(record, block_id))
479 return true;
480 }
481
482 return false;
483}
484
485/*
486 * Function to externally save all FPWs stored in the given WAL record.
487 * Decompression is applied to all the blocks saved, if necessary.
488 */
489static void
491{
492 int block_id;
493
494 for (block_id = 0; block_id <= XLogRecMaxBlockId(record); block_id++)
495 {
497 Page page;
498 char filename[MAXPGPATH];
499 char forkname[FORKNAMECHARS + 2]; /* _ + terminating zero */
500 FILE *file;
504
505 if (!XLogRecHasBlockRef(record, block_id))
506 continue;
507
508 if (!XLogRecHasBlockImage(record, block_id))
509 continue;
510
511 page = (Page) buf.data;
512
513 /* Full page exists, so let's save it */
514 if (!RestoreBlockImage(record, block_id, page))
515 pg_fatal("%s", record->errormsg_buf);
516
518 &rnode, &fork, &blk, NULL);
519
520 if (fork >= 0 && fork <= MAX_FORKNUM)
521 sprintf(forkname, "_%s", forkNames[fork]);
522 else
523 pg_fatal("invalid fork number: %u", fork);
524
525 snprintf(filename, MAXPGPATH, "%s/%08X-%08X-%08X.%u.%u.%u.%u%s", savepath,
526 record->seg.ws_tli,
528 rnode.spcOid, rnode.dbOid, rnode.relNumber, blk, forkname);
529
530 file = fopen(filename, PG_BINARY_W);
531 if (!file)
532 pg_fatal("could not open file \"%s\": %m", filename);
533
534 if (fwrite(page, BLCKSZ, 1, file) != 1)
535 pg_fatal("could not write file \"%s\": %m", filename);
536
537 if (fclose(file) != 0)
538 pg_fatal("could not close file \"%s\": %m", filename);
539 }
540}
541
542/*
543 * Print a record to stdout
544 */
545static void
547{
548 const char *id;
549 const RmgrDescData *desc = GetRmgrDesc(XLogRecGetRmid(record));
550 uint32 rec_len;
551 uint32 fpi_len;
552 uint8 info = XLogRecGetInfo(record);
553 XLogRecPtr xl_prev = XLogRecGetPrev(record);
555
556 XLogRecGetLen(record, &rec_len, &fpi_len);
557
558 printf("rmgr: %-11s len (rec/tot): %6u/%6u, tx: %10u, lsn: %X/%08X, prev %X/%08X, ",
559 desc->rm_name,
560 rec_len, XLogRecGetTotalLen(record),
561 XLogRecGetXid(record),
563 LSN_FORMAT_ARGS(xl_prev));
564
565 id = desc->rm_identify(info);
566 if (id == NULL)
567 printf("desc: UNKNOWN (%x) ", info & ~XLR_INFO_MASK);
568 else
569 printf("desc: %s ", id);
570
571 initStringInfo(&s);
572 desc->rm_desc(&s, record);
573 printf("%s", s.data);
574
575 resetStringInfo(&s);
576 XLogRecGetBlockRefInfo(record, true, config->bkp_details, &s, NULL);
577 printf("%s", s.data);
578 pfree(s.data);
579}
580
581/*
582 * Display a single row of record counts and sizes for an rmgr or record.
583 */
584static void
587 uint64 rec_len, uint64 total_rec_len,
588 uint64 fpi_len, uint64 total_fpi_len,
589 uint64 tot_len, uint64 total_len)
590{
591 double n_pct,
595
596 n_pct = 0;
597 if (total_count != 0)
598 n_pct = 100 * (double) n / total_count;
599
600 rec_len_pct = 0;
601 if (total_rec_len != 0)
602 rec_len_pct = 100 * (double) rec_len / total_rec_len;
603
604 fpi_len_pct = 0;
605 if (total_fpi_len != 0)
606 fpi_len_pct = 100 * (double) fpi_len / total_fpi_len;
607
608 tot_len_pct = 0;
609 if (total_len != 0)
610 tot_len_pct = 100 * (double) tot_len / total_len;
611
612 printf("%-27s "
613 "%20" PRIu64 " (%6.02f) "
614 "%20" PRIu64 " (%6.02f) "
615 "%20" PRIu64 " (%6.02f) "
616 "%20" PRIu64 " (%6.02f)\n",
617 name, n, n_pct, rec_len, rec_len_pct, fpi_len, fpi_len_pct,
619}
620
621
622/*
623 * Display summary statistics about the records seen so far.
624 */
625static void
627{
628 int ri,
629 rj;
633 uint64 total_len = 0;
634 double rec_len_pct,
636
637 /*
638 * Leave if no stats have been computed yet, as tracked by the end LSN.
639 */
640 if (!XLogRecPtrIsValid(stats->endptr))
641 return;
642
643 /*
644 * Each row shows its percentages of the total, so make a first pass to
645 * calculate column totals.
646 */
647
648 for (ri = 0; ri <= RM_MAX_ID; ri++)
649 {
650 if (!RmgrIdIsValid(ri))
651 continue;
652
653 total_count += stats->rmgr_stats[ri].count;
656 }
657 total_len = total_rec_len + total_fpi_len;
658
659 printf("WAL statistics between %X/%08X and %X/%08X:\n",
660 LSN_FORMAT_ARGS(stats->startptr), LSN_FORMAT_ARGS(stats->endptr));
661
662 /*
663 * 27 is strlen("Transaction/COMMIT_PREPARED"), 20 is strlen(2^64), 8 is
664 * strlen("(100.00%)")
665 */
666
667 printf("%-27s %20s %8s %20s %8s %20s %8s %20s %8s\n"
668 "%-27s %20s %8s %20s %8s %20s %8s %20s %8s\n",
669 "Type", "N", "(%)", "Record size", "(%)", "FPI size", "(%)", "Combined size", "(%)",
670 "----", "-", "---", "-----------", "---", "--------", "---", "-------------", "---");
671
672 for (ri = 0; ri <= RM_MAX_ID; ri++)
673 {
674 uint64 count,
675 rec_len,
676 fpi_len,
677 tot_len;
678 const RmgrDescData *desc;
679
680 if (!RmgrIdIsValid(ri))
681 continue;
682
683 desc = GetRmgrDesc(ri);
684
685 if (!config->stats_per_record)
686 {
687 count = stats->rmgr_stats[ri].count;
688 rec_len = stats->rmgr_stats[ri].rec_len;
689 fpi_len = stats->rmgr_stats[ri].fpi_len;
690 tot_len = rec_len + fpi_len;
691
692 if (RmgrIdIsCustom(ri) && count == 0)
693 continue;
694
696 count, total_count, rec_len, total_rec_len,
697 fpi_len, total_fpi_len, tot_len, total_len);
698 }
699 else
700 {
701 for (rj = 0; rj < MAX_XLINFO_TYPES; rj++)
702 {
703 const char *id;
704
705 count = stats->record_stats[ri][rj].count;
706 rec_len = stats->record_stats[ri][rj].rec_len;
707 fpi_len = stats->record_stats[ri][rj].fpi_len;
708 tot_len = rec_len + fpi_len;
709
710 /* Skip undefined combinations and ones that didn't occur */
711 if (count == 0)
712 continue;
713
714 /* the upper four bits in xl_info are the rmgr's */
715 id = desc->rm_identify(rj << 4);
716 if (id == NULL)
717 id = psprintf("UNKNOWN (%x)", rj << 4);
718
719 XLogDumpStatsRow(psprintf("%s/%s", desc->rm_name, id),
720 count, total_count, rec_len, total_rec_len,
721 fpi_len, total_fpi_len, tot_len, total_len);
722 }
723 }
724 }
725
726 printf("%-27s %20s %8s %20s %8s %20s %8s %20s\n",
727 "", "--------", "", "--------", "", "--------", "", "--------");
728
729 /*
730 * The percentages in earlier rows were calculated against the column
731 * total, but the ones that follow are against the row total. Note that
732 * these are displayed with a % symbol to differentiate them from the
733 * earlier ones, and are thus up to 9 characters long.
734 */
735
736 rec_len_pct = 0;
737 if (total_len != 0)
738 rec_len_pct = 100 * (double) total_rec_len / total_len;
739
740 fpi_len_pct = 0;
741 if (total_len != 0)
742 fpi_len_pct = 100 * (double) total_fpi_len / total_len;
743
744 printf("%-27s "
745 "%20" PRIu64 " %-9s"
746 "%20" PRIu64 " %-9s"
747 "%20" PRIu64 " %-9s"
748 "%20" PRIu64 " %-6s\n",
749 "Total", stats->count, "",
750 total_rec_len, psprintf("[%.02f%%]", rec_len_pct),
751 total_fpi_len, psprintf("[%.02f%%]", fpi_len_pct),
752 total_len, "[100%]");
753}
754
755static void
756usage(void)
757{
758 printf(_("%s decodes and displays PostgreSQL write-ahead logs for debugging.\n\n"),
759 progname);
760 printf(_("Usage:\n"));
761 printf(_(" %s [OPTION]... [STARTSEG [ENDSEG]]\n"), progname);
762 printf(_("\nOptions:\n"));
763 printf(_(" -b, --bkp-details output detailed information about backup blocks\n"));
764 printf(_(" -B, --block=N with --relation, only show records that modify block N\n"));
765 printf(_(" -e, --end=RECPTR stop reading at WAL location RECPTR\n"));
766 printf(_(" -f, --follow keep retrying after reaching end of WAL\n"));
767 printf(_(" -F, --fork=FORK only show records that modify blocks in fork FORK;\n"
768 " valid names are main, fsm, vm, init\n"));
769 printf(_(" -n, --limit=N number of records to display\n"));
770 printf(_(" -p, --path=PATH directory in which to find WAL segment files or a\n"
771 " directory with a ./pg_wal that contains such files\n"
772 " (default: current directory, ./pg_wal, $PGDATA/pg_wal)\n"));
773 printf(_(" -q, --quiet do not print any output, except for errors\n"));
774 printf(_(" -r, --rmgr=RMGR only show records generated by resource manager RMGR;\n"
775 " use --rmgr=list to list valid resource manager names\n"));
776 printf(_(" -R, --relation=T/D/R only show records that modify blocks in relation T/D/R\n"));
777 printf(_(" -s, --start=RECPTR start reading at WAL location RECPTR\n"));
778 printf(_(" -t, --timeline=TLI timeline from which to read WAL records\n"
779 " (default: 1 or the value used in STARTSEG)\n"));
780 printf(_(" -V, --version output version information, then exit\n"));
781 printf(_(" -w, --fullpage only show records with a full page write\n"));
782 printf(_(" -x, --xid=XID only show records with transaction ID XID\n"));
783 printf(_(" -z, --stats[=record] show statistics instead of records\n"
784 " (optionally, show per-record statistics)\n"));
785 printf(_(" --save-fullpage=DIR save full page images to DIR\n"));
786 printf(_(" -?, --help show this help, then exit\n"));
787 printf(_("\nReport bugs to <%s>.\n"), PACKAGE_BUGREPORT);
788 printf(_("%s home page: <%s>\n"), PACKAGE_NAME, PACKAGE_URL);
789}
790
791int
792main(int argc, char **argv)
793{
794 uint32 xlogid;
795 uint32 xrecoff;
797 XLogDumpPrivate private;
798 XLogDumpConfig config;
799 XLogStats stats;
800 XLogRecord *record;
802 char *waldir = NULL;
803 char *errormsg;
804 int WalSegSz;
805
806 static struct option long_options[] = {
807 {"bkp-details", no_argument, NULL, 'b'},
808 {"block", required_argument, NULL, 'B'},
809 {"end", required_argument, NULL, 'e'},
810 {"follow", no_argument, NULL, 'f'},
811 {"fork", required_argument, NULL, 'F'},
812 {"fullpage", no_argument, NULL, 'w'},
813 {"help", no_argument, NULL, '?'},
814 {"limit", required_argument, NULL, 'n'},
815 {"path", required_argument, NULL, 'p'},
816 {"quiet", no_argument, NULL, 'q'},
817 {"relation", required_argument, NULL, 'R'},
818 {"rmgr", required_argument, NULL, 'r'},
819 {"start", required_argument, NULL, 's'},
820 {"timeline", required_argument, NULL, 't'},
821 {"xid", required_argument, NULL, 'x'},
822 {"version", no_argument, NULL, 'V'},
823 {"stats", optional_argument, NULL, 'z'},
824 {"save-fullpage", required_argument, NULL, 1},
825 {NULL, 0, NULL, 0}
826 };
827
828 int option;
829 int optindex = 0;
830
831#ifndef WIN32
833#endif
834
835 pg_logging_init(argv[0]);
836 set_pglocale_pgservice(argv[0], PG_TEXTDOMAIN("pg_waldump"));
837 progname = get_progname(argv[0]);
838
839 if (argc > 1)
840 {
841 if (strcmp(argv[1], "--help") == 0 || strcmp(argv[1], "-?") == 0)
842 {
843 usage();
844 exit(0);
845 }
846 if (strcmp(argv[1], "--version") == 0 || strcmp(argv[1], "-V") == 0)
847 {
848 puts("pg_waldump (PostgreSQL) " PG_VERSION);
849 exit(0);
850 }
851 }
852
853 memset(&private, 0, sizeof(XLogDumpPrivate));
854 memset(&config, 0, sizeof(XLogDumpConfig));
855 memset(&stats, 0, sizeof(XLogStats));
856
857 private.timeline = 1;
858 private.startptr = InvalidXLogRecPtr;
859 private.endptr = InvalidXLogRecPtr;
860 private.endptr_reached = false;
861
862 config.quiet = false;
863 config.bkp_details = false;
864 config.stop_after_records = -1;
865 config.already_displayed_records = 0;
866 config.follow = false;
867 /* filter_by_rmgr array was zeroed by memset above */
868 config.filter_by_rmgr_enabled = false;
870 config.filter_by_xid_enabled = false;
871 config.filter_by_extended = false;
872 config.filter_by_relation_enabled = false;
875 config.filter_by_fpw = false;
876 config.save_fullpage_path = NULL;
877 config.stats = false;
878 config.stats_per_record = false;
879
880 stats.startptr = InvalidXLogRecPtr;
881 stats.endptr = InvalidXLogRecPtr;
882
883 if (argc <= 1)
884 {
885 pg_log_error("no arguments specified");
886 goto bad_argument;
887 }
888
889 while ((option = getopt_long(argc, argv, "bB:e:fF:n:p:qr:R:s:t:wx:z",
890 long_options, &optindex)) != -1)
891 {
892 switch (option)
893 {
894 case 'b':
895 config.bkp_details = true;
896 break;
897 case 'B':
898 if (sscanf(optarg, "%u", &config.filter_by_relation_block) != 1 ||
900 {
901 pg_log_error("invalid block number: \"%s\"", optarg);
902 goto bad_argument;
903 }
905 config.filter_by_extended = true;
906 break;
907 case 'e':
908 if (sscanf(optarg, "%X/%08X", &xlogid, &xrecoff) != 2)
909 {
910 pg_log_error("invalid WAL location: \"%s\"",
911 optarg);
912 goto bad_argument;
913 }
914 private.endptr = (uint64) xlogid << 32 | xrecoff;
915 break;
916 case 'f':
917 config.follow = true;
918 break;
919 case 'F':
922 {
923 pg_log_error("invalid fork name: \"%s\"", optarg);
924 goto bad_argument;
925 }
926 config.filter_by_extended = true;
927 break;
928 case 'n':
929 if (sscanf(optarg, "%d", &config.stop_after_records) != 1)
930 {
931 pg_log_error("invalid value \"%s\" for option %s", optarg, "-n/--limit");
932 goto bad_argument;
933 }
934 break;
935 case 'p':
937 break;
938 case 'q':
939 config.quiet = true;
940 break;
941 case 'r':
942 {
943 int rmid;
944
945 if (pg_strcasecmp(optarg, "list") == 0)
946 {
949 }
950
951 /*
952 * First look for the generated name of a custom rmgr, of
953 * the form "custom###". We accept this form, because the
954 * custom rmgr module is not loaded, so there's no way to
955 * know the real name. This convention should be
956 * consistent with that in rmgrdesc.c.
957 */
958 if (sscanf(optarg, "custom%03d", &rmid) == 1)
959 {
960 if (!RmgrIdIsCustom(rmid))
961 {
962 pg_log_error("custom resource manager \"%s\" does not exist",
963 optarg);
964 goto bad_argument;
965 }
966 config.filter_by_rmgr[rmid] = true;
967 config.filter_by_rmgr_enabled = true;
968 }
969 else
970 {
971 /* then look for builtin rmgrs */
972 for (rmid = 0; rmid <= RM_MAX_BUILTIN_ID; rmid++)
973 {
974 if (pg_strcasecmp(optarg, GetRmgrDesc(rmid)->rm_name) == 0)
975 {
976 config.filter_by_rmgr[rmid] = true;
977 config.filter_by_rmgr_enabled = true;
978 break;
979 }
980 }
981 if (rmid > RM_MAX_BUILTIN_ID)
982 {
983 pg_log_error("resource manager \"%s\" does not exist",
984 optarg);
985 goto bad_argument;
986 }
987 }
988 }
989 break;
990 case 'R':
991 if (sscanf(optarg, "%u/%u/%u",
994 &config.filter_by_relation.relNumber) != 3 ||
997 {
998 pg_log_error("invalid relation specification: \"%s\"", optarg);
999 pg_log_error_detail("Expecting \"tablespace OID/database OID/relation filenode\".");
1000 goto bad_argument;
1001 }
1002 config.filter_by_relation_enabled = true;
1003 config.filter_by_extended = true;
1004 break;
1005 case 's':
1006 if (sscanf(optarg, "%X/%08X", &xlogid, &xrecoff) != 2)
1007 {
1008 pg_log_error("invalid WAL location: \"%s\"",
1009 optarg);
1010 goto bad_argument;
1011 }
1012 else
1013 private.startptr = (uint64) xlogid << 32 | xrecoff;
1014 break;
1015 case 't':
1016
1017 /*
1018 * This is like option_parse_int() but needs to handle
1019 * unsigned 32-bit int. Also, we accept both decimal and
1020 * hexadecimal specifications here.
1021 */
1022 {
1023 char *endptr;
1024 unsigned long val;
1025
1026 errno = 0;
1027 val = strtoul(optarg, &endptr, 0);
1028
1029 while (*endptr != '\0' && isspace((unsigned char) *endptr))
1030 endptr++;
1031
1032 if (*endptr != '\0')
1033 {
1034 pg_log_error("invalid value \"%s\" for option %s",
1035 optarg, "-t/--timeline");
1036 goto bad_argument;
1037 }
1038
1040 {
1041 pg_log_error("%s must be in range %u..%u",
1042 "-t/--timeline", 1, UINT_MAX);
1043 goto bad_argument;
1044 }
1045
1046 private.timeline = val;
1047
1048 break;
1049 }
1050 case 'w':
1051 config.filter_by_fpw = true;
1052 break;
1053 case 'x':
1054 if (sscanf(optarg, "%u", &config.filter_by_xid) != 1)
1055 {
1056 pg_log_error("invalid transaction ID specification: \"%s\"",
1057 optarg);
1058 goto bad_argument;
1059 }
1060 config.filter_by_xid_enabled = true;
1061 break;
1062 case 'z':
1063 config.stats = true;
1064 config.stats_per_record = false;
1065 if (optarg)
1066 {
1067 if (strcmp(optarg, "record") == 0)
1068 config.stats_per_record = true;
1069 else if (strcmp(optarg, "rmgr") != 0)
1070 {
1071 pg_log_error("unrecognized value for option %s: %s",
1072 "--stats", optarg);
1073 goto bad_argument;
1074 }
1075 }
1076 break;
1077 case 1:
1079 break;
1080 default:
1081 goto bad_argument;
1082 }
1083 }
1084
1087 {
1088 pg_log_error("option %s requires option %s to be specified",
1089 "-B/--block", "-R/--relation");
1090 goto bad_argument;
1091 }
1092
1093 if ((optind + 2) < argc)
1094 {
1095 pg_log_error("too many command-line arguments (first is \"%s\")",
1096 argv[optind + 2]);
1097 goto bad_argument;
1098 }
1099
1100 if (waldir != NULL)
1101 {
1102 /* validate path points to directory */
1104 {
1105 pg_log_error("could not open directory \"%s\": %m", waldir);
1106 goto bad_argument;
1107 }
1108 }
1109
1110 if (config.save_fullpage_path != NULL)
1112
1113 /* parse files as start/end boundaries, extract path if not specified */
1114 if (optind < argc)
1115 {
1116 char *directory = NULL;
1117 char *fname = NULL;
1118 int fd;
1119 XLogSegNo segno;
1120
1121 split_path(argv[optind], &directory, &fname);
1122
1123 if (waldir == NULL && directory != NULL)
1124 {
1125 waldir = directory;
1126
1128 pg_fatal("could not open directory \"%s\": %m", waldir);
1129 }
1130
1133 if (fd < 0)
1134 pg_fatal("could not open file \"%s\"", fname);
1135 close(fd);
1136
1137 /* parse position from file */
1138 XLogFromFileName(fname, &private.timeline, &segno, WalSegSz);
1139
1140 if (!XLogRecPtrIsValid(private.startptr))
1141 XLogSegNoOffsetToRecPtr(segno, 0, WalSegSz, private.startptr);
1142 else if (!XLByteInSeg(private.startptr, segno, WalSegSz))
1143 {
1144 pg_log_error("start WAL location %X/%08X is not inside file \"%s\"",
1145 LSN_FORMAT_ARGS(private.startptr),
1146 fname);
1147 goto bad_argument;
1148 }
1149
1150 /* no second file specified, set end position */
1151 if (!(optind + 1 < argc) && !XLogRecPtrIsValid(private.endptr))
1152 XLogSegNoOffsetToRecPtr(segno + 1, 0, WalSegSz, private.endptr);
1153
1154 /* parse ENDSEG if passed */
1155 if (optind + 1 < argc)
1156 {
1158
1159 /* ignore directory, already have that */
1160 split_path(argv[optind + 1], &directory, &fname);
1161
1163 if (fd < 0)
1164 pg_fatal("could not open file \"%s\"", fname);
1165 close(fd);
1166
1167 /* parse position from file */
1168 XLogFromFileName(fname, &private.timeline, &endsegno, WalSegSz);
1169
1170 if (endsegno < segno)
1171 pg_fatal("ENDSEG %s is before STARTSEG %s",
1172 argv[optind + 1], argv[optind]);
1173
1174 if (!XLogRecPtrIsValid(private.endptr))
1176 private.endptr);
1177
1178 /* set segno to endsegno for check of --end */
1179 segno = endsegno;
1180 }
1181
1182
1183 if (!XLByteInSeg(private.endptr, segno, WalSegSz) &&
1184 private.endptr != (segno + 1) * WalSegSz)
1185 {
1186 pg_log_error("end WAL location %X/%08X is not inside file \"%s\"",
1187 LSN_FORMAT_ARGS(private.endptr),
1188 argv[argc - 1]);
1189 goto bad_argument;
1190 }
1191 }
1192 else
1194
1195 /* we don't know what to print */
1196 if (!XLogRecPtrIsValid(private.startptr))
1197 {
1198 pg_log_error("no start WAL location given");
1199 goto bad_argument;
1200 }
1201
1202 /* done with argument parsing, do the actual work */
1203
1204 /* we have everything we need, start reading */
1207 XL_ROUTINE(.page_read = WALDumpReadPage,
1208 .segment_open = WALDumpOpenSegment,
1209 .segment_close = WALDumpCloseSegment),
1210 &private);
1211 if (!xlogreader_state)
1212 pg_fatal("out of memory while allocating a WAL reading processor");
1213
1214 /* first find a valid recptr to start from */
1216
1218 pg_fatal("could not find a valid record after %X/%08X",
1219 LSN_FORMAT_ARGS(private.startptr));
1220
1221 /*
1222 * Display a message that we're skipping data if `from` wasn't a pointer
1223 * to the start of a record and also wasn't a pointer to the beginning of
1224 * a segment (e.g. we were used in file mode).
1225 */
1226 if (first_record != private.startptr &&
1227 XLogSegmentOffset(private.startptr, WalSegSz) != 0)
1228 pg_log_info(ngettext("first record is after %X/%08X, at %X/%08X, skipping over %u byte",
1229 "first record is after %X/%08X, at %X/%08X, skipping over %u bytes",
1230 (first_record - private.startptr)),
1231 LSN_FORMAT_ARGS(private.startptr),
1233 (uint32) (first_record - private.startptr));
1234
1235 if (config.stats == true && !config.quiet)
1236 stats.startptr = first_record;
1237
1238 for (;;)
1239 {
1240 if (time_to_stop)
1241 {
1242 /* We've been Ctrl-C'ed, so leave */
1243 break;
1244 }
1245
1246 /* try to read the next record */
1247 record = XLogReadRecord(xlogreader_state, &errormsg);
1248 if (!record)
1249 {
1250 if (!config.follow || private.endptr_reached)
1251 break;
1252 else
1253 {
1254 pg_usleep(1000000L); /* 1 second */
1255 continue;
1256 }
1257 }
1258
1259 /* apply all specified filters */
1260 if (config.filter_by_rmgr_enabled &&
1261 !config.filter_by_rmgr[record->xl_rmid])
1262 continue;
1263
1264 if (config.filter_by_xid_enabled &&
1265 config.filter_by_xid != record->xl_xid)
1266 continue;
1267
1268 /* check for extended filtering */
1269 if (config.filter_by_extended &&
1272 config.filter_by_relation :
1278 continue;
1279
1281 continue;
1282
1283 /* perform any per-record work */
1284 if (!config.quiet)
1285 {
1286 if (config.stats == true)
1287 {
1289 stats.endptr = xlogreader_state->EndRecPtr;
1290 }
1291 else
1293 }
1294
1295 /* save full pages if requested */
1296 if (config.save_fullpage_path != NULL)
1298
1299 /* check whether we printed enough */
1301 if (config.stop_after_records > 0 &&
1303 break;
1304 }
1305
1306 if (config.stats == true && !config.quiet)
1307 XLogDumpDisplayStats(&config, &stats);
1308
1309 if (time_to_stop)
1310 exit(0);
1311
1312 if (errormsg)
1313 pg_fatal("error in WAL record at %X/%08X: %s",
1314 LSN_FORMAT_ARGS(xlogreader_state->ReadRecPtr),
1315 errormsg);
1316
1318
1319 return EXIT_SUCCESS;
1320
1322 pg_log_error_hint("Try \"%s --help\" for more information.", progname);
1323 return EXIT_FAILURE;
1324}
uint32 BlockNumber
Definition block.h:31
#define InvalidBlockNumber
Definition block.h:33
static bool BlockNumberIsValid(BlockNumber blockNumber)
Definition block.h:71
PageData * Page
Definition bufpage.h:81
uint8_t uint8
Definition c.h:544
#define ngettext(s, p, n)
Definition c.h:1176
#define SIGNAL_ARGS
Definition c.h:1363
#define Assert(condition)
Definition c.h:873
#define PG_TEXTDOMAIN(domain)
Definition c.h:1209
#define PG_BINARY
Definition c.h:1287
uint64_t uint64
Definition c.h:547
uint32_t uint32
Definition c.h:546
#define PG_BINARY_W
Definition c.h:1290
uint32 TransactionId
Definition c.h:666
#define OidIsValid(objectId)
Definition c.h:788
void set_pglocale_pgservice(const char *argv0, const char *app)
Definition exec.c:430
int main(void)
int closedir(DIR *)
Definition dirent.c:127
struct dirent * readdir(DIR *)
Definition dirent.c:78
DIR * opendir(const char *)
Definition dirent.c:33
#define _(x)
Definition elog.c:91
char * pg_strdup(const char *in)
Definition fe_memutils.c:85
int pg_dir_create_mode
Definition file_perm.c:18
int getopt_long(int argc, char *const argv[], const char *optstring, const struct option *longopts, int *longindex)
Definition getopt_long.c:60
#define no_argument
Definition getopt_long.h:25
#define required_argument
Definition getopt_long.h:26
#define optional_argument
Definition getopt_long.h:27
long val
Definition informix.c:689
#define close(a)
Definition win32.h:12
#define read(a, b, c)
Definition win32.h:13
int i
Definition isn.c:77
void pg_logging_init(const char *argv0)
Definition logging.c:83
#define pg_log_error(...)
Definition logging.h:106
#define pg_log_error_hint(...)
Definition logging.h:112
#define pg_log_info(...)
Definition logging.h:124
#define pg_log_error_detail(...)
Definition logging.h:109
void pfree(void *pointer)
Definition mcxt.c:1616
char * pnstrdup(const char *in, Size len)
Definition mcxt.c:1792
#define pg_fatal(...)
#define MAXPGPATH
static char * filename
Definition pg_dumpall.c:120
PGDLLIMPORT int optind
Definition getopt.c:51
PGDLLIMPORT char * optarg
Definition getopt.c:53
char * datadir
static char buf[DEFAULT_XLOG_SEG_SIZE]
static void XLogDumpDisplayStats(XLogDumpConfig *config, XLogStats *stats)
Definition pg_waldump.c:626
static void WALDumpCloseSegment(XLogReaderState *state)
Definition pg_waldump.c:380
static volatile sig_atomic_t time_to_stop
Definition pg_waldump.c:42
static void split_path(const char *path, char **dir, char **fname)
Definition pg_waldump.c:160
static bool search_directory(const char *directory, const char *fname, int *WalSegSz)
Definition pg_waldump.c:209
static int open_file_in_directory(const char *directory, const char *fname)
Definition pg_waldump.c:187
static char * identify_target_directory(char *directory, char *fname, int *WalSegSz)
Definition pg_waldump.c:292
static void XLogDumpDisplayRecord(XLogDumpConfig *config, XLogReaderState *record)
Definition pg_waldump.c:546
static void XLogDumpStatsRow(const char *name, uint64 n, uint64 total_count, uint64 rec_len, uint64 total_rec_len, uint64 fpi_len, uint64 total_fpi_len, uint64 tot_len, uint64 total_len)
Definition pg_waldump.c:585
static void create_fullpage_directory(char *path)
Definition pg_waldump.c:127
static bool verify_directory(const char *directory)
Definition pg_waldump.c:112
static const RelFileLocator emptyRelFileLocator
Definition pg_waldump.c:44
static void print_rmgr_list(void)
Definition pg_waldump.c:97
static void WALDumpOpenSegment(XLogReaderState *state, XLogSegNo nextSegNo, TimeLineID *tli_p)
Definition pg_waldump.c:338
static const char * progname
Definition pg_waldump.c:40
static void usage(void)
Definition pg_waldump.c:756
static int WALDumpReadPage(XLogReaderState *state, XLogRecPtr targetPagePtr, int reqLen, XLogRecPtr targetPtr, char *readBuff)
Definition pg_waldump.c:389
static void XLogRecordSaveFPWs(XLogReaderState *record, const char *savepath)
Definition pg_waldump.c:490
static bool XLogRecordHasFPW(XLogReaderState *record)
Definition pg_waldump.c:469
static void sigint_handler(SIGNAL_ARGS)
Definition pg_waldump.c:90
static bool XLogRecordMatchesRelationBlock(XLogReaderState *record, RelFileLocator matchRlocator, BlockNumber matchBlock, ForkNumber matchFork)
Definition pg_waldump.c:438
#define pqsignal
Definition port.h:547
int pg_mkdir_p(char *path, int omode)
Definition pgmkdirp.c:57
int pg_strcasecmp(const char *s1, const char *s2)
#define sprintf
Definition port.h:262
int pg_check_dir(const char *dir)
Definition pgcheckdir.c:33
#define snprintf
Definition port.h:260
const char * get_progname(const char *argv0)
Definition path.c:652
#define printf(...)
Definition port.h:266
static int fd(const char *x, int i)
static int fb(int x)
char * psprintf(const char *fmt,...)
Definition psprintf.c:43
#define RelFileLocatorEquals(locator1, locator2)
ForkNumber forkname_to_number(const char *forkName)
Definition relpath.c:50
const char *const forkNames[]
Definition relpath.c:33
ForkNumber
Definition relpath.h:56
@ InvalidForkNumber
Definition relpath.h:57
#define MAX_FORKNUM
Definition relpath.h:70
#define FORKNAMECHARS
Definition relpath.h:72
#define RelFileNumberIsValid(relnumber)
Definition relpath.h:27
#define RM_MAX_BUILTIN_ID
Definition rmgr.h:34
static bool RmgrIdIsCustom(int rmid)
Definition rmgr.h:48
#define RmgrIdIsValid(rmid)
Definition rmgr.h:53
#define RM_MAX_ID
Definition rmgr.h:33
const RmgrDescData * GetRmgrDesc(RmgrId rmid)
Definition rmgrdesc.c:87
#define EXIT_SUCCESS
Definition settings.h:193
#define EXIT_FAILURE
Definition settings.h:197
void pg_usleep(long microsec)
Definition signal.c:53
int WalSegSz
Definition streamutil.c:32
void resetStringInfo(StringInfo str)
Definition stringinfo.c:126
void initStringInfo(StringInfo str)
Definition stringinfo.c:97
Definition dirent.c:26
RelFileNumber relNumber
const char * rm_name
Definition rmgrdesc.h:16
void(* rm_desc)(StringInfo buf, XLogReaderState *record)
Definition rmgrdesc.h:17
const char *(* rm_identify)(uint8 info)
Definition rmgrdesc.h:18
XLogSegNo ws_segno
Definition xlogreader.h:48
TimeLineID ws_tli
Definition xlogreader.h:49
bool filter_by_xid_enabled
Definition pg_waldump.c:69
RelFileLocator filter_by_relation
Definition pg_waldump.c:70
char * save_fullpage_path
Definition pg_waldump.c:79
bool filter_by_rmgr[RM_MAX_ID+1]
Definition pg_waldump.c:66
bool filter_by_extended
Definition pg_waldump.c:71
bool stats_per_record
Definition pg_waldump.c:63
int already_displayed_records
Definition pg_waldump.c:60
int stop_after_records
Definition pg_waldump.c:59
bool filter_by_relation_enabled
Definition pg_waldump.c:72
BlockNumber filter_by_relation_block
Definition pg_waldump.c:73
bool filter_by_rmgr_enabled
Definition pg_waldump.c:67
TransactionId filter_by_xid
Definition pg_waldump.c:68
ForkNumber filter_by_relation_forknum
Definition pg_waldump.c:75
bool filter_by_relation_block_enabled
Definition pg_waldump.c:74
XLogRecPtr endptr
Definition pg_waldump.c:50
XLogRecPtr startptr
Definition pg_waldump.c:49
TimeLineID timeline
Definition pg_waldump.c:48
char * errormsg_buf
Definition xlogreader.h:310
XLogRecPtr ReadRecPtr
Definition xlogreader.h:205
WALOpenSegment seg
Definition xlogreader.h:271
uint64 count
Definition xlogstats.h:23
uint64 fpi_len
Definition xlogstats.h:25
uint64 rec_len
Definition xlogstats.h:24
TransactionId xl_xid
Definition xlogrecord.h:44
RmgrId xl_rmid
Definition xlogrecord.h:47
XLogRecStats record_stats[RM_MAX_ID+1][MAX_XLINFO_TYPES]
Definition xlogstats.h:36
uint64 count
Definition xlogstats.h:30
XLogRecStats rmgr_stats[RM_MAX_ID+1]
Definition xlogstats.h:35
#define InvalidTransactionId
Definition transam.h:31
const char * name
#define IsValidWalSegSize(size)
XLogLongPageHeaderData * XLogLongPageHeader
#define XLogSegmentOffset(xlogptr, wal_segsz_bytes)
static bool IsXLogFileName(const char *fname)
static void XLogFromFileName(const char *fname, TimeLineID *tli, XLogSegNo *logSegNo, int wal_segsz_bytes)
#define XLogSegNoOffsetToRecPtr(segno, offset, wal_segsz_bytes, dest)
#define XLOGDIR
static void XLogFileName(char *fname, TimeLineID tli, XLogSegNo logSegNo, int wal_segsz_bytes)
#define XLByteInSeg(xlrp, logSegNo, wal_segsz_bytes)
#define XLogRecPtrIsValid(r)
Definition xlogdefs.h:29
#define LSN_FORMAT_ARGS(lsn)
Definition xlogdefs.h:47
uint64 XLogRecPtr
Definition xlogdefs.h:21
#define InvalidXLogRecPtr
Definition xlogdefs.h:28
uint32 TimeLineID
Definition xlogdefs.h:63
uint64 XLogSegNo
Definition xlogdefs.h:52
void XLogRecGetBlockRefInfo(XLogReaderState *record, bool pretty, bool detailed_format, StringInfo buf, uint32 *fpi_len)
Definition xlogdesc.c:242
bool XLogRecGetBlockTagExtended(XLogReaderState *record, uint8 block_id, RelFileLocator *rlocator, ForkNumber *forknum, BlockNumber *blknum, Buffer *prefetch_buffer)
XLogReaderState * XLogReaderAllocate(int wal_segment_size, const char *waldir, XLogReaderRoutine *routine, void *private_data)
Definition xlogreader.c:107
bool WALRead(XLogReaderState *state, char *buf, XLogRecPtr startptr, Size count, TimeLineID tli, WALReadError *errinfo)
XLogRecord * XLogReadRecord(XLogReaderState *state, char **errormsg)
Definition xlogreader.c:390
void XLogReaderFree(XLogReaderState *state)
Definition xlogreader.c:162
XLogRecPtr XLogFindNextRecord(XLogReaderState *state, XLogRecPtr RecPtr)
bool RestoreBlockImage(XLogReaderState *record, uint8 block_id, char *page)
#define XLogRecGetInfo(decoder)
Definition xlogreader.h:409
#define XLogRecGetRmid(decoder)
Definition xlogreader.h:410
#define XLogRecGetTotalLen(decoder)
Definition xlogreader.h:407
#define XLogRecGetXid(decoder)
Definition xlogreader.h:411
#define XL_ROUTINE(...)
Definition xlogreader.h:117
#define XLogRecMaxBlockId(decoder)
Definition xlogreader.h:417
#define XLogRecHasBlockImage(decoder, block_id)
Definition xlogreader.h:422
#define XLogRecHasBlockRef(decoder, block_id)
Definition xlogreader.h:419
#define XLogRecGetPrev(decoder)
Definition xlogreader.h:408
#define XLR_INFO_MASK
Definition xlogrecord.h:62
void XLogRecStoreStats(XLogStats *stats, XLogReaderState *record)
Definition xlogstats.c:54
void XLogRecGetLen(XLogReaderState *record, uint32 *rec_len, uint32 *fpi_len)
Definition xlogstats.c:22
#define MAX_XLINFO_TYPES
Definition xlogstats.h:19
static const char * directory
Definition zic.c:648