PATCH: Exclude unlogged tables from base backups

From: David Steele <david(at)pgmasters(dot)net>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: PATCH: Exclude unlogged tables from base backups
Date: 2017-12-12 22:49:54
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Including unlogged relations in base backups takes up space and is
wasteful since they are truncated during backup recovery.

The attached patches exclude unlogged relations from base backups except
for the init fork, which is required to recreate the main fork during

* exclude-unlogged-v1-01.patch

Some refactoring of reinit.c was required to reduce code duplication but
the coverage report showed that most of the interesting parts of
reinit.c were not being tested. This patch adds coverage for reinit.c.

* exclude-unlogged-v1-02.patch

Refactor reinit.c to allow other modules to identify and work with
unlogged relation forks.

* exclude-unlogged-v1-03.patch

Exclude unlogged relation forks (except init) from pg_basebackup to save
space (and time).

I decided not to try and document unlogged exclusions in the continuous
backup documentation yet (they are noted in the protocol docs). I would
like to get some input on whether the community thinks this is a good
idea. It's a non-trivial procedure that would be easy to misunderstand
and does not affect the quality of the backup other than using less
space. Thoughts?

I'll add these patches to the next CF.


Attachment Content-Type Size
exclude-unlogged-v1-01.patch text/plain 4.1 KB
exclude-unlogged-v1-02.patch text/plain 7.1 KB
exclude-unlogged-v1-03.patch text/plain 6.7 KB


Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2017-12-12 22:52:34 Re: PATCH: Exclude unlogged tables from base backups
Previous Message Chapman Flack 2017-12-12 22:09:58 Re: [HACKERS] Custom compression methods