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

Commitdbfc447

Browse files
committed
Expose new function get_controlfile_by_exact_path().
This works just like get_controlfile(), but expects the path to thecontrol file rather than the path to the data directory that containsthe control file. This makes more sense in cases where the callerhas already constructed the path to the control file itself.Amul Sul and Robert Haas, reviewed by Michael Paquier
1 parent97d85be commitdbfc447

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

‎src/bin/pg_combinebackup/pg_combinebackup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ check_control_files(int n_backups, char **backup_dirs)
534534

535535
controlpath=psprintf("%s/%s",backup_dirs[i],"global/pg_control");
536536
pg_log_debug("reading \"%s\"",controlpath);
537-
control_file=get_controlfile(backup_dirs[i],&crc_ok);
537+
control_file=get_controlfile_by_exact_path(controlpath,&crc_ok);
538538

539539
/* Control file contents not meaningful if CRC is bad. */
540540
if (!crc_ok)

‎src/common/controldata_utils.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,25 @@
5050
*/
5151
ControlFileData*
5252
get_controlfile(constchar*DataDir,bool*crc_ok_p)
53+
{
54+
charControlFilePath[MAXPGPATH];
55+
56+
snprintf(ControlFilePath,MAXPGPATH,"%s/global/pg_control",DataDir);
57+
58+
returnget_controlfile_by_exact_path(ControlFilePath,crc_ok_p);
59+
}
60+
61+
/*
62+
* get_controlfile_by_exact_path()
63+
*
64+
* As above, but the caller specifies the path to the control file itself,
65+
* rather than the path to the data directory.
66+
*/
67+
ControlFileData*
68+
get_controlfile_by_exact_path(constchar*ControlFilePath,bool*crc_ok_p)
5369
{
5470
ControlFileData*ControlFile;
5571
intfd;
56-
charControlFilePath[MAXPGPATH];
5772
pg_crc32ccrc;
5873
intr;
5974
#ifdefFRONTEND
@@ -64,7 +79,6 @@ get_controlfile(const char *DataDir, bool *crc_ok_p)
6479
Assert(crc_ok_p);
6580

6681
ControlFile=palloc_object(ControlFileData);
67-
snprintf(ControlFilePath,MAXPGPATH,"%s/global/pg_control",DataDir);
6882

6983
#ifdefFRONTEND
7084
INIT_CRC32C(last_crc);

‎src/include/common/controldata_utils.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
#include"catalog/pg_control.h"
1414

1515
externControlFileData*get_controlfile(constchar*DataDir,bool*crc_ok_p);
16+
externControlFileData*get_controlfile_by_exact_path(constchar*ControlFilePath,
17+
bool*crc_ok_p);
1618
externvoidupdate_controlfile(constchar*DataDir,
1719
ControlFileData*ControlFile,booldo_sync);
1820

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp