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

Issue 151#307

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
kuzmindb wants to merge5 commits intopostgrespro:release_2_5
base:release_2_5
Choose a base branch
Loading
fromkuzmindb:issue_151
Open
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletionssrc/catalog.c
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -15,6 +15,7 @@
#include <signal.h>
#include <sys/stat.h>
#include <unistd.h>
#include <time.h>

#include "utils/file.h"
#include "utils/configuration.h"
Expand DownExpand Up@@ -1493,7 +1494,7 @@ catalog_get_timelines(InstanceConfig *instance)
}

/* determine which WAL segments must be kept because of wal retention */
if (instance->wal_depth <= 0)
if (instance->wal_depth <= 0 && instance->wal_window <= 0)
return timelineinfos;

/*
Expand DownExpand Up@@ -1559,8 +1560,15 @@ catalog_get_timelines(InstanceConfig *instance)
for (i = 0; i < parray_num(timelineinfos); i++)
{
int count = 0;
time_t days_threshold = current_time;
timelineInfo *tlinfo = parray_get(timelineinfos, i);

if (instance_config.wal_window > 0)
{
days_threshold = current_time -
(instance_config.wal_window * 60 * 60 * 24);
}

/*
* Iterate backward on backups belonging to this timeline to find
* anchor_backup. NOTE Here we rely on the fact that backups list
Expand DownExpand Up@@ -1597,7 +1605,9 @@ catalog_get_timelines(InstanceConfig *instance)

count++;

if (count == instance->wal_depth)
if (count >= instance->wal_depth &&
days_threshold >= backup->recovery_time)

{
elog(LOG, "On timeline %i WAL is protected from purge at %X/%X",
tlinfo->tli,
Expand Down
11 changes: 11 additions & 0 deletionssrc/configure.c
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -194,6 +194,11 @@ ConfigOption instance_options[] =
&instance_config.wal_depth, SOURCE_CMD, 0,
OPTION_RETENTION_GROUP, 0, option_get_value
},
{
'u', 231, "wal-window",
&instance_config.wal_window, SOURCE_CMD, 0,
OPTION_RETENTION_GROUP, 0, option_get_value
},
/* Compression options */
{
'f', 222, "compress-algorithm",
Expand DownExpand Up@@ -363,6 +368,7 @@ init_config(InstanceConfig *config, const char *instance_name)
config->retention_redundancy = RETENTION_REDUNDANCY_DEFAULT;
config->retention_window = RETENTION_WINDOW_DEFAULT;
config->wal_depth = 0;
config->wal_window = 0;

config->compress_alg = COMPRESS_ALG_DEFAULT;
config->compress_level = COMPRESS_LEVEL_DEFAULT;
Expand DownExpand Up@@ -541,6 +547,11 @@ readInstanceConfigFile(const char *instance_name)
&instance->wal_depth, SOURCE_CMD, 0,
OPTION_RETENTION_GROUP, 0, option_get_value
},
{
'u', 231, "wal-window",
&instance->wal_window, SOURCE_CMD, 0,
OPTION_RETENTION_GROUP, 0, option_get_value
},
/* Compression options */
{
's', 222, "compress-algorithm",
Expand Down
1 change: 1 addition & 0 deletionssrc/pg_probackup.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -384,6 +384,7 @@ typedef struct InstanceConfig
uint32retention_redundancy;
uint32retention_window;
uint32wal_depth;
uint32wal_window;

CompressAlgcompress_alg;
intcompress_level;
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp