Re: [HACKERS] Segfault while using an array domain

2015-11-29 Thread Tom Lane
Emre Hasegeli writes: > [ SQL function in a domain constraint doesn't work ] Hm, looks like I broke this in 8abb3cda0. Should have learned by now that long-lived caching of ExprState trees is dangerous. The proximate cause of the problem is that execQual.c is executing an

[HACKERS] Making the C collation less inclined to abort abbreviation

2015-11-29 Thread Peter Geoghegan
The C collation is treated exactly the same as other collations when considering whether the generation of abbreviated keys for text should continue. This doesn't make much sense. With text, the big cost that we are concerned about going to waste should abbreviated keys not capture sufficient

Re: [HACKERS] silent data loss with ext4 / all current versions

2015-11-29 Thread Tomas Vondra
On 11/29/2015 03:33 PM, Tomas Vondra wrote: Hi, On 11/29/2015 02:38 PM, Craig Ringer wrote: I've had a few tries at implementing a qemu-based crashtester where it hard kills the qemu instance at a random point then starts it back up. I've tried to reproduce the issue by killing a qemu VM,

Re: [HACKERS] WIP: Make timestamptz_out less slow.

2015-11-29 Thread David Rowley
On 29 November 2015 at 14:00, Peter Geoghegan wrote: > On Sun, Nov 22, 2015 at 2:20 AM, David Rowley > wrote: > > Just to confirm, you mean this comment? > > > > int tm_year; /* relative to 1900 */ > > > > Please let me know if you disagree, but

Re: [HACKERS] Re: In-core regression tests for replication, cascading, archiving, PITR, etc.

2015-11-29 Thread Andrew Dunstan
On 11/29/2015 04:28 PM, Noah Misch wrote: +BEGIN +{ + $windows_os = $Config{osname} eq 'MSWin32' || $Config{osname} eq 'msys'; + + # Determine output directories, and create them. The base path is the + # TESTDIR environment variable, which is normally set by the invoking +

Re: [HACKERS] Re: In-core regression tests for replication, cascading, archiving, PITR, etc.

2015-11-29 Thread Noah Misch
On Fri, Nov 27, 2015 at 07:53:10PM -0300, Alvaro Herrera wrote: > Michael Paquier wrote: > > The result of a couple of hours of hacking is attached: > > - 0001 is the refactoring adding PostgresNode and RecursiveCopy. I have > > also found that it is quite advantageous to move some of the routines

[HACKERS] Segfault while using an array domain

2015-11-29 Thread Emre Hasegeli
I was getting segfaults while working on the current master for a while. This is the shortest way I could found to reproduce the problem: create or replace function is_distinct_from(anyelement, anyelement) returns boolean language sql as 'select $1 is distinct from $2'; create operator !== (

Re: [HACKERS] silent data loss with ext4 / all current versions

2015-11-29 Thread Tomas Vondra
Hi, On 11/29/2015 02:38 PM, Craig Ringer wrote: On 27 November 2015 at 21:28, Greg Stark > wrote: On Fri, Nov 27, 2015 at 11:17 AM, Tomas Vondra > wrote: > I plan to do more

Re: [HACKERS] silent data loss with ext4 / all current versions

2015-11-29 Thread Tomas Vondra
On 11/29/2015 02:41 PM, Craig Ringer wrote: On 27 November 2015 at 19:17, Tomas Vondra > wrote: It's also possible to mitigate this by setting wal_sync_method=fsync Are you sure? https://lwn.net/Articles/322823/ tends

Re: [HACKERS] Using quicksort for every external sort run

2015-11-29 Thread Peter Geoghegan
On Sat, Nov 28, 2015 at 4:05 PM, Peter Geoghegan wrote: > So there was 27.76 seconds spent copying tuples into local memory > ahead of the quicksort, 2 minutes 56.68 seconds spent actually > quicksorting, and a trifling 10.32 seconds actually writing the run! I > bet that the

Re: [HACKERS] proposal: PL/Pythonu - function ereport

2015-11-29 Thread Pavel Stehule
Hi 2015-11-16 23:40 GMT+01:00 Peter Eisentraut : > On 11/15/15 11:29 PM, Pavel Stehule wrote: > > > > > > 2015-11-16 5:20 GMT+01:00 Peter Eisentraut > >: > > > > I don't think it's right to reuse SPIError for this. SPIError is > >

Re: [HACKERS] Using quicksort for every external sort run

2015-11-29 Thread Peter Geoghegan
On Sun, Nov 29, 2015 at 2:01 AM, Peter Geoghegan wrote: > I think that at least the first several > hundred leading attribute tuples are duplicates. I mean duplicate abbreviated keys. There are 40 distinct keys overall in the first 160 tuples, which is why abbreviation is

Re: [HACKERS] proposal: PL/Pythonu - function ereport

2015-11-29 Thread Michael Paquier
On Sun, Nov 29, 2015 at 4:00 PM, Pavel Stehule wrote: > 2015-11-28 13:11 GMT+01:00 Michael Paquier : > >> On Sat, Nov 28, 2015 at 1:57 AM, Pavel Stehule >> wrote: >> > >> > >> > 2015-11-27 17:54 GMT+01:00 Teodor Sigaev

Re: [HACKERS] silent data loss with ext4 / all current versions

2015-11-29 Thread Michael Paquier
On Sat, Nov 28, 2015 at 3:01 AM, Tomas Vondra wrote: > > > On 11/27/2015 02:18 PM, Michael Paquier wrote: >> >> On Fri, Nov 27, 2015 at 8:17 PM, Tomas Vondra >> wrote: >>> >>> So, what's going on? The problem is that while the rename()

Re: [HACKERS] proposal: PL/Pythonu - function ereport

2015-11-29 Thread Pavel Stehule
2015-11-29 13:42 GMT+01:00 Michael Paquier : > > > On Sun, Nov 29, 2015 at 4:00 PM, Pavel Stehule > wrote: > >> 2015-11-28 13:11 GMT+01:00 Michael Paquier : >> >>> On Sat, Nov 28, 2015 at 1:57 AM, Pavel Stehule

Re: [HACKERS] silent data loss with ext4 / all current versions

2015-11-29 Thread Craig Ringer
On 27 November 2015 at 21:28, Greg Stark wrote: > On Fri, Nov 27, 2015 at 11:17 AM, Tomas Vondra > wrote: > > I plan to do more power failure testing soon, with more complex test > > scenarios. I suspect there might be other similar issues (e.g. when

Re: [HACKERS] silent data loss with ext4 / all current versions

2015-11-29 Thread Craig Ringer
On 27 November 2015 at 19:17, Tomas Vondra wrote: > It's also possible to mitigate this by setting wal_sync_method=fsync Are you sure? https://lwn.net/Articles/322823/ tends to suggest that fsync() on the file is insufficient to ensure rename() is persistent,

Re: [HACKERS] How to add and use a static library within Postgres backend

2015-11-29 Thread Craig Ringer
On 27 November 2015 at 10:35, XiaoChuan Yu wrote: > I'm doing some experimenting with the storage engine and I'd like to use a > C++ static library (that has C headers). I only need this to build on > Ubuntu 64-bit for now. > How do I make postgres build with this library? >

Re: [HACKERS] Speed up Clog Access by increasing CLOG buffers

2015-11-29 Thread Amit Kapila
On Sun, Nov 29, 2015 at 1:47 AM, Jeff Janes wrote: > > On Thu, Nov 26, 2015 at 11:32 PM, Amit Kapila wrote: > > On Tue, Nov 17, 2015 at 6:30 PM, Simon Riggs wrote: > >> > >> On 17 November 2015 at 11:48, Amit Kapila

Re: [HACKERS] Re: In-core regression tests for replication, cascading, archiving, PITR, etc.

2015-11-29 Thread Michael Paquier
On Sun, Nov 29, 2015 at 12:13 AM, Alvaro Herrera wrote: > Here's your recovery test patch rebased, for your (and others'!) > perusal. It passes for me. (Test 003 is unchanged.) Are you planning to push that as well? It does not have much coverage but I guess that's quite good for a first shot,

Re: [HACKERS] Issue on C function that reads int2[] (using "int2vector")

2015-11-29 Thread Tom Lane
Rodrigo Hjort writes: > I created a custom C function with this signature: > CREATE FUNCTION calculate_hash(numbers int2[]) > RETURNS int8 > AS 'MODULE_PATHNAME', 'pg_calculate_hash' > LANGUAGE C > IMMUTABLE STRICT; > And here is the function source code (inspired in

Re: [HACKERS] Using quicksort for every external sort run

2015-11-29 Thread David Fetter
On Sat, Nov 28, 2015 at 02:04:16PM -0800, Jeff Janes wrote: > On Wed, Nov 18, 2015 at 3:29 PM, Peter Geoghegan wrote: > > On Wed, Nov 18, 2015 at 10:31 AM, Jeff Janes wrote: > > > >> I agree we don't want to optimize for low memory, but I don't think we >

Re: [HACKERS] Memory prefetching while sequentially fetching from SortTuple array, tuplestore

2015-11-29 Thread Peter Geoghegan
On Sun, Nov 29, 2015 at 8:52 PM, David Rowley wrote: > You're right, gcc did not include the prefetch instructions. > I've tested again on the same machine but with clang 3.7 instead of gcc > 4.8.3 Thanks for going to the trouble of investigating this. These

Re: [HACKERS] Erroneous cost estimation for nested loop join

2015-11-29 Thread KAWAMICHI Ryoji
Robert Haas wrote: > > - If we're sequential scanning a small table, let's say less than 1/4 > of shared_buffers, which is the point where synchronized scans kick > in, then assume the data is coming from shared_buffers. > - If we're scanning a medium-sized table, let's

Re: [HACKERS] Re: In-core regression tests for replication, cascading, archiving, PITR, etc.

2015-11-29 Thread Michael Paquier
On Mon, Nov 30, 2015 at 6:28 AM, Noah Misch wrote: > > On Fri, Nov 27, 2015 at 07:53:10PM -0300, Alvaro Herrera wrote: > > Michael Paquier wrote: > > > The result of a couple of hours of hacking is attached: > > > - 0001 is the refactoring adding PostgresNode and RecursiveCopy.

[HACKERS] Issue on C function that reads int2[] (using "int2vector")

2015-11-29 Thread Rodrigo Hjort
Hello PG Hackers, I created a custom C function with this signature: CREATE FUNCTION calculate_hash(numbers int2[]) RETURNS int8 AS 'MODULE_PATHNAME', 'pg_calculate_hash' LANGUAGE C IMMUTABLE STRICT; And here is the function source code (inspired in codes I found in