File tree Expand file tree Collapse file tree 5 files changed +15
-15
lines changed Expand file tree Collapse file tree 5 files changed +15
-15
lines changed Original file line number Diff line number Diff line change @@ -8711,7 +8711,7 @@ do_pg_backup_stop(BackupState *state, bool waitforarchive)
8711
8711
}
8712
8712
else
8713
8713
{
8714
- StringInfo history_file ;
8714
+ char * history_file ;
8715
8715
8716
8716
/*
8717
8717
* Write the backup-end xlog record
@@ -8751,8 +8751,7 @@ do_pg_backup_stop(BackupState *state, bool waitforarchive)
8751
8751
8752
8752
/* Build and save the contents of the backup history file */
8753
8753
history_file = build_backup_content (state , true);
8754
- fprintf (fp , "%s" , history_file -> data );
8755
- pfree (history_file -> data );
8754
+ fprintf (fp , "%s" , history_file );
8756
8755
pfree (history_file );
8757
8756
8758
8757
if (fflush (fp ) || ferror (fp ) || FreeFile (fp ))
Original file line number Diff line number Diff line change 23
23
* When ishistoryfile is true, it creates the contents for a backup history
24
24
* file, otherwise it creates contents for a backup_label file.
25
25
*
26
- * Returns the result generated as a palloc'd StringInfo .
26
+ * Returns the result generated as a palloc'd string .
27
27
*/
28
- StringInfo
28
+ char *
29
29
build_backup_content (BackupState * state , bool ishistoryfile )
30
30
{
31
31
char startstrbuf [128 ];
32
32
char startxlogfile [MAXFNAMELEN ]; /* backup start WAL file */
33
33
XLogSegNo startsegno ;
34
34
StringInfo result = makeStringInfo ();
35
+ char * data ;
35
36
36
37
Assert (state != NULL );
37
38
@@ -76,5 +77,8 @@ build_backup_content(BackupState *state, bool ishistoryfile)
76
77
appendStringInfo (result , "STOP TIMELINE: %u\n" , state -> stoptli );
77
78
}
78
79
79
- return result ;
80
+ data = result -> data ;
81
+ pfree (result );
82
+
83
+ return data ;
80
84
}
Original file line number Diff line number Diff line change @@ -130,7 +130,7 @@ pg_backup_stop(PG_FUNCTION_ARGS)
130
130
Datum values [PG_BACKUP_STOP_V2_COLS ] = {0 };
131
131
bool nulls [PG_BACKUP_STOP_V2_COLS ] = {0 };
132
132
bool waitforarchive = PG_GETARG_BOOL (0 );
133
- StringInfo backup_label ;
133
+ char * backup_label ;
134
134
SessionBackupState status = get_backup_status ();
135
135
136
136
/* Initialize attributes information in the tuple descriptor */
@@ -153,7 +153,7 @@ pg_backup_stop(PG_FUNCTION_ARGS)
153
153
backup_label = build_backup_content (backup_state , false);
154
154
155
155
values [0 ] = LSNGetDatum (backup_state -> stoppoint );
156
- values [1 ] = CStringGetTextDatum (backup_label -> data );
156
+ values [1 ] = CStringGetTextDatum (backup_label );
157
157
values [2 ] = CStringGetTextDatum (tablespace_map -> data );
158
158
159
159
/* Deallocate backup-related variables */
@@ -162,7 +162,6 @@ pg_backup_stop(PG_FUNCTION_ARGS)
162
162
pfree (tablespace_map -> data );
163
163
pfree (tablespace_map );
164
164
tablespace_map = NULL ;
165
- pfree (backup_label -> data );
166
165
pfree (backup_label );
167
166
168
167
/* Returns the record as Datum */
Original file line number Diff line number Diff line change @@ -317,15 +317,14 @@ perform_base_backup(basebackup_options *opt, bbsink *sink)
317
317
{
318
318
struct stat statbuf ;
319
319
bool sendtblspclinks = true;
320
- StringInfo backup_label ;
320
+ char * backup_label ;
321
321
322
322
bbsink_begin_archive (sink , "base.tar" );
323
323
324
324
/* In the main tar, include the backup_label first... */
325
325
backup_label = build_backup_content (backup_state , false);
326
326
sendFileWithContent (sink , BACKUP_LABEL_FILE ,
327
- backup_label -> data , & manifest );
328
- pfree (backup_label -> data );
327
+ backup_label , & manifest );
329
328
pfree (backup_label );
330
329
331
330
/* Then the tablespace_map file, if required... */
Original file line number Diff line number Diff line change 15
15
#define XLOG_BACKUP_H
16
16
17
17
#include "access/xlogdefs.h"
18
- #include "lib/stringinfo.h"
19
18
#include "pgtime.h"
20
19
21
20
/* Structure to hold backup state. */
@@ -36,7 +35,7 @@ typedef struct BackupState
36
35
pg_time_t stoptime ; /* backup stop time */
37
36
} BackupState ;
38
37
39
- extern StringInfo build_backup_content (BackupState * state ,
40
- bool ishistoryfile );
38
+ extern char * build_backup_content (BackupState * state ,
39
+ bool ishistoryfile );
41
40
42
41
#endif /* XLOG_BACKUP_H */
You can’t perform that action at this time.
0 commit comments