diff --git a/src/backup.c b/src/backup.c index 78c3512e..b19e80e1 100644 --- a/src/backup.c +++ b/src/backup.c @@ -506,12 +506,12 @@ do_backup_pg(InstanceState *instanceState, PGconn *backup_conn, /* copy pg_control at very end */ if (backup_isok) { + char from_fullpath[MAXPGPATH]; + char to_fullpath[MAXPGPATH]; elog(progress ? INFO : LOG, "Progress: Backup file \"%s\"", src_pg_control_file->rel_path); - char from_fullpath[MAXPGPATH]; - char to_fullpath[MAXPGPATH]; join_path_components(from_fullpath, instance_config.pgdata, src_pg_control_file->rel_path); join_path_components(to_fullpath, current.database_dir, src_pg_control_file->rel_path); diff --git a/src/catalog.c b/src/catalog.c index b2909078..dee82c22 100644 --- a/src/catalog.c +++ b/src/catalog.c @@ -1755,16 +1755,16 @@ catalog_get_timelines(InstanceState *instanceState, InstanceConfig *instance) for (i = 0; i < parray_num(timelineinfos); i++) { - timelineInfo *tlinfo = parray_get(timelineinfos, i); + timelineInfo *tlInfo = parray_get(timelineinfos, i); for (j = 0; j < parray_num(backups); j++) { pgBackup *backup = parray_get(backups, j); - if (tlinfo->tli == backup->tli) + if (tlInfo->tli == backup->tli) { - if (tlinfo->backups == NULL) - tlinfo->backups = parray_new(); + if (tlInfo->backups == NULL) + tlInfo->backups = parray_new(); - parray_append(tlinfo->backups, backup); + parray_append(tlInfo->backups, backup); } } } @@ -1772,10 +1772,10 @@ catalog_get_timelines(InstanceState *instanceState, InstanceConfig *instance) /* determine oldest backup and closest backup for every timeline */ for (i = 0; i < parray_num(timelineinfos); i++) { - timelineInfo *tlinfo = parray_get(timelineinfos, i); + timelineInfo *tlInfo = parray_get(timelineinfos, i); - tlinfo->oldest_backup = get_oldest_backup(tlinfo); - tlinfo->closest_backup = get_closest_backup(tlinfo); + tlInfo->oldest_backup = get_oldest_backup(tlInfo); + tlInfo->closest_backup = get_closest_backup(tlInfo); } /* determine which WAL segments must be kept because of wal retention */ @@ -1845,18 +1845,18 @@ catalog_get_timelines(InstanceState *instanceState, InstanceConfig *instance) for (i = 0; i < parray_num(timelineinfos); i++) { int count = 0; - timelineInfo *tlinfo = parray_get(timelineinfos, i); + timelineInfo *tlInfo = parray_get(timelineinfos, i); /* * Iterate backward on backups belonging to this timeline to find * anchor_backup. NOTE Here we rely on the fact that backups list * is ordered by start_lsn DESC. */ - if (tlinfo->backups) + if (tlInfo->backups) { - for (j = 0; j < parray_num(tlinfo->backups); j++) + for (j = 0; j < parray_num(tlInfo->backups); j++) { - pgBackup *backup = parray_get(tlinfo->backups, j); + pgBackup *backup = parray_get(tlInfo->backups, j); /* sanity */ if (XLogRecPtrIsInvalid(backup->start_lsn) || @@ -1886,12 +1886,12 @@ catalog_get_timelines(InstanceState *instanceState, InstanceConfig *instance) if (count == instance->wal_depth) { elog(LOG, "On timeline %i WAL is protected from purge at %X/%X", - tlinfo->tli, + tlInfo->tli, (uint32) (backup->start_lsn >> 32), (uint32) (backup->start_lsn)); - tlinfo->anchor_lsn = backup->start_lsn; - tlinfo->anchor_tli = backup->tli; + tlInfo->anchor_lsn = backup->start_lsn; + tlInfo->anchor_tli = backup->tli; break; } } @@ -1916,7 +1916,7 @@ catalog_get_timelines(InstanceState *instanceState, InstanceConfig *instance) * If closest_backup is not available, then general WAL purge rules * are applied. */ - if (XLogRecPtrIsInvalid(tlinfo->anchor_lsn)) + if (XLogRecPtrIsInvalid(tlInfo->anchor_lsn)) { /* * Failed to find anchor_lsn in our own timeline. @@ -1942,7 +1942,7 @@ catalog_get_timelines(InstanceState *instanceState, InstanceConfig *instance) xlogInterval *interval = NULL; TimeLineID tli = 0; /* check if tli has closest_backup */ - if (!tlinfo->closest_backup) + if (!tlInfo->closest_backup) /* timeline has no closest_backup, wal retention cannot be * applied to this timeline. * Timeline will be purged up to oldest_backup if any or @@ -1952,47 +1952,47 @@ catalog_get_timelines(InstanceState *instanceState, InstanceConfig *instance) continue; /* sanity for closest_backup */ - if (XLogRecPtrIsInvalid(tlinfo->closest_backup->start_lsn) || - tlinfo->closest_backup->tli <= 0) + if (XLogRecPtrIsInvalid(tlInfo->closest_backup->start_lsn) || + tlInfo->closest_backup->tli <= 0) continue; /* * Set anchor_lsn and anchor_tli to protect whole timeline from purge * In the example above: tli3. */ - tlinfo->anchor_lsn = tlinfo->closest_backup->start_lsn; - tlinfo->anchor_tli = tlinfo->closest_backup->tli; + tlInfo->anchor_lsn = tlInfo->closest_backup->start_lsn; + tlInfo->anchor_tli = tlInfo->closest_backup->tli; /* closest backup may be located not in parent timeline */ - closest_backup = tlinfo->closest_backup; + closest_backup = tlInfo->closest_backup; - tli = tlinfo->tli; + tli = tlInfo->tli; /* * Iterate over parent timeline chain and * look for timeline where closest_backup belong */ - while (tlinfo->parent_link) + while (tlInfo->parent_link) { /* In case of intermediate timeline save to keep_segments * begin_segno and switchpoint segment. * In case of final timelines save to keep_segments * closest_backup start_lsn segment and switchpoint segment. */ - XLogRecPtr switchpoint = tlinfo->switchpoint; + XLogRecPtr switchpoint = tlInfo->switchpoint; - tlinfo = tlinfo->parent_link; + tlInfo = tlInfo->parent_link; - if (tlinfo->keep_segments == NULL) - tlinfo->keep_segments = parray_new(); + if (tlInfo->keep_segments == NULL) + tlInfo->keep_segments = parray_new(); /* in any case, switchpoint segment must be added to interval */ interval = palloc(sizeof(xlogInterval)); GetXLogSegNo(switchpoint, interval->end_segno, instance->xlog_seg_size); /* Save [S1`, S2] to keep_segments */ - if (tlinfo->tli != closest_backup->tli) - interval->begin_segno = tlinfo->begin_segno; + if (tlInfo->tli != closest_backup->tli) + interval->begin_segno = tlInfo->begin_segno; /* Save [B1, S1] to keep_segments */ else GetXLogSegNo(closest_backup->start_lsn, interval->begin_segno, instance->xlog_seg_size); @@ -2002,27 +2002,27 @@ catalog_get_timelines(InstanceState *instanceState, InstanceConfig *instance) * covered by other larger interval. */ - GetXLogFileName(begin_segno_str, tlinfo->tli, interval->begin_segno, instance->xlog_seg_size); - GetXLogFileName(end_segno_str, tlinfo->tli, interval->end_segno, instance->xlog_seg_size); + GetXLogFileName(begin_segno_str, tlInfo->tli, interval->begin_segno, instance->xlog_seg_size); + GetXLogFileName(end_segno_str, tlInfo->tli, interval->end_segno, instance->xlog_seg_size); elog(LOG, "Timeline %i to stay reachable from timeline %i " "protect from purge WAL interval between " "%s and %s on timeline %i", tli, closest_backup->tli, begin_segno_str, - end_segno_str, tlinfo->tli); + end_segno_str, tlInfo->tli); - parray_append(tlinfo->keep_segments, interval); + parray_append(tlInfo->keep_segments, interval); continue; } continue; } /* Iterate over backups left */ - for (j = count; j < parray_num(tlinfo->backups); j++) + for (j = count; j < parray_num(tlInfo->backups); j++) { XLogSegNo segno = 0; xlogInterval *interval = NULL; - pgBackup *backup = parray_get(tlinfo->backups, j); + pgBackup *backup = parray_get(tlInfo->backups, j); /* * We must calculate keep_segments intervals for ARCHIVE backups @@ -2039,7 +2039,7 @@ catalog_get_timelines(InstanceState *instanceState, InstanceConfig *instance) continue; /* no point in clogging keep_segments by backups protected by anchor_lsn */ - if (backup->start_lsn >= tlinfo->anchor_lsn) + if (backup->start_lsn >= tlInfo->anchor_lsn) continue; /* append interval to keep_segments */ @@ -2057,8 +2057,8 @@ catalog_get_timelines(InstanceState *instanceState, InstanceConfig *instance) else interval->end_segno = segno; - GetXLogFileName(begin_segno_str, tlinfo->tli, interval->begin_segno, instance->xlog_seg_size); - GetXLogFileName(end_segno_str, tlinfo->tli, interval->end_segno, instance->xlog_seg_size); + GetXLogFileName(begin_segno_str, tlInfo->tli, interval->begin_segno, instance->xlog_seg_size); + GetXLogFileName(end_segno_str, tlInfo->tli, interval->end_segno, instance->xlog_seg_size); elog(LOG, "Archive backup %s to stay consistent " "protect from purge WAL interval " @@ -2066,10 +2066,10 @@ catalog_get_timelines(InstanceState *instanceState, InstanceConfig *instance) backup_id_of(backup), begin_segno_str, end_segno_str, backup->tli); - if (tlinfo->keep_segments == NULL) - tlinfo->keep_segments = parray_new(); + if (tlInfo->keep_segments == NULL) + tlInfo->keep_segments = parray_new(); - parray_append(tlinfo->keep_segments, interval); + parray_append(tlInfo->keep_segments, interval); } } @@ -2081,27 +2081,27 @@ catalog_get_timelines(InstanceState *instanceState, InstanceConfig *instance) for (i = 0; i < parray_num(timelineinfos); i++) { XLogSegNo anchor_segno = 0; - timelineInfo *tlinfo = parray_get(timelineinfos, i); + timelineInfo *tlInfo = parray_get(timelineinfos, i); /* * At this point invalid anchor_lsn can be only in one case: * timeline is going to be purged by regular WAL purge rules. */ - if (XLogRecPtrIsInvalid(tlinfo->anchor_lsn)) + if (XLogRecPtrIsInvalid(tlInfo->anchor_lsn)) continue; /* * anchor_lsn is located in another timeline, it means that the timeline * will be protected from purge entirely. */ - if (tlinfo->anchor_tli > 0 && tlinfo->anchor_tli != tlinfo->tli) + if (tlInfo->anchor_tli > 0 && tlInfo->anchor_tli != tlInfo->tli) continue; - GetXLogSegNo(tlinfo->anchor_lsn, anchor_segno, instance->xlog_seg_size); + GetXLogSegNo(tlInfo->anchor_lsn, anchor_segno, instance->xlog_seg_size); - for (j = 0; j < parray_num(tlinfo->xlog_filelist); j++) + for (j = 0; j < parray_num(tlInfo->xlog_filelist); j++) { - xlogFile *wal_file = (xlogFile *) parray_get(tlinfo->xlog_filelist, j); + xlogFile *wal_file = (xlogFile *) parray_get(tlInfo->xlog_filelist, j); if (wal_file->segno >= anchor_segno) { @@ -2110,13 +2110,13 @@ catalog_get_timelines(InstanceState *instanceState, InstanceConfig *instance) } /* no keep segments */ - if (!tlinfo->keep_segments) + if (!tlInfo->keep_segments) continue; /* Protect segments belonging to one of the keep invervals */ - for (k = 0; k < parray_num(tlinfo->keep_segments); k++) + for (k = 0; k < parray_num(tlInfo->keep_segments); k++) { - xlogInterval *keep_segments = (xlogInterval *) parray_get(tlinfo->keep_segments, k); + xlogInterval *keep_segments = (xlogInterval *) parray_get(tlInfo->keep_segments, k); if ((wal_file->segno >= keep_segments->begin_segno) && wal_file->segno <= keep_segments->end_segno) diff --git a/src/pg_probackup.h b/src/pg_probackup.h index ae99e060..c6e52c4e 100644 --- a/src/pg_probackup.h +++ b/src/pg_probackup.h @@ -431,6 +431,8 @@ typedef struct InstanceConfig extern ConfigOption instance_options[]; extern InstanceConfig instance_config; extern time_t current_time; +extern bool no_validate; +extern IncrRestoreMode incremental_mode; typedef struct PGNodeInfo { @@ -805,9 +807,12 @@ extern pid_t my_pid; extern __thread int my_thread_num; extern int num_threads; extern bool stream_wal; +extern bool no_color; extern bool show_color; extern bool progress; +extern bool no_sync; extern bool is_archive_cmd; /* true for archive-{get,push} */ +extern time_t start_time; /* In pre-10 'replication_slot' is defined in receivelog.h */ extern char *replication_slot; #if PG_VERSION_NUM >= 100000 @@ -816,6 +821,7 @@ extern bool temp_slot; extern bool perm_slot; /* backup options */ +extern bool backup_logs; extern bool smooth_checkpoint; /* remote probackup options */ @@ -827,8 +833,15 @@ extern bool exclusive_backup; extern bool delete_wal; extern bool delete_expired; extern bool merge_expired; +extern bool force; extern bool dry_run; +/* archive push options */ +extern int batch_size; + +/* archive get options */ +extern bool no_validate_wal; + /* ===== instanceState ===== */ typedef struct InstanceState @@ -858,11 +871,18 @@ typedef struct InstanceState /* show options */ extern ShowFormat show_format; +extern bool show_archive; + +/* set backup options */ +extern int64 ttl; /* checkdb options */ +extern bool need_amcheck; extern bool heapallindexed; extern bool checkunique; +extern bool amcheck_parent; extern bool skip_block_validation; +extern bool skip_external_dirs; /* current settings */ extern pgBackup current; diff --git a/src/stream.c b/src/stream.c index 77453e99..b1129a77 100644 --- a/src/stream.c +++ b/src/stream.c @@ -592,7 +592,7 @@ parse_tli_history_buffer(char *history, TimeLineID tli) if (curLineLen > 0) { char *ptr; - TimeLineID tli; + TimeLineID currTLI; uint32 switchpoint_hi; uint32 switchpoint_lo; int nfields; @@ -605,7 +605,7 @@ parse_tli_history_buffer(char *history, TimeLineID tli) if (*ptr == '\0' || *ptr == '#') continue; - nfields = sscanf(tempStr, "%u\t%X/%X", &tli, &switchpoint_hi, &switchpoint_lo); + nfields = sscanf(tempStr, "%u\t%X/%X", &currTLI, &switchpoint_hi, &switchpoint_lo); if (nfields < 1) { @@ -615,11 +615,11 @@ parse_tli_history_buffer(char *history, TimeLineID tli) if (nfields != 3) elog(ERROR, "Syntax error in timeline history: \"%s\". Expected a transaction log switchpoint location.", tempStr); - if (last_timeline && tli <= last_timeline->tli) + if (last_timeline && currTLI <= last_timeline->tli) elog(ERROR, "Timeline IDs must be in increasing sequence: \"%s\"", tempStr); entry = pgut_new(TimeLineHistoryEntry); - entry->tli = tli; + entry->tli = currTLI; entry->end = ((uint64) switchpoint_hi << 32) | switchpoint_lo; last_timeline = entry; @@ -628,7 +628,7 @@ parse_tli_history_buffer(char *history, TimeLineID tli) result = parray_new(); parray_append(result, entry); elog(VERBOSE, "parse_tli_history_buffer() found entry: tli = %X, end = %X/%X", - tli, switchpoint_hi, switchpoint_lo); + currTLI, switchpoint_hi, switchpoint_lo); /* we ignore the remainder of each line */ } diff --git a/src/utils/file.c b/src/utils/file.c index fa08939f..f4e583e2 100644 --- a/src/utils/file.c +++ b/src/utils/file.c @@ -1684,7 +1684,7 @@ fio_gzread(gzFile f, void *buf, unsigned size) { gz->strm.next_in = gz->buf; } - rc = fio_read(gz->fd, gz->strm.next_in + gz->strm.avail_in, + rc = fio_read(gz->fd, (void *) (gz->strm.next_in + gz->strm.avail_in), gz->buf + ZLIB_BUFFER_SIZE - gz->strm.next_in - gz->strm.avail_in); if (rc > 0) { @@ -2499,7 +2499,7 @@ fio_send_pages_impl(int out, char* buf) int fio_send_file_gz(const char *from_fullpath, FILE* out, char **errormsg) { - fio_header hdr; + fio_header header; int exit_code = SEND_OK; char *in_buf = pgut_malloc(CHUNK_SIZE); /* buffer for compressed data */ char *out_buf = pgut_malloc(OUT_BUF_SIZE); /* 1MB buffer for decompressed data */ @@ -2507,13 +2507,13 @@ fio_send_file_gz(const char *from_fullpath, FILE* out, char **errormsg) /* decompressor */ z_stream *strm = NULL; - hdr.cop = FIO_SEND_FILE; - hdr.size = path_len; + header.cop = FIO_SEND_FILE; + header.size = path_len; // elog(VERBOSE, "Thread [%d]: Attempting to open remote compressed WAL file '%s'", // thread_num, from_fullpath); - IO_CHECK(fio_write_all(fio_stdout, &hdr, sizeof(hdr)), sizeof(hdr)); + IO_CHECK(fio_write_all(fio_stdout, &header, sizeof(header)), sizeof(header)); IO_CHECK(fio_write_all(fio_stdout, from_fullpath, path_len), path_len); for (;;) 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