Re: O(n^2) system calls in RemoveOldXlogFiles()

From: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: O(n^2) system calls in RemoveOldXlogFiles()
Date: 2021-01-12 15:10:24
Message-ID: 20210112151024.GA364@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2021-Jan-11, Thomas Munro wrote:

> I didn't check the migration history of this code but it seems that
> endlogSegNo doesn't currently have the right scoping to achieve the
> goal of that last comment, so checkpoints finish up repeatedly search
> for the next free slot, starting at the low end each time,

Apparently b2a5545bd63f changed; before that commit, that code
(including the quoted comment) was all in RemoveOldXlogFiles, and
endlogSegNo was calculated only once. But ISTM that even with that
formulation it had the problem you point out. The real problem is the
loop hidden inside InstallXLogFileSegment().

--
Álvaro Herrera

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2021-01-12 15:15:14 Re: Executing inet_server_addr/port() in parallel workers
Previous Message Alvaro Herrera 2021-01-12 15:07:21 Re: Fix a typo in xlogreader.c