Skip to content

Commit 477e5bc

Browse files
authored
Some minor fixes (#397)
* Reformat fio_*() definitions for easier grep'ping * typo * move check_postmaster() into src/utils/file.c (from src/util.c), rename it to local_check_postmaster() and make it static/private to src/utils/file.c
1 parent 47c3993 commit 477e5bc

File tree

5 files changed

+174
-117
lines changed

5 files changed

+174
-117
lines changed

src/data.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1516,7 +1516,7 @@ validate_one_page(Page page, BlockNumber absolute_blkno,
15161516
}
15171517

15181518
/*
1519-
* Valiate pages of datafile in PGDATA one by one.
1519+
* Validate pages of datafile in PGDATA one by one.
15201520
*
15211521
* returns true if the file is valid
15221522
* also returns true if the file was not found

src/pg_probackup.h

-2
Original file line numberDiff line numberDiff line change
@@ -1071,8 +1071,6 @@ extern PageState *get_checksum_map(const char *fullpath, uint32 checksum_version
10711071
int n_blocks, XLogRecPtr dest_stop_lsn, BlockNumber segmentno);
10721072
extern datapagemap_t *get_lsn_map(const char *fullpath, uint32 checksum_version,
10731073
int n_blocks, XLogRecPtr shift_lsn, BlockNumber segmentno);
1074-
extern pid_t check_postmaster(const char *pgdata);
1075-
10761074
extern bool validate_file_pages(pgFile *file, const char *fullpath, XLogRecPtr stop_lsn,
10771075
uint32 checksum_version, uint32 backup_version, HeaderMap *hdr_map);
10781076

src/util.c

-48
Original file line numberDiff line numberDiff line change
@@ -556,51 +556,3 @@ datapagemap_print_debug(datapagemap_t *map)
556556

557557
pg_free(iter);
558558
}
559-
560-
/*
561-
* Return pid of postmaster process running in given pgdata.
562-
* Return 0 if there is none.
563-
* Return 1 if postmaster.pid is mangled.
564-
*/
565-
pid_t
566-
check_postmaster(const char *pgdata)
567-
{
568-
FILE *fp;
569-
pid_t pid;
570-
char pid_file[MAXPGPATH];
571-
572-
join_path_components(pid_file, pgdata, "postmaster.pid");
573-
574-
fp = fopen(pid_file, "r");
575-
if (fp == NULL)
576-
{
577-
/* No pid file, acceptable*/
578-
if (errno == ENOENT)
579-
return 0;
580-
else
581-
elog(ERROR, "Cannot open file \"%s\": %s",
582-
pid_file, strerror(errno));
583-
}
584-
585-
if (fscanf(fp, "%i", &pid) != 1)
586-
{
587-
/* something is wrong with the file content */
588-
pid = 1;
589-
}
590-
591-
if (pid > 1)
592-
{
593-
if (kill(pid, 0) != 0)
594-
{
595-
/* process no longer exists */
596-
if (errno == ESRCH)
597-
pid = 0;
598-
else
599-
elog(ERROR, "Failed to send signal 0 to a process %d: %s",
600-
pid, strerror(errno));
601-
}
602-
}
603-
604-
fclose(fp);
605-
return pid;
606-
}

0 commit comments

Comments
 (0)