Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit02ca67d

Browse files
committed
Merge branch 'master' into release_2_5
2 parents6bdd241 +477e5bc commit02ca67d

File tree

9 files changed

+185
-129
lines changed

9 files changed

+185
-129
lines changed

‎src/catalog.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -842,7 +842,7 @@ IsDir(const char *dirpath, const char *entry, fio_location location)
842842
charpath[MAXPGPATH];
843843
structstatst;
844844

845-
snprintf(path,MAXPGPATH,"%s/%s",dirpath,entry);
845+
join_path_components(path,dirpath,entry);
846846

847847
returnfio_stat(path,&st, false,location)==0&&S_ISDIR(st.st_mode);
848848
}
@@ -956,7 +956,7 @@ catalog_get_backup_list(InstanceState *instanceState, time_t requested_backup_id
956956
join_path_components(data_path,instanceState->instance_backup_subdir_path,data_ent->d_name);
957957

958958
/* read backup information from BACKUP_CONTROL_FILE */
959-
snprintf(backup_conf_path,MAXPGPATH,"%s/%s",data_path,BACKUP_CONTROL_FILE);
959+
join_path_components(backup_conf_path,data_path,BACKUP_CONTROL_FILE);
960960
backup=readBackupControlFile(backup_conf_path);
961961

962962
if (!backup)

‎src/data.c

Lines changed: 1 addition & 1 deletion
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/parsexlog.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1017,7 +1017,7 @@ SimpleXLogPageRead(XLogReaderState *xlogreader, XLogRecPtr targetPagePtr,
10171017

10181018
GetXLogFileName(xlogfname,reader_data->tli,reader_data->xlogsegno,wal_seg_size);
10191019

1020-
snprintf(reader_data->xlogpath,MAXPGPATH,"%s/%s",wal_archivedir,xlogfname);
1020+
join_path_components(reader_data->xlogpath,wal_archivedir,xlogfname);
10211021
snprintf(reader_data->gz_xlogpath,MAXPGPATH,"%s.gz",reader_data->xlogpath);
10221022

10231023
/* We fall back to using .partial segment in case if we are running

‎src/pg_probackup.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,8 +1101,6 @@ extern PageState *get_checksum_map(const char *fullpath, uint32 checksum_version
11011101
intn_blocks,XLogRecPtrdest_stop_lsn,BlockNumbersegmentno);
11021102
externdatapagemap_t*get_lsn_map(constchar*fullpath,uint32checksum_version,
11031103
intn_blocks,XLogRecPtrshift_lsn,BlockNumbersegmentno);
1104-
externpid_tcheck_postmaster(constchar*pgdata);
1105-
11061104
externboolvalidate_file_pages(pgFile*file,constchar*fullpath,XLogRecPtrstop_lsn,
11071105
uint32checksum_version,uint32backup_version,HeaderMap*hdr_map);
11081106

‎src/restore.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1483,7 +1483,7 @@ update_recovery_options_before_v12(InstanceState *instanceState, pgBackup *backu
14831483
}
14841484

14851485
elog(LOG,"update recovery settings in recovery.conf");
1486-
snprintf(path,lengthof(path),"%s/recovery.conf",instance_config.pgdata);
1486+
join_path_components(path,instance_config.pgdata,"recovery.conf");
14871487

14881488
fp=fio_fopen(path,"w",FIO_DB_HOST);
14891489
if (fp==NULL)
@@ -1540,8 +1540,7 @@ update_recovery_options(InstanceState *instanceState, pgBackup *backup,
15401540

15411541
time2iso(current_time_str,lengthof(current_time_str),current_time, false);
15421542

1543-
snprintf(postgres_auto_path,lengthof(postgres_auto_path),
1544-
"%s/postgresql.auto.conf",instance_config.pgdata);
1543+
join_path_components(postgres_auto_path,instance_config.pgdata,"postgresql.auto.conf");
15451544

15461545
if (fio_stat(postgres_auto_path,&st, false,FIO_DB_HOST)<0)
15471546
{
@@ -1651,7 +1650,7 @@ update_recovery_options(InstanceState *instanceState, pgBackup *backup,
16511650
if (params->recovery_settings_mode==PITR_REQUESTED)
16521651
{
16531652
elog(LOG,"creating recovery.signal file");
1654-
snprintf(path,lengthof(path),"%s/recovery.signal",instance_config.pgdata);
1653+
join_path_components(path,instance_config.pgdata,"recovery.signal");
16551654

16561655
fp=fio_fopen(path,PG_BINARY_W,FIO_DB_HOST);
16571656
if (fp==NULL)
@@ -1667,7 +1666,7 @@ update_recovery_options(InstanceState *instanceState, pgBackup *backup,
16671666
if (params->restore_as_replica)
16681667
{
16691668
elog(LOG,"creating standby.signal file");
1670-
snprintf(path,lengthof(path),"%s/standby.signal",instance_config.pgdata);
1669+
join_path_components(path,instance_config.pgdata,"standby.signal");
16711670

16721671
fp=fio_fopen(path,PG_BINARY_W,FIO_DB_HOST);
16731672
if (fp==NULL)
@@ -2163,7 +2162,7 @@ check_incremental_compatibility(const char *pgdata, uint64 system_identifier,
21632162
{
21642163
charpid_file[MAXPGPATH];
21652164

2166-
snprintf(pid_file,MAXPGPATH,"%s/postmaster.pid",pgdata);
2165+
join_path_components(pid_file,pgdata,"postmaster.pid");
21672166
elog(WARNING,"Pid file \"%s\" is mangled, cannot determine whether postmaster is running or not",
21682167
pid_file);
21692168
success= false;
@@ -2204,7 +2203,7 @@ check_incremental_compatibility(const char *pgdata, uint64 system_identifier,
22042203
*/
22052204
if (incremental_mode==INCR_LSN)
22062205
{
2207-
snprintf(backup_label,MAXPGPATH,"%s/backup_label",pgdata);
2206+
join_path_components(backup_label,pgdata,"backup_label");
22082207
if (fio_access(backup_label,F_OK,FIO_DB_HOST)==0)
22092208
{
22102209
elog(WARNING,"Destination directory contains \"backup_control\" file. "

‎src/util.c

Lines changed: 1 addition & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ set_min_recovery_point(pgFile *file, const char *backup_path,
418418
FIN_CRC32C(ControlFile.crc);
419419

420420
/* overwrite pg_control */
421-
snprintf(fullpath,sizeof(fullpath),"%s/%s",backup_path,XLOG_CONTROL_FILE);
421+
join_path_components(fullpath,backup_path,XLOG_CONTROL_FILE);
422422
writeControlFile(&ControlFile,fullpath,FIO_LOCAL_HOST);
423423

424424
/* Update pg_control checksum in backup_list */
@@ -579,51 +579,3 @@ datapagemap_print_debug(datapagemap_t *map)
579579

580580
pg_free(iter);
581581
}
582-
583-
/*
584-
* Return pid of postmaster process running in given pgdata.
585-
* Return 0 if there is none.
586-
* Return 1 if postmaster.pid is mangled.
587-
*/
588-
pid_t
589-
check_postmaster(constchar*pgdata)
590-
{
591-
FILE*fp;
592-
pid_tpid;
593-
charpid_file[MAXPGPATH];
594-
595-
snprintf(pid_file,MAXPGPATH,"%s/postmaster.pid",pgdata);
596-
597-
fp=fopen(pid_file,"r");
598-
if (fp==NULL)
599-
{
600-
/* No pid file, acceptable*/
601-
if (errno==ENOENT)
602-
return0;
603-
else
604-
elog(ERROR,"Cannot open file \"%s\": %s",
605-
pid_file,strerror(errno));
606-
}
607-
608-
if (fscanf(fp,"%i",&pid)!=1)
609-
{
610-
/* something is wrong with the file content */
611-
pid=1;
612-
}
613-
614-
if (pid>1)
615-
{
616-
if (kill(pid,0)!=0)
617-
{
618-
/* process no longer exists */
619-
if (errno==ESRCH)
620-
pid=0;
621-
else
622-
elog(ERROR,"Failed to send signal 0 to a process %d: %s",
623-
pid,strerror(errno));
624-
}
625-
}
626-
627-
fclose(fp);
628-
returnpid;
629-
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp