Thread: [COMMITTERS] pgsql: Remove secondary checkpoint

[COMMITTERS] pgsql: Remove secondary checkpoint

From
Simon Riggs
Date:
Remove secondary checkpoint

Previously server reserved WAL for last two checkpoints,
which used too much disk space for small servers.

Bumps PG_CONTROL_VERSION

Author: Simon Riggs <simon@2ndQuadrant.com>
Reviewed-by: Michael Paquier <michael.paquier@gmail.com>

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/4b0d28de06b28e57c540fca458e4853854fbeaf8

Modified Files
--------------
doc/src/sgml/backup.sgml                |  2 +-
doc/src/sgml/func.sgml                  |  5 --
src/backend/access/transam/xlog.c       | 93 ++++++++-------------------------
src/backend/utils/misc/pg_controldata.c | 79 +++++++++++++---------------
src/bin/pg_controldata/pg_controldata.c |  3 --
src/bin/pg_resetwal/pg_resetwal.c       |  1 -
src/include/catalog/pg_control.h        |  3 +-
src/include/catalog/pg_proc.h           |  2 +-
8 files changed, 62 insertions(+), 126 deletions(-)


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

Re: [COMMITTERS] pgsql: Remove secondary checkpoint

From
Andres Freund
Date:
On 2017-11-07 17:57:31 +0000, Simon Riggs wrote:
> Remove secondary checkpoint
> 
> Previously server reserved WAL for last two checkpoints,
> which used too much disk space for small servers.
> 
> Bumps PG_CONTROL_VERSION

FWIW, I don't think this should be applied without a pg_resetxlog
feature allowing to manually use older checkpoints.

Greetings,

Andres Freund


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

Re: [COMMITTERS] pgsql: Remove secondary checkpoint

From
Andreas Seltenreich
Date:
Hi,

sqlsmith doesn't like commit 4b0d28de06:

,----
| regression=> select * from pg_control_checkpoint();
| server closed the connection unexpectedly
| TRAP: FailedAssertion("!((atti->attalign) == 's')", File: "heaptuple.c", Line: 126)
`----

On a build with assertions disabled, the statement fails with an error
instead:

,----
| regression=> select * from pg_control_checkpoint();
| ERROR:  function return row and query-specified return row do not match
| DETAIL:  Returned row contains 19 attributes, but query expects 18.
`----

The attached patch fixes it for me.

regards,
Andreas

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

Attachment

Re: [COMMITTERS] pgsql: Remove secondary checkpoint

From
Amit Kapila
Date:
On Sat, Nov 11, 2017 at 10:58 PM, Andreas Seltenreich
<seltenreich@gmx.de> wrote:
> Hi,
>
> sqlsmith doesn't like commit 4b0d28de06:
>
> ,----
> | regression=> select * from pg_control_checkpoint();
> | server closed the connection unexpectedly
> | TRAP: FailedAssertion("!((atti->attalign) == 's')", File: "heaptuple.c", Line: 126)
> `----
>
> On a build with assertions disabled, the statement fails with an error
> instead:
>
> ,----
> | regression=> select * from pg_control_checkpoint();
> | ERROR:  function return row and query-specified return row do not match
> | DETAIL:  Returned row contains 19 attributes, but query expects 18.
> `----
>
> The attached patch fixes it for me.
>


Your patch looks correct to me.  I can reproduce the problem and
verified that patch fixes the problem.  It is better to track this in
CF if not already tracked.

-- 
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com


Re: [COMMITTERS] pgsql: Remove secondary checkpoint

From
Simon Riggs
Date:
On 20 November 2017 at 08:38, Amit Kapila <amit.kapila16@gmail.com> wrote:
> On Sat, Nov 11, 2017 at 10:58 PM, Andreas Seltenreich
> <seltenreich@gmx.de> wrote:
>> Hi,
>>
>> sqlsmith doesn't like commit 4b0d28de06:
>>
>> ,----
>> | regression=> select * from pg_control_checkpoint();
>> | server closed the connection unexpectedly
>> | TRAP: FailedAssertion("!((atti->attalign) == 's')", File: "heaptuple.c", Line: 126)
>> `----
>>
>> On a build with assertions disabled, the statement fails with an error
>> instead:
>>
>> ,----
>> | regression=> select * from pg_control_checkpoint();
>> | ERROR:  function return row and query-specified return row do not match
>> | DETAIL:  Returned row contains 19 attributes, but query expects 18.
>> `----
>>
>> The attached patch fixes it for me.
>>
>
>
> Your patch looks correct to me.  I can reproduce the problem and
> verified that patch fixes the problem.  It is better to track this in
> CF if not already tracked.

What email and patch is this referring to?

-- 
Simon Riggs                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


Re: [COMMITTERS] pgsql: Remove secondary checkpoint

From
Andres Freund
Date:
On 2017-11-20 15:50:40 -0500, Simon Riggs wrote:
> On 20 November 2017 at 08:38, Amit Kapila <amit.kapila16@gmail.com> wrote:
> > Your patch looks correct to me.  I can reproduce the problem and
> > verified that patch fixes the problem.  It is better to track this in
> > CF if not already tracked.
> 
> What email and patch is this referring to?

https://www.postgresql.org/message-id/878tfcsp1t.fsf@ansel.ydns.eu


Re: [COMMITTERS] pgsql: Remove secondary checkpoint

From
Simon Riggs
Date:
On 20 November 2017 at 15:55, Andres Freund <andres@anarazel.de> wrote:
> On 2017-11-20 15:50:40 -0500, Simon Riggs wrote:
>> On 20 November 2017 at 08:38, Amit Kapila <amit.kapila16@gmail.com> wrote:
>> > Your patch looks correct to me.  I can reproduce the problem and
>> > verified that patch fixes the problem.  It is better to track this in
>> > CF if not already tracked.
>>
>> What email and patch is this referring to?
>
> https://www.postgresql.org/message-id/878tfcsp1t.fsf@ansel.ydns.eu

Apologies to Andreas, I didn't receive that email

-- 
Simon Riggs                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


Re: [COMMITTERS] pgsql: Remove secondary checkpoint

From
Thomas Munro
Date:
On Wed, Nov 8, 2017 at 6:57 AM, Simon Riggs <simon@2ndquadrant.com> wrote:
> Remove secondary checkpoint

I think this comment in xlog.c was missed:

-               /*
-                * Get the last valid checkpoint record.  If the
latest one according
-                * to pg_control is broken, try the next-to-last one.
-                */
+               /* Get the last valid checkpoint record. */

-- 
Thomas Munro
http://www.enterprisedb.com

Attachment

Re: [COMMITTERS] pgsql: Remove secondary checkpoint

From
Robert Haas
Date:
On Tue, Feb 6, 2018 at 4:42 PM, Thomas Munro
<thomas.munro@enterprisedb.com> wrote:
> On Wed, Nov 8, 2017 at 6:57 AM, Simon Riggs <simon@2ndquadrant.com> wrote:
>> Remove secondary checkpoint
>
> I think this comment in xlog.c was missed:
>
> -               /*
> -                * Get the last valid checkpoint record.  If the
> latest one according
> -                * to pg_control is broken, try the next-to-last one.
> -                */
> +               /* Get the last valid checkpoint record. */

Committed.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company