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

Commit1fa0929

Browse files
committed
Don't export basebackup.c's sendTablespace().
Commit72d422a made xlog.c callsendTablespace() with the 'sizeonly' argument set to true, whichrequired basebackup.c to export sendTablespace(). However, that'skind of ugly, so instead defer the call to sendTablespace() untilbasebackup.c regains control. That way, it can still be a staticfunction.Patch by me, reviewed by Amit Kapila and Kyotaro Horiguchi.Discussion:http://postgr.es/m/CA+TgmoYq+59SJ2zBbP891ngWPA9fymOqntqYcweSDYXS2a620A@mail.gmail.com
1 parenta513f1d commit1fa0929

File tree

5 files changed

+19
-28
lines changed

5 files changed

+19
-28
lines changed

‎src/backend/access/transam/xlog.c‎

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10481,8 +10481,7 @@ issue_xlog_fsync(int fd, XLogSegNo segno)
1048110481
XLogRecPtr
1048210482
do_pg_start_backup(constchar*backupidstr,boolfast,TimeLineID*starttli_p,
1048310483
StringInfolabelfile,List**tablespaces,
10484-
StringInfotblspcmapfile,boolinfotbssize,
10485-
boolneedtblspcmapfile)
10484+
StringInfotblspcmapfile,boolneedtblspcmapfile)
1048610485
{
1048710486
boolexclusive= (labelfile==NULL);
1048810487
boolbackup_started_in_recovery= false;
@@ -10702,14 +10701,6 @@ do_pg_start_backup(const char *backupidstr, bool fast, TimeLineID *starttli_p,
1070210701

1070310702
datadirpathlen=strlen(DataDir);
1070410703

10705-
/*
10706-
* Report that we are now estimating the total backup size if we're
10707-
* streaming base backup as requested by pg_basebackup
10708-
*/
10709-
if (tablespaces)
10710-
pgstat_progress_update_param(PROGRESS_BASEBACKUP_PHASE,
10711-
PROGRESS_BASEBACKUP_PHASE_ESTIMATE_BACKUP_SIZE);
10712-
1071310704
/* Collect information about all tablespaces */
1071410705
tblspcdir=AllocateDir("pg_tblspc");
1071510706
while ((de=ReadDir(tblspcdir,"pg_tblspc"))!=NULL)
@@ -10774,8 +10765,7 @@ do_pg_start_backup(const char *backupidstr, bool fast, TimeLineID *starttli_p,
1077410765
ti->oid=pstrdup(de->d_name);
1077510766
ti->path=pstrdup(buflinkpath.data);
1077610767
ti->rpath=relpath ?pstrdup(relpath) :NULL;
10777-
ti->size=infotbssize ?
10778-
sendTablespace(fullpath,ti->oid, true,NULL) :-1;
10768+
ti->size=-1;
1077910769

1078010770
if (tablespaces)
1078110771
*tablespaces=lappend(*tablespaces,ti);

‎src/backend/access/transam/xlogfuncs.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ pg_start_backup(PG_FUNCTION_ARGS)
7676
if (exclusive)
7777
{
7878
startpoint=do_pg_start_backup(backupidstr,fast,NULL,NULL,
79-
NULL,NULL,false,true);
79+
NULL,NULL, true);
8080
}
8181
else
8282
{
@@ -94,7 +94,7 @@ pg_start_backup(PG_FUNCTION_ARGS)
9494
register_persistent_abort_backup_handler();
9595

9696
startpoint=do_pg_start_backup(backupidstr,fast,NULL,label_file,
97-
NULL,tblspc_map_file,false,true);
97+
NULL,tblspc_map_file, true);
9898
}
9999

100100
PG_RETURN_LSN(startpoint);

‎src/backend/replication/basebackup.c‎

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ typedef struct
5858
pg_checksum_typemanifest_checksum_type;
5959
}basebackup_options;
6060

61+
staticint64sendTablespace(char*path,char*oid,boolsizeonly,
62+
structbackup_manifest_info*manifest);
6163
staticint64sendDir(constchar*path,intbasepathlen,boolsizeonly,
6264
List*tablespaces,boolsendtblspclinks,
6365
backup_manifest_info*manifest,constchar*spcoid);
@@ -307,8 +309,7 @@ perform_base_backup(basebackup_options *opt)
307309
PROGRESS_BASEBACKUP_PHASE_WAIT_CHECKPOINT);
308310
startptr=do_pg_start_backup(opt->label,opt->fastcheckpoint,&starttli,
309311
labelfile,&tablespaces,
310-
tblspc_map_file,
311-
opt->progress,opt->sendtblspcmapfile);
312+
tblspc_map_file,opt->sendtblspcmapfile);
312313

313314
/*
314315
* Once do_pg_start_backup has been called, ensure that any failure causes
@@ -337,10 +338,7 @@ perform_base_backup(basebackup_options *opt)
337338

338339
/* Add a node for the base directory at the end */
339340
ti=palloc0(sizeof(tablespaceinfo));
340-
if (opt->progress)
341-
ti->size=sendDir(".",1, true,tablespaces, true,NULL,NULL);
342-
else
343-
ti->size=-1;
341+
ti->size=-1;
344342
tablespaces=lappend(tablespaces,ti);
345343

346344
/*
@@ -349,10 +347,19 @@ perform_base_backup(basebackup_options *opt)
349347
*/
350348
if (opt->progress)
351349
{
350+
pgstat_progress_update_param(PROGRESS_BASEBACKUP_PHASE,
351+
PROGRESS_BASEBACKUP_PHASE_ESTIMATE_BACKUP_SIZE);
352+
352353
foreach(lc,tablespaces)
353354
{
354355
tablespaceinfo*tmp= (tablespaceinfo*)lfirst(lc);
355356

357+
if (tmp->path==NULL)
358+
tmp->size=sendDir(".",1, true,tablespaces, true,NULL,
359+
NULL);
360+
else
361+
tmp->size=sendTablespace(tmp->path,tmp->oid, true,
362+
NULL);
356363
backup_total+=tmp->size;
357364
}
358365
}
@@ -1145,7 +1152,7 @@ sendFileWithContent(const char *filename, const char *content,
11451152
*
11461153
* Only used to send auxiliary tablespaces, not PGDATA.
11471154
*/
1148-
int64
1155+
staticint64
11491156
sendTablespace(char*path,char*spcoid,boolsizeonly,
11501157
backup_manifest_info*manifest)
11511158
{

‎src/include/access/xlog.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ typedef enum SessionBackupState
372372

373373
externXLogRecPtrdo_pg_start_backup(constchar*backupidstr,boolfast,
374374
TimeLineID*starttli_p,StringInfolabelfile,
375-
List**tablespaces,StringInfotblspcmapfile,boolinfotbssize,
375+
List**tablespaces,StringInfotblspcmapfile,
376376
boolneedtblspcmapfile);
377377
externXLogRecPtrdo_pg_stop_backup(char*labelfile,boolwaitforarchive,
378378
TimeLineID*stoptli_p);

‎src/include/replication/basebackup.h‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414

1515
#include"nodes/replnodes.h"
1616

17-
structbackup_manifest_info;/* avoid including backup_manifest.h */
18-
19-
2017
/*
2118
* Minimum and maximum values of MAX_RATE option in BASE_BACKUP command.
2219
*/
@@ -33,7 +30,4 @@ typedef struct
3330

3431
externvoidSendBaseBackup(BaseBackupCmd*cmd);
3532

36-
externint64sendTablespace(char*path,char*oid,boolsizeonly,
37-
structbackup_manifest_info*manifest);
38-
3933
#endif/* _BASEBACKUP_H */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp