Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit759aefc

Browse files
committed
[Issue#103] select oldest backup with valid start_lsn and tli to determine oldest lsn for WAL purge
1 parent961293c commit759aefc

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

‎src/delete.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -622,6 +622,7 @@ do_retention_wal(void)
622622
XLogRecPtroldest_lsn=InvalidXLogRecPtr;
623623
TimeLineIDoldest_tli=0;
624624
boolbackup_list_is_empty= false;
625+
inti;
625626

626627
/* Get list of backups. */
627628
backup_list=catalog_get_backup_list(INVALID_BACKUP_ID);
@@ -630,14 +631,17 @@ do_retention_wal(void)
630631
backup_list_is_empty= true;
631632

632633
/* Save LSN and Timeline to remove unnecessary WAL segments */
633-
if (!backup_list_is_empty)
634+
for (i= (int)parray_num(backup_list)-1;i >=0;i--)
634635
{
635-
pgBackup*backup=NULL;
636-
/* Get LSN and TLI of oldest alive backup */
637-
backup= (pgBackup*)parray_get(backup_list,parray_num(backup_list)-1);
636+
pgBackup*backup= (pgBackup*)parray_get(backup_list,parray_num(backup_list)-1);
638637

639-
oldest_tli=backup->tli;
640-
oldest_lsn=backup->start_lsn;
638+
/* Get LSN and TLI of the oldest backup with valid start_lsn and tli */
639+
if (backup->tli>0&& !XLogRecPtrIsInvalid(backup->start_lsn))
640+
{
641+
oldest_tli=backup->tli;
642+
oldest_lsn=backup->start_lsn;
643+
break;
644+
}
641645
}
642646

643647
/* Be paranoid */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp