Skip to content

Commit 55c114f

Browse files
committed
bugfix: remove unnecessary tablespace_map file write
1 parent 5089400 commit 55c114f

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/catchup.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -745,24 +745,26 @@ do_catchup_instance(const char *source_pgdata, const char *dest_pgdata, PGconn *
745745

746746
wait_wal_and_calculate_stop_lsn(dest_xlog_path, stop_backup_result.lsn, &current);
747747

748-
/* Write backup_label and tablespace_map */
749-
Assert(stop_backup_result.backup_label_content != NULL);
750-
751748
/* Write backup_label */
749+
Assert(stop_backup_result.backup_label_content != NULL);
752750
pg_stop_backup_write_file_helper(dest_pgdata, PG_BACKUP_LABEL_FILE, "backup label",
753751
stop_backup_result.backup_label_content, stop_backup_result.backup_label_content_len,
754752
NULL);
755753
free(stop_backup_result.backup_label_content);
756754
stop_backup_result.backup_label_content = NULL;
757755
stop_backup_result.backup_label_content_len = 0;
758756

759-
/* Write tablespace_map */
757+
/* tablespace_map */
760758
if (stop_backup_result.tablespace_map_content != NULL)
761759
{
762760
// TODO what if tablespace is created during catchup?
763-
pg_stop_backup_write_file_helper(dest_pgdata, PG_TABLESPACE_MAP_FILE, "tablespace map",
764-
stop_backup_result.tablespace_map_content, stop_backup_result.tablespace_map_content_len,
765-
NULL);
761+
/* Because we have already created symlinks in pg_tblspc earlier,
762+
* we do not need to write the tablespace_map file.
763+
* So this call is unnecessary:
764+
* pg_stop_backup_write_file_helper(dest_pgdata, PG_TABLESPACE_MAP_FILE, "tablespace map",
765+
* stop_backup_result.tablespace_map_content, stop_backup_result.tablespace_map_content_len,
766+
* NULL);
767+
*/
766768
free(stop_backup_result.tablespace_map_content);
767769
stop_backup_result.tablespace_map_content = NULL;
768770
stop_backup_result.tablespace_map_content_len = 0;

0 commit comments

Comments
 (0)