Re: Issue in GIN fast-insert: XLogBeginInsert + Read/LockBuffer ordering - Mailing list pgsql-hackers

From Zhang Mingli
Subject Re: Issue in GIN fast-insert: XLogBeginInsert + Read/LockBuffer ordering
Date
Msg-id 541bfe57-89c0-4f35-8059-b25188a99dd3@Spark
Whole thread Raw
In response to Issue in GIN fast-insert: XLogBeginInsert + Read/LockBuffer ordering  (Matthias van de Meent <boekewurm+postgres@gmail.com>)
Responses Re: Issue in GIN fast-insert: XLogBeginInsert + Read/LockBuffer ordering
List pgsql-hackers
Hi,

On Sep 8, 2022, 19:08 +0800, Matthias van de Meent <boekewurm+postgres@gmail.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

pgsql-hackers by date:

Previous
From: Dilip Kumar
Date:
Subject: Re: problems with making relfilenodes 56-bits
Next
From: Alvaro Herrera
Date:
Subject: Re: Fix some newly modified tab-complete changes