Re: [HACKERS] Optional message to user when terminating/cancelling backend

2017-06-21 Thread Daniel Gustafsson
> On 21 Jun 2017, at 16:30, Yugo Nagata wrote: > > On Wed, 21 Jun 2017 12:06:33 +0900 > Michael Paquier wrote: > >> On Tue, Jun 20, 2017 at 3:24 AM, Daniel Gustafsson wrote: >>> The message is stored in a new shmem area which is

Re: [HACKERS] Default Partition for Range

2017-06-21 Thread Robert Haas
On Wed, Jun 21, 2017 at 8:57 AM, Dilip Kumar wrote: > For the default partition we are only setting bound->content[0] to > default, but content for others key > attributes are not initialized. But later in the code, if the content > of the first key is RANGE_DATUM_DEFAULT

Re: [HACKERS] pg_bsd_indent 2.0 is available from git.postgresql.org

2017-06-21 Thread Andrew Dunstan
On 06/21/2017 08:20 AM, Andrew Dunstan wrote: > > On 06/20/2017 08:30 PM, Tom Lane wrote: >> Michael Paquier writes: >>> On Wed, Jun 21, 2017 at 8:43 AM, Tom Lane wrote: Yeah, I thought it would work fine with Makefile-using Windows

Re: [HACKERS] Useless code in ExecInitModifyTable

2017-06-21 Thread Tom Lane
Amit Langote writes: > On 2017/06/21 16:59, Etsuro Fujita wrote: >> but I noticed that that function doesn't use the relation descriptor at >> all. Since partitioned_rels is given in case of an UPDATE/DELETE on a >> partitioned table, the relation is opened in that

Re: [HACKERS] Optional message to user when terminating/cancelling backend

2017-06-21 Thread Yugo Nagata
On Wed, 21 Jun 2017 12:06:33 +0900 Michael Paquier wrote: > On Tue, Jun 20, 2017 at 3:24 AM, Daniel Gustafsson wrote: > > The message is stored in a new shmem area which is checked when the session > > is > > aborted. To keep things simple a small

Re: [HACKERS] Autovacuum launcher occurs error when cancelled by SIGINT

2017-06-21 Thread Dilip Kumar
On Wed, Jun 21, 2017 at 7:47 PM, Kuntal Ghosh wrote: >> IMHO, It's not a good idea to use DSM call to verify the DSA handle. >> > Okay. Is there any particular scenario you've in mind where this may fail? It's not about failure, but about the abstraction. When we are

Re: [HACKERS] Broken hint bits (freeze)

2017-06-21 Thread Amit Kapila
On Tue, Jun 20, 2017 at 7:24 PM, Amit Kapila wrote: > On Tue, Jun 20, 2017 at 7:05 PM, Sergey Burladyan wrote: >> Amit Kapila writes: >> >>> On Tue, Jun 20, 2017 at 3:40 PM, Sergey Burladyan >>> wrote:

Re: [HACKERS] Incorrect documentation about pg_stat_activity

2017-06-21 Thread Simon Riggs
On 21 June 2017 at 16:15, Yugo Nagata wrote: > On Wed, 21 Jun 2017 19:08:35 +0530 > Kuntal Ghosh wrote: > >> On Wed, Jun 21, 2017 at 6:05 PM, Yugo Nagata wrote: >> > >> > Attached is a patch for the documentation fix. >> > >>

Re: [HACKERS] Autovacuum launcher occurs error when cancelled by SIGINT

2017-06-21 Thread Kuntal Ghosh
On Wed, Jun 21, 2017 at 7:07 PM, Dilip Kumar wrote: > On Wed, Jun 21, 2017 at 6:50 PM, Kuntal Ghosh > wrote: >> I think we can just check dsm_find_mapping() to check whether the dsm >> handle is already attached. Something like, >> >> }

Re: [HACKERS] Incorrect documentation about pg_stat_activity

2017-06-21 Thread Yugo Nagata
On Wed, 21 Jun 2017 19:08:35 +0530 Kuntal Ghosh wrote: > On Wed, Jun 21, 2017 at 6:05 PM, Yugo Nagata wrote: > > > > Attached is a patch for the documentation fix. > > > Please attach the patch as well. :-) I'm sorry, I forgot it. I attahed

Re: [HACKERS] Logical replication in the same cluster

2017-06-21 Thread Albe Laurenz
Tom Lane wrote: > Petr Jelinek writes: >> On 26/04/17 18:59, Bruce Momjian wrote: >>> ... it just hangs. My server logs say: > >> Yes that's result of how logical replication slots work, the transaction >> that needs to finish is your transaction. It can be worked

Re: [HACKERS] Optional message to user when terminating/cancelling backend

2017-06-21 Thread Yugo Nagata
Hi, Here are some comments for the patch. +Datum +pg_cancel_backend(PG_FUNCTION_ARGS) +{ + PG_RETURN_BOOL(pg_cancel_backend_internal(PG_GETARG_INT32(0), NULL)); +} +Datum +pg_cancel_backend_msg(PG_FUNCTION_ARGS) +{ + pid_t pid = PG_GETARG_INT32(0); + char *msg =

Re: [HACKERS] Incorrect documentation about pg_stat_activity

2017-06-21 Thread Kuntal Ghosh
On Wed, Jun 21, 2017 at 6:05 PM, Yugo Nagata wrote: > > Attached is a patch for the documentation fix. > Please attach the patch as well. :-) -- Thanks & Regards, Kuntal Ghosh EnterpriseDB: http://www.enterprisedb.com -- Sent via pgsql-hackers mailing list

Re: [HACKERS] Autovacuum launcher occurs error when cancelled by SIGINT

2017-06-21 Thread Dilip Kumar
On Wed, Jun 21, 2017 at 6:50 PM, Kuntal Ghosh wrote: > I think we can just check dsm_find_mapping() to check whether the dsm > handle is already attached. Something like, > > } > - else > + else if(!dsm_find_mapping(AutoVacuumShmem->av_dsa_handle))

Re: [HACKERS] Autovacuum launcher occurs error when cancelled by SIGINT

2017-06-21 Thread Kuntal Ghosh
On Wed, Jun 21, 2017 at 5:45 PM, Yugo Nagata wrote: > Hi, > > As I report in another thread[1], I found the autovacuum launcher occurs > the following error in PG 10 when this received SIGINT. I can repuroduce > this by pg_cancel_backend or `kill -2 `. > > 2017-06-21

[HACKERS] Logical replication: stuck spinlock at ReplicationSlotRelease

2017-06-21 Thread Albe Laurenz
While playing with HEAD as of d14c85ed, I ran into the following: CREATE DATABASE source; CREATE DATABASE recipient; \c source CREATE TABLE repli(id integer PRIMARY KEY, val text NOT NULL); INSERT INTO repli VALUES (1, 'one'); CREATE PUBLICATION repsend FOR TABLE repli; SELECT

Re: [HACKERS] Default Partition for Range

2017-06-21 Thread Dilip Kumar
On Tue, Jun 20, 2017 at 6:57 PM, Dilip Kumar wrote: > This is basically crashing in RelationBuildPartitionDesc, so I think > we don't have any test case for testing DEFAULT range partition where > partition key has more than one attribute. So I suggest we can add > such

Re: [HACKERS] An attempt to reduce WALWriteLock contention

2017-06-21 Thread jasrajd
We are also seeing contention on the walwritelock and repeated writes to the same offset if we move the flush outside the lock in the Azure environment. pgbench doesn't scale beyond ~8 cores without saturating the IOPs or bandwidth. Is there more work being done in this area? -- View this

Re: [HACKERS] Adding support for Default partition in partitioning

2017-06-21 Thread Jeevan Ladhe
Thanks Ashutosh and Kyotaro for reviewing further. I shall address your comments in next version of my patch. Regards, Jeevan Ladhe On Fri, Jun 16, 2017 at 1:46 PM, Kyotaro HORIGUCHI < horiguchi.kyot...@lab.ntt.co.jp> wrote: > Hello, I'd like to review this but it doesn't fit the master, as >

Re: [HACKERS] Adding support for Default partition in partitioning

2017-06-21 Thread Jeevan Ladhe
Hi Amit, On Thu, Jun 15, 2017 at 12:31 PM, Amit Langote < langote_amit...@lab.ntt.co.jp> wrote: > Oops, I meant to send one more comment. > > On 2017/06/15 15:48, Amit Langote wrote: > > BTW, I noticed the following in 0002 > +errmsg("there exists a

[HACKERS] Incorrect documentation about pg_stat_activity

2017-06-21 Thread Yugo Nagata
Hi, In the documentation[1], there is the following description: "pg_stat_activity does not show an entry for the Startup process" However, the current pg_stat_activity show startup process's entry. postgres=# select pid, backend_type from pg_stat_activity ; pid | backend_type

Re: [HACKERS] Adding support for Default partition in partitioning

2017-06-21 Thread Jeevan Ladhe
Hi, Sorry for being away from here. I had some issues with my laptop, and I have resumed working on this. On Thu, Jun 15, 2017 at 1:21 AM, Robert Haas wrote: > On Wed, Jun 14, 2017 at 8:02 AM, Jeevan Ladhe > wrote: > > Here are the details

Re: [HACKERS] pg_bsd_indent 2.0 is available from git.postgresql.org

2017-06-21 Thread Andrew Dunstan
On 06/20/2017 08:30 PM, Tom Lane wrote: > Michael Paquier writes: >> On Wed, Jun 21, 2017 at 8:43 AM, Tom Lane wrote: >>> Yeah, I thought it would work fine with Makefile-using Windows toolchains. >>> But people who use MSVC need something else,

[HACKERS] Autovacuum launcher occurs error when cancelled by SIGINT

2017-06-21 Thread Yugo Nagata
Hi, As I report in another thread[1], I found the autovacuum launcher occurs the following error in PG 10 when this received SIGINT. I can repuroduce this by pg_cancel_backend or `kill -2 `. 2017-06-21 13:56:07.010 JST [32483] ERROR: canceling statement due to user request 2017-06-21

[HACKERS] pg_terminate_backend can terminate background workers and autovacuum launchers

2017-06-21 Thread Yugo Nagata
Hi, I have found that we can cancel/terminate autovacuum launchers and background worker processes by pg_cancel/terminate_backend function. I'm wondering this behavior is not expected and if not I want to fix it. The current pg_stat_activity shows background workers and autovacuum lancher as

Re: [HACKERS] Proposal for CSN based snapshots

2017-06-21 Thread Alexander Kuzmenkov
On 21.06.2017 04:48, Michael Paquier wrote: There has not been much activity on this thread for some time, and I mentioned my intentions to some developers at the last PGCon. But I am planning to study more the work that has been done here, with as envisaged goal to present a patch for the first

Re: [HACKERS] Rules on table partitions

2017-06-21 Thread Dean Rasheed
On 20 June 2017 at 03:01, Amit Langote wrote: > Hmm, yes. The following exercise convinced me. > > create table r (a int) partition by range (a); > create table r1 partition of r for values from (1) to (10); > create rule "_RETURN" as on select to r1 do instead

Re: [HACKERS] ASOF join

2017-06-21 Thread Konstantin Knizhnik
On 21.06.2017 11:00, Thomas Munro wrote: Hmm. Yeah, I see the notational problem. It's hard to come up with a new syntax that has SQL nature. What if... we didn't use a new syntax at all, but recognised existing queries that are executable with this strategy? Queries like this: WITH

Re: [HACKERS] Logical decoding on standby

2017-06-21 Thread sanyam jain
Hi, After changing sendTimeLineIsHistoric = state->currTLI == ThisTimeLineID; to sendTimeLineIsHistoric = state->currTLI != ThisTimeLineID; I was facing another issue. On promotion of a cascaded server ThisTimeLineID in the standby server having logical slot becomes 0. Then i added a function

Re: [HACKERS] UPDATE of partition key

2017-06-21 Thread Amit Langote
On 2017/06/21 3:53, Robert Haas wrote: > On Tue, Jun 20, 2017 at 2:54 AM, Amit Khandekar > wrote: >>> I guess I don't see why it should work like this. In the INSERT case, >>> we must build withCheckOption objects for each partition because those >>> partitions don't

Re: [HACKERS] Useless code in ExecInitModifyTable

2017-06-21 Thread Amit Langote
Fujita-san, On 2017/06/21 16:59, Etsuro Fujita wrote: > Commit d3cc37f1d801a6b5cad9bf179274a8d767f1ee50 added this to > ExecInitModifyTable: > > + /* The root table RT index is at the head of the partitioned_rels list */ > + if (node->partitioned_rels) > + { > + Index root_rti; > +

Re: [HACKERS] Comment typo in execMain.c

2017-06-21 Thread Heikki Linnakangas
On 06/21/2017 11:35 AM, Etsuro Fujita wrote: Here is a patch to fix a typo in a comment in ExecWithCheckOptions(): s/as as/as/. Fixed, thanks! - Heikki -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription:

Re: [HACKERS] AdvanceXLInsertBuffer vs. WAL segment compressibility

2017-06-21 Thread Heikki Linnakangas
(I'm cleaning up my inbox, hence the delayed reply) On 08/02/2016 10:51 PM, Robert Haas wrote: On Tue, Aug 2, 2016 at 2:33 PM, Bruce Momjian wrote: On Tue, Jul 26, 2016 at 05:42:43PM -0400, Chapman Flack wrote: Even so, I'd be curious whether it would break anything to have

[HACKERS] Comment typo in execMain.c

2017-06-21 Thread Etsuro Fujita
Here is a patch to fix a typo in a comment in ExecWithCheckOptions(): s/as as/as/. Best regards, Etsuro Fujita diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c index 7f460bd..9dbe175 100644 --- a/src/backend/executor/execMain.c +++ b/src/backend/executor/execMain.c

Re: [HACKERS] [GSOC][weekly report 3] Eliminate O(N^2) scaling from rw-conflict tracking in serializable transactions

2017-06-21 Thread Mengxing Liu
> From: "Heikki Linnakangas" > > Hmm. The hash table ought to speed up the RWConflictExists() function > right? Where in the flame graph is RWConflictExists()? If it only > accounts for a small amount of the overall runtime, even drastic speedup > there won't make much

[HACKERS] Useless code in ExecInitModifyTable

2017-06-21 Thread Etsuro Fujita
Commit d3cc37f1d801a6b5cad9bf179274a8d767f1ee50 added this to ExecInitModifyTable: + /* The root table RT index is at the head of the partitioned_rels list */ + if (node->partitioned_rels) + { + Index root_rti; + Oid root_oid; + + root_rti =

Re: [HACKERS] ASOF join

2017-06-21 Thread Thomas Munro
On Mon, Jun 19, 2017 at 11:57 PM, Konstantin Knizhnik wrote: > I attached simple patch adding ASOF join to Postgres. Right now it support > only outer join and requires USING clause (consequently it is not possible > to join two tables which joi keys has different

Re: [HACKERS] GSoC 2017 : Patch for predicate locking in Gist index

2017-06-21 Thread Shubham Barai
Hi, On 21 June 2017 at 13:11, Heikki Linnakangas wrote: > On 06/16/2017 01:24 PM, Shubham Barai wrote: > >> @@ -497,6 +499,13 @@ gistplacetopage(Relation rel, Size freespace, >> GISTSTATE *giststate, >> for (ptr = dist->next; ptr; ptr = ptr->next) >>

Re: [HACKERS] Regarding Postgres Dynamic Shared Memory (DSA)

2017-06-21 Thread Mahendranath Gurram
Hi Thomas, I like the whole idea. In fact, i understood this in your very first response itself. Only thing is every time i have to check for dsa_attached or not. I mean get_my_shared_state() is NULL or not. To avoid that check, i tried creating it in _PG_Init(postmaster process itself)

Re: [HACKERS] GSoC 2017 : Patch for predicate locking in Gist index

2017-06-21 Thread Heikki Linnakangas
On 06/21/2017 10:41 AM, Heikki Linnakangas wrote: On 06/16/2017 01:24 PM, Shubham Barai wrote: @@ -497,6 +499,13 @@ gistplacetopage(Relation rel, Size freespace, GISTSTATE *giststate, for (ptr = dist->next; ptr; ptr = ptr->next)

Re: [HACKERS] GSoC 2017 : Patch for predicate locking in Gist index

2017-06-21 Thread Heikki Linnakangas
On 06/16/2017 01:24 PM, Shubham Barai wrote: @@ -497,6 +499,13 @@ gistplacetopage(Relation rel, Size freespace, GISTSTATE *giststate, for (ptr = dist->next; ptr; ptr = ptr->next) UnlockReleaseBuffer(ptr->buffer); } + +

Re: [HACKERS] Regarding Postgres Dynamic Shared Memory (DSA)

2017-06-21 Thread Thomas Munro
On Wed, Jun 21, 2017 at 5:27 PM, Mahendranath Gurram wrote: > Initially i tried to design the same way. > I mean, i have created a background worker and created dsa in it. > I tried to attach/detach to the same dsa/dsm by all the backends(postgres > clients/connections)

<    1   2