Re: Segfault on ANALYZE in SERIALIZABLE isolation

2019-05-19 Thread Andres Freund
Hi, On 2019-05-18 18:12:31 +0300, Sergei Kornilov wrote: > Seems table_beginscan_analyze (src/include/access/tableam.h) should not pass > second argument as NULL. As hopefully explained downthread, and in the commit message, that's not really the concern. We shouldn't use the snapshot in the fir

Re: Segfault on ANALYZE in SERIALIZABLE isolation

2019-05-19 Thread Andres Freund
Hi, Thanks for the report Joe! I've pushed a fix for this. I ended up going down the path of making scan_begin's arguments a bitmask. Given that several people expressed desire for that, and that recognizing analyze scans would have required a new argument, that seemed the most reasonable course

Re: Segfault on ANALYZE in SERIALIZABLE isolation

2019-05-18 Thread Andres Freund
Hi, On 2019-05-18 15:48:47 -0400, Tom Lane wrote: > Andres Freund writes: > > Not quite - that was about the DML callbacks, this is about the scan > > itself. And while we have a snapshot allocated, the analyze version of the > > beginscan intentionally doesn't take a snapshot. > > Uh, what?

Re: Segfault on ANALYZE in SERIALIZABLE isolation

2019-05-18 Thread Tom Lane
Andres Freund writes: > Not quite - that was about the DML callbacks, this is about the scan itself. > And while we have a snapshot allocated, the analyze version of the beginscan > intentionally doesn't take a snapshot. Uh, what? That's a *huge* regression. See, eg, 7170268ef. We really wan

Re: Segfault on ANALYZE in SERIALIZABLE isolation

2019-05-18 Thread Andres Freund
Hi, On May 18, 2019 11:55:01 AM PDT, Tom Lane wrote: >I wrote: >> Sergei Kornilov writes: >>> I can reproduce with: >>> set default_transaction_isolation TO serializable ; >>> analyze ; > >> So the problem is that something is passing a null snapshot to >something >> that isn't expecting that.

Re: Segfault on ANALYZE in SERIALIZABLE isolation

2019-05-18 Thread Tom Lane
I wrote: > Sergei Kornilov writes: >> I can reproduce with: >> set default_transaction_isolation TO serializable ; >> analyze ; > So the problem is that something is passing a null snapshot to something > that isn't expecting that. This seems closely related to the tableam > API issue that was b

Re: Segfault on ANALYZE in SERIALIZABLE isolation

2019-05-18 Thread Tom Lane
Sergei Kornilov writes: > I can reproduce with: > set default_transaction_isolation TO serializable ; > analyze ; > Here is backtrace: > #0 SerializationNeededForRead (snapshot=0x0, relation=0x7f53e9a525f8) at > predicate.c:530 > #1 PredicateLockRelation (relation=relation@entry=0x7f53e9a525

Re: Segfault on ANALYZE in SERIALIZABLE isolation

2019-05-18 Thread Sergei Kornilov
Hello Seems table_beginscan_analyze (src/include/access/tableam.h) should not pass second argument as NULL. CC'ing Andres Freund PS: also I noticed in src/include/utils/snapshot.h exactly same comment for both SNAPSHOT_SELF and SNAPSHOT_DIRTY - they have no difference? regards, Sergei

Re: Segfault on ANALYZE in SERIALIZABLE isolation

2019-05-18 Thread Sergei Kornilov
Hi I can reproduce with: set default_transaction_isolation TO serializable ; analyze ; Here is backtrace: #0 SerializationNeededForRead (snapshot=0x0, relation=0x7f53e9a525f8) at predicate.c:530 #1 PredicateLockRelation (relation=relation@entry=0x7f53e9a525f8, snapshot=snapshot@entry=0x0) a

Segfault on ANALYZE in SERIALIZABLE isolation

2019-05-18 Thread Joe Wildish
Hackers, Head of master is giving me a segfault on running ANALYZE when isolation mode is SERIALIZABLE. My configure: export CFLAGS="-g" export LDFLAGS="-L/usr/local/opt/readline/lib" export CPPFLAGS="-I/usr/local/opt/readline/include" ./configure \ --prefix=/Users/joe/Development/tmp/pg \