Standby reads fail when autovacuum take AEL during truncation

Started by Adrien NAYRATover 7 years ago3 messages
#1Adrien NAYRAT
adrien.nayrat@anayrat.info

Hello hackers,

I was faced on $SUBJECT on an heavily updated table and the same table
heavily accessed on standby server.

I notice autovacuum try to take an AEL in lazy_truncate_heap(). On
primary we try during VACUUM_TRUNCATE_LOCK_WAIT_INTERVAL (50ms) and we
failed after several attempts.

But we do not have this mechanism on a standby, AEL could lock simple
SELECT during the RelationTruncate().

Please note, this can occurs even with hot_standby_feedback = on

I wonder how we can improve this? Maybe by introducing an option to
disable truncation for autovacuum on specific table?

Thanks!

#2Alexander Korotkov
a.korotkov@postgrespro.ru
In reply to: Adrien NAYRAT (#1)
Re: Standby reads fail when autovacuum take AEL during truncation

Hi!

On Fri, Sep 7, 2018 at 3:17 PM Adrien NAYRAT <adrien.nayrat@anayrat.info> wrote:

I was faced on $SUBJECT on an heavily updated table and the same table
heavily accessed on standby server.

I notice autovacuum try to take an AEL in lazy_truncate_heap(). On
primary we try during VACUUM_TRUNCATE_LOCK_WAIT_INTERVAL (50ms) and we
failed after several attempts.

But we do not have this mechanism on a standby, AEL could lock simple
SELECT during the RelationTruncate().

Please note, this can occurs even with hot_standby_feedback = on

I wonder how we can improve this? Maybe by introducing an option to
disable truncation for autovacuum on specific table?

Please, take a look at following threads:
1. /messages/by-id/c9374921e50a5e8fb1ecf04eb8c6ebc3@postgrespro.ru
2. /messages/by-id/CAHGQGwE5UqFqSq1=kV3QtTUtXphTdyHA-8rAj4A=Y+e4kyp3BQ@mail.gmail.com

------
Alexander Korotkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

#3Adrien NAYRAT
adrien.nayrat@anayrat.info
In reply to: Alexander Korotkov (#2)
Re: Standby reads fail when autovacuum take AEL during truncation

On 9/7/18 7:36 PM, Alexander Korotkov wrote:

Please, take a look at following threads:
1./messages/by-id/c9374921e50a5e8fb1ecf04eb8c6ebc3@postgrespro.ru
2./messages/by-id/CAHGQGwE5UqFqSq1=kV3QtTUtXphTdyHA-8rAj4A=Y+e4kyp3BQ@mail.gmail.com

Thanks, I will to these threads.