Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 75aa7a4

Browse files
committed
Merge branch 'master' into pgpro-2573
2 parents 9da90b6 + b5d8a77 commit 75aa7a4

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

src/restore.c

+2
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ do_restore_or_validate(time_t target_backup_id, pgRecoveryTarget *rt,
219219
}
220220
}
221221
}
222+
pg_free(missing_backup_id);
222223
/* No point in doing futher */
223224
elog(ERROR, "%s of backup %s failed.", action, base36enc(dest_backup->start_time));
224225
}
@@ -255,6 +256,7 @@ do_restore_or_validate(time_t target_backup_id, pgRecoveryTarget *rt,
255256
}
256257
}
257258
}
259+
pg_free(parent_backup_id);
258260
tmp_backup = find_parent_full_backup(dest_backup);
259261

260262
/* sanity */

src/utils/logger.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,13 @@ exit_if_necessary(int elevel)
130130
/* If this is not the main thread then don't call exit() */
131131
if (main_tid != pthread_self())
132132
{
133+
/* Interrupt other possible routines */
134+
thread_interrupted = true;
133135
#ifdef WIN32
134136
ExitThread(elevel);
135137
#else
136138
pthread_exit(NULL);
137139
#endif
138-
/* Interrupt other possible routines */
139-
thread_interrupted = true;
140140
}
141141
else
142142
exit(elevel);

src/validate.c

+7-7
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,6 @@ do_validate_all(void)
382382
static void
383383
do_validate_instance(void)
384384
{
385-
char *current_backup_id;
386385
int i;
387386
int j;
388387
parray *backups;
@@ -397,7 +396,6 @@ do_validate_instance(void)
397396
for (i = 0; i < parray_num(backups); i++)
398397
{
399398
pgBackup *base_full_backup;
400-
char *parent_backup_id;
401399

402400
current_backup = (pgBackup *) parray_get(backups, i);
403401

@@ -412,6 +410,7 @@ do_validate_instance(void)
412410
/* chain is broken */
413411
if (result == 0)
414412
{
413+
char *parent_backup_id;
415414
/* determine missing backup ID */
416415

417416
parent_backup_id = base36enc_dup(tmp_backup->parent_backup);
@@ -430,31 +429,31 @@ do_validate_instance(void)
430429
elog(WARNING, "Backup %s has missing parent %s",
431430
base36enc(current_backup->start_time), parent_backup_id);
432431
}
432+
pg_free(parent_backup_id);
433433
continue;
434434
}
435435
/* chain is whole, but at least one parent is invalid */
436436
else if (result == 1)
437437
{
438-
/* determine corrupt backup ID */
439-
parent_backup_id = base36enc_dup(tmp_backup->start_time);
440-
441438
/* Oldest corrupt backup has a chance for revalidation */
442439
if (current_backup->start_time != tmp_backup->start_time)
443440
{
441+
char *backup_id = base36enc_dup(tmp_backup->start_time);
444442
/* orphanize current_backup */
445443
if (current_backup->status == BACKUP_STATUS_OK)
446444
{
447445
write_backup_status(current_backup, BACKUP_STATUS_ORPHAN);
448446
elog(WARNING, "Backup %s is orphaned because his parent %s has status: %s",
449-
base36enc(current_backup->start_time), parent_backup_id,
447+
base36enc(current_backup->start_time), backup_id,
450448
status2str(tmp_backup->status));
451449
}
452450
else
453451
{
454452
elog(WARNING, "Backup %s has parent %s with status: %s",
455-
base36enc(current_backup->start_time),parent_backup_id,
453+
base36enc(current_backup->start_time), backup_id,
456454
status2str(tmp_backup->status));
457455
}
456+
pg_free(backup_id);
458457
continue;
459458
}
460459
base_full_backup = find_parent_full_backup(current_backup);
@@ -495,6 +494,7 @@ do_validate_instance(void)
495494
*/
496495
if (current_backup->status != BACKUP_STATUS_OK)
497496
{
497+
char *current_backup_id;
498498
/* This is ridiculous but legal.
499499
* PAGE_b2 <- OK
500500
* PAGE_a2 <- OK

0 commit comments

Comments
 (0)