@@ -532,23 +532,19 @@ merge_chain(parray *parent_chain, pgBackup *full_backup, pgBackup *dest_backup)
532
532
* If current program version differs from destination backup version,
533
533
* then in-place merge is not possible.
534
534
*/
535
- if (parse_program_version (dest_backup -> program_version ) ==
536
- parse_program_version (PROGRAM_VERSION ))
535
+ if ((parse_program_version (full_backup -> program_version ) ==
536
+ parse_program_version (dest_backup -> program_version )) &&
537
+ (parse_program_version (dest_backup -> program_version ) ==
538
+ parse_program_version (PROGRAM_VERSION )))
537
539
program_version_match = true;
538
540
else
539
541
elog (WARNING , "In-place merge is disabled because of program "
540
- "versions mismatch: backup %s was produced by version %s, "
541
- "but current program version is %s" ,
542
- base36enc (dest_backup -> start_time ),
543
- dest_backup -> program_version , PROGRAM_VERSION );
544
-
545
- /* Construct path to database dir: /backup_dir/instance_name/FULL/database */
546
- join_path_components (full_database_dir , full_backup -> root_dir , DATABASE_DIR );
547
- /* Construct path to external dir: /backup_dir/instance_name/FULL/external */
548
- join_path_components (full_external_prefix , full_backup -> root_dir , EXTERNAL_DIR );
549
-
550
- elog (INFO , "Validate parent chain for backup %s" ,
551
- base36enc (dest_backup -> start_time ));
542
+ "versions mismatch. Full backup version: %s, "
543
+ "destination backup version: %s, "
544
+ "current program version: %s" ,
545
+ full_backup -> program_version ,
546
+ dest_backup -> program_version ,
547
+ PROGRAM_VERSION );
552
548
553
549
/* Forbid merge retry for failed merges between 2.4.0 and any
554
550
* older version. Several format changes makes it impossible
@@ -568,6 +564,9 @@ merge_chain(parray *parent_chain, pgBackup *full_backup, pgBackup *dest_backup)
568
564
* with sole exception of FULL backup. If it has MERGING status
569
565
* then it isn't valid backup until merging is finished.
570
566
*/
567
+ elog (INFO , "Validate parent chain for backup %s" ,
568
+ base36enc (dest_backup -> start_time ));
569
+
571
570
for (i = parray_num (parent_chain ) - 1 ; i >= 0 ; i -- )
572
571
{
573
572
pgBackup * backup = (pgBackup * ) parray_get (parent_chain , i );
@@ -611,6 +610,11 @@ merge_chain(parray *parent_chain, pgBackup *full_backup, pgBackup *dest_backup)
611
610
write_backup_status (backup , BACKUP_STATUS_MERGING , instance_name , true);
612
611
}
613
612
613
+ /* Construct path to database dir: /backup_dir/instance_name/FULL/database */
614
+ join_path_components (full_database_dir , full_backup -> root_dir , DATABASE_DIR );
615
+ /* Construct path to external dir: /backup_dir/instance_name/FULL/external */
616
+ join_path_components (full_external_prefix , full_backup -> root_dir , EXTERNAL_DIR );
617
+
614
618
/* Create directories */
615
619
create_data_directories (dest_backup -> files , full_database_dir ,
616
620
dest_backup -> root_dir , false, false, FIO_BACKUP_HOST );
@@ -627,6 +631,7 @@ merge_chain(parray *parent_chain, pgBackup *full_backup, pgBackup *dest_backup)
627
631
if (full_externals && dest_externals )
628
632
reorder_external_dirs (full_backup , full_externals , dest_externals );
629
633
634
+ /* bitmap optimization rely on n_blocks, which is generally available since 2.3.0 */
630
635
if (parse_program_version (dest_backup -> program_version ) < 20300 )
631
636
use_bitmap = false;
632
637
@@ -981,7 +986,8 @@ merge_files(void *arg)
981
986
* In-place merge is also impossible, if program version of destination
982
987
* backup differs from PROGRAM_VERSION
983
988
*/
984
- if (arguments -> program_version_match && arguments -> compression_match )
989
+ if (arguments -> program_version_match && arguments -> compression_match &&
990
+ !arguments -> is_retry )
985
991
{
986
992
/*
987
993
* Case 1:
@@ -1049,7 +1055,7 @@ merge_files(void *arg)
1049
1055
* page header map cannot be trusted when retrying, so no
1050
1056
* in place merge for retry.
1051
1057
*/
1052
- if (in_place && ! arguments -> is_retry )
1058
+ if (in_place )
1053
1059
{
1054
1060
pgFile * * res_file = NULL ;
1055
1061
pgFile * file = NULL ;
0 commit comments