Re: Adding REPACK [concurrently] - Mailing list pgsql-hackers

From Mihail Nikalayeu
Subject Re: Adding REPACK [concurrently]
Date
Msg-id CADzfLwUVQw+XLwurjHYBHuNdDw3mBUUM7fXxaruMt25YB6xbyQ@mail.gmail.com
Whole thread Raw
In response to Re: Adding REPACK [concurrently]  (Mihail Nikalayeu <mihailnikalayeu@gmail.com>)
List pgsql-hackers
> > I'm not sure it's acceptable to cause other sessions to raise errors if
> >  they query the table being repacked (or a table repacked recently).
> >  That sounds extremely unpleasant.  Imagine a long-running transactions
> >  that runs enormous queries for many hours or even days, being killed
> >  near the end because some DBA decided to run REPACK on a table.

> It will not. It raises an error only for the case table will be "empty" because REPACK switched to new with all tuples with REPACK xid and our transaction treats that xid as running.

> So, there is no regression here, it just changes from "see an empty table because of MVCC violation" to "get error"  in the exact situation.
> I prefer the second.

But I agree that a MVCC-safe solution is better. But to receive the error you need to be really unlucky (subtle race - in *first* access to a repacked table in transaction you need to get a statement snapshot in the moment of table swap) or use non READ-COMMITED isolation method.

So, we prevent silent READ of MVCC-violated data - I think it is enough, at least for start.

Mikhail.

pgsql-hackers by date:

Previous
From: shveta malik
Date:
Subject: Re: Improve pg_sync_replication_slots() to wait for primary to advance
Next
From: Mihail Nikalayeu
Date:
Subject: Re: Adding REPACK [concurrently]