Re: pg_basebackup and pg_stat_tmp directory

From: Mitsumasa KONDO <kondo(dot)mitsumasa(at)gmail(dot)com>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: Magnus Hagander <magnus(at)hagander(dot)net>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_basebackup and pg_stat_tmp directory
Date: 2014-01-31 14:13:01
Message-ID: CADupcHWtt41BqohSi8CGE8FY-3YZ0Q0wZVP-AqemBAqYm9NFPQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2014-01-31 Fujii Masao <masao(dot)fujii(at)gmail(dot)com>:

> On Fri, Jan 31, 2014 at 10:18 PM, Mitsumasa KONDO
> <kondo(dot)mitsumasa(at)gmail(dot)com> wrote:
> > 2014-01-31 Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
> >>
> >> On Tue, Jan 28, 2014 at 5:51 PM, Magnus Hagander <magnus(at)hagander(dot)net>
> >> wrote:
> >> > On Tue, Jan 28, 2014 at 6:11 AM, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com
> >
> >> > wrote:
> >> >>
> >> >> On Tue, Jan 28, 2014 at 9:26 AM, Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
> >> >> wrote:
> >> >> > Hi,
> >> >> >
> >> >> > The files in pg_stat_tmp directory don't need to be backed up
> because
> >> >> > they are
> >> >> > basically reset at the archive recovery. So I think it's worth
> >> >> > changing pg_basebackup
> >> >> > so that it skips any files in pg_stat_tmp directory. Thought?
> >> >>
> >> >> I think this is good idea, but can't it also avoid
> >> >> PGSTAT_STAT_PERMANENT_TMPFILE along with temp files in
> >> >> pg_stat_tmp
> >> >>
> >> >
> >> > All stats files should be excluded. IIRC the
> >> > PGSTAT_STAT_PERMANENT_TMPFILE
> >> > refers to just the global one. You want to exclude based on
> >> > PGSTAT_STAT_PERMANENT_DIRECTORY (and of course based on the guc
> >> > stats_temp_directory if it's in PGDATA.
> >>
> >> Attached patch changes basebackup.c so that it skips all files in both
> >> pg_stat_tmp
> >> and stats_temp_directory. Even when a user sets stats_temp_directory
> >> to the directory
> >> other than pg_stat_tmp, we need to skip the files in pg_stat_tmp.
> Because,
> >> per recent change of pg_stat_statements, the external query file is
> >> always created there.
> >
> > +1.
> >
> > And, I'd like to also skip pg_log directory because security reason.
>
> Yeah, I was thinking that, too. I'm not sure whether including log files
> in backup really increases the security risk, though. There are already
> very important data, i.e., database, in backups. Anyway, since
> the amount of log files can be very large and they are not essential
> for recovery, it's worth considering whether to exclude them. OTOH,
> I'm sure that some users prefer current behavior for some reasons.
> So I think that it's better to expose the pg_basebackup option
> specifying whether log files are included in backups or not.

I'm with you. Thanks a lot !

Regards,
--
Mitsumsasa KONDO
NTT Open Source Software Center

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Stark 2014-01-31 14:39:47 Re: Recovery inconsistencies, standby much larger than primary
Previous Message Stephen Frost 2014-01-31 14:10:11 Re: Prohibit row-security + inheritance in 9.4?