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

Commitca44e73

Browse files
committed
PGPRO-2573: use parray_bsearch
1 parent0c40a75 commitca44e73

File tree

2 files changed

+9
-26
lines changed

2 files changed

+9
-26
lines changed

‎src/catalog.c

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,27 +1035,6 @@ is_prolific(parray *backup_list, pgBackup *target_backup)
10351035
return false;
10361036
}
10371037

1038-
/*
1039-
* Check if target_backup in backup_list. Use if bsearch cannot be trusted.
1040-
*/
1041-
bool
1042-
in_backup_list(parray*backup_list,pgBackup*target_backup)
1043-
{
1044-
inti;
1045-
1046-
if (!target_backup)
1047-
elog(ERROR,"Target backup cannot be NULL");
1048-
1049-
for (i=0;i<parray_num(backup_list);i++)
1050-
{
1051-
pgBackup*tmp_backup= (pgBackup*)parray_get(backup_list,i);
1052-
1053-
if (tmp_backup->start_time==target_backup->start_time)
1054-
return true;
1055-
}
1056-
return false;
1057-
}
1058-
10591038
/*
10601039
* Find parent base FULL backup for current backup using parent_backup_link
10611040
*/

‎src/delete.c

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -282,11 +282,11 @@ do_retention_internal(void)
282282

283283
pgBackup*backup= (pgBackup*)parray_get(backup_list,i);
284284

285-
if (in_backup_list(to_keep_list,backup))
285+
if (parray_bsearch(to_keep_list,backup,pgBackupCompareIdDesc))
286286
action="Keep";
287287

288-
if (in_backup_list(to_purge_list,backup))
289-
action="Purge";
288+
if (parray_bsearch(to_purge_list,backup,pgBackupCompareIdDesc))
289+
action="Keep";
290290

291291
if (backup->recovery_time==0)
292292
actual_window=0;
@@ -365,7 +365,9 @@ do_retention_internal(void)
365365
continue;
366366

367367
/* If parent of current backup is also in keep list, go to the next */
368-
if (in_backup_list(to_keep_list,keep_backup->parent_backup_link))
368+
if (parray_bsearch(to_keep_list,
369+
keep_backup->parent_backup_link,
370+
pgBackupCompareIdDesc))
369371
{
370372
/* make keep list a bit sparse */
371373
elog(INFO,"Sparsing keep list, remove %s",base36enc(keep_backup->start_time));
@@ -388,7 +390,9 @@ do_retention_internal(void)
388390
}
389391

390392
/* Check that ancestor is in purge_list */
391-
if (!in_backup_list(to_purge_list,full_backup))
393+
if (!parray_bsearch(to_purge_list,
394+
full_backup,
395+
pgBackupCompareIdDesc))
392396
{
393397
elog(WARNING,"Skip backup %s for merging, "
394398
"because his FULL parent is not marked for purge",base36enc(keep_backup->start_time));

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp