Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2201d80

Browse files
committed
Avoid extra locks in GetSnapshotData if old_snapshot_threshold < 0
On a big NUMA machine with 1000 connections in saturation loadthere was a performance regression due to spinlock contention, foracquiring values which were never used. Just fill with dummyvalues if we're not going to use them.This patch has not been benchmarked yet on a big NUMA machine, butit seems like a good idea on general principle, and it seemed toprevent an apparent 2.2% regression on a single-socket i7 boxrunning 200 connections at saturation load.
1 parent5713f03 commit2201d80

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

‎src/backend/storage/ipc/procarray.c

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1759,14 +1759,26 @@ GetSnapshotData(Snapshot snapshot)
17591759
snapshot->regd_count=0;
17601760
snapshot->copied= false;
17611761

1762-
/*
1763-
* Capture the current time and WAL stream location in case this snapshot
1764-
* becomes old enough to need to fall back on the special "old snapshot"
1765-
* logic.
1766-
*/
1767-
snapshot->lsn=GetXLogInsertRecPtr();
1768-
snapshot->whenTaken=GetSnapshotCurrentTimestamp();
1769-
MaintainOldSnapshotTimeMapping(snapshot->whenTaken,xmin);
1762+
if (old_snapshot_threshold<0)
1763+
{
1764+
/*
1765+
* If not using "snapshot too old" feature, fill related fields with
1766+
* dummy values that don't require any locking.
1767+
*/
1768+
snapshot->lsn=InvalidXLogRecPtr;
1769+
snapshot->whenTaken=0;
1770+
}
1771+
else
1772+
{
1773+
/*
1774+
* Capture the current time and WAL stream location in case this
1775+
* snapshot becomes old enough to need to fall back on the special
1776+
* "old snapshot" logic.
1777+
*/
1778+
snapshot->lsn=GetXLogInsertRecPtr();
1779+
snapshot->whenTaken=GetSnapshotCurrentTimestamp();
1780+
MaintainOldSnapshotTimeMapping(snapshot->whenTaken,xmin);
1781+
}
17701782

17711783
returnsnapshot;
17721784
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp