Re: PATCH: Exclude additional directories in pg_basebackup

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: David Steele <david(at)pgmasters(dot)net>
Cc: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Ashutosh Sharma <ashu(dot)coek88(at)gmail(dot)com>
Subject: Re: PATCH: Exclude additional directories in pg_basebackup
Date: 2016-09-10 08:22:08
Message-ID: CAB7nPqToOJCs0B4NMvYJ=Xkh0uG0WkQ7-TDgW8aFFWE54nWXAg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Sep 9, 2016 at 10:18 PM, David Steele <david(at)pgmasters(dot)net> wrote:
> On 9/6/16 10:25 PM, Michael Paquier wrote:
>>
>>
>> On Wed, Sep 7, 2016 at 12:16 AM, David Steele <david(at)pgmasters(dot)net> wrote:
>>
>>> Attached is a new patch that adds sgml documentation. I can expand on
>>> each
>>> directory individually if you think that's necessary, but thought it was
>>> better to lump them into a few categories.
>>
>>
>> + be ommitted from the backup as they will be initialized on postmaster
>> + startup. If the <xref linkend="GUC-STATS-TEMP-DIRECTORY"> is set and
>> is
>> + under the database cluster directory then the contents of the
>> directory
>> + specified by <xref linkend="GUC-STATS-TEMP-DIRECTORY"> can also
>> be ommitted.
>>
>> s/ommitted/omitted/
>
>
> Fixed.
>
>> +#define EXCLUDE_DIR_MAX 8
>> +#define EXCLUDE_DIR_STAT_TMP 0
>> +
>> +const char *excludeDirContents[EXCLUDE_DIR_MAX] =
>> +{
>> + /*
>> + * Skip temporary statistics files. The first array position will be
>> + * filled with the value of pgstat_stat_directory relative to PGDATA.
>> + * PG_STAT_TMP_DIR must be skipped even when stats_temp_directory is
>> set
>> + * because PGSS_TEXT_FILE is always created there.
>> + */
>> + NULL,
>> I find that ugly. I'd rather use an array with undefined size for the
>> fixed elements finishing by NULL, remove EXCLUDE_DIR_MAX and
>> EXCLUDE_DIR_STAT_TMP and use a small routine to do the work done on
>> _tarWriteHeader...
>
>
> Done. Also writing out pg_xlog with the new routine.

Thanks, this looks in far better shape now.

+ /* Removed on startup, see DeleteAllExportedSnapshotFiles(). */
+ "pg_snapshots",
Using SNAPSHOT_EXPORT_DIR is possible here.

+_tarWriteDir(char *pathbuf, int basepathlen, struct stat *statbuf,
+ bool sizeonly)
That's nice, thanks! This even takes care of the fact when directories
other than pg_xlog are symlinks or junction points.

+ /* Recreated on startup, see StartupReplicationSlots(). */
+ "pg_replslot",
This comment is incorrect, pg_replslot is skipped in a base backup
because that's just useless.
--
Michael

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2016-09-10 09:27:45 Re: pg_basebackup, pg_receivexlog and data durability (was: silent data loss with ext4 / all current versions)
Previous Message Michael Paquier 2016-09-10 07:53:01 Re: An extra error for client disconnection on Windows