how can I use "pg_basebackup" and not include pg_log of master ?

Started by linabout 9 years ago4 messagesgeneral
Jump to latest
#1lin
jluwln@163.com

Hi,
all. I use "pg_basebackup" to make slave, but the master has too large logs of pg_log, How Can I use "pg_basebackup" but not include logs of "pg_log" ?

best regards,
wln

#2Michael Paquier
michael@paquier.xyz
In reply to: lin (#1)
Re: how can I use "pg_basebackup" and not include pg_log of master ?

On Mon, Mar 20, 2017 at 9:28 PM, lin <jluwln@163.com> wrote:

all. I use "pg_basebackup" to make slave, but the master has too large
logs of pg_log, How Can I use "pg_basebackup" but not include logs of
"pg_log" ?

Unfortunately not, there have been several discussions about being
able to define a blacklist of paths when taking a backup but nothing
has showed up in the code tree. For log files, there is a trick
though: you can define log_directory with an absolute path pointing
out of PGDATA so those logs won't be included in base backups.
--
Michael

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#3lin
jluwln@163.com
In reply to: Michael Paquier (#2)
Re: how can I use "pg_basebackup" and not include pg_log of master ?

Can I modify "sendDir" function to skip the log_direction (default is "pg_log") ?

the sendDir function is :
static int64
sendDir(char *path, int basepathlen, bool sizeonly, List *tablespaces)
{
DIR *dir;
struct dirent *de;
charpathbuf[MAXPGPATH];
struct stat statbuf;
int64size = 0;

dir = AllocateDir(path);
while ((de = ReadDir(dir, path)) != NULL)
{
/* Skip special stuff */
              if (strcmp(de->d_name, ".") == 0 || strcmp(de->d_name, "..") == 0)  
continue;
.......
--if (strcmp(de->d_name, ".") == 0 || strcmp(de->d_name, "..") == 0) 
++ if (strcmp(de->d_name, ".") == 0 || strcmp(de->d_name, "..") == 0 || strcmp(de->d_name, "pg_log"))    

Is there something wrong ?

Thanks,
wln

At 2017-03-20 20:43:11, "Michael Paquier" <michael.paquier@gmail.com> wrote:

Show quoted text

On Mon, Mar 20, 2017 at 9:28 PM, lin <jluwln@163.com> wrote:

all. I use "pg_basebackup" to make slave, but the master has too large
logs of pg_log, How Can I use "pg_basebackup" but not include logs of
"pg_log" ?

Unfortunately not, there have been several discussions about being
able to define a blacklist of paths when taking a backup but nothing
has showed up in the code tree. For log files, there is a trick
though: you can define log_directory with an absolute path pointing
out of PGDATA so those logs won't be included in base backups.
--
Michael

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#4Michael Paquier
michael@paquier.xyz
In reply to: lin (#3)
Re: how can I use "pg_basebackup" and not include pg_log of master ?

On Tue, Mar 21, 2017 at 12:08 PM, lin <jluwln@163.com> wrote:

Can I modify "sendDir" function to skip the log_direction (default is
"pg_log") ?

Of course you can patch your own version of the backend. That will
just not be supported by community if there are bugs in your patches.
You are looking at Log_directory by the way.
--
Michael

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general