Re: Maximum number of WAL files in the pg_xlog directory

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: Guillaume Lelarge <guillaume(at)lelarge(dot)info>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, PostgreSQL Developers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Maximum number of WAL files in the pg_xlog directory
Date: 2014-12-30 17:45:57
Message-ID: CAMkU=1ybuKsqQk5LDHw6z+8w9DeB3WZ5gDsEz49AdvGXibf_2A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Dec 30, 2014 at 12:35 AM, Guillaume Lelarge <guillaume(at)lelarge(dot)info>
wrote:

> Sorry for my very late answer. It's been a tough month.
>
> 2014-11-27 0:00 GMT+01:00 Bruce Momjian <bruce(at)momjian(dot)us>:
>
>> On Mon, Nov 3, 2014 at 12:39:26PM -0800, Jeff Janes wrote:
>> > It looked to me that the formula, when descending from a previously
>> stressed
>> > state, would be:
>> >
>> > greatest(1 + checkpoint_completion_target) * checkpoint_segments,
>> > wal_keep_segments) + 1 +
>> > 2 * checkpoint_segments + 1
>>
>> I don't think we can assume checkpoint_completion_target is at all
>> reliable enough to base a maximum calculation on, assuming anything
>> above the maximum is cause of concern and something to inform the admins
>> about.
>>
>> Assuming checkpoint_completion_target is 1 for maximum purposes, how
>> about:
>>
>> max(2 * checkpoint_segments, wal_keep_segments) + 2 *
>> checkpoint_segments + 2
>>
>>
> Seems something I could agree on. At least, it makes sense, and it works
> for my customers. Although I'm wondering why "+ 2", and not "+ 1". It seems
> Jeff and you agree on this, so I may have misunderstood something.
>

From hazy memory, one +1 comes from the currently active WAL file, which
exists but is not counted towards either wal_keep_segments nor towards
recycled files. And the other +1 comes from the formula for how many
recycled files to retain, which explicitly has a +1 in it.

Cheers,

Jeff

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Geoghegan 2014-12-30 20:07:34 Re: Documentation of bt_page_items()'s ctid field
Previous Message Andres Freund 2014-12-30 17:26:41 Re: What exactly is our CRC algorithm?