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

Commit0fbbc22

Browse files
committed
Little optimization, remove unnecessary find_direct_child()
1 parent6b6491e commit0fbbc22

File tree

3 files changed

+10
-36
lines changed

3 files changed

+10
-36
lines changed

‎src/catalog.c

Lines changed: 6 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,13 +1026,14 @@ is_prolific(parray *backup_list, pgBackup *target_backup)
10261026
if (tmp_backup->parent_backup==target_backup->start_time&&
10271027
(tmp_backup->status==BACKUP_STATUS_OK||
10281028
tmp_backup->status==BACKUP_STATUS_DONE))
1029+
{
10291030
child_counter++;
1031+
if (child_counter>1)
1032+
return true;
1033+
}
10301034
}
10311035

1032-
if (child_counter>1)
1033-
return true;
1034-
else
1035-
return false;
1036+
return false;
10361037
}
10371038

10381039
/*
@@ -1067,35 +1068,6 @@ find_parent_full_backup(pgBackup *current_backup)
10671068
returnbase_full_backup;
10681069
}
10691070

1070-
/*
1071-
* Find closest child of target_backup. If there are several direct
1072-
* offsprings in backup_list, then first win.
1073-
*/
1074-
pgBackup*
1075-
find_direct_child(parray*backup_list,pgBackup*target_backup)
1076-
{
1077-
inti;
1078-
1079-
for (i=0;i<parray_num(backup_list);i++)
1080-
{
1081-
pgBackup*tmp_backup= (pgBackup*)parray_get(backup_list,i);
1082-
1083-
if (tmp_backup->backup_mode==BACKUP_MODE_FULL)
1084-
continue;
1085-
1086-
/* Consider only OK and DONE children */
1087-
if (tmp_backup->parent_backup==target_backup->start_time&&
1088-
(tmp_backup->status==BACKUP_STATUS_OK||
1089-
tmp_backup->status==BACKUP_STATUS_DONE))
1090-
{
1091-
returntmp_backup;
1092-
}
1093-
}
1094-
elog(WARNING,"Failed to find a direct child for backup %s",
1095-
base36enc(target_backup->start_time));
1096-
returnNULL;
1097-
}
1098-
10991071
/*
11001072
* Interate over parent chain and look for any problems.
11011073
* Return 0 if chain is broken.
@@ -1204,4 +1176,4 @@ get_backup_index_number(parray *backup_list, pgBackup *backup)
12041176
}
12051177
elog(WARNING,"Failed to find backup %s",base36enc(backup->start_time));
12061178
return-1;
1207-
}
1179+
}

‎src/delete.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,9 @@ int do_retention(void)
129129
boolretention_is_set= false;/* At least one retention policy is set */
130130
boolbackup_list_is_empty= false;
131131

132+
backup_deleted= false;
133+
backup_merged= false;
134+
132135
/* Get a complete list of backups. */
133136
backup_list=catalog_get_backup_list(INVALID_BACKUP_ID);
134137

@@ -411,7 +414,7 @@ do_retention_merge(parray *backup_list, parray *to_keep_list, parray *to_purge_l
411414
continue;
412415
}
413416

414-
/* FULL backup in purge list, thanks to sparsing of keep_list current backup is
417+
/* FULL backup in purge list, thanks to sparsing of keep_list current backup is
415418
* final target for merge, but there could be intermediate incremental
416419
* backups from purge_list.
417420
*/

‎src/pg_probackup.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,6 @@ extern int pgBackupCompareId(const void *f1, const void *f2);
501501
externintpgBackupCompareIdDesc(constvoid*f1,constvoid*f2);
502502
externintpgBackupCompareIdEqual(constvoid*l,constvoid*r);
503503

504-
externpgBackup*find_direct_child(parray*backup_list,pgBackup*target_backup);
505504
externpgBackup*find_parent_full_backup(pgBackup*current_backup);
506505
externintscan_parent_chain(pgBackup*current_backup,pgBackup**result_backup);
507506
externboolis_parent(time_tparent_backup_time,pgBackup*child_backup,boolinclusive);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp