Re: relhassubclass and partitioned indexes

2018-10-18 Thread Tom Lane
Amit Langote writes: > Should relhassubclass be set/reset for partitioned indexes? Seems like a reasonable idea to me, at least the "set" end of it. We don't ever clear relhassubclass for tables, so maybe that's not necessary for indexes either. > Michael suggested on the linked thread to get

Re: Postgres, fsync, and OSs (specifically linux)

2018-10-18 Thread Craig Ringer
On Fri, 19 Oct 2018 at 07:27, Thomas Munro wrote: > > 2. I am +1 on back-patching Craig's PANIC-on-failure logic. Doing > nothing is not an option I like. I have some feedback and changes to > propose though; see attached. > Thanks very much for the work on reviewing and revising this. > I

relhassubclass and partitioned indexes

2018-10-18 Thread Amit Langote
Hi, $subject came up in [1]. Should relhassubclass be set/reset for partitioned indexes? The only use case being sought here is to use find_inheritance_children() for getting an index's partitions, but it uses relhassublcass test to short-circuit scanning pg_inherits. That means it cannot be

Re: partition tree inspection functions

2018-10-18 Thread Amit Langote
On 2018/10/10 13:01, Michael Paquier wrote: > On Wed, Oct 10, 2018 at 11:54:48AM +0900, Amit Langote wrote: >> I was partly wrong in saying that we wouldn't need any changes to support >> partitioned indexes here. Actually, the core function >> find_inheritance_children wouldn't scan pg_inherits

Re: DSM segment handle generation in background workers

2018-10-18 Thread Thomas Munro
On Sat, Oct 13, 2018 at 11:45 PM Thomas Munro wrote: > On Thu, Oct 11, 2018 at 5:51 PM Tom Lane wrote: > > The comment adjacent to the change in InitStandaloneProcess bothers me. > > In particular, it points out that what BackendRun() is currently doing > > creates more entropy in the process's

Re: lowering pg_regress privileges on Windows

2018-10-18 Thread Thomas Munro
On Fri, Oct 19, 2018 at 1:13 PM Michael Paquier wrote: > On Thu, Oct 18, 2018 at 08:31:11AM -0400, Andrew Dunstan wrote: > > The attached ridiculously tiny patch solves the problem whereby while we can > > run Postgres on Windows safely from an Administrator account, we can't run > > run the

Re: lowering pg_regress privileges on Windows

2018-10-18 Thread Michael Paquier
On Thu, Oct 18, 2018 at 08:31:11AM -0400, Andrew Dunstan wrote: > The attached ridiculously tiny patch solves the problem whereby while we can > run Postgres on Windows safely from an Administrator account, we can't run > run the regression tests from the same account, since it fails on the >

Re: Function to promote standby servers

2018-10-18 Thread Michael Paquier
On Mon, Oct 15, 2018 at 04:16:02PM +0200, Laurenz Albe wrote: > Michael Paquier wrote: >> Let's remove this restriction at code level, and instead use >> function-level ACLs so as it is possible to allow non-superusers to >> trigger a promotion as well, say a dedicated role. We could add a >>

Re: Function to promote standby servers

2018-10-18 Thread Michael Paquier
On Tue, Oct 16, 2018 at 09:49:20AM +0200, Laurenz Albe wrote: > Only for hot standby - how do you want to execute a function on a standby > server that doesn't allow connections? In most deployments hot standby will be enabled, and wal_level uses the same value for archive and hot_standby for

Re: file cloning in pg_upgrade and CREATE DATABASE

2018-10-18 Thread Michael Paquier
On Thu, Oct 18, 2018 at 11:59:00PM +0200, Peter Eisentraut wrote: > New patch that removes all the various reflink modes and adds a new > option --clone that works similar to --link. I think it's much cleaner now. Thanks Peter for the new version. + + {"clone", no_argument, NULL,

Re: Postgres, fsync, and OSs (specifically linux)

2018-10-18 Thread Thomas Munro
Hello hackers, Let's try to get this issue resolved. Here is my position on the course of action we should take in back-branches: 1. I am -1 on back-patching the fd-transfer code. It's a significant change, and even when sufficiently debugged (I don't think it's there yet), we have no idea

Re: file cloning in pg_upgrade and CREATE DATABASE

2018-10-18 Thread Peter Eisentraut
On 11/10/2018 16:50, Peter Eisentraut wrote: > On 10/10/2018 21:50, Bruce Momjian wrote: >>> I see. Peter is proposing to have a fourth mode, essentially >>> --transfer-mode=clone-or-copy. >> >> Uh, if you use --link, and the two data directories are on different >> file systems, it fails. No

Re: Making all nbtree entries unique by having heap TIDs participate in comparisons

2018-10-18 Thread Peter Geoghegan
On Thu, Oct 18, 2018 at 1:44 PM Andres Freund wrote: > What kind of backend_flush_after values where you trying? > backend_flush_after=0 obviously is the default, so I'm not clear on > that. How large is the database here, and how high is shared_buffers I *was* trying

Re: Making all nbtree entries unique by having heap TIDs participate in comparisons

2018-10-18 Thread Peter Geoghegan
Shared_buffers is 10gb iirc. The server has 32gb of memory. Yes, 'public' is the patch case. Sorry for not mentioning it initially. -- Peter Geoghegan (Sent from my phone)

Re: Making all nbtree entries unique by having heap TIDs participate in comparisons

2018-10-18 Thread Andres Freund
Hi, On 2018-10-18 12:54:27 -0700, Peter Geoghegan wrote: > I can show a nice improvement in latency on a slightly-rate-limited > TPC-C workload when backend_flush_after=0 (something like a 40% > reduction on average), but that doesn't hold up when oltpbench isn't > rate-limited and/or has

Re: Large writable variables

2018-10-18 Thread Andres Freund
On 2018-10-18 22:17:55 +0200, Peter Eisentraut wrote: > I'd perhaps change the signature > > #define unconstify(underlying_type, var) > > because the "var" doesn't actually have to be a variable. Hm, so expr, or what would you use? > Attached is my previous patch adapted to your macro. > >

Re: Large writable variables

2018-10-18 Thread Andres Freund
On 2018-10-18 22:20:29 +0200, Peter Eisentraut wrote: > On 18/10/2018 22:17, Peter Eisentraut wrote: > > On 17/10/2018 23:51, Andres Freund wrote: > >>> __builtin_types_compatible_p(const char *, char *) returns false (0) for > >>> me. > >> > >> Right, that's why I added a const, inside the

Re: Large writable variables

2018-10-18 Thread Peter Eisentraut
On 18/10/2018 22:17, Peter Eisentraut wrote: > On 17/10/2018 23:51, Andres Freund wrote: >>> __builtin_types_compatible_p(const char *, char *) returns false (0) for me. >> >> Right, that's why I added a const, inside the macro, to the type >> specified in the unconstify argument. So typeof()

Re: Large writable variables

2018-10-18 Thread Peter Eisentraut
On 17/10/2018 23:51, Andres Freund wrote: >> __builtin_types_compatible_p(const char *, char *) returns false (0) for me. > > Right, that's why I added a const, inside the macro, to the type > specified in the unconstify argument. So typeof() yields a const char *, > and the return type is

removing unnecessary get_att*() lsyscache functions

2018-10-18 Thread Peter Eisentraut
I noticed that get_attidentity() isn't really necessary because the information can be obtained from an existing tuple descriptor in each case. Also, get_atttypmod() hasn't been used since 2004. I propose the attached patches to remove these two functions. -- Peter Eisentraut

Re: Making all nbtree entries unique by having heap TIDs participate in comparisons

2018-10-18 Thread Peter Geoghegan
On Wed, Oct 3, 2018 at 4:39 PM Peter Geoghegan wrote: > I did find a pretty clear regression, though only with writes to > unique indexes. Attached is v6, which fixes the issue. More on that > below. I've been benchmarking my patch using oltpbench's TPC-C benchmark these past few weeks, which

Re: Implementation of Flashback Query

2018-10-18 Thread Yang Jie
Hello,I'll take a look at some of the features that zheap undo, is considering for flashback based on undo.Flashback Drop is more complex and, at the moment, doesn't do anything about it. Yang

Re: PG vs macOS Mojave

2018-10-18 Thread Tom Lane
I wrote: > Jakob Egger writes: >> I would assume that clang sets -isysroot automatically, but I have no idea >> why that didn't work for you previously. > [ experiments further ... ] It looks like clang does default to assuming > -isysroot with the correct sysroot for its Xcode version. The

Possibly redundant context switch in postgres_fdw

2018-10-18 Thread Ildar Musin
Hi hackers, ISTM that context switch in `create_cursor()`: if (numParams > 0) { MemoryContext oldcontext; oldcontext = MemoryContextSwitchTo(econtext->ecxt_per_tuple_memory); process_query_params(econtext, fsstate->param_flinfo, fsstate->param_exprs, values); MemoryContextSwitchTo(oldcontext); }

Re: Removing unneeded self joins

2018-10-18 Thread Alexander Kuzmenkov
Here is a version that compiles. -- Alexander Kuzmenkov Postgres Professional: http://www.postgrespro.com The Russian Postgres Company diff --git a/src/backend/nodes/equalfuncs.c b/src/backend/nodes/equalfuncs.c index 3bb91c9..62d46a1 100644 --- a/src/backend/nodes/equalfuncs.c +++

lowering pg_regress privileges on Windows

2018-10-18 Thread Andrew Dunstan
From the "scratch a long running itch" department. The attached ridiculously tiny patch solves the problem whereby while we can run Postgres on Windows safely from an Administrator account, we can't run run the regression tests from the same account, since it fails on the tablespace test,

Re: DSM robustness failure (was Re: Peripatus/failures)

2018-10-18 Thread Thomas Munro
On Thu, Oct 18, 2018 at 5:00 PM Amit Kapila wrote: > The below code seems to be problemetic: > dsm_cleanup_using_control_segment() > { > .. > if (!dsm_control_segment_sane(old_control, mapped_size)) > { > dsm_impl_op(DSM_OP_DETACH, old_control_handle, 0, _private, > _address, _size, LOG); > .. >

Re: DSM robustness failure (was Re: Peripatus/failures)

2018-10-18 Thread Thomas Munro
On Thu, Oct 18, 2018 at 6:02 PM Larry Rosenman wrote: > Let me know soon(ish) if any of you want to poke at this machine, as I'm > likely to forget and reboot it. Hi Larry, Thanks for the offer but it looks like there is no way to get our hands on that memory for forensics now. I'll see if

Re: Checkpoint start logging is done inside critical section

2018-10-18 Thread Ants Aasma
On Thu, Oct 18, 2018 at 9:02 AM Amit Kapila wrote: > > On Thu, Oct 18, 2018 at 10:27 AM Andres Freund wrote: > > (that's why we mark the ctx as being ok with that). > > > > Yeah, as the palloc for log message would be called in an ErrorContext > where it is safe to do the allocation, so ideally

Re: PG vs macOS Mojave

2018-10-18 Thread Tom Lane
Jakob Egger writes: > Am 17.10.2018 um 16:28 schrieb Tom Lane : >> It's also very odd, >> if the compiler will search the sysroot automatically, why that seemingly >> works for tcl.h but not perl.h. plperl definitely still fails if you >> lobotomize the PG_SYSROOT logic. > Because pl/tcl ends

Re: Checkpoint start logging is done inside critical section

2018-10-18 Thread Amit Kapila
On Thu, Oct 18, 2018 at 10:27 AM Andres Freund wrote: > > Hi, > > On 2018-10-18 10:21:39 +0530, Amit Kapila wrote: > > On Thu, Oct 18, 2018 at 4:44 AM Ants Aasma wrote: > > > > > > The LogCheckpointStart() call inside CreateCheckPoint() is done while > > > inside a critical section. The elog