Re: Commit Timestamp and LSN Inversion issue

Поиск
Список
Период
Сортировка
От Jan Wieck
Тема Re: Commit Timestamp and LSN Inversion issue
Дата
Msg-id 296b2c56-c688-41a0-a752-b242268691fd@wi3ck.info
обсуждение исходный текст
Ответ на Re: Commit Timestamp and LSN Inversion issue  (Andres Freund <andres@anarazel.de>)
Ответы Re: Commit Timestamp and LSN Inversion issue
Список pgsql-hackers
Hello,

On 11/12/24 08:55, Andres Freund wrote:
> Hi,
> 
> On 2024-11-12 08:51:49 -0500, Jan Wieck wrote:
>> On 11/11/24 23:21, Amit Kapila wrote:
>> > As the inversion issue can mainly hamper logical replication-based
>> > solutions we can do any of this additional work under spinlock only
>> > when the current record is a commit record (which the currently
>> > proposed patch is already doing) and "wal_level = logical" and also
>> > can have another option at the subscription level to enable this new
>> > code path. I am not sure what is best but just sharing the ideas here.
>>
>> It can indeed be reduced to one extra *unlikely* if test only for commit
>> records and only when WAL level is "logical". Without those two being true
>> there would be zero impact on ReserveXLogInsertLocation().
> 
> No, the impact would be far larger, because it would make it impractical to
> remove this bottleneck by using atomic instructions in
> ReserveXLogInsertLocation(). It doesn't make sense to make it harder to
> resolve one of the core central bottlenecks in postgres for a niche feature
> like this. Sorry, but this is just not a viable path.


The current section of code covered by the spinlock performs the 
following operations:

     - read CurrBytePos (shmem)
     - read PrevBytePos (shmem)
     - store CurrBytePos in PrevBytePos
     - increment CurrBytePos by size

In addition there is ReserveXLogSwitch() that is far more complex and is 
guarded by the same spinlock because both functions manipulate the same 
shared memory variables. With that in mind, how viable is the proposal 
to replace these code sections in both functions with atomic operations?


Best Regards, Jan





В списке pgsql-hackers по дате отправления: