Re: Issue in GIN fast-insert: XLogBeginInsert + Read/LockBuffer ordering

From: Zhang Mingli <zmlpostgres(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>
Subject: Re: Issue in GIN fast-insert: XLogBeginInsert + Read/LockBuffer ordering
Date: 2022-09-30 10:22:02
Message-ID: 541bfe57-89c0-4f35-8059-b25188a99dd3@Spark
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On Sep 8, 2022, 19:08 +0800, Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>, wrote:
>
> PFA a patch that rectifies this issue, by moving the XLogBeginInsert()
> down to where 1.) we have all relevant buffers pinned and locked, and
> 2.) we're in a critical section, making that part of the code
> consistent with the general scheme for XLog insertion.
>
In the same function, there is disorder of XLogBeginInsert and START_CRIT_SECTION.

```
collectordata = ptr = (char *) palloc(collector->sumsize);

 data.ntuples = collector->ntuples;

 if (needWal)
   XLogBeginInsert();

 START_CRIT_SECTION();
```

Shall we adjust that too?

Regards,
Zhang Mingli

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2022-09-30 10:59:55 Re: Fix some newly modified tab-complete changes
Previous Message Dilip Kumar 2022-09-30 10:06:11 Re: problems with making relfilenodes 56-bits