@@ -102,6 +102,13 @@ void
102
102
pgBackupConfigInit (pgBackupConfig * config )
103
103
{
104
104
config -> system_identifier = 0 ;
105
+
106
+ #if PG_VERSION_NUM >= 110000
107
+ config -> xlog_seg_size = 0 ;
108
+ #else
109
+ config -> xlog_seg_size = XLOG_SEG_SIZE ;
110
+ #endif
111
+
105
112
config -> pgdata = NULL ;
106
113
config -> pgdatabase = NULL ;
107
114
config -> pghost = NULL ;
@@ -140,6 +147,9 @@ writeBackupCatalogConfig(FILE *out, pgBackupConfig *config)
140
147
fprintf (out , "#Backup instance info\n" );
141
148
fprintf (out , "PGDATA = %s\n" , config -> pgdata );
142
149
fprintf (out , "system-identifier = " UINT64_FORMAT "\n" , config -> system_identifier );
150
+ #if PG_VERSION_NUM >= 110000
151
+ fprintf (out , "xlog-seg-size = %u\n" , config -> xlog_seg_size );
152
+ #endif
143
153
144
154
fprintf (out , "#Connection parameters:\n" );
145
155
if (config -> pgdatabase )
@@ -253,6 +263,9 @@ readBackupCatalogConfigFile(void)
253
263
{ 'u' , 0 , "replica-timeout" , & (config -> replica_timeout ), SOURCE_CMDLINE , SOURCE_DEFAULT , OPTION_UNIT_MS },
254
264
/* other options */
255
265
{ 'U' , 0 , "system-identifier" , & (config -> system_identifier ), SOURCE_FILE_STRICT },
266
+ #if PG_VERSION_NUM >= 110000
267
+ {'u' , 0 , "xlog-seg-size" , & config -> xlog_seg_size , SOURCE_FILE_STRICT },
268
+ #endif
256
269
/* archive options */
257
270
{ 'u' , 0 , "archive-timeout" , & (config -> archive_timeout ), SOURCE_CMDLINE , SOURCE_DEFAULT , OPTION_UNIT_MS },
258
271
{0 }
@@ -263,11 +276,44 @@ readBackupCatalogConfigFile(void)
263
276
join_path_components (path , backup_instance_path , BACKUP_CATALOG_CONF_FILE );
264
277
265
278
pgBackupConfigInit (config );
266
- pgut_readopt (path , options , ERROR );
279
+ pgut_readopt (path , options , ERROR , true);
280
+
281
+ #if PG_VERSION_NUM >= 110000
282
+ if (!IsValidWalSegSize (config -> xlog_seg_size ))
283
+ elog (ERROR , "Invalid WAL segment size %u" , config -> xlog_seg_size );
284
+ #endif
267
285
268
286
return config ;
269
287
}
270
288
289
+ /*
290
+ * Read xlog-seg-size from BACKUP_CATALOG_CONF_FILE.
291
+ */
292
+ uint32
293
+ get_config_xlog_seg_size (void )
294
+ {
295
+ #if PG_VERSION_NUM >= 110000
296
+ char path [MAXPGPATH ];
297
+ uint32 seg_size ;
298
+ pgut_option options [] =
299
+ {
300
+ {'u' , 0 , "xlog-seg-size" , & seg_size , SOURCE_FILE_STRICT },
301
+ {0 }
302
+ };
303
+
304
+ join_path_components (path , backup_instance_path , BACKUP_CATALOG_CONF_FILE );
305
+ pgut_readopt (path , options , ERROR , false);
306
+
307
+ if (!IsValidWalSegSize (seg_size ))
308
+ elog (ERROR , "Invalid WAL segment size %u" , seg_size );
309
+
310
+ return seg_size ;
311
+
312
+ #else
313
+ return (uint32 ) XLOG_SEG_SIZE ;
314
+ #endif
315
+ }
316
+
271
317
static void
272
318
opt_log_level_console (pgut_option * opt , const char * arg )
273
319
{
@@ -349,6 +395,11 @@ show_configure_json(pgBackupConfig *config)
349
395
json_add_key (buf , "system-identifier" , json_level , true);
350
396
appendPQExpBuffer (buf , UINT64_FORMAT , config -> system_identifier );
351
397
398
+ #if PG_VERSION_NUM >= 110000
399
+ json_add_key (buf , "xlog-seg-size" , json_level , true);
400
+ appendPQExpBuffer (buf , "%u" , config -> xlog_seg_size );
401
+ #endif
402
+
352
403
/* Connection parameters */
353
404
if (config -> pgdatabase )
354
405
json_add_value (buf , "pgdatabase" , config -> pgdatabase , json_level , true);
0 commit comments