Re: SLRUs in the main buffer pool - Page Header definitions

From: "Bagga, Rishu" <bagrishu(at)amazon(dot)com>
To: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, "Debnath, Shawn" <sdn(at)amazon(dot)com>, Ian Lawrence Barwick <barwick(at)gmail(dot)com>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Subject: Re: SLRUs in the main buffer pool - Page Header definitions
Date: 2022-11-22 06:02:10
Message-ID: A45DC000-C7F5-43C1-9E9E-57FB18E2FD0D@amazon.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Heikki and Thomas,

I’ve reworked your patches for moving SLRUs to the buffer cache to add page headers to the SLRUs. Additionally, I’ve rebased this patch on top of the latest commit.

Changes in this patch include:

1. page headers on SLRU pages
2. pg_upgrade support to add page headers to existing on-disk SLRU pages
3. a new ReadBuffer mode RBM_TRIM for TrimCLOG and TrimMultiXact
4. Removing concept of External LSNs introduced in Heikki’s patch, as page headers can now store LSNs normally for SLRUs.¬¬¬¬¬
5. Addressed Serial SLRU asserts in previous patch

We still need to fix asserts triggered from memory allocation in the critical section in Munro’s patch in RecordNewMultiXact.

Currently, in GetNewMultiXact we enter the critical section, and end only after we finish our write, after doing RecordNewMultiXact in MultiXactIdCreateFromMembers. Now that we’re making ReadBuffer calls in RecordNewMultiXact, we allocate memory in the critical section, but this isn’t allowed.

For now, to avoid triggering asserts, I moved the end of the critical section before doing ReadBuffer calls, but this could cause potential data corruption for multixacts in the case ReadBuffer fails.

A potential fix for this issue is to hold on to MultiXactGenLock until we successfully read and write to the buffer, to ensure no but this would cause ReadBuffer to become a bottleneck as no other backends could access the MultiXact state data.

We should figure out a way to allow ReadBuffer calls in critical sections specifically for multixacts, as the current behavior is to panic when multixact data write operations fail.

I would appreciate your thoughts on how we could proceed here.

P.S, Ian, thanks for reminding me to rebase the patch!

Sincerely,

Rishu Bagga,

Amazon Web Services (AWS)

Attachment Content-Type Size
slru_to_buffer_cache_with_page_headers_v2.patch application/octet-stream 380.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message vignesh C 2022-11-22 06:18:58 Re: Improve tab completion for ALTER FUNCTION/PROCEDURE/ROUTINE
Previous Message Bharath Rupireddy 2022-11-22 05:43:22 Re: Proposal: Allow user with pg_monitor role to call pg_stat_reset* functions