pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Avoid SnapshotResetXmin() during AtEOXact_Snapshot()
10+ messages / 5 participants
[nested] [flat]

* pgsql: Avoid SnapshotResetXmin() during AtEOXact_Snapshot()
@ 2017-03-24 14:23  Simon Riggs <simon@2ndQuadrant.com>
  0 siblings, 1 reply; 10+ messages in thread

From: Simon Riggs @ 2017-03-24 14:23 UTC (permalink / raw)
  To: pgsql-committers

Avoid SnapshotResetXmin() during AtEOXact_Snapshot()

For normal commits and aborts we already reset PgXact->xmin
Avoiding touching highly contented shmem improves concurrent
performance.

Simon Riggs

Discussion: CANP8+jJdXE9b+b9F8CQT-LuxxO0PBCB-SZFfMVAdp+akqo4zfg@mail.gmail.com

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/42b4b0b2413b9b472aaf2112a3bbfd80a6ab4dc5

Modified Files
--------------
src/backend/access/transam/xact.c |  6 +++---
src/backend/utils/time/snapmgr.c  | 21 ++++++++++++++++++---
src/include/utils/snapmgr.h       |  2 +-
3 files changed, 22 insertions(+), 7 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* Re: [COMMITTERS] pgsql: Avoid SnapshotResetXmin() during AtEOXact_Snapshot()
@ 2017-03-24 16:14  Robert Haas <robertmhaas@gmail.com>
  parent: Simon Riggs <simon@2ndQuadrant.com>
  0 siblings, 2 replies; 10+ messages in thread

From: Robert Haas @ 2017-03-24 16:14 UTC (permalink / raw)
  To: Simon Riggs <simon@2ndquadrant.com>; +Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>

On Fri, Mar 24, 2017 at 10:23 AM, Simon Riggs <simon@2ndquadrant.com> wrote:
> Avoid SnapshotResetXmin() during AtEOXact_Snapshot()
>
> For normal commits and aborts we already reset PgXact->xmin
> Avoiding touching highly contented shmem improves concurrent
> performance.
>
> Simon Riggs

I'm getting occasional crashes with backtraces that look like this:

#0  0x00007fff9679c286 in __pthread_kill ()
#1  0x00007fff94e1a9f9 in pthread_kill ()
#2  0x00007fff9253a9a3 in abort ()
#3  0x0000000107e0659e in ExceptionalCondition (conditionName=<value
temporarily unavailable, due to optimizations>, errorType=0x6 <Address
0x6 out of bounds>, fileName=<value temporarily unavailable, due to
optimizations>, lineNumber=<value temporarily unavailable, due to
optimizations>) at assert.c:54
#4  0x0000000107e4be2b in AtEOXact_Snapshot (isCommit=<value
temporarily unavailable, due to optimizations>, isPrepare=0 '\0') at
snapmgr.c:1154
#5  0x0000000107a76c06 in CleanupTransaction () at xact.c:2643
#6  0x0000000107a76267 in CommitTransactionCommand () at xact.c:2818
#7  0x0000000107cecfc2 in exec_simple_query
(query_string=0x7f975481e640 "ABORT TRANSACTION") at postgres.c:2461
#8  0x0000000107ceabb7 in PostgresMain (argc=<value temporarily
unavailable, due to optimizations>, argv=<value temporarily
unavailable, due to optimizations>, dbname=<value temporarily
unavailable, due to optimizations>, username=<value temporarily
unavailable, due to optimizations>) at postgres.c:4071
#9  0x0000000107c6bb58 in PostmasterMain (argc=<value temporarily
unavailable, due to optimizations>, argv=<value temporarily
unavailable, due to optimizations>) at postmaster.c:4317
#10 0x0000000107be5cdd in main (argc=<value temporarily unavailable,
due to optimizations>, argv=<value temporarily unavailable, due to
optimizations>) at main.c:228

I suspect that is the fault of this patch.  Please fix or revert.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* Re: [COMMITTERS] pgsql: Avoid SnapshotResetXmin() during AtEOXact_Snapshot()
@ 2017-03-24 16:27  Robert Haas <robertmhaas@gmail.com>
  parent: Robert Haas <robertmhaas@gmail.com>
  1 sibling, 1 reply; 10+ messages in thread

From: Robert Haas @ 2017-03-24 16:27 UTC (permalink / raw)
  To: Simon Riggs <simon@2ndquadrant.com>; +Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>

On Fri, Mar 24, 2017 at 12:14 PM, Robert Haas <robertmhaas@gmail.com> wrote:
> On Fri, Mar 24, 2017 at 10:23 AM, Simon Riggs <simon@2ndquadrant.com> wrote:
>> Avoid SnapshotResetXmin() during AtEOXact_Snapshot()
>>
>> For normal commits and aborts we already reset PgXact->xmin
>> Avoiding touching highly contented shmem improves concurrent
>> performance.
>>
>> Simon Riggs
>
> I'm getting occasional crashes with backtraces that look like this:
>
> #4  0x0000000107e4be2b in AtEOXact_Snapshot (isCommit=<value
> temporarily unavailable, due to optimizations>, isPrepare=0 '\0') at
> snapmgr.c:1154
> #5  0x0000000107a76c06 in CleanupTransaction () at xact.c:2643
>
> I suspect that is the fault of this patch.  Please fix or revert.

Also, the entire buildfarm is turning red.

longfin, spurfowl, and magpie all show this assertion failure in the
log.  I haven't checked the others.

TRAP: FailedAssertion("!(MyPgXact->xmin == 0)", File: "snapmgr.c", Line: 1154)

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* Re: [COMMITTERS] pgsql: Avoid SnapshotResetXmin() during AtEOXact_Snapshot()
@ 2017-03-24 17:50  Robert Haas <robertmhaas@gmail.com>
  parent: Robert Haas <robertmhaas@gmail.com>
  0 siblings, 1 reply; 10+ messages in thread

From: Robert Haas @ 2017-03-24 17:50 UTC (permalink / raw)
  To: Simon Riggs <simon@2ndquadrant.com>; +Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>

On Fri, Mar 24, 2017 at 12:27 PM, Robert Haas <robertmhaas@gmail.com> wrote:
> On Fri, Mar 24, 2017 at 12:14 PM, Robert Haas <robertmhaas@gmail.com> wrote:
>> On Fri, Mar 24, 2017 at 10:23 AM, Simon Riggs <simon@2ndquadrant.com> wrote:
>>> Avoid SnapshotResetXmin() during AtEOXact_Snapshot()
>>>
>>> For normal commits and aborts we already reset PgXact->xmin
>>> Avoiding touching highly contented shmem improves concurrent
>>> performance.
>>>
>>> Simon Riggs
>>
>> I'm getting occasional crashes with backtraces that look like this:
>>
>> #4  0x0000000107e4be2b in AtEOXact_Snapshot (isCommit=<value
>> temporarily unavailable, due to optimizations>, isPrepare=0 '\0') at
>> snapmgr.c:1154
>> #5  0x0000000107a76c06 in CleanupTransaction () at xact.c:2643
>>
>> I suspect that is the fault of this patch.  Please fix or revert.
>
> Also, the entire buildfarm is turning red.
>
> longfin, spurfowl, and magpie all show this assertion failure in the
> log.  I haven't checked the others.
>
> TRAP: FailedAssertion("!(MyPgXact->xmin == 0)", File: "snapmgr.c", Line: 1154)

Another thing that is interesting is that when I run make -j8
check-world, the overall tests appear to succeed even though there are
failures mid-way through:

test tablefunc                ... FAILED (test process exited with exit code 2)

...but then later we end with:

ok
All tests successful.
Files=11, Tests=80, 251 wallclock secs ( 0.07 usr  0.02 sys + 19.77
cusr 14.45 csys = 34.31 CPU)
Result: PASS

real    4m27.421s
user    3m50.047s
sys    1m31.937s

That's unrelated to the current problem of course, but it seems to
suggest that make's -j option doesn't entirely do what you'd expect
when used with make check-world.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* Re: [COMMITTERS] pgsql: Avoid SnapshotResetXmin() during AtEOXact_Snapshot()
@ 2017-03-24 17:55  Simon Riggs <simon@2ndquadrant.com>
  parent: Robert Haas <robertmhaas@gmail.com>
  1 sibling, 0 replies; 10+ messages in thread

From: Simon Riggs @ 2017-03-24 17:55 UTC (permalink / raw)
  To: Robert Haas <robertmhaas@gmail.com>; +Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>

On 24 March 2017 at 16:14, Robert Haas <robertmhaas@gmail.com> wrote:

> I suspect that is the fault of this patch.  Please fix or revert.

Will revert then fix.

-- 
Simon Riggs                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* Re: [COMMITTERS] pgsql: Avoid SnapshotResetXmin() during AtEOXact_Snapshot()
@ 2017-03-24 17:56  Andres Freund <andres@anarazel.de>
  parent: Robert Haas <robertmhaas@gmail.com>
  0 siblings, 0 replies; 10+ messages in thread

From: Andres Freund @ 2017-03-24 17:56 UTC (permalink / raw)
  To: Robert Haas <robertmhaas@gmail.com>; +Cc: Simon Riggs <simon@2ndquadrant.com>; pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>

On 2017-03-24 13:50:54 -0400, Robert Haas wrote:
> On Fri, Mar 24, 2017 at 12:27 PM, Robert Haas <robertmhaas@gmail.com> wrote:
> > On Fri, Mar 24, 2017 at 12:14 PM, Robert Haas <robertmhaas@gmail.com> wrote:
> >> On Fri, Mar 24, 2017 at 10:23 AM, Simon Riggs <simon@2ndquadrant.com> wrote:
> >>> Avoid SnapshotResetXmin() during AtEOXact_Snapshot()
> >>>
> >>> For normal commits and aborts we already reset PgXact->xmin
> >>> Avoiding touching highly contented shmem improves concurrent
> >>> performance.
> >>>
> >>> Simon Riggs
> >>
> >> I'm getting occasional crashes with backtraces that look like this:
> >>
> >> #4  0x0000000107e4be2b in AtEOXact_Snapshot (isCommit=<value
> >> temporarily unavailable, due to optimizations>, isPrepare=0 '\0') at
> >> snapmgr.c:1154
> >> #5  0x0000000107a76c06 in CleanupTransaction () at xact.c:2643
> >>
> >> I suspect that is the fault of this patch.  Please fix or revert.
> >
> > Also, the entire buildfarm is turning red.
> >
> > longfin, spurfowl, and magpie all show this assertion failure in the
> > log.  I haven't checked the others.
> >
> > TRAP: FailedAssertion("!(MyPgXact->xmin == 0)", File: "snapmgr.c", Line: 1154)
> 
> Another thing that is interesting is that when I run make -j8
> check-world, the overall tests appear to succeed even though there are
> failures mid-way through:
> 
> test tablefunc                ... FAILED (test process exited with exit code 2)
> 
> ...but then later we end with:
> 
> ok
> All tests successful.
> Files=11, Tests=80, 251 wallclock secs ( 0.07 usr  0.02 sys + 19.77
> cusr 14.45 csys = 34.31 CPU)
> Result: PASS

> real    4m27.421s
> user    3m50.047s
> sys    1m31.937s

> That's unrelated to the current problem of course, but it seems to
> suggest that make's -j option doesn't entirely do what you'd expect
> when used with make check-world.
> 

That's likely the output of a different test from the one that failed.
It's a lot easier to see the result if you're doing
&& echo success || echo failure

- Andres


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers



^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* pgsql: Avoid SnapshotResetXmin() during AtEOXact_Snapshot()
@ 2017-04-06 12:35  Simon Riggs <simon@2ndQuadrant.com>
  0 siblings, 2 replies; 10+ messages in thread

From: Simon Riggs @ 2017-04-06 12:35 UTC (permalink / raw)
  To: pgsql-committers

Avoid SnapshotResetXmin() during AtEOXact_Snapshot()

For normal commits and aborts we already reset PgXact->xmin,
so we can simply avoid running SnapshotResetXmin() twice.

During performance tests by Alexander Korotkov, diagnosis
by Andres Freund showed PgXact array as a bottleneck. After
manual analysis by me of the code paths that touch those
memory locations, I was able to identify extraneous code
in the main transaction commit path.

Avoiding touching highly contented shmem improves concurrent
performance slightly on all workloads, confirmed by tests
run by Ashutosh Sharma and Alexander Korotkov.

Simon Riggs

Discussion: CANP8+jJdXE9b+b9F8CQT-LuxxO0PBCB-SZFfMVAdp+akqo4zfg@mail.gmail.com

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/6bad580d9e678a0b604883e14d8401d469b06566

Modified Files
--------------
src/backend/access/transam/xact.c |  6 +++---
src/backend/utils/time/snapmgr.c  | 14 ++++++++++++--
src/include/utils/snapmgr.h       |  2 +-
3 files changed, 16 insertions(+), 6 deletions(-)


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* Re: pgsql: Avoid SnapshotResetXmin() during AtEOXact_Snapshot()
@ 2017-04-06 13:11  Robert Haas <robertmhaas@gmail.com>
  parent: Simon Riggs <simon@2ndQuadrant.com>
  1 sibling, 1 reply; 10+ messages in thread

From: Robert Haas @ 2017-04-06 13:11 UTC (permalink / raw)
  To: Simon Riggs <simon@2ndquadrant.com>; +Cc: pgsql-committers

On Thu, Apr 6, 2017 at 8:35 AM, Simon Riggs <simon@2ndquadrant.com> wrote:
> Avoid SnapshotResetXmin() during AtEOXact_Snapshot()
>
> For normal commits and aborts we already reset PgXact->xmin,
> so we can simply avoid running SnapshotResetXmin() twice.
>
> During performance tests by Alexander Korotkov, diagnosis
> by Andres Freund showed PgXact array as a bottleneck. After
> manual analysis by me of the code paths that touch those
> memory locations, I was able to identify extraneous code
> in the main transaction commit path.
>
> Avoiding touching highly contented shmem improves concurrent
> performance slightly on all workloads, confirmed by tests
> run by Ashutosh Sharma and Alexander Korotkov.
>
> Simon Riggs
>
> Discussion: CANP8+jJdXE9b+b9F8CQT-LuxxO0PBCB-SZFfMVAdp+akqo4zfg@mail.gmail.com

Just like the last time you committed this, it seems to have broken
the entire buildfarm.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers



^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* Re: pgsql: Avoid SnapshotResetXmin() during AtEOXact_Snapshot()
@ 2017-04-06 14:10  Simon Riggs <simon@2ndquadrant.com>
  parent: Robert Haas <robertmhaas@gmail.com>
  0 siblings, 0 replies; 10+ messages in thread

From: Simon Riggs @ 2017-04-06 14:10 UTC (permalink / raw)
  To: Robert Haas <robertmhaas@gmail.com>; +Cc: pgsql-committers

On 6 April 2017 at 09:11, Robert Haas <robertmhaas@gmail.com> wrote:

> Just like the last time you committed this, it seems to have broken
> the entire buildfarm.

For different reasons, AFAIU. Investigating already.

-- 
Simon Riggs                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers



^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* Re: pgsql: Avoid SnapshotResetXmin() during AtEOXact_Snapshot()
@ 2017-04-06 14:12  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Simon Riggs <simon@2ndQuadrant.com>
  1 sibling, 0 replies; 10+ messages in thread

From: Tom Lane @ 2017-04-06 14:12 UTC (permalink / raw)
  To: Simon Riggs <simon@2ndQuadrant.com>; +Cc: pgsql-committers

Simon Riggs <simon@2ndQuadrant.com> writes:
> Avoid SnapshotResetXmin() during AtEOXact_Snapshot()

The buildfarm doesn't like this a bit.

			regards, tom lane


-- 
Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers



^ permalink  raw  reply  [nested|flat] 10+ messages in thread


end of thread, other threads:[~2017-04-06 14:12 UTC | newest]

Thread overview: 10+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-03-24 14:23 pgsql: Avoid SnapshotResetXmin() during AtEOXact_Snapshot() Simon Riggs <simon@2ndQuadrant.com>
2017-03-24 16:14 ` Robert Haas <robertmhaas@gmail.com>
2017-03-24 16:27   ` Robert Haas <robertmhaas@gmail.com>
2017-03-24 17:50     ` Robert Haas <robertmhaas@gmail.com>
2017-03-24 17:56       ` Andres Freund <andres@anarazel.de>
2017-03-24 17:55   ` Simon Riggs <simon@2ndquadrant.com>
2017-04-06 12:35 pgsql: Avoid SnapshotResetXmin() during AtEOXact_Snapshot() Simon Riggs <simon@2ndQuadrant.com>
2017-04-06 13:11 ` Robert Haas <robertmhaas@gmail.com>
2017-04-06 14:10   ` Simon Riggs <simon@2ndquadrant.com>
2017-04-06 14:12 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox