Re: O(n^2) system calls in RemoveOldXlogFiles() - Mailing list pgsql-hackers

From Alvaro Herrera
Subject Re: O(n^2) system calls in RemoveOldXlogFiles()
Date
Msg-id 20210112151024.GA364@alvherre.pgsql
Whole thread Raw
In response to O(n^2) system calls in RemoveOldXlogFiles()  (Thomas Munro <thomas.munro@gmail.com>)
Responses Re: O(n^2) system calls in RemoveOldXlogFiles()  (Michael Paquier <michael@paquier.xyz>)
List 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



pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: Fix a typo in xlogreader.c
Next
From: Tom Lane
Date:
Subject: Re: Executing inet_server_addr/port() in parallel workers