[MASSMAIL] Remove unnecessary segment number calculation after wal_removed invalidation of replication slots

Поиск
Список
Период
Сортировка
От Bharath Rupireddy
Тема [MASSMAIL] Remove unnecessary segment number calculation after wal_removed invalidation of replication slots
Дата
Msg-id CALj2ACU_m+QWH4nCdin0Z4aytG50CJPP-bcpqjj3tP63wiYtiQ@mail.gmail.com
обсуждение исходный текст
Список pgsql-hackers
Hi,

It looks like there's an unnecessary segment number calculation after
InvalidateObsoleteReplicationSlots in CreateCheckPoint and
CreateRestartPoint. Since none of RedoRecPtr, _logSegNo and
wal_segment_size are changed by the slot invalidation code [1], the
recalculation of
_logSegNo with XLByteToSeg seems unnecessary.

I've attached a patch to fix this.

[1] Assertions like the following won't fail with make check-world
proving InvalidateObsoleteReplicationSlots doesn't change them at all.

        XLByteToSeg(RedoRecPtr, _logSegNo, wal_segment_size);
        KeepLogSeg(recptr, &_logSegNo);
+       _logSegNo_saved = _logSegNo;
+       RedoRecPtr_saved = RedoRecPtr;
        if (InvalidateObsoleteReplicationSlots(RS_INVAL_WAL_REMOVED,

            _logSegNo, InvalidOid,

            InvalidTransactionId))
        {
+               Assert(_logSegNo_saved == _logSegNo);
+               Assert(RedoRecPtr_saved == RedoRecPtr);

--
Bharath Rupireddy
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com

Вложения

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

Предыдущее
От: Bharath Rupireddy
Дата:
Сообщение: [MASSMAIL]Add missing ConditionVariableCancelSleep() in slot.c
Следующее
От: Tomas Vondra
Дата:
Сообщение: Re: Parallel CREATE INDEX for BRIN indexes