Re: commit dfda6ebaec67 versus wal_keep_segments

From: Jeff Janes <jeff(dot)janes(at)gmail(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: commit dfda6ebaec67 versus wal_keep_segments
Date: 2013-04-03 15:58:00
Message-ID: CAMkU=1z5doaNOYCdSvH0bDqx29bXrRdKm0SeOw=4iRZMg7GXcA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Apr 2, 2013 at 10:08 PM, Jeff Janes <jeff(dot)janes(at)gmail(dot)com> wrote:

> This commit introduced a problem with wal_keep_segments:
>
> commit dfda6ebaec6763090fb78b458a979b558c50b39b
>

The problem seems to be that the underflow warned about is happening,
because the check to guard it was checking the wrong thing. However, I
don't really understand KeepLogSeg. It seems like segno, and hence recptr,
don't actually serve any purpose.

Cheers,

Jeff

diff --git a/src/backend/access/transam/xlog.c
b/src/backend/access/transam/xlog.c
index 2f9209f..3643be8 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -8264,7 +8264,7 @@ KeepLogSeg(XLogRecPtr recptr, XLogSegNo *logSegNo)
XLByteToSeg(recptr, segno);

/* avoid underflow, don't go below 1 */
- if (segno <= wal_keep_segments)
+ if (*logSegNo <= wal_keep_segments)
segno = 1;
else
segno = *logSegNo - wal_keep_segments;

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2013-04-03 15:58:57 Re: [PATCH] Exorcise "zero-dimensional" arrays (Was: Re: Should array_length() Return NULL)
Previous Message Tom Lane 2013-04-03 15:41:03 Re: Regex with > 32k different chars causes a backend crash