From: | Dilip Kumar <dilipbalaut(at)gmail(dot)com> |
---|---|
To: | Michael Paquier <michael(at)paquier(dot)xyz> |
Cc: | Jeff Davis <pgsql(at)j-davis(dot)com>, Melanie Plageman <melanieplageman(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Andres Freund <andres(at)anarazel(dot)de> |
Subject: | Re: Incorrect logic in XLogNeedsFlush() |
Date: | 2025-09-12 04:51:27 |
Message-ID: | CAFiTN-vBRhs19A0B1G44BBujmsS1WAJeFzDbN_GN0vdVYguHag@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Fri, Sep 12, 2025 at 9:47 AM Michael Paquier <michael(at)paquier(dot)xyz> wrote:
>
> On Fri, Sep 12, 2025 at 08:45:36AM +0530, Dilip Kumar wrote:
> > On Fri, Sep 12, 2025 at 8:07 AM Dilip Kumar <dilipbalaut(at)gmail(dot)com> wrote:
> >> +1, it really makes XLogFlush() to directly check using
> >> XLogNeedsFlush() after adding the "WAL inserts are allowed" check in
> >> XLogNeedsFlush(), this is the best way to avoid any inconsistencies in
> >> future as well.
> >
> > I tried with the attached patch, at least check-world reports no issue.
>
> @@ -2797,7 +2797,7 @@ XLogFlush(XLogRecPtr record)
> }
>
> /* Quick exit if already known flushed */
> - if (record <= LogwrtResult.Flush)
> + if (!XLogNeedsFlush(record))
> return;
>
> Hmm, no. You are making more expensive a check that is written to be
> cheap. I was more thinking about an assertion at the bottom of
> XLogFlush() once a flush is completed. Input and ideas from others
> are of course welcome on the matter.
Yeah, asserting it at the end makes sense, as we can ensure that
XLogFlush() and XLogNeedsFlush() agree on the same thing without
adding additional overhead. Here is the revised one.
--
Regards,
Dilip Kumar
Google
Attachment | Content-Type | Size |
---|---|---|
v1-0001-Make-XLogFlush-and-XLogNeedsFlush-decision-more-c.patch | application/octet-stream | 2.3 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Corey Huinker | 2025-09-12 04:55:56 | Re: Extended Statistics set/restore/clear functions. |
Previous Message | Michael Paquier | 2025-09-12 04:16:59 | Re: Incorrect logic in XLogNeedsFlush() |