Re: [HACKERS] brin index vacuum versus transaction snapshots

2015-08-05 Thread Alvaro Herrera
Alvaro Herrera wrote: > Here's the promised patch. Pushed to master and 9.5. Thanks for reporting! -- Álvaro Herrerahttp://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgre

Re: [HACKERS] brin index vacuum versus transaction snapshots

2015-08-04 Thread Alvaro Herrera
Alvaro Herrera wrote: > Thankfully I found > another way to solve it, which is to forgo usage of MVCC here and > instead use SnapshotAny. There's already a mode in > IndexBuildHeapRangeScan that uses SnapshotAny, but it needs some tweaks > to do what we need. I'm going to propose a patch along t

Re: [HACKERS] brin index vacuum versus transaction snapshots

2015-08-04 Thread Alvaro Herrera
Robert Haas wrote: > On Fri, Jul 31, 2015 at 3:45 PM, Alvaro Herrera > wrote: > > I think the only way to close this hole is to have summarize_range() > > sleep until all open snapshots are gone after inserting the placeholder > > tuple and before acquiring the snapshot, similarly to how CREATE I

Re: [HACKERS] brin index vacuum versus transaction snapshots

2015-08-04 Thread Robert Haas
On Fri, Jul 31, 2015 at 3:45 PM, Alvaro Herrera wrote: >> I think the real solution to this problem is to avoid use of >> GetTransactionSnapshot(), and instead use GetLatestSnapshot(). As far >> as I can see, that should completely close the hole. This requires >> patching IndexBuildHeapRangeSca

Re: [HACKERS] brin index vacuum versus transaction snapshots

2015-08-01 Thread Kevin Grittner
Alvaro Herrera wrote: > Untested patch attached. That fixes the installcheck failure on my machine. -- Kevin Grittner EDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription

Re: [HACKERS] brin index vacuum versus transaction snapshots

2015-07-31 Thread Alvaro Herrera
Kevin Grittner wrote: > Alvaro Herrera wrote: > > >> I think the real solution to this problem is to avoid use of > >> GetTransactionSnapshot(), and instead use GetLatestSnapshot(). As far > >> as I can see, that should completely close the hole. This requires > >> patching IndexBuildHeapRangeS

Re: [HACKERS] brin index vacuum versus transaction snapshots

2015-07-31 Thread Kevin Grittner
Alvaro Herrera wrote: >> I think the real solution to this problem is to avoid use of >> GetTransactionSnapshot(), and instead use GetLatestSnapshot(). As far >> as I can see, that should completely close the hole. This requires >> patching IndexBuildHeapRangeScan() to allow for that. > > Actua

Re: [HACKERS] brin index vacuum versus transaction snapshots

2015-07-31 Thread Alvaro Herrera
> I think the real solution to this problem is to avoid use of > GetTransactionSnapshot(), and instead use GetLatestSnapshot(). As far > as I can see, that should completely close the hole. This requires > patching IndexBuildHeapRangeScan() to allow for that. Actually I think there's another pro

Re: [HACKERS] brin index vacuum versus transaction snapshots

2015-07-31 Thread Alvaro Herrera
Let me explain a bit more what's the mechanism at play. When scanning a block range to summarize it, we use an MVCC snapshot. Any tuples that are inserted by transactions that appear as in-progress to that snapshot will not be seen by that range scan; therefore we need another mechanism to include

Re: [HACKERS] brin index vacuum versus transaction snapshots

2015-07-31 Thread Simon Riggs
On 31 July 2015 at 15:48, Kevin Grittner wrote: > > Reread the thread. I stand corrected. > The error is being hit on a VACUUM command > (which is not, of course in any explicit transaction). > Seems like VACUUM only ever needs a read-committed snapshot. Whether it takes a read-committed or

Re: [HACKERS] brin index vacuum versus transaction snapshots

2015-07-31 Thread Kevin Grittner
Simon Riggs wrote: > On 30 July 2015 at 22:24, Tom Lane wrote: >> Alvaro Herrera writes: >>> Kevin Grittner wrote: If you run `make installcheck` against a cluster with default_transaction_isolation = 'repeatable read' you get one failure: >>> >>> I am tempted to say that we shou

Re: [HACKERS] brin index vacuum versus transaction snapshots

2015-07-31 Thread Kevin Grittner
Alvaro Herrera wrote: > Kevin Grittner wrote: >> If you run `make installcheck` against a cluster with >> default_transaction_isolation = 'repeatable read' you get one >> failure: > > I am tempted to say that we should just disallow to run vacuum on > a table containing a brin index in a transact

Re: [HACKERS] brin index vacuum versus transaction snapshots

2015-07-31 Thread Simon Riggs
On 30 July 2015 at 22:24, Tom Lane wrote: > Alvaro Herrera writes: > > Kevin Grittner wrote: > >> If you run `make installcheck` against a cluster with > >> default_transaction_isolation = 'repeatable read' you get one > >> failure: > > > I am tempted to say that we should just disallow to run v

Re: [HACKERS] brin index vacuum versus transaction snapshots

2015-07-30 Thread Tom Lane
Alvaro Herrera writes: > Kevin Grittner wrote: >> If you run `make installcheck` against a cluster with >> default_transaction_isolation = 'repeatable read' you get one >> failure: > I am tempted to say that we should just disallow to run vacuum on a > table containing a brin index in a transacti

Re: [HACKERS] brin index vacuum versus transaction snapshots

2015-07-30 Thread Alvaro Herrera
Kevin Grittner wrote: > If you run `make installcheck` against a cluster with > default_transaction_isolation = 'repeatable read' you get one > failure: I am tempted to say that we should just disallow to run vacuum on a table containing a brin index in a transaction-snapshot transaction. It is po

Re: [HACKERS] brin index vacuum versus transaction snapshots

2015-07-22 Thread Alvaro Herrera
Kevin Grittner wrote: > If you run `make installcheck` against a cluster with > default_transaction_isolation = 'repeatable read' you get one > failure: So there's some code that's specifically intended to handle this case: /* * If

Re: [HACKERS] brin index vacuum versus transaction snapshots

2015-07-22 Thread Kevin Grittner
Jeff Janes wrote: > On Tue, Jul 21, 2015 at 3:10 PM, Kevin Grittner wrote: >> Kevin Grittner wrote: >> >>> If you run `make installcheck` against a cluster with >>> default_transaction_isolation = 'repeatable read' you get one >>> failure: >> >>> + ERROR: brin_summarize_new_values() cannot run i

Re: [HACKERS] brin index vacuum versus transaction snapshots

2015-07-21 Thread Jeff Janes
On Tue, Jul 21, 2015 at 3:10 PM, Kevin Grittner wrote: > Kevin Grittner wrote: > > > If you run `make installcheck` against a cluster with > > default_transaction_isolation = 'repeatable read' you get one > > failure: > > > + ERROR: brin_summarize_new_values() cannot run in a transaction that >

Re: [HACKERS] brin index vacuum versus transaction snapshots

2015-07-21 Thread Kevin Grittner
Kevin Grittner wrote: > If you run `make installcheck` against a cluster with > default_transaction_isolation = 'repeatable read' you get one > failure: > + ERROR: brin_summarize_new_values() cannot run in a transaction that has > already obtained a snapshot > This is using source at commit 9f

[HACKERS] brin index vacuum versus transaction snapshots

2015-07-21 Thread Kevin Grittner
If you run `make installcheck` against a cluster with default_transaction_isolation = 'repeatable read' you get one failure: *** /home/kgrittn/pg/master/src/test/regress/expected/brin.out 2015-07-21 10:21:58.798619111 -0500 --- /home/kgrittn/pg/master/src/test/regress/results/brin.out 2015-07-21