Skip to content

Commit e861c7f

Browse files
committed
Little fixes
- read parent-backup-id not parent_backup - sort backup_files_list only for ptrack backup
1 parent a2bcbc7 commit e861c7f

File tree

4 files changed

+19
-17
lines changed

4 files changed

+19
-17
lines changed

backup.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -208,11 +208,6 @@ do_backup_database(parray *backup_list)
208208
(uint32) (prev_backup->start_lsn >> 32), (uint32) (prev_backup->start_lsn));
209209
elog(LOG, "current.start_lsn: %X/%X",
210210
(uint32) (current.start_lsn >> 32), (uint32) (current.start_lsn));
211-
212-
/* TODO for some reason we sort the list for both incremental modes.
213-
* Is it necessary?
214-
*/
215-
parray_qsort(backup_files_list, pgFileComparePathDesc);
216211
}
217212

218213
/*
@@ -243,13 +238,15 @@ do_backup_database(parray *backup_list)
243238
"Create new full backup before an incremental one.",
244239
ptrack_lsn, prev_backup->start_lsn);
245240
}
241+
parray_qsort(backup_files_list, pgFileComparePathDesc);
246242
make_pagemap_from_ptrack(backup_files_list);
247243
}
248244

249-
/* sort pathname ascending TODO What for?*/
245+
/* Sort pathname ascending TODO What for?*/
250246
parray_qsort(backup_files_list, pgFileComparePath);
251247

252-
/* make dirs before backup
248+
/*
249+
* Make directories before backup
253250
* and setup threads at the same time
254251
*/
255252
for (i = 0; i < parray_num(backup_files_list); i++)

catalog.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -375,16 +375,17 @@ pgBackupCreateDir(pgBackup *backup)
375375
void
376376
pgBackupWriteControl(FILE *out, pgBackup *backup)
377377
{
378-
char timestamp[20];
378+
char timestamp[20];
379+
379380
fprintf(out, "#Configuration\n");
380381
fprintf(out, "backup-mode = %s\n", backupModes[backup->backup_mode]);
381-
fprintf(out, "stream = %s\n", backup->stream?"true":"false");
382+
fprintf(out, "stream = %s\n", backup->stream?"true":"false");
382383

383384
fprintf(out, "\n#Compatibility\n");
384385
fprintf(out, "block-size = %u\n", backup->block_size);
385386
fprintf(out, "xlog-block-size = %u\n", backup->wal_block_size);
386387
fprintf(out, "checksum-version = %u\n", backup->checksum_version);
387-
388+
388389
fprintf(out, "\n#Result backup info\n");
389390
fprintf(out, "timelineid = %d\n", backup->tli);
390391
fprintf(out, "start-lsn = %x/%08x\n",
@@ -415,7 +416,8 @@ pgBackupWriteControl(FILE *out, pgBackup *backup)
415416
fprintf(out, "status = %s\n", status2str(backup->status));
416417
if (backup->parent_backup != 0)
417418
{
418-
char *parent_backup = base36enc(backup->parent_backup);
419+
char *parent_backup = base36enc(backup->parent_backup);
420+
419421
fprintf(out, "parent-backup-id = '%s'\n", parent_backup);
420422
free(parent_backup);
421423
}
@@ -470,7 +472,7 @@ readBackupControlFile(const char *path)
470472
{'u', 0, "checksum_version", &backup->checksum_version, SOURCE_FILE_STRICT},
471473
{'b', 0, "stream", &backup->stream, SOURCE_FILE_STRICT},
472474
{'s', 0, "status", &status, SOURCE_FILE_STRICT},
473-
{'s', 0, "parent_backup", &parent_backup, SOURCE_FILE_STRICT},
475+
{'s', 0, "parent-backup-id", &parent_backup, SOURCE_FILE_STRICT},
474476
{0}
475477
};
476478

@@ -599,7 +601,7 @@ pgBackupCompareIdDesc(const void *l, const void *r)
599601
void
600602
pgBackupGetPath(const pgBackup *backup, char *path, size_t len, const char *subdir)
601603
{
602-
char *datetime;
604+
char *datetime;
603605

604606
datetime = base36enc(backup->start_time);
605607
if (subdir)

delete.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ static int
252252
pgBackupDeleteFiles(pgBackup *backup)
253253
{
254254
size_t i;
255+
char *backup_id;
255256
char path[MAXPGPATH];
256257
char timestamp[20];
257258
parray *files;

util.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@
1414

1515
#include "storage/bufpage.h"
1616

17-
char *base36enc(long unsigned int value)
17+
char *
18+
base36enc(long unsigned int value)
1819
{
19-
char base36[36] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
20+
char base36[36] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
2021
/* log(2**64) / log(36) = 12.38 => max 13 char + '\0' */
21-
char buffer[14];
22+
char buffer[14];
2223
unsigned int offset = sizeof(buffer);
2324

2425
buffer[--offset] = '\0';
@@ -29,7 +30,8 @@ char *base36enc(long unsigned int value)
2930
return strdup(&buffer[offset]); // warning: this must be free-d by the user
3031
}
3132

32-
long unsigned int base36dec(const char *text)
33+
long unsigned int
34+
base36dec(const char *text)
3335
{
3436
return strtoul(text, NULL, 36);
3537
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy