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

Commit3989dbd

Browse files
committed
Rename exposed identifiers to say "backup manifest".
Function names declared "extern" now use BackupManifest in the namerather than just Manifest, and data types use backup_manifestrather than just manifest.Per note from Michael Paquier.Discussion:http://postgr.es/m/20200418125713.GG350229@paquier.xyz
1 parent299298b commit3989dbd

File tree

3 files changed

+65
-59
lines changed

3 files changed

+65
-59
lines changed

‎src/backend/replication/backup_manifest.c

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
#include"utils/builtins.h"
2121
#include"utils/json.h"
2222

23+
staticvoidAppendStringToManifest(backup_manifest_info*manifest,char*s);
24+
2325
/*
2426
* Does the user want a backup manifest?
2527
*
@@ -28,7 +30,7 @@
2830
* want a manifest, we set manifest->buffile to NULL.
2931
*/
3032
staticinlinebool
31-
IsManifestEnabled(manifest_info*manifest)
33+
IsManifestEnabled(backup_manifest_info*manifest)
3234
{
3335
return (manifest->buffile!=NULL);
3436
}
@@ -51,8 +53,9 @@ IsManifestEnabled(manifest_info *manifest)
5153
* SendBackupManifest.
5254
*/
5355
void
54-
InitializeManifest(manifest_info*manifest,manifest_optionwant_manifest,
55-
pg_checksum_typemanifest_checksum_type)
56+
InitializeBackupManifest(backup_manifest_info*manifest,
57+
backup_manifest_optionwant_manifest,
58+
pg_checksum_typemanifest_checksum_type)
5659
{
5760
if (want_manifest==MANIFEST_OPTION_NO)
5861
manifest->buffile=NULL;
@@ -71,33 +74,13 @@ InitializeManifest(manifest_info *manifest, manifest_option want_manifest,
7174
"\"Files\": [");
7275
}
7376

74-
/*
75-
* Append a cstring to the manifest.
76-
*/
77-
void
78-
AppendStringToManifest(manifest_info*manifest,char*s)
79-
{
80-
intlen=strlen(s);
81-
size_twritten;
82-
83-
Assert(manifest!=NULL);
84-
if (manifest->still_checksumming)
85-
pg_sha256_update(&manifest->manifest_ctx, (uint8*)s,len);
86-
written=BufFileWrite(manifest->buffile,s,len);
87-
if (written!=len)
88-
ereport(ERROR,
89-
(errcode_for_file_access(),
90-
errmsg("could not write to temporary file: %m")));
91-
manifest->manifest_size+=len;
92-
}
93-
9477
/*
9578
* Add an entry to the backup manifest for a file.
9679
*/
9780
void
98-
AddFileToManifest(manifest_info*manifest,constchar*spcoid,
99-
constchar*pathname,size_tsize,pg_time_tmtime,
100-
pg_checksum_context*checksum_ctx)
81+
AddFileToBackupManifest(backup_manifest_info*manifest,constchar*spcoid,
82+
constchar*pathname,size_tsize,pg_time_tmtime,
83+
pg_checksum_context*checksum_ctx)
10184
{
10285
charpathbuf[MAXPGPATH];
10386
intpathlen;
@@ -203,8 +186,9 @@ AddFileToManifest(manifest_info *manifest, const char *spcoid,
203186
* this backup to the manifest.
204187
*/
205188
void
206-
AddWALInfoToManifest(manifest_info*manifest,XLogRecPtrstartptr,
207-
TimeLineIDstarttli,XLogRecPtrendptr,TimeLineIDendtli)
189+
AddWALInfoToBackupManifest(backup_manifest_info*manifest,XLogRecPtrstartptr,
190+
TimeLineIDstarttli,XLogRecPtrendptr,
191+
TimeLineIDendtli)
208192
{
209193
List*timelines;
210194
ListCell*lc;
@@ -299,7 +283,7 @@ AddWALInfoToManifest(manifest_info *manifest, XLogRecPtr startptr,
299283
* Finalize the backup manifest, and send it to the client.
300284
*/
301285
void
302-
SendBackupManifest(manifest_info*manifest)
286+
SendBackupManifest(backup_manifest_info*manifest)
303287
{
304288
StringInfoDataprotobuf;
305289
uint8checksumbuf[PG_SHA256_DIGEST_LENGTH];
@@ -373,3 +357,23 @@ SendBackupManifest(manifest_info *manifest)
373357
/* Release resources */
374358
BufFileClose(manifest->buffile);
375359
}
360+
361+
/*
362+
* Append a cstring to the manifest.
363+
*/
364+
staticvoid
365+
AppendStringToManifest(backup_manifest_info*manifest,char*s)
366+
{
367+
intlen=strlen(s);
368+
size_twritten;
369+
370+
Assert(manifest!=NULL);
371+
if (manifest->still_checksumming)
372+
pg_sha256_update(&manifest->manifest_ctx, (uint8*)s,len);
373+
written=BufFileWrite(manifest->buffile,s,len);
374+
if (written!=len)
375+
ereport(ERROR,
376+
(errcode_for_file_access(),
377+
errmsg("could not write to temporary file: %m")));
378+
manifest->manifest_size+=len;
379+
}

‎src/backend/replication/basebackup.c

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,18 @@ typedef struct
5454
boolincludewal;
5555
uint32maxrate;
5656
boolsendtblspcmapfile;
57-
manifest_optionmanifest;
57+
backup_manifest_optionmanifest;
5858
pg_checksum_typemanifest_checksum_type;
5959
}basebackup_options;
6060

6161
staticint64sendDir(constchar*path,intbasepathlen,boolsizeonly,
6262
List*tablespaces,boolsendtblspclinks,
63-
manifest_info*manifest,constchar*spcoid);
63+
backup_manifest_info*manifest,constchar*spcoid);
6464
staticboolsendFile(constchar*readfilename,constchar*tarfilename,
6565
structstat*statbuf,boolmissing_ok,Oiddboid,
66-
manifest_info*manifest,constchar*spcoid);
66+
backup_manifest_info*manifest,constchar*spcoid);
6767
staticvoidsendFileWithContent(constchar*filename,constchar*content,
68-
manifest_info*manifest);
68+
backup_manifest_info*manifest);
6969
staticint64_tarWriteHeader(constchar*filename,constchar*linktarget,
7070
structstat*statbuf,boolsizeonly);
7171
staticint64_tarWriteDir(constchar*pathbuf,intbasepathlen,structstat*statbuf,
@@ -268,7 +268,7 @@ perform_base_backup(basebackup_options *opt)
268268
TimeLineIDendtli;
269269
StringInfolabelfile;
270270
StringInfotblspc_map_file=NULL;
271-
manifest_infomanifest;
271+
backup_manifest_infomanifest;
272272
intdatadirpathlen;
273273
List*tablespaces=NIL;
274274

@@ -298,7 +298,8 @@ perform_base_backup(basebackup_options *opt)
298298

299299
labelfile=makeStringInfo();
300300
tblspc_map_file=makeStringInfo();
301-
InitializeManifest(&manifest,opt->manifest,opt->manifest_checksum_type);
301+
InitializeBackupManifest(&manifest,opt->manifest,
302+
opt->manifest_checksum_type);
302303

303304
total_checksum_failures=0;
304305

@@ -710,7 +711,7 @@ perform_base_backup(basebackup_options *opt)
710711
pq_putemptymessage('c');
711712
}
712713

713-
AddWALInfoToManifest(&manifest,startptr,starttli,endptr,endtli);
714+
AddWALInfoToBackupManifest(&manifest,startptr,starttli,endptr,endtli);
714715

715716
SendBackupManifest(&manifest);
716717

@@ -1085,7 +1086,7 @@ SendXlogRecPtrResult(XLogRecPtr ptr, TimeLineID tli)
10851086
*/
10861087
staticvoid
10871088
sendFileWithContent(constchar*filename,constchar*content,
1088-
manifest_info*manifest)
1089+
backup_manifest_info*manifest)
10891090
{
10901091
structstatstatbuf;
10911092
intpad,
@@ -1129,9 +1130,8 @@ sendFileWithContent(const char *filename, const char *content,
11291130
}
11301131

11311132
pg_checksum_update(&checksum_ctx, (uint8*)content,len);
1132-
AddFileToManifest(manifest,NULL,filename,len,
1133-
(pg_time_t)statbuf.st_mtime,
1134-
&checksum_ctx);
1133+
AddFileToBackupManifest(manifest,NULL,filename,len,
1134+
(pg_time_t)statbuf.st_mtime,&checksum_ctx);
11351135
}
11361136

11371137
/*
@@ -1143,7 +1143,7 @@ sendFileWithContent(const char *filename, const char *content,
11431143
*/
11441144
int64
11451145
sendTablespace(char*path,char*spcoid,boolsizeonly,
1146-
manifest_info*manifest)
1146+
backup_manifest_info*manifest)
11471147
{
11481148
int64size;
11491149
charpathbuf[MAXPGPATH];
@@ -1196,7 +1196,8 @@ sendTablespace(char *path, char *spcoid, bool sizeonly,
11961196
*/
11971197
staticint64
11981198
sendDir(constchar*path,intbasepathlen,boolsizeonly,List*tablespaces,
1199-
boolsendtblspclinks,manifest_info*manifest,constchar*spcoid)
1199+
boolsendtblspclinks,backup_manifest_info*manifest,
1200+
constchar*spcoid)
12001201
{
12011202
DIR*dir;
12021203
structdirent*de;
@@ -1558,7 +1559,7 @@ is_checksummed_file(const char *fullpath, const char *filename)
15581559
staticbool
15591560
sendFile(constchar*readfilename,constchar*tarfilename,
15601561
structstat*statbuf,boolmissing_ok,Oiddboid,
1561-
manifest_info*manifest,constchar*spcoid)
1562+
backup_manifest_info*manifest,constchar*spcoid)
15621563
{
15631564
FILE*fp;
15641565
BlockNumberblkno=0;
@@ -1810,8 +1811,8 @@ sendFile(const char *readfilename, const char *tarfilename,
18101811

18111812
total_checksum_failures+=checksum_failures;
18121813

1813-
AddFileToManifest(manifest,spcoid,tarfilename,statbuf->st_size,
1814-
(pg_time_t)statbuf->st_mtime,&checksum_ctx);
1814+
AddFileToBackupManifest(manifest,spcoid,tarfilename,statbuf->st_size,
1815+
(pg_time_t)statbuf->st_mtime,&checksum_ctx);
18151816

18161817
return true;
18171818
}

‎src/include/replication/backup_manifest.h

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ typedef enum manifest_option
2222
MANIFEST_OPTION_YES,
2323
MANIFEST_OPTION_NO,
2424
MANIFEST_OPTION_FORCE_ENCODE
25-
}manifest_option;
25+
}backup_manifest_option;
2626

2727
typedefstructmanifest_info
2828
{
@@ -33,19 +33,20 @@ typedef struct manifest_info
3333
boolforce_encode;
3434
boolfirst_file;
3535
boolstill_checksumming;
36-
}manifest_info;
36+
}backup_manifest_info;
3737

38-
externvoidInitializeManifest(manifest_info*manifest,
39-
manifest_optionwant_manifest,
40-
pg_checksum_typemanifest_checksum_type);
41-
externvoidAppendStringToManifest(manifest_info*manifest,char*s);
42-
externvoidAddFileToManifest(manifest_info*manifest,constchar*spcoid,
43-
constchar*pathname,size_tsize,
44-
pg_time_tmtime,
45-
pg_checksum_context*checksum_ctx);
46-
externvoidAddWALInfoToManifest(manifest_info*manifest,XLogRecPtrstartptr,
47-
TimeLineIDstarttli,XLogRecPtrendptr,
48-
TimeLineIDendtli);
49-
externvoidSendBackupManifest(manifest_info*manifest);
38+
externvoidInitializeBackupManifest(backup_manifest_info*manifest,
39+
backup_manifest_optionwant_manifest,
40+
pg_checksum_typemanifest_checksum_type);
41+
externvoidAddFileToBackupManifest(backup_manifest_info*manifest,
42+
constchar*spcoid,
43+
constchar*pathname,size_tsize,
44+
pg_time_tmtime,
45+
pg_checksum_context*checksum_ctx);
46+
externvoidAddWALInfoToBackupManifest(backup_manifest_info*manifest,
47+
XLogRecPtrstartptr,
48+
TimeLineIDstarttli,XLogRecPtrendptr,
49+
TimeLineIDendtli);
50+
externvoidSendBackupManifest(backup_manifest_info*manifest);
5051

5152
#endif

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp