@@ -1237,17 +1237,12 @@ wait_wal_lsn(const char *wal_segment_dir, XLogRecPtr target_lsn, bool is_start_l
12371237int timeout_elevel ,bool in_stream_dir )
12381238{
12391239XLogSegNo targetSegNo ;
1240- char wal_segment_path [MAXPGPATH ],
1241- //wal_segment_subdir[MAXPGPATH], // used only to check file existence, not actual parsing
1240+ char wal_segment_path [MAXPGPATH ],/* used only for reporting */
12421241wal_segment [MAXFNAMELEN ];
12431242uint32 try_count = 0 ,
12441243timeout ;
12451244char * wal_delivery_str = in_stream_dir ?"streamed" :"archived" ;
12461245
1247- //#ifdef HAVE_LIBZ
1248- //chargz_wal_segment_path[MAXPGPATH];
1249- //#endif
1250-
12511246/* Compute the name of the WAL file containing requested LSN */
12521247GetXLogSegNo (target_lsn ,targetSegNo ,instance_config .xlog_seg_size );
12531248if (in_prev_segment )
@@ -1256,12 +1251,15 @@ wait_wal_lsn(const char *wal_segment_dir, XLogRecPtr target_lsn, bool is_start_l
12561251instance_config .xlog_seg_size );
12571252
12581253// obtain WAL archive subdir for ARCHIVE backup
1259- //if (in_stream_dir)
1260- //strcpy(wal_segment_subdir, wal_segment_dir);
1261- //else
1262- //get_archive_subdir(wal_segment_subdir, wal_segment_dir, wal_segment, SEGMENT);
1263- //
1264- //join_path_components(wal_segment_path, wal_segment_subdir, wal_segment);
1254+ if (in_stream_dir )
1255+ join_path_components (wal_segment_path ,wal_segment_dir ,wal_segment );
1256+ else
1257+ {
1258+ char wal_segment_subdir [MAXPGPATH ];
1259+ get_archive_subdir (wal_segment_subdir ,wal_segment_dir ,wal_segment ,SEGMENT );
1260+ join_path_components (wal_segment_path ,wal_segment_subdir ,wal_segment );
1261+ }
1262+
12651263/*
12661264 * In pg_start_backup we wait for 'target_lsn' in 'pg_wal' directory if it is
12671265 * stream and non-page backup. Page backup needs archived WAL files, so we
@@ -1282,11 +1280,6 @@ wait_wal_lsn(const char *wal_segment_dir, XLogRecPtr target_lsn, bool is_start_l
12821280elog (LOG ,"Looking for LSN %X/%X in segment: %s" ,
12831281 (uint32 ) (target_lsn >>32 ), (uint32 )target_lsn ,wal_segment );
12841282
1285- //#ifdef HAVE_LIBZ
1286- //snprintf(gz_wal_segment_path, sizeof(gz_wal_segment_path), "%s.gz",
1287- // wal_segment_path);
1288- //#endif
1289-
12901283/* Wait until target LSN is archived or streamed */
12911284while (true)
12921285{