1
0
mirror of https://github.com/postgrespro/pg_probackup.git synced 2024-11-24 08:52:38 +02:00

Remove dead code xlog_is_complete_wal

This routine is not used anywhere now.
This commit is contained in:
Michael Paquier 2016-01-19 09:21:54 +09:00
parent f2c523b1ee
commit 2882954b95
3 changed files with 0 additions and 71 deletions

View File

@ -13,7 +13,6 @@ OBJS = backup.o \
status.o \
util.o \
validate.o \
xlog.o \
datapagemap.o \
parsexlog.o \
xlogreader.o \

View File

@ -276,9 +276,6 @@ extern int pgFileComparePathDesc(const void *f1, const void *f2);
extern int pgFileCompareMtime(const void *f1, const void *f2);
extern int pgFileCompareMtimeDesc(const void *f1, const void *f2);
/* in xlog.c */
extern bool xlog_is_complete_wal(const pgFile *file);
/* in data.c */
extern bool backup_data_file(const char *from_root, const char *to_root,
pgFile *file, const XLogRecPtr *lsn);

67
xlog.c
View File

@ -1,67 +0,0 @@
/*-------------------------------------------------------------------------
*
* xlog.c: Parse WAL files.
*
* Copyright (c) 2009-2013, NIPPON TELEGRAPH AND TELEPHONE CORPORATION
*
*-------------------------------------------------------------------------
*/
#include "pg_arman.h"
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include "access/xlog_internal.h"
/*
* XLogLongPageHeaderData is modified in 8.3, but the layout is compatible
* except xlp_xlog_blcksz.
*/
typedef union XLogPage
{
XLogPageHeaderData header;
XLogLongPageHeaderData lheader;
char data[XLOG_BLCKSZ];
} XLogPage;
/*
* Return whether the file is a WAL segment or not.
* based on ValidXLOGHeader() in src/backend/access/transam/xlog.c.
*/
bool
xlog_is_complete_wal(const pgFile *file)
{
FILE *fp;
XLogPage page;
fp = fopen(file->path, "r");
if (!fp)
return false;
if (fread(&page, 1, sizeof(page), fp) != XLOG_BLCKSZ)
{
fclose(fp);
return false;
}
fclose(fp);
/* check header */
if (page.header.xlp_magic != XLOG_PAGE_MAGIC)
return false;
if ((page.header.xlp_info & ~XLP_ALL_FLAGS) != 0)
return false;
if ((page.header.xlp_info & XLP_LONG_HEADER) == 0)
return false;
if (page.lheader.xlp_seg_size != XLogSegSize)
return false;
if (page.lheader.xlp_xlog_blcksz != XLOG_BLCKSZ)
return false;
/* check size (the actual file size, not backup file size) */
if (file->size != XLogSegSize)
return false;
return true;
}