pgsql: Allow condition variables to be used in interrupt code.

2021-02-28 Thread Thomas Munro
Allow condition variables to be used in interrupt code.

Adjust the condition variable sleep loop to work correctly when code
reached by its internal CHECK_FOR_INTERRUPTS() call interacts with
another condition variable.

There are no such cases currently, but a proposed patch would do this.

Discussion: 
https://postgr.es/m/ca+hukgldemy2gbm80kz20gte6hnvwoere8kwcjk6-u56ost...@mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/f5a5773a9dc4185414fe538525e20d8512c2ba35

Modified Files
--
src/backend/storage/lmgr/condition_variable.c | 11 +--
1 file changed, 9 insertions(+), 2 deletions(-)



pgsql: Introduce symbolic names for FeBeWaitSet positions.

2021-02-28 Thread Thomas Munro
Introduce symbolic names for FeBeWaitSet positions.

Previously we used 0 and 1 to refer to the socket and latch in far flung
parts of the tree, without any explanation.  Also use PGINVALID_SOCKET
rather than -1 in a couple of places that didn't already do that.

Reviewed-by: Kyotaro Horiguchi 
Discussion: 
https://postgr.es/m/CA%2BhUKGJAC4Oqao%3DqforhNey20J8CiG2R%3DoBPqvfR0vOJrFysGw%40mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/a042ba2ba7bb44f191f6f9398da27f04a958a0db

Modified Files
--
src/backend/libpq/be-secure.c |  4 ++--
src/backend/libpq/pqcomm.c| 18 +++---
src/backend/utils/init/miscinit.c |  6 --
src/include/libpq/libpq.h |  3 +++
4 files changed, 24 insertions(+), 7 deletions(-)



pgsql: Use FeBeWaitSet for walsender.c.

2021-02-28 Thread Thomas Munro
Use FeBeWaitSet for walsender.c.

This avoids the need to set up and tear down a fresh WaitEventSet every
time we need need to wait.  We have to add an explicit exit on
postmaster exit (FeBeWaitSet isn't set up to do that automatically), so
move the code to do that into a new function to avoid repetition.

Reviewed-by: Kyotaro Horiguchi  (earlier version)
Discussion: 
https://postgr.es/m/CA%2BhUKGJAC4Oqao%3DqforhNey20J8CiG2R%3DoBPqvfR0vOJrFysGw%40mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/6230912f23904aa6cb2a1f948ca9b08235b4f54a

Modified Files
--
src/backend/replication/walsender.c | 43 +
1 file changed, 25 insertions(+), 18 deletions(-)



pgsql: Use EVFILT_SIGNAL for kqueue latches.

2021-02-28 Thread Thomas Munro
Use EVFILT_SIGNAL for kqueue latches.

Cut down on system calls and other overheads by waiting for SIGURG
explicitly with kqueue instead of using a signal handler and self-pipe.
Affects *BSD and macOS systems.

This leaves only the poll implementation with a signal handler and the
traditional self-pipe trick.

Discussion: 
https://postgr.es/m/ca+hukgjjxpdpzbe0a3hyuywbvazuc89yx3jk9rfzgfv_khu...@mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/6148656a0be1c6245fbcfcbbeb87541f1b173162

Modified Files
--
src/backend/storage/ipc/latch.c | 55 -
1 file changed, 38 insertions(+), 17 deletions(-)



pgsql: Use signalfd(2) for epoll latches.

2021-02-28 Thread Thomas Munro
Use signalfd(2) for epoll latches.

Cut down on system calls and other overheads by reading from a signalfd
instead of using a signal handler and self-pipe.  Affects Linux sytems,
and possibly others including illumos that implement the Linux epoll and
signalfd interfaces.

Reviewed-by: Andres Freund 
Discussion: 
https://postgr.es/m/ca+hukgjjxpdpzbe0a3hyuywbvazuc89yx3jk9rfzgfv_khu...@mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/6a2a70a02018d6362f9841cc2f499cc45405e86b

Modified Files
--
src/backend/libpq/pqsignal.c  |   4 +-
src/backend/storage/ipc/latch.c   | 159 ++
src/backend/utils/init/miscinit.c |  10 +--
3 files changed, 118 insertions(+), 55 deletions(-)



pgsql: Optimize latches to send fewer signals.

2021-02-28 Thread Thomas Munro
Optimize latches to send fewer signals.

Don't send signals to processes that aren't sleeping.

Author: Andres Freund 
Discussion: 
https://postgr.es/m/ca+hukgjjxpdpzbe0a3hyuywbvazuc89yx3jk9rfzgfv_khu...@mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/c8f3bc2401e7df7b79bae39dd3511c91f825b6a4

Modified Files
--
src/backend/storage/ipc/latch.c | 24 
src/include/storage/latch.h |  1 +
2 files changed, 25 insertions(+)



pgsql: Use SIGURG rather than SIGUSR1 for latches.

2021-02-28 Thread Thomas Munro
Use SIGURG rather than SIGUSR1 for latches.

Traditionally, SIGUSR1 has been overloaded for ad-hoc signals,
procsignal.c signals and latch.c wakeups.  Move that last use over to a
new dedicated signal.  SIGURG is normally used to report out-of-band
socket data, but PostgreSQL doesn't use that facility.

The signal handler is now installed in all postmaster children by
InitializeLatchSupport().  Those wishing to disconnect from it should
call ShutdownLatchSupport().

Future patches will use this separation of signals to avoid the need for
a signal handler on some operating systems.

Discussion: 
https://postgr.es/m/ca+hukgjjxpdpzbe0a3hyuywbvazuc89yx3jk9rfzgfv_khu...@mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/83709a0d5a46559db016c50ded1a95fd3b0d3be6

Modified Files
--
src/backend/postmaster/bgworker.c| 19 ++
src/backend/postmaster/postmaster.c  |  4 +++
src/backend/storage/ipc/latch.c  | 50 
src/backend/storage/ipc/procsignal.c |  2 --
src/include/storage/latch.h  | 11 +---
5 files changed, 40 insertions(+), 46 deletions(-)



pgsql: Remove latch.c workaround for Linux < 2.6.27.

2021-02-28 Thread Thomas Munro
Remove latch.c workaround for Linux < 2.6.27.

Commit 82ebbeb0 added a workaround for systems with no epoll_create1()
and EPOLL_CLOEXEC.  Linux < 2.6.27 and glibc < 2.9 are long gone.  Now
seems like a good time to drop the extra code, because otherwise we'd
have to add similar already-dead workaround code to new patches using
XXX_CLOEXEC flags that arrived in the same kernel release.

Reviewed-by: Tom Lane 
Discussion: 
https://postgr.es/m/CA%2BhUKGKL_%3DaO%3Dr30N%3Ds9VoDgTqHpRSzePRbA9dkYO7snc7HsxA%40mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/d1b90995e8d41df7e59efe48e98f26cd66baba9b

Modified Files
--
src/backend/storage/ipc/latch.c | 21 +
1 file changed, 1 insertion(+), 20 deletions(-)



Re: pgsql: pg_collation_actual_version() -> pg_collation_current_version().

2021-02-25 Thread Thomas Munro
On Thu, Feb 25, 2021 at 10:49 PM Peter Eisentraut  wrote:
> Seeing that explanation, I think that's even more of a reason to avoid
> the name "current" and use something strikingly different.
>
> In any case, this function name has been around for some years now and
> renaming it just for taste reasons seems unnecessary.

I guess my unspoken assumption was that anyone using this in a query
is probably comparing it with collversion and thus already has a query
that needs to be rewritten for v14, and therefore it's not a bad time
to clean up some naming.  But that argument is moot if you don't even
agree that the new name's an improvement, so... reverted.




pgsql: Revert "pg_collation_actual_version() -> pg_collation_current_ve

2021-02-25 Thread Thomas Munro
Revert "pg_collation_actual_version() -> pg_collation_current_version()."

This reverts commit 9cf184cc0599b6e65e7e5ecd9d91cd42e278bcd8.  Name
change less well received than anticipated.

Discussion: 
https://postgr.es/m/afcfb97e-88a1-a540-db95-6c573b93bc2b%40eisentraut.org

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/8556267b2b1b8e1c26037c4c25cf390ee5afb5d9

Modified Files
--
doc/src/sgml/func.sgml |  8 
src/backend/commands/collationcmds.c   |  2 +-
src/backend/utils/adt/pg_locale.c  | 14 +++---
src/include/catalog/catversion.h   |  2 +-
src/include/catalog/pg_proc.dat|  4 ++--
src/test/regress/expected/collate.icu.utf8.out |  6 +++---
src/test/regress/sql/collate.icu.utf8.sql  |  6 +++---
7 files changed, 21 insertions(+), 21 deletions(-)



Re: pgsql: pg_collation_actual_version() -> pg_collation_current_version().

2021-02-22 Thread Thomas Munro
On Tue, Feb 23, 2021 at 7:03 PM Peter Eisentraut  wrote:
> On 22.02.21 12:28, Thomas Munro wrote:
> > pg_collation_actual_version() -> pg_collation_current_version().
> >
> > The new name seems a bit more natural.
> >
> > Discussion: https://postgr.es/m/20210117215940.GE8560%40telsasoft.com
>
> I don't find where this change was discussed in that thread.  I
> specifically chose that name to indicate, "not the current version in
> the database, but the version the OS thinks it should be".  I think the
> rename loses that distinction.

I understood "actual" to be a way of contrasting with
pg_collation.collversion, which we dropped.  Without that, the meaning
of a more typical function name with "current" seemed clearer to me,
and "actual" seemed excessively emphatic.  There isn't a concept of a
single "current version in the database" anymore, there's just the set
of relevant versions that were current when each index was built.
Happy to revert the name change if you hate it though, and sorry I
didn't CC you on the thread.




pgsql: Hide internal error for pg_collation_actual_version().

2021-02-22 Thread Thomas Munro
Hide internal error for pg_collation_actual_version().

Instead of an unsightly internal "cache lookup failed" message, just
return NULL for bad OIDs, as is the convention for other similar things.

Reported-by: Justin Pryzby 
Reviewed-by: Michael Paquier 
Discussion: https://postgr.es/m/20210117215940.GE8560%40telsasoft.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/0fb0a0503bfc125764c8dba4f515058145dc7f8b

Modified Files
--
src/backend/catalog/index.c|  5 +++--
src/backend/catalog/pg_depend.c|  3 ++-
src/backend/commands/collationcmds.c   |  2 +-
src/backend/utils/adt/pg_locale.c  |  9 +++--
src/include/utils/pg_locale.h  |  2 +-
src/test/regress/expected/collate.icu.utf8.out | 14 ++
src/test/regress/sql/collate.icu.utf8.sql  |  5 +
7 files changed, 33 insertions(+), 7 deletions(-)



pgsql: Refactor get_collation_current_version().

2021-02-22 Thread Thomas Munro
Refactor get_collation_current_version().

The code paths for three different OSes finished up with three different
ways of excluding C[.xxx] and POSIX from consideration.  Merge them.

Reviewed-by: Michael Paquier 
Discussion: https://postgr.es/m/20210117215940.GE8560%40telsasoft.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/beb4480c853a60ec43bd3f1a71252890dd234f10

Modified Files
--
src/backend/utils/adt/pg_locale.c | 34 --
1 file changed, 4 insertions(+), 30 deletions(-)



pgsql: Tab-complete CREATE COLLATION.

2021-02-22 Thread Thomas Munro
Tab-complete CREATE COLLATION.

Reviewed-by: Michael Paquier 
Discussion: https://postgr.es/m/20210117215940.GE8560%40telsasoft.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/5bc09a74719dfeb6c4cebb311b81385c508459a8

Modified Files
--
src/bin/psql/tab-complete.c | 26 +-
1 file changed, 25 insertions(+), 1 deletion(-)



pgsql: pg_collation_actual_version() -> pg_collation_current_version().

2021-02-22 Thread Thomas Munro
pg_collation_actual_version() -> pg_collation_current_version().

The new name seems a bit more natural.

Discussion: https://postgr.es/m/20210117215940.GE8560%40telsasoft.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/9cf184cc0599b6e65e7e5ecd9d91cd42e278bcd8

Modified Files
--
doc/src/sgml/func.sgml |  8 
src/backend/commands/collationcmds.c   |  2 +-
src/backend/utils/adt/pg_locale.c  | 14 +++---
src/include/catalog/catversion.h   |  2 +-
src/include/catalog/pg_proc.dat|  4 ++--
src/test/regress/expected/collate.icu.utf8.out |  6 +++---
src/test/regress/sql/collate.icu.utf8.sql  |  6 +++---
7 files changed, 21 insertions(+), 21 deletions(-)



pgsql: Remove outdated reference to RAID spindles.

2021-02-21 Thread Thomas Munro
Remove outdated reference to RAID spindles.

Commit b09ff536 left behind some outdated advice in the long_desc field
of the GUC "effective_io_concurrency".  Remove it.

Back-patch to 13.

Reported-by: Andrew Gierth 
Reviewed-by: Julien Rouhaud 
Discussion: 
https://postgr.es/m/CA%2BhUKGJyyWqFBxL9gEj-qtjBThGjhAOBE8GBnF8MUJOJ3vrfag%40mail.gmail.com

Branch
--
REL_13_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/5190ce845c59727ed7177dadd62626d6450a55bd

Modified Files
--
src/backend/utils/misc/guc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



pgsql: Remove outdated reference to RAID spindles.

2021-02-21 Thread Thomas Munro
Remove outdated reference to RAID spindles.

Commit b09ff536 left behind some outdated advice in the long_desc field
of the GUC "effective_io_concurrency".  Remove it.

Back-patch to 13.

Reported-by: Andrew Gierth 
Reviewed-by: Julien Rouhaud 
Discussion: 
https://postgr.es/m/CA%2BhUKGJyyWqFBxL9gEj-qtjBThGjhAOBE8GBnF8MUJOJ3vrfag%40mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/db8374d804f2dd35a0f934984d1d3686cc71f545

Modified Files
--
src/backend/utils/misc/guc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



pgsql: Fix compiler warning in back branches (9.6, 10).

2021-02-15 Thread Thomas Munro
Fix compiler warning in back branches (9.6, 10).

Back-patch a tiny bit of commit fbb2e9a0 into 9.6 and 10, to silence an
uninitialized variable warning from GCC 10.2.  Seen on buildfarm member
handfish, and my own development workflow where I like to use -Werror.

Discussion: 
https://postgr.es/m/CA%2BhUKGJRcwvK86Uf5t-FrTekZjqHtpv3u%3D3MuBg8Zw8R933Mqg%40mail.gmail.com

Branch
--
REL9_6_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/618d139f82d4222df796e989de3c4c4de0359d7b

Modified Files
--
src/backend/utils/misc/guc.c | 2 ++
1 file changed, 2 insertions(+)



pgsql: Fix compiler warning in back branches (9.6, 10).

2021-02-15 Thread Thomas Munro
Fix compiler warning in back branches (9.6, 10).

Back-patch a tiny bit of commit fbb2e9a0 into 9.6 and 10, to silence an
uninitialized variable warning from GCC 10.2.  Seen on buildfarm member
handfish, and my own development workflow where I like to use -Werror.

Discussion: 
https://postgr.es/m/CA%2BhUKGJRcwvK86Uf5t-FrTekZjqHtpv3u%3D3MuBg8Zw8R933Mqg%40mail.gmail.com

Branch
--
REL_10_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/26812bcaa664b17843b3dbc8803551d720109b6e

Modified Files
--
src/backend/utils/misc/guc.c | 2 ++
1 file changed, 2 insertions(+)



pgsql: Default to wal_sync_method=fdatasync on FreeBSD.

2021-02-14 Thread Thomas Munro
Default to wal_sync_method=fdatasync on FreeBSD.

FreeBSD 13 gained O_DSYNC, which would normally cause wal_sync_method to
choose open_datasync as its default value.  That may not be a good
choice for all systems, and performs worse than fdatasync in some
scenarios.  Let's preserve the existing default behavior for now.

Like commit 576477e73c4, which did the same for Linux, back-patch to all
supported releases.

Discussion: 
https://postgr.es/m/CA%2BhUKGLsAMXBQrCxCXoW-JsUYmdOL8ALYvaX%3DCrHqWxm-nWbGA%40mail.gmail.com

Branch
--
REL9_6_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/09a3b19e38ee09ce1f12cee9b9537ae66d729ead

Modified Files
--
doc/src/sgml/config.sgml  | 4 ++--
src/backend/utils/misc/postgresql.conf.sample | 2 +-
src/include/port/freebsd.h| 9 +
3 files changed, 12 insertions(+), 3 deletions(-)



pgsql: Default to wal_sync_method=fdatasync on FreeBSD.

2021-02-14 Thread Thomas Munro
Default to wal_sync_method=fdatasync on FreeBSD.

FreeBSD 13 gained O_DSYNC, which would normally cause wal_sync_method to
choose open_datasync as its default value.  That may not be a good
choice for all systems, and performs worse than fdatasync in some
scenarios.  Let's preserve the existing default behavior for now.

Like commit 576477e73c4, which did the same for Linux, back-patch to all
supported releases.

Discussion: 
https://postgr.es/m/CA%2BhUKGLsAMXBQrCxCXoW-JsUYmdOL8ALYvaX%3DCrHqWxm-nWbGA%40mail.gmail.com

Branch
--
REL_10_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/800131df74c4b870b6a459bcee0acc0bb89f75ff

Modified Files
--
doc/src/sgml/config.sgml  | 4 ++--
src/backend/utils/misc/postgresql.conf.sample | 2 +-
src/include/port/freebsd.h| 9 +
3 files changed, 12 insertions(+), 3 deletions(-)



pgsql: Default to wal_sync_method=fdatasync on FreeBSD.

2021-02-14 Thread Thomas Munro
Default to wal_sync_method=fdatasync on FreeBSD.

FreeBSD 13 gained O_DSYNC, which would normally cause wal_sync_method to
choose open_datasync as its default value.  That may not be a good
choice for all systems, and performs worse than fdatasync in some
scenarios.  Let's preserve the existing default behavior for now.

Like commit 576477e73c4, which did the same for Linux, back-patch to all
supported releases.

Discussion: 
https://postgr.es/m/CA%2BhUKGLsAMXBQrCxCXoW-JsUYmdOL8ALYvaX%3DCrHqWxm-nWbGA%40mail.gmail.com

Branch
--
REL_11_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/1fefe8879a684666fee8353bef99e8c3e6f15901

Modified Files
--
doc/src/sgml/config.sgml  | 2 +-
src/backend/utils/misc/postgresql.conf.sample | 2 +-
src/include/port/freebsd.h| 9 +
3 files changed, 11 insertions(+), 2 deletions(-)



pgsql: Default to wal_sync_method=fdatasync on FreeBSD.

2021-02-14 Thread Thomas Munro
Default to wal_sync_method=fdatasync on FreeBSD.

FreeBSD 13 gained O_DSYNC, which would normally cause wal_sync_method to
choose open_datasync as its default value.  That may not be a good
choice for all systems, and performs worse than fdatasync in some
scenarios.  Let's preserve the existing default behavior for now.

Like commit 576477e73c4, which did the same for Linux, back-patch to all
supported releases.

Discussion: 
https://postgr.es/m/CA%2BhUKGLsAMXBQrCxCXoW-JsUYmdOL8ALYvaX%3DCrHqWxm-nWbGA%40mail.gmail.com

Branch
--
REL_12_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/a27f3a7f4159c5afaf33932df16ca4fed6689c06

Modified Files
--
doc/src/sgml/config.sgml  | 2 +-
src/backend/utils/misc/postgresql.conf.sample | 2 +-
src/include/port/freebsd.h| 9 +
3 files changed, 11 insertions(+), 2 deletions(-)



pgsql: Default to wal_sync_method=fdatasync on FreeBSD.

2021-02-14 Thread Thomas Munro
Default to wal_sync_method=fdatasync on FreeBSD.

FreeBSD 13 gained O_DSYNC, which would normally cause wal_sync_method to
choose open_datasync as its default value.  That may not be a good
choice for all systems, and performs worse than fdatasync in some
scenarios.  Let's preserve the existing default behavior for now.

Like commit 576477e73c4, which did the same for Linux, back-patch to all
supported releases.

Discussion: 
https://postgr.es/m/CA%2BhUKGLsAMXBQrCxCXoW-JsUYmdOL8ALYvaX%3DCrHqWxm-nWbGA%40mail.gmail.com

Branch
--
REL_13_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/6c23e5ae9ee12ff1f5183573885bfaa4eb97b243

Modified Files
--
doc/src/sgml/config.sgml  | 2 +-
src/backend/utils/misc/postgresql.conf.sample | 2 +-
src/include/port/freebsd.h| 9 +
3 files changed, 11 insertions(+), 2 deletions(-)



pgsql: Default to wal_sync_method=fdatasync on FreeBSD.

2021-02-14 Thread Thomas Munro
Default to wal_sync_method=fdatasync on FreeBSD.

FreeBSD 13 gained O_DSYNC, which would normally cause wal_sync_method to
choose open_datasync as its default value.  That may not be a good
choice for all systems, and performs worse than fdatasync in some
scenarios.  Let's preserve the existing default behavior for now.

Like commit 576477e73c4, which did the same for Linux, back-patch to all
supported releases.

Discussion: 
https://postgr.es/m/CA%2BhUKGLsAMXBQrCxCXoW-JsUYmdOL8ALYvaX%3DCrHqWxm-nWbGA%40mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/f900a79ecdc1864a6ead72c97c34a41012227eaf

Modified Files
--
doc/src/sgml/config.sgml  | 2 +-
src/backend/utils/misc/postgresql.conf.sample | 2 +-
src/include/port/freebsd.h| 9 +
3 files changed, 11 insertions(+), 2 deletions(-)



pgsql: Use pg_pwrite() in pg_test_fsync.

2021-02-14 Thread Thomas Munro
Use pg_pwrite() in pg_test_fsync.

For consistency with the PostgreSQL behavior this test program is
intended to simulate, use pwrite() instead of lseek() + write().

Also fix the final "non-sync" test, which was opening and closing the
file for every write.

Discussion: 
https://postgr.es/m/CA%2BhUKGJjjid2BJsvjMALBTduo1ogdx2SPYaTQL3wAy8y2hc4nw%40mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/2c8b42b50df6cc5ba6987c400a857d6bbfdf0300

Modified Files
--
src/bin/pg_test_fsync/pg_test_fsync.c | 51 +++
1 file changed, 28 insertions(+), 23 deletions(-)



pgsql: Hold interrupts while running dsm_detach() callbacks.

2021-02-14 Thread Thomas Munro
Hold interrupts while running dsm_detach() callbacks.

While cleaning up after a parallel query or parallel index creation that
created temporary files, we could be interrupted by a statement timeout.
The error handling path would then fail to clean up the files when it
ran dsm_detach() again, because the callback was already popped off the
list.  Prevent this hazard by holding interrupts while the cleanup code
runs.

Thanks to Heikki Linnakangas for this suggestion, and also to Kyotaro
Horiguchi, Masahiko Sawada, Justin Pryzby and Tom Lane for discussion of
this and earlier ideas on how to fix the problem.

Back-patch to all supported releases.

Reported-by: Justin Pryzby 
Discussion: https://postgr.es/m/20191212180506.gr2...@telsasoft.com

Branch
--
REL9_6_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/8a07e5bd82486b024e58417c09da193c275b13d3

Modified Files
--
src/backend/storage/ipc/dsm.c | 7 ++-
1 file changed, 6 insertions(+), 1 deletion(-)



pgsql: Hold interrupts while running dsm_detach() callbacks.

2021-02-14 Thread Thomas Munro
Hold interrupts while running dsm_detach() callbacks.

While cleaning up after a parallel query or parallel index creation that
created temporary files, we could be interrupted by a statement timeout.
The error handling path would then fail to clean up the files when it
ran dsm_detach() again, because the callback was already popped off the
list.  Prevent this hazard by holding interrupts while the cleanup code
runs.

Thanks to Heikki Linnakangas for this suggestion, and also to Kyotaro
Horiguchi, Masahiko Sawada, Justin Pryzby and Tom Lane for discussion of
this and earlier ideas on how to fix the problem.

Back-patch to all supported releases.

Reported-by: Justin Pryzby 
Discussion: https://postgr.es/m/20191212180506.gr2...@telsasoft.com

Branch
--
REL_10_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/4b426f77c3cf7fab24115ddb99174d1efa311aee

Modified Files
--
src/backend/storage/ipc/dsm.c | 7 ++-
1 file changed, 6 insertions(+), 1 deletion(-)



pgsql: Hold interrupts while running dsm_detach() callbacks.

2021-02-14 Thread Thomas Munro
Hold interrupts while running dsm_detach() callbacks.

While cleaning up after a parallel query or parallel index creation that
created temporary files, we could be interrupted by a statement timeout.
The error handling path would then fail to clean up the files when it
ran dsm_detach() again, because the callback was already popped off the
list.  Prevent this hazard by holding interrupts while the cleanup code
runs.

Thanks to Heikki Linnakangas for this suggestion, and also to Kyotaro
Horiguchi, Masahiko Sawada, Justin Pryzby and Tom Lane for discussion of
this and earlier ideas on how to fix the problem.

Back-patch to all supported releases.

Reported-by: Justin Pryzby 
Discussion: https://postgr.es/m/20191212180506.gr2...@telsasoft.com

Branch
--
REL_11_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/acafdd9ed5f05742730ee666abf49b89e8a125ad

Modified Files
--
src/backend/storage/ipc/dsm.c | 7 ++-
1 file changed, 6 insertions(+), 1 deletion(-)



pgsql: Hold interrupts while running dsm_detach() callbacks.

2021-02-14 Thread Thomas Munro
Hold interrupts while running dsm_detach() callbacks.

While cleaning up after a parallel query or parallel index creation that
created temporary files, we could be interrupted by a statement timeout.
The error handling path would then fail to clean up the files when it
ran dsm_detach() again, because the callback was already popped off the
list.  Prevent this hazard by holding interrupts while the cleanup code
runs.

Thanks to Heikki Linnakangas for this suggestion, and also to Kyotaro
Horiguchi, Masahiko Sawada, Justin Pryzby and Tom Lane for discussion of
this and earlier ideas on how to fix the problem.

Back-patch to all supported releases.

Reported-by: Justin Pryzby 
Discussion: https://postgr.es/m/20191212180506.gr2...@telsasoft.com

Branch
--
REL_12_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/840eda04ebc99ce211ffd11946a59ad43c42bfa6

Modified Files
--
src/backend/storage/ipc/dsm.c | 7 ++-
1 file changed, 6 insertions(+), 1 deletion(-)



pgsql: Hold interrupts while running dsm_detach() callbacks.

2021-02-14 Thread Thomas Munro
Hold interrupts while running dsm_detach() callbacks.

While cleaning up after a parallel query or parallel index creation that
created temporary files, we could be interrupted by a statement timeout.
The error handling path would then fail to clean up the files when it
ran dsm_detach() again, because the callback was already popped off the
list.  Prevent this hazard by holding interrupts while the cleanup code
runs.

Thanks to Heikki Linnakangas for this suggestion, and also to Kyotaro
Horiguchi, Masahiko Sawada, Justin Pryzby and Tom Lane for discussion of
this and earlier ideas on how to fix the problem.

Back-patch to all supported releases.

Reported-by: Justin Pryzby 
Discussion: https://postgr.es/m/20191212180506.gr2...@telsasoft.com

Branch
--
REL_13_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/9fe40913c45dcb78d3271fdc2dcf21ff15bee583

Modified Files
--
src/backend/storage/ipc/dsm.c | 7 ++-
1 file changed, 6 insertions(+), 1 deletion(-)



pgsql: Hold interrupts while running dsm_detach() callbacks.

2021-02-14 Thread Thomas Munro
Hold interrupts while running dsm_detach() callbacks.

While cleaning up after a parallel query or parallel index creation that
created temporary files, we could be interrupted by a statement timeout.
The error handling path would then fail to clean up the files when it
ran dsm_detach() again, because the callback was already popped off the
list.  Prevent this hazard by holding interrupts while the cleanup code
runs.

Thanks to Heikki Linnakangas for this suggestion, and also to Kyotaro
Horiguchi, Masahiko Sawada, Justin Pryzby and Tom Lane for discussion of
this and earlier ideas on how to fix the problem.

Back-patch to all supported releases.

Reported-by: Justin Pryzby 
Discussion: https://postgr.es/m/20191212180506.gr2...@telsasoft.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/637668fb1d17ad789e392a40ff09694ff1aabffb

Modified Files
--
src/backend/storage/ipc/dsm.c | 7 ++-
1 file changed, 6 insertions(+), 1 deletion(-)



pgsql: ReadNewTransactionId() -> ReadNextTransactionId().

2021-02-14 Thread Thomas Munro
ReadNewTransactionId() -> ReadNextTransactionId().

The new name conveys the effect better, is more consistent with similar
functions ReadNextMultiXactId(), ReadNextFullTransactionId(), and
matches the name of the variable that it reads.

Reported-by: Peter Geoghegan 
Discussion: 
https://postgr.es/m/CAH2-WzmVR4SakBXQUdhhPpMf1aYvZCnna5%3DHKa7DAgEmBAg%2B8g%40mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/c7ecd6af010e2ac8c5530f3985e97f24531bfa5f

Modified Files
--
src/backend/access/gin/ginvacuum.c |  2 +-
src/backend/access/nbtree/nbtpage.c|  6 +++---
src/backend/access/transam/commit_ts.c |  2 +-
src/backend/access/transam/xact.c  |  2 +-
src/backend/commands/vacuum.c  | 10 +-
src/backend/postmaster/autovacuum.c|  4 ++--
src/include/access/transam.h   |  2 +-
7 files changed, 14 insertions(+), 14 deletions(-)



pgsql: Tab-complete CREATE DATABASE ... LOCALE.

2021-02-04 Thread Thomas Munro
Tab-complete CREATE DATABASE ... LOCALE.

Author: Ian Lawrence Barwick 
Discussion: 
https://postgr.es/m/CAB8KJ%3Dh0XO2CB4QbLBc1Tm9Bg5wzSGQtT-eunaCmrghJp4nqdA%40mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/e1c02d92aee30328316c309c3c2f305d77f231a2

Modified Files
--
src/bin/psql/tab-complete.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



pgsql: Remove documentation of waiting restore_command.

2021-01-28 Thread Thomas Munro
Remove documentation of waiting restore_command.

Following the removal of pg_standby, also remove the documentation
section that describes how to write your own "waiting restore_command"
along the same lines.

Discussion: https://postgr.es/m/20201029024412.GP5380%40telsasoft.com
Reviewed-by: Michael Paquier 

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/5c6d184213bb9feac0800eee1a16769bec9e8d58

Modified Files
--
doc/src/sgml/high-availability.sgml | 137 
1 file changed, 137 deletions(-)



pgsql: Retire pg_standby.

2021-01-28 Thread Thomas Munro
Retire pg_standby.

pg_standby was useful more than a decade ago, but now it is obsolete.
It has been proposed that we retire it many times.  Now seems like a
good time to finally do it, because "waiting restore commands"
are incompatible with a proposed recovery prefetching feature.

Discussion: https://postgr.es/m/20201029024412.GP5380%40telsasoft.com
Author: Justin Pryzby 
Reviewed-by: Heikki Linnakangas 
Reviewed-by: Peter Eisentraut 
Reviewed-by: Michael Paquier 
Reviewed-by: Fujii Masao 

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/514b411a2b5226167add9ab139d3a96dbe98035d

Modified Files
--
contrib/Makefile   |   1 -
contrib/pg_standby/.gitignore  |   1 -
contrib/pg_standby/Makefile|  20 -
contrib/pg_standby/pg_standby.c| 907 -
doc/src/sgml/contrib.sgml  |   7 +-
doc/src/sgml/filelist.sgml |   1 -
doc/src/sgml/high-availability.sgml|  17 +-
doc/src/sgml/pgstandby.sgml| 394 --
doc/src/sgml/ref/pgarchivecleanup.sgml |   7 -
src/backend/access/transam/xlog.c  |   2 +-
src/tools/msvc/Mkvcbuild.pm|   4 +-
11 files changed, 9 insertions(+), 1352 deletions(-)



pgsql: Fix sample output of EXPLAIN ANALYZE.

2021-01-20 Thread Thomas Munro
Fix sample output of EXPLAIN ANALYZE.

Since commit f0f13a3a08b2757997410f3a1c38bdc22973c525, we estimate
ModifyTable paths without a RETURNING clause differently.  Update an
example from the manual that showed the old behavior.

Author: Takayuki Tsunakawa 
Reviewed-by: Laurenz Albe 
Discussion: 
https://postgr.es/m/TYAPR01MB29905674F41693BBA9DA28CAFEA20%40TYAPR01MB2990.jpnprd01.prod.outlook.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/679744cf1b0d0569d16b4dd2d020f9095ea3d53b

Modified Files
--
doc/src/sgml/perform.sgml | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)



pgsql: Minor header cleanup for the new iovec code.

2021-01-13 Thread Thomas Munro
Minor header cleanup for the new iovec code.

Remove redundant function declaration and improve header comment in
pg_iovec.h.  Move the new declaration in fd.h next to a group of more
similar functions.

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/fb29ab26b38f1647423bf6aa2991e5fdf9060f08

Modified Files
--
src/include/port/pg_iovec.h | 7 +--
src/include/storage/fd.h| 8 
2 files changed, 5 insertions(+), 10 deletions(-)



pgsql: Move our p{read,write}v replacements into their own files.

2021-01-13 Thread Thomas Munro
Move our p{read,write}v replacements into their own files.

macOS's ranlib issued a warning about an empty pread.o file with the
previous arrangement, on systems new enough to require no replacement
functions.  Let's go back to using configure's AC_REPLACE_FUNCS system
to build and include each .o in the library only if it's needed, which
requires moving the *v() functions to their own files.

Also move the _with_retry() wrapper to a more permanent home.

Reported-by: Tom Lane 
Discussion: https://postgr.es/m/1283127.1610554395%40sss.pgh.pa.us

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/0d56acfbaa799553c0c6ea350fd6e68d81025994

Modified Files
--
configure |  54 -
configure.ac  |   8 ++--
src/backend/storage/file/fd.c |  65 +
src/include/storage/fd.h  |   5 ++
src/port/Makefile |   2 -
src/port/pread.c  |  43 +
src/port/preadv.c |  58 +++
src/port/pwrite.c | 107 +-
src/port/pwritev.c|  58 +++
src/tools/msvc/Mkvcbuild.pm   |   2 +-
10 files changed, 248 insertions(+), 154 deletions(-)



pgsql: Don't use elog() in src/port/pwrite.c.

2021-01-12 Thread Thomas Munro
Don't use elog() in src/port/pwrite.c.

Nothing broke because of this oversight yet, but it would fail to link
if we tried to use pg_pwrite() in frontend code on a system that lacks
pwrite().  Use an assertion instead.  Also pgindent while here.

Discussion: 
https://postgr.es/m/CA%2BhUKGL57RvoQsS35TVPnQoPYqbtBixsdRhynB8NpcUKpHTTtg%40mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/df10ac625c1672edf839ff59cfcac9dcc097515c

Modified Files
--
src/port/pwrite.c | 12 ++--
1 file changed, 6 insertions(+), 6 deletions(-)



pgsql: Fix function prototypes in dependency.h.

2021-01-11 Thread Thomas Munro
Fix function prototypes in dependency.h.

Commit 257836a7 accidentally deleted a couple of
redundant-but-conventional "extern" keywords on function prototypes.
Put them back.

Reported-by: Alvaro Herrera 

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/f315205f3fafd6f6c7c479f480289fcf45700310

Modified Files
--
src/include/catalog/dependency.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)



Re: pgsql: Track collation versions for indexes.

2021-01-11 Thread Thomas Munro
On Tue, Jan 12, 2021 at 10:37 AM Alvaro Herrera  wrote:
> This was a strange change ... Is this just an inadvertent slip-up?

> -extern long changeDependenciesOf(Oid classId, Oid oldObjectId,
> +long changeDependenciesOf(Oid classId, Oid oldObjectId,

Huh, definitely not done on purpose.  Will fix.  Thanks.




pgsql: Use vectored I/O to fill new WAL segments.

2021-01-10 Thread Thomas Munro
Use vectored I/O to fill new WAL segments.

Instead of making many block-sized write() calls to fill a new WAL file
with zeroes, make a smaller number of pwritev() calls (or various
emulations).  The actual number depends on the OS's IOV_MAX, which
PG_IOV_MAX currently caps at 32.  That means we'll write 256kB per call
on typical systems.  We may want to tune the number later with more
experience.

Reviewed-by: Tom Lane 
Reviewed-by: Andres Freund 
Discussion: 
https://postgr.es/m/CA%2BhUKGJA%2Bu-220VONeoREBXJ9P3S94Y7J%2BkqCnTYmahvZJwM%3Dg%40mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/ce6a71fa5300cf00adf32c9daee302c523609709

Modified Files
--
src/backend/access/transam/xlog.c | 28 ++--
1 file changed, 22 insertions(+), 6 deletions(-)



pgsql: Provide pg_preadv() and pg_pwritev().

2021-01-10 Thread Thomas Munro
Provide pg_preadv() and pg_pwritev().

Provide synchronous vectored file I/O routines.  These map to preadv()
and pwritev(), with fallback implementations for systems that don't have
them.  Also provide a wrapper pg_pwritev_with_retry() that automatically
retries on short writes.

Reviewed-by: Tom Lane 
Reviewed-by: Andres Freund 
Discussion: 
https://postgr.es/m/CA%2BhUKGJA%2Bu-220VONeoREBXJ9P3S94Y7J%2BkqCnTYmahvZJwM%3Dg%40mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/13a021f3e8c99915b3cc0cb2021a948d9c71ff32

Modified Files
--
configure   |  30 +
configure.ac|   9 +++-
src/include/pg_config.h.in  |  15 +++
src/include/port.h  |   2 +
src/include/port/pg_iovec.h |  59 
src/port/Makefile   |   2 +
src/port/pread.c|  43 +-
src/port/pwrite.c   | 107 +++-
src/tools/msvc/Solution.pm  |   5 +++
9 files changed, 238 insertions(+), 34 deletions(-)



pgsql: Replace remaining uses of "whitelist".

2021-01-04 Thread Thomas Munro
Replace remaining uses of "whitelist".

Instead describe the action that the list effects, or just use "list"
where the meaning is obvious from context.

Author: Dagfinn Ilmari Mannsåker 
Discussion: 
https://postgr.es/m/20200615182235.x7lch5n6kcjq4aue%40alap3.anarazel.de

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/034510c820cd75e0410332d92b4967ef9b844936

Modified Files
--
contrib/postgres_fdw/postgres_fdw.h| 2 +-
contrib/postgres_fdw/shippable.c   | 4 ++--
src/backend/access/hash/hashvalidate.c | 2 +-
src/backend/utils/adt/lockfuncs.c  | 2 +-
src/tools/pginclude/README | 4 ++--
5 files changed, 7 insertions(+), 7 deletions(-)



pgsql: pgindent: whitelist/blacklist -> additional/excluded.

2021-01-04 Thread Thomas Munro
pgindent: whitelist/blacklist -> additional/excluded.

Author: Dagfinn Ilmari Mannsåker 
Discussion: 
https://postgr.es/m/20200615182235.x7lch5n6kcjq4aue%40alap3.anarazel.de

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/fe05b6b620066aec313c43b6b4d6c169d0a346f7

Modified Files
--
src/tools/pgindent/pgindent | 16 
1 file changed, 8 insertions(+), 8 deletions(-)



pgsql: Rename "enum blacklist" to "uncommitted enums".

2021-01-04 Thread Thomas Munro
Rename "enum blacklist" to "uncommitted enums".

We agreed to remove this terminology and use something more descriptive.

Discussion: 
https://postgr.es/m/20200615182235.x7lch5n6kcjq4aue%40alap3.anarazel.de

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/c0d4f6d897492727d4812679e6a94d12edbe016f

Modified Files
--
src/backend/access/transam/parallel.c | 31 +
src/backend/catalog/pg_enum.c | 65 ++-
src/backend/utils/adt/enum.c  |  4 +--
src/include/catalog/pg_enum.h |  8 ++---
4 files changed, 55 insertions(+), 53 deletions(-)



pgsql: Remove unused function prototypes.

2021-01-04 Thread Thomas Munro
Remove unused function prototypes.

Cleanup for commit dee663f7.

Reported-by: Tomas Vondra 
Discussion: 
https://postgr.es/m/CA+hUKGLJ=84yt+nvhkeedauutvhmfq9i-n7k_o50jmq6rpj...@mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/87c23d36a3bc81e57b813f13c403f74a67ff33a9

Modified Files
--
src/include/access/clog.h  | 1 -
src/include/access/commit_ts.h | 1 -
src/include/access/multixact.h | 1 -
src/include/access/subtrans.h  | 1 -
4 files changed, 4 deletions(-)



pgsql: Use truncate(2) where appropriate.

2020-11-30 Thread Thomas Munro
Use truncate(2) where appropriate.

When truncating files by name, use truncate(2).  Windows hasn't got it,
so keep our previous coding based on ftruncate(2) as a fallback.

Discussion: https://postgr.es/m/16663-fe97ccf9932fc800%40postgresql.org

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/57faaf376e1961fa48866c6e5d6926463c6671b1

Modified Files
--
src/backend/storage/file/fd.c | 27 +++
src/backend/storage/smgr/md.c | 13 +
src/include/storage/fd.h  |  1 +
3 files changed, 29 insertions(+), 12 deletions(-)



pgsql: Free disk space for dropped relations on commit.

2020-11-30 Thread Thomas Munro
Free disk space for dropped relations on commit.

When committing a transaction that dropped a relation, we previously
truncated only the first segment file to free up disk space (the one
that won't be unlinked until the next checkpoint).

Truncate higher numbered segments too, even though we unlink them on
commit.  This frees the disk space immediately, even if other backends
have open file descriptors and might take a long time to get around to
handling shared invalidation events and closing them.  Also extend the
same behavior to the first segment, in recovery.

Back-patch to all supported releases.

Bug: #16663
Reported-by: Denis Patron 
Reviewed-by: Pavel Borisov 
Reviewed-by: Neil Chen 
Reviewed-by: David Zhang 
Discussion: https://postgr.es/m/16663-fe97ccf9932fc800%40postgresql.org

Branch
--
REL9_5_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/e00928de8d221435864c8f84421df988c0425ef7

Modified Files
--
src/backend/storage/smgr/md.c | 89 +++
1 file changed, 65 insertions(+), 24 deletions(-)



pgsql: Free disk space for dropped relations on commit.

2020-11-30 Thread Thomas Munro
Free disk space for dropped relations on commit.

When committing a transaction that dropped a relation, we previously
truncated only the first segment file to free up disk space (the one
that won't be unlinked until the next checkpoint).

Truncate higher numbered segments too, even though we unlink them on
commit.  This frees the disk space immediately, even if other backends
have open file descriptors and might take a long time to get around to
handling shared invalidation events and closing them.  Also extend the
same behavior to the first segment, in recovery.

Back-patch to all supported releases.

Bug: #16663
Reported-by: Denis Patron 
Reviewed-by: Pavel Borisov 
Reviewed-by: Neil Chen 
Reviewed-by: David Zhang 
Discussion: https://postgr.es/m/16663-fe97ccf9932fc800%40postgresql.org

Branch
--
REL9_6_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/d0bbe212209924e664a783a767e827df5b5c08d3

Modified Files
--
src/backend/storage/smgr/md.c | 89 +++
1 file changed, 65 insertions(+), 24 deletions(-)



pgsql: Free disk space for dropped relations on commit.

2020-11-30 Thread Thomas Munro
Free disk space for dropped relations on commit.

When committing a transaction that dropped a relation, we previously
truncated only the first segment file to free up disk space (the one
that won't be unlinked until the next checkpoint).

Truncate higher numbered segments too, even though we unlink them on
commit.  This frees the disk space immediately, even if other backends
have open file descriptors and might take a long time to get around to
handling shared invalidation events and closing them.  Also extend the
same behavior to the first segment, in recovery.

Back-patch to all supported releases.

Bug: #16663
Reported-by: Denis Patron 
Reviewed-by: Pavel Borisov 
Reviewed-by: Neil Chen 
Reviewed-by: David Zhang 
Discussion: https://postgr.es/m/16663-fe97ccf9932fc800%40postgresql.org

Branch
--
REL_10_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/22701755dc6429ec5896e37958565466b0509310

Modified Files
--
src/backend/storage/smgr/md.c | 89 +++
1 file changed, 65 insertions(+), 24 deletions(-)



pgsql: Free disk space for dropped relations on commit.

2020-11-30 Thread Thomas Munro
Free disk space for dropped relations on commit.

When committing a transaction that dropped a relation, we previously
truncated only the first segment file to free up disk space (the one
that won't be unlinked until the next checkpoint).

Truncate higher numbered segments too, even though we unlink them on
commit.  This frees the disk space immediately, even if other backends
have open file descriptors and might take a long time to get around to
handling shared invalidation events and closing them.  Also extend the
same behavior to the first segment, in recovery.

Back-patch to all supported releases.

Bug: #16663
Reported-by: Denis Patron 
Reviewed-by: Pavel Borisov 
Reviewed-by: Neil Chen 
Reviewed-by: David Zhang 
Discussion: https://postgr.es/m/16663-fe97ccf9932fc800%40postgresql.org

Branch
--
REL_11_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/d5706ad7b70a03c53d06abff019d4cc56342ab09

Modified Files
--
src/backend/storage/smgr/md.c | 89 +++
1 file changed, 65 insertions(+), 24 deletions(-)



pgsql: Free disk space for dropped relations on commit.

2020-11-30 Thread Thomas Munro
Free disk space for dropped relations on commit.

When committing a transaction that dropped a relation, we previously
truncated only the first segment file to free up disk space (the one
that won't be unlinked until the next checkpoint).

Truncate higher numbered segments too, even though we unlink them on
commit.  This frees the disk space immediately, even if other backends
have open file descriptors and might take a long time to get around to
handling shared invalidation events and closing them.  Also extend the
same behavior to the first segment, in recovery.

Back-patch to all supported releases.

Bug: #16663
Reported-by: Denis Patron 
Reviewed-by: Pavel Borisov 
Reviewed-by: Neil Chen 
Reviewed-by: David Zhang 
Discussion: https://postgr.es/m/16663-fe97ccf9932fc800%40postgresql.org

Branch
--
REL_12_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/50f338574242be955c79ed0b3e193ce3ff4cd5eb

Modified Files
--
src/backend/storage/smgr/md.c | 100 +-
1 file changed, 69 insertions(+), 31 deletions(-)



pgsql: Free disk space for dropped relations on commit.

2020-11-30 Thread Thomas Munro
Free disk space for dropped relations on commit.

When committing a transaction that dropped a relation, we previously
truncated only the first segment file to free up disk space (the one
that won't be unlinked until the next checkpoint).

Truncate higher numbered segments too, even though we unlink them on
commit.  This frees the disk space immediately, even if other backends
have open file descriptors and might take a long time to get around to
handling shared invalidation events and closing them.  Also extend the
same behavior to the first segment, in recovery.

Back-patch to all supported releases.

Bug: #16663
Reported-by: Denis Patron 
Reviewed-by: Pavel Borisov 
Reviewed-by: Neil Chen 
Reviewed-by: David Zhang 
Discussion: https://postgr.es/m/16663-fe97ccf9932fc800%40postgresql.org

Branch
--
REL_13_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/fd3a75d820a4fee3e25b699f1ccc043469afc55c

Modified Files
--
src/backend/storage/smgr/md.c | 100 +-
1 file changed, 69 insertions(+), 31 deletions(-)



pgsql: Free disk space for dropped relations on commit.

2020-11-30 Thread Thomas Munro
Free disk space for dropped relations on commit.

When committing a transaction that dropped a relation, we previously
truncated only the first segment file to free up disk space (the one
that won't be unlinked until the next checkpoint).

Truncate higher numbered segments too, even though we unlink them on
commit.  This frees the disk space immediately, even if other backends
have open file descriptors and might take a long time to get around to
handling shared invalidation events and closing them.  Also extend the
same behavior to the first segment, in recovery.

Back-patch to all supported releases.

Bug: #16663
Reported-by: Denis Patron 
Reviewed-by: Pavel Borisov 
Reviewed-by: Neil Chen 
Reviewed-by: David Zhang 
Discussion: https://postgr.es/m/16663-fe97ccf9932fc800%40postgresql.org

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/9f35f943732eaf9121a107f54ea043925e9a5d7b

Modified Files
--
src/backend/storage/smgr/md.c | 100 +-
1 file changed, 69 insertions(+), 31 deletions(-)



pgsql: Fix WaitLatch(NULL) on Windows.

2020-11-24 Thread Thomas Munro
Fix WaitLatch(NULL) on Windows.

Further to commit 733fa9aa, on Windows when a latch is triggered but we
aren't currently waiting for it, we need to locate the latch's HANDLE
rather than calling ResetEvent(NULL).

Author: Kyotaro Horiguchi 
Reported-by: Ranier Vilela 
Discussion: 
https://postgr.es/m/CAEudQArTPi1YBc%2Bn1fo0Asy3QBFhVjp_QgyKG-8yksVn%2ByRTiw%40mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/a7e65dc88b6f088fc2fcf5a660d866de644b1300

Modified Files
--
src/backend/storage/ipc/latch.c | 6 +-
1 file changed, 5 insertions(+), 1 deletion(-)



pgsql: Add collation versions for FreeBSD.

2020-11-20 Thread Thomas Munro
Add collation versions for FreeBSD.

On FreeBSD 13, use querylocale() to read the current version of libc
collations.  Similar to commits 352f6f2d for Windows and d5ac14f9 for
GNU/Linux.

Discussion: 
https://postgr.es/m/CAEepm%3D0uEQCpfq_%2BLYFBdArCe4Ot98t1aR4eYiYTe%3DyavQygiQ%40mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/ca051d8b101d3205f1c5faf0d1da8a523ffc95a1

Modified Files
--
doc/src/sgml/charset.sgml |  3 ++-
src/backend/utils/adt/pg_locale.c | 20 
2 files changed, 22 insertions(+), 1 deletion(-)



pgsql: Adjust DSM and DSA slot usage constants (back-patch).

2020-11-19 Thread Thomas Munro
Adjust DSM and DSA slot usage constants (back-patch).

1.  Previously, a DSA area would create up to four segments at each size
before doubling the size.  After this commit, it will create only two at
each size, so it ramps up faster and therefore needs fewer slots.

2.  Previously, the total limit on DSM slots allowed for 2 per connection.
Switch to 5 per connection.

This back-patches commit d061ea21 from release 13 into 10-12 based on a
field complaint.

Discussion: 
https://postgr.es/m/CAO03teA%2BjE1qt5iWDWzHqaufqBsF6EoOgZphnazps_tr_jDPZA%40mail.gmail.com
Discussion: 
https://postgr.es/m/CA%2BhUKGL6H2BpGbiF7Lj6QiTjTGyTLW_vLR%3DSn2tEBeTcYXiMKw%40mail.gmail.com

Branch
--
REL_10_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/f5332503ef0a65b90366c2a222e1b5aa64977a95

Modified Files
--
src/backend/storage/ipc/dsm.c | 7 +--
src/backend/utils/mmgr/dsa.c  | 2 +-
2 files changed, 2 insertions(+), 7 deletions(-)



pgsql: Adjust DSM and DSA slot usage constants (back-patch).

2020-11-19 Thread Thomas Munro
Adjust DSM and DSA slot usage constants (back-patch).

1.  Previously, a DSA area would create up to four segments at each size
before doubling the size.  After this commit, it will create only two at
each size, so it ramps up faster and therefore needs fewer slots.

2.  Previously, the total limit on DSM slots allowed for 2 per connection.
Switch to 5 per connection.

This back-patches commit d061ea21 from release 13 into 10-12 based on a
field complaint.

Discussion: 
https://postgr.es/m/CAO03teA%2BjE1qt5iWDWzHqaufqBsF6EoOgZphnazps_tr_jDPZA%40mail.gmail.com
Discussion: 
https://postgr.es/m/CA%2BhUKGL6H2BpGbiF7Lj6QiTjTGyTLW_vLR%3DSn2tEBeTcYXiMKw%40mail.gmail.com

Branch
--
REL_11_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/0455f78ddbb09b6ad3bb6b582b75fd3975a24541

Modified Files
--
src/backend/storage/ipc/dsm.c | 7 +--
src/backend/utils/mmgr/dsa.c  | 2 +-
2 files changed, 2 insertions(+), 7 deletions(-)



pgsql: Adjust DSM and DSA slot usage constants (back-patch).

2020-11-19 Thread Thomas Munro
Adjust DSM and DSA slot usage constants (back-patch).

1.  Previously, a DSA area would create up to four segments at each size
before doubling the size.  After this commit, it will create only two at
each size, so it ramps up faster and therefore needs fewer slots.

2.  Previously, the total limit on DSM slots allowed for 2 per connection.
Switch to 5 per connection.

This back-patches commit d061ea21 from release 13 into 10-12 based on a
field complaint.

Discussion: 
https://postgr.es/m/CAO03teA%2BjE1qt5iWDWzHqaufqBsF6EoOgZphnazps_tr_jDPZA%40mail.gmail.com
Discussion: 
https://postgr.es/m/CA%2BhUKGL6H2BpGbiF7Lj6QiTjTGyTLW_vLR%3DSn2tEBeTcYXiMKw%40mail.gmail.com

Branch
--
REL_12_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/2ded1f1fbb6e8e2b7927cce93238775604069bc3

Modified Files
--
src/backend/storage/ipc/dsm.c | 7 +--
src/backend/utils/mmgr/dsa.c  | 2 +-
2 files changed, 2 insertions(+), 7 deletions(-)



pgsql: Add BarrierArriveAndDetachExceptLast().

2020-11-18 Thread Thomas Munro
Add BarrierArriveAndDetachExceptLast().

Provide a way for one process to continue the remaining phases of a
(previously) parallel computation alone.  Later patches will use this to
extend Parallel Hash Join.

Author: Melanie Plageman 
Reviewed-by: Thomas Munro 
Discussion: 
https://postgr.es/m/CA%2BhUKG%2BA6ftXPz4oe92%2Bx8Er%2BxpGZqto70-Q_ERwRaSyA%3DafNg%40mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/7888b0999488511e4266f2134053fa3a6505a155

Modified Files
--
src/backend/storage/ipc/barrier.c | 22 ++
src/include/storage/barrier.h |  1 +
2 files changed, 23 insertions(+)



pgsql: Fix parsePGArray() error checking in pg_dump.

2020-11-08 Thread Thomas Munro
Fix parsePGArray() error checking in pg_dump.

Coverity complained about a defect in commit 257836a7:

  Calling "parsePGArray" without checking return value (as is
  done elsewhere 11 out of 13 times).

Fix, and also check for empty strings explicitly (NULL as represented by
PQgetvalue()).  That worked correctly before only because parsePGArray()
happens to set *nitems = 0 when it fails on an empty string.  Also
convert a sanity check assertion to an error to be more paranoid, and
pgindent a nearby line.

Reported-by: Michael Paquier 

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/3636efa11945af64479995609762b2626c6c319a

Modified Files
--
src/bin/pg_dump/pg_dump.c | 28 
1 file changed, 20 insertions(+), 8 deletions(-)



pgsql: Fix assertion in collation version lookup.

2020-11-07 Thread Thomas Munro
Fix assertion in collation version lookup.

Commit 257836a7 included an assertion that a version lookup routine is
not trying to look up "C" or "POSIX", but that case is reachable with
the user-facing SQL function pg_collation_actual_version().  Remove the
assertion.

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/d50e3b1f8d763d51080ca4f6cbaa6818a6472292

Modified Files
--
src/backend/utils/adt/pg_locale.c | 7 +++
1 file changed, 3 insertions(+), 4 deletions(-)



pgsql: Fix unlinking of SLRU segments.

2020-11-04 Thread Thomas Munro
Fix unlinking of SLRU segments.

Commit dee663f7 intended to drop any queued up fsync requests before
unlinking segment files, but missed a code path.  Fix, by centralizing
the forget-and-unlink code into a single function.

Reported-by: Tomas Vondra 
Discussion: https://postgr.es/m/20201104013205.icogbi773przyny5%40development

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/c732c3f8c122009de373cff9b44b5cf0992ba1bf

Modified Files
--
src/backend/access/transam/slru.c | 44 ---
1 file changed, 18 insertions(+), 26 deletions(-)



pgsql: Tolerate version lookup failure for old style Windows locale nam

2020-11-03 Thread Thomas Munro
Tolerate version lookup failure for old style Windows locale names.

Accept that we can't get versions for such locale names for now.  Users
will need to specify the newer language tag format to enable the
collation versioning feature.  It's not clear that we can do automatic
conversion from the old style to the new style reliably enough for this
purpose.

Unfortunately, this means that collation versioning probably won't work
for the default collation unless you provide something like en-US at
initdb or CREATE DATABASE time (though, for reasons not yet understood,
it does seem to work on some systems).  It'd be nice to find a better
solution, or document this quirk if we settle on it, but this should
unbreak the 3 failing build farm animals in the meantime.

Reviewed-by: David Rowley 
Reviewed-by: Tom Lane 
Discussion: 
https://postgr.es/m/CAEepm%3D0uEQCpfq_%2BLYFBdArCe4Ot98t1aR4eYiYTe%3DyavQygiQ%40mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/9f12a3b95dd56c897f1aa3d756d8fb419e84a187

Modified Files
--
src/backend/utils/adt/pg_locale.c | 12 
1 file changed, 12 insertions(+)



pgsql: Track collation versions for indexes.

2020-11-02 Thread Thomas Munro
Track collation versions for indexes.

Record the current version of dependent collations in pg_depend when
creating or rebuilding an index.  When accessing the index later, warn
that the index may be corrupted if the current version doesn't match.

Thanks to Douglas Doole, Peter Eisentraut, Christoph Berg, Laurenz Albe,
Michael Paquier, Robert Haas, Tom Lane and others for very helpful
discussion.

Author: Thomas Munro 
Author: Julien Rouhaud 
Reviewed-by: Peter Eisentraut  (earlier 
versions)
Discussion: 
https://postgr.es/m/CAEepm%3D0uEQCpfq_%2BLYFBdArCe4Ot98t1aR4eYiYTe%3DyavQygiQ%40mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/257836a75585934cc05ed7a80bccf8190d41e056

Modified Files
--
doc/src/sgml/catalogs.sgml |   3 +-
doc/src/sgml/charset.sgml  |  38 +
doc/src/sgml/func.sgml |   4 +-
doc/src/sgml/ref/alter_index.sgml  |  15 ++
doc/src/sgml/ref/pgupgrade.sgml|  15 ++
doc/src/sgml/ref/reindex.sgml  |   9 ++
src/backend/catalog/dependency.c   | 182 ++
src/backend/catalog/heap.c |   7 +-
src/backend/catalog/index.c| 197 ++--
src/backend/catalog/pg_constraint.c|   2 +-
src/backend/catalog/pg_depend.c|  46 +-
src/backend/catalog/pg_type.c  |  60 
src/backend/commands/collationcmds.c   |  16 +-
src/backend/commands/tablecmds.c   |  31 
src/backend/nodes/copyfuncs.c  |   1 +
src/backend/optimizer/util/plancat.c   |   9 ++
src/backend/parser/gram.y  |   8 +
src/backend/utils/adt/pg_locale.c  |  46 +-
src/backend/utils/adt/pg_upgrade_support.c |   1 +
src/backend/utils/cache/relcache.c |   2 +
src/bin/pg_dump/pg_backup.h|   1 +
src/bin/pg_dump/pg_dump.c  | 182 +-
src/bin/pg_dump/pg_dump.h  |   2 +
src/bin/pg_upgrade/dump.c  |   4 +-
src/bin/pg_upgrade/option.c|   7 +
src/bin/pg_upgrade/pg_upgrade.h|   1 +
src/bin/psql/tab-complete.c|  29 +++-
src/include/catalog/catversion.h   |   2 +-
src/include/catalog/dependency.h   |  25 ++-
src/include/catalog/index.h|   3 +
src/include/catalog/pg_depend.h|   3 +-
src/include/catalog/pg_type.h  |   2 +
src/include/nodes/parsenodes.h |   4 +-
src/include/utils/pg_locale.h  |   2 +-
src/include/utils/rel.h|   1 +
src/test/Makefile  |   3 +-
src/test/locale/.gitignore |   1 +
src/test/locale/Makefile   |   7 +
src/test/locale/t/001_index.pl |  67 +
src/test/regress/expected/collate.icu.utf8.out | 201 +
src/test/regress/expected/create_index.out |   8 +-
src/test/regress/sql/collate.icu.utf8.sql  | 132 
src/tools/pgindent/typedefs.list   |   2 +
43 files changed, 1287 insertions(+), 94 deletions(-)



pgsql: Add pg_depend.refobjversion.

2020-11-02 Thread Thomas Munro
Add pg_depend.refobjversion.

Provide a place for the version of referenced database objects to be
recorded.  A follow-up commit will use this to record dependencies on
collation versions for indexes, but similar ideas for other kinds of
objects have also been mooted.

Author: Thomas Munro 
Reviewed-by: Julien Rouhaud 
Reviewed-by: Peter Eisentraut 
Discussion: 
https://postgr.es/m/CAEepm%3D0uEQCpfq_%2BLYFBdArCe4Ot98t1aR4eYiYTe%3DyavQygiQ%40mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/cd6f479e79f3a33ef7a919c6b6c0c498c790f154

Modified Files
--
doc/src/sgml/catalogs.sgml| 11 +++
src/backend/catalog/dependency.c  | 14 ++
src/backend/catalog/pg_depend.c   | 14 ++
src/include/catalog/catversion.h  |  2 +-
src/include/catalog/dependency.h  |  1 +
src/include/catalog/pg_depend.h   |  4 
src/include/catalog/toasting.h|  1 +
src/test/regress/expected/misc_sanity.out |  4 ++--
8 files changed, 40 insertions(+), 11 deletions(-)



pgsql: Remove pg_collation.collversion.

2020-11-02 Thread Thomas Munro
Remove pg_collation.collversion.

This model couldn't be extended to cover the default collation, and
didn't have any information about the affected database objects when the
version changed.  Remove, in preparation for a follow-up commit that
will add a new mechanism.

Author: Thomas Munro 
Reviewed-by: Julien Rouhaud 
Reviewed-by: Peter Eisentraut 
Discussion: 
https://postgr.es/m/CAEepm%3D0uEQCpfq_%2BLYFBdArCe4Ot98t1aR4eYiYTe%3DyavQygiQ%40mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/7d1297df0830725d4434ba7dbf71a9e8221ad49e

Modified Files
--
doc/src/sgml/catalogs.sgml   | 11 ---
doc/src/sgml/func.sgml   |  6 +-
doc/src/sgml/ref/alter_collation.sgml| 63 -
doc/src/sgml/ref/create_collation.sgml   | 21 --
src/backend/catalog/pg_collation.c   |  5 --
src/backend/commands/collationcmds.c | 88 
src/backend/nodes/copyfuncs.c| 13 
src/backend/nodes/equalfuncs.c   | 11 ---
src/backend/parser/gram.y| 18 +
src/backend/tcop/utility.c   | 12 
src/backend/utils/adt/pg_locale.c| 37 --
src/bin/pg_dump/pg_dump.c| 24 +--
src/include/catalog/catversion.h |  2 +-
src/include/catalog/pg_collation.dat |  7 +-
src/include/catalog/pg_collation.h   |  5 --
src/include/catalog/toasting.h   |  1 -
src/include/commands/collationcmds.h |  1 -
src/include/nodes/parsenodes.h   | 11 ---
src/test/regress/expected/collate.icu.utf8.out   |  3 -
src/test/regress/expected/collate.linux.utf8.out |  3 -
src/test/regress/sql/collate.icu.utf8.sql|  5 --
src/test/regress/sql/collate.linux.utf8.sql  |  5 --
22 files changed, 8 insertions(+), 344 deletions(-)



pgsql: Handle EACCES errors from kevent() better.

2020-10-14 Thread Thomas Munro
Handle EACCES errors from kevent() better.

While registering for postmaster exit events, we have to handle a couple
of edge cases where the postmaster is already gone.  Commit 815c2f09
missed one: EACCES must surely imply that PostmasterPid no longer
belongs to our postmaster process (or alternatively an unexpected
permissions model has been imposed on us).  Like ESRCH, this should be
treated as a WL_POSTMASTER_DEATH event, rather than being raised with
ereport().

No known problems reported in the wild.  Per code review from Tom Lane.
Back-patch to 13.

Reported-by: Tom Lane 
Discussion: https://postgr.es/m/3624029.1602701929%40sss.pgh.pa.us

Branch
--
REL_13_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/47522ee00ddbe77280e4c063605b443ec1de3881

Modified Files
--
src/backend/storage/ipc/latch.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)



pgsql: Handle EACCES errors from kevent() better.

2020-10-14 Thread Thomas Munro
Handle EACCES errors from kevent() better.

While registering for postmaster exit events, we have to handle a couple
of edge cases where the postmaster is already gone.  Commit 815c2f09
missed one: EACCES must surely imply that PostmasterPid no longer
belongs to our postmaster process (or alternatively an unexpected
permissions model has been imposed on us).  Like ESRCH, this should be
treated as a WL_POSTMASTER_DEATH event, rather than being raised with
ereport().

No known problems reported in the wild.  Per code review from Tom Lane.
Back-patch to 13.

Reported-by: Tom Lane 
Discussion: https://postgr.es/m/3624029.1602701929%40sss.pgh.pa.us

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/70516a178ad0fc54d0f0d2a88175af3e1e92f83f

Modified Files
--
src/backend/storage/ipc/latch.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)



pgsql: Make WL_POSTMASTER_DEATH level-triggered on kqueue builds.

2020-10-14 Thread Thomas Munro
Make WL_POSTMASTER_DEATH level-triggered on kqueue builds.

If WaitEventSetWait() reports that the postmaster has gone away, later
calls to WaitEventSetWait() should continue to report that.  Otherwise
further waits that occur in the proc_exit() path after we already
noticed the postmaster's demise could block forever.

Back-patch to 13, where the kqueue support landed.

Reported-by: Tom Lane 
Discussion: https://postgr.es/m/3624029.1602701929%40sss.pgh.pa.us

Branch
--
REL_13_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/e0950135ae5d50140feecc7bc87c018019c6e406

Modified Files
--
src/backend/storage/ipc/latch.c | 12 +++-
1 file changed, 11 insertions(+), 1 deletion(-)



pgsql: Make WL_POSTMASTER_DEATH level-triggered on kqueue builds.

2020-10-14 Thread Thomas Munro
Make WL_POSTMASTER_DEATH level-triggered on kqueue builds.

If WaitEventSetWait() reports that the postmaster has gone away, later
calls to WaitEventSetWait() should continue to report that.  Otherwise
further waits that occur in the proc_exit() path after we already
noticed the postmaster's demise could block forever.

Back-patch to 13, where the kqueue support landed.

Reported-by: Tom Lane 
Discussion: https://postgr.es/m/3624029.1602701929%40sss.pgh.pa.us

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/b94109ce375b137f235149bfba3559c69f4573e7

Modified Files
--
src/backend/storage/ipc/latch.c | 12 +++-
1 file changed, 11 insertions(+), 1 deletion(-)



pgsql: Fix estimates for ModifyTable paths without RETURNING.

2020-10-12 Thread Thomas Munro
Fix estimates for ModifyTable paths without RETURNING.

In the past, we always estimated that a ModifyTable node would emit the
same number of rows as its subpaths.  Without a RETURNING clause, the
correct estimate is zero.  Fix, in preparation for a proposed parallel
write patch that is sensitive to that number.

A remaining problem is that for RETURNING queries, the estimated width
is based on subpath output rather than the RETURNING tlist.

Reviewed-by: Greg Nancarrow 
Discussion: 
https://postgr.es/m/CAJcOf-cXnB5cnMKqWEp2E2z7Mvcd04iLVmV%3DqpFJrR3AcrTS3g%40mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/f0f13a3a08b2757997410f3a1c38bdc22973c525

Modified Files
--
src/backend/optimizer/util/pathnode.c | 13 -
1 file changed, 8 insertions(+), 5 deletions(-)



pgsql: Defer flushing of SLRU files.

2020-09-25 Thread Thomas Munro
Defer flushing of SLRU files.

Previously, we called fsync() after writing out individual pg_xact,
pg_multixact and pg_commit_ts pages due to cache pressure, leading to
regular I/O stalls in user backends and recovery.  Collapse requests for
the same file into a single system call as part of the next checkpoint,
as we already did for relation files, using the infrastructure developed
by commit 3eb77eba.  This can cause a significant improvement to
recovery performance, especially when it's otherwise CPU-bound.

Hoist ProcessSyncRequests() up into CheckPointGuts() to make it clearer
that it applies to all the SLRU mini-buffer-pools as well as the main
buffer pool.  Rearrange things so that data collected in CheckpointStats
includes SLRU activity.

Also remove the Shutdown{CLOG,CommitTS,SUBTRANS,MultiXact}() functions,
because they were redundant after the shutdown checkpoint that
immediately precedes them.  (I'm not sure if they were ever needed, but
they aren't now.)

Reviewed-by: Tom Lane  (parts)
Tested-by: Jakub Wartak 
Discussion: 
https://postgr.es/m/CA+hUKGLJ=84yt+nvhkeedauutvhmfq9i-n7k_o50jmq6rpj...@mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/dee663f7843902535a15ae366cede8b4089f1144

Modified Files
--
src/backend/access/transam/clog.c  |  40 -
src/backend/access/transam/commit_ts.c |  36 
src/backend/access/transam/multixact.c |  57 ++--
src/backend/access/transam/slru.c  | 154 +++--
src/backend/access/transam/subtrans.c  |  25 +-
src/backend/access/transam/xlog.c  |  28 +++---
src/backend/commands/async.c   |   5 +-
src/backend/storage/buffer/bufmgr.c|   7 --
src/backend/storage/lmgr/predicate.c   |   8 +-
src/backend/storage/sync/sync.c|  28 +-
src/include/access/clog.h  |   3 +
src/include/access/commit_ts.h |   3 +
src/include/access/multixact.h |   4 +
src/include/access/slru.h  |  14 +--
src/include/storage/sync.h |   7 +-
src/tools/pgindent/typedefs.list   |   5 +-
16 files changed, 252 insertions(+), 172 deletions(-)



pgsql: Fix missing fsync of SLRU directories.

2020-09-23 Thread Thomas Munro
Fix missing fsync of SLRU directories.

Harmonize behavior by moving reponsibility for fsyncing directories down
into slru.c.  In 10 and later, only the multixact directories were
missed (see commit 1b02be21), and in older branches all SLRUs were
missed.

Back-patch to all supported releases.

Reviewed-by: Andres Freund 
Reviewed-by: Michael Paquier 
Discussion: 
https://postgr.es/m/CA%2BhUKGLtsTUOScnNoSMZ-2ZLv%2BwGh01J6kAo_DM8mTRq1sKdSQ%40mail.gmail.com

Branch
--
REL9_5_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/23d8b3577d0c247731addc188fe0479aa8f81c45

Modified Files
--
src/backend/access/transam/slru.c | 4 
1 file changed, 4 insertions(+)



pgsql: Fix missing fsync of SLRU directories.

2020-09-23 Thread Thomas Munro
Fix missing fsync of SLRU directories.

Harmonize behavior by moving reponsibility for fsyncing directories down
into slru.c.  In 10 and later, only the multixact directories were
missed (see commit 1b02be21), and in older branches all SLRUs were
missed.

Back-patch to all supported releases.

Reviewed-by: Andres Freund 
Reviewed-by: Michael Paquier 
Discussion: 
https://postgr.es/m/CA%2BhUKGLtsTUOScnNoSMZ-2ZLv%2BwGh01J6kAo_DM8mTRq1sKdSQ%40mail.gmail.com

Branch
--
REL_10_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/dd36d6b0038928a0aa05b1847a7a44ff136349de

Modified Files
--
src/backend/access/transam/clog.c  | 7 ---
src/backend/access/transam/commit_ts.c | 6 --
src/backend/access/transam/slru.c  | 4 
3 files changed, 4 insertions(+), 13 deletions(-)



pgsql: Fix missing fsync of SLRU directories.

2020-09-23 Thread Thomas Munro
Fix missing fsync of SLRU directories.

Harmonize behavior by moving reponsibility for fsyncing directories down
into slru.c.  In 10 and later, only the multixact directories were
missed (see commit 1b02be21), and in older branches all SLRUs were
missed.

Back-patch to all supported releases.

Reviewed-by: Andres Freund 
Reviewed-by: Michael Paquier 
Discussion: 
https://postgr.es/m/CA%2BhUKGLtsTUOScnNoSMZ-2ZLv%2BwGh01J6kAo_DM8mTRq1sKdSQ%40mail.gmail.com

Branch
--
REL9_6_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/d38e15979ba484380cc3c54648e4985d44fb0b5e

Modified Files
--
src/backend/access/transam/slru.c | 4 
1 file changed, 4 insertions(+)



pgsql: Fix missing fsync of SLRU directories.

2020-09-23 Thread Thomas Munro
Fix missing fsync of SLRU directories.

Harmonize behavior by moving reponsibility for fsyncing directories down
into slru.c.  In 10 and later, only the multixact directories were
missed (see commit 1b02be21), and in older branches all SLRUs were
missed.

Back-patch to all supported releases.

Reviewed-by: Andres Freund 
Reviewed-by: Michael Paquier 
Discussion: 
https://postgr.es/m/CA%2BhUKGLtsTUOScnNoSMZ-2ZLv%2BwGh01J6kAo_DM8mTRq1sKdSQ%40mail.gmail.com

Branch
--
REL_11_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/c5a5bd0bb6ffaaf2ea14dba37b578412523071c8

Modified Files
--
src/backend/access/transam/clog.c  | 7 ---
src/backend/access/transam/commit_ts.c | 6 --
src/backend/access/transam/slru.c  | 4 
3 files changed, 4 insertions(+), 13 deletions(-)



pgsql: Fix missing fsync of SLRU directories.

2020-09-23 Thread Thomas Munro
Fix missing fsync of SLRU directories.

Harmonize behavior by moving reponsibility for fsyncing directories down
into slru.c.  In 10 and later, only the multixact directories were
missed (see commit 1b02be21), and in older branches all SLRUs were
missed.

Back-patch to all supported releases.

Reviewed-by: Andres Freund 
Reviewed-by: Michael Paquier 
Discussion: 
https://postgr.es/m/CA%2BhUKGLtsTUOScnNoSMZ-2ZLv%2BwGh01J6kAo_DM8mTRq1sKdSQ%40mail.gmail.com

Branch
--
REL_12_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/7664cc869aba2ca116eb04d9b86fc88f24084836

Modified Files
--
src/backend/access/transam/clog.c  | 7 ---
src/backend/access/transam/commit_ts.c | 6 --
src/backend/access/transam/slru.c  | 4 
3 files changed, 4 insertions(+), 13 deletions(-)



pgsql: Fix missing fsync of SLRU directories.

2020-09-23 Thread Thomas Munro
Fix missing fsync of SLRU directories.

Harmonize behavior by moving reponsibility for fsyncing directories down
into slru.c.  In 10 and later, only the multixact directories were
missed (see commit 1b02be21), and in older branches all SLRUs were
missed.

Back-patch to all supported releases.

Reviewed-by: Andres Freund 
Reviewed-by: Michael Paquier 
Discussion: 
https://postgr.es/m/CA%2BhUKGLtsTUOScnNoSMZ-2ZLv%2BwGh01J6kAo_DM8mTRq1sKdSQ%40mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/aca74843e40f43d0cceffd314aec6aa6f80e83d5

Modified Files
--
src/backend/access/transam/clog.c  | 7 ---
src/backend/access/transam/commit_ts.c | 6 --
src/backend/access/transam/slru.c  | 4 
3 files changed, 4 insertions(+), 13 deletions(-)



pgsql: Fix missing fsync of SLRU directories.

2020-09-23 Thread Thomas Munro
Fix missing fsync of SLRU directories.

Harmonize behavior by moving reponsibility for fsyncing directories down
into slru.c.  In 10 and later, only the multixact directories were
missed (see commit 1b02be21), and in older branches all SLRUs were
missed.

Back-patch to all supported releases.

Reviewed-by: Andres Freund 
Reviewed-by: Michael Paquier 
Discussion: 
https://postgr.es/m/CA%2BhUKGLtsTUOScnNoSMZ-2ZLv%2BwGh01J6kAo_DM8mTRq1sKdSQ%40mail.gmail.com

Branch
--
REL_13_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/052014a2066827cb96dbc9ef464ce44293585601

Modified Files
--
src/backend/access/transam/clog.c  | 7 ---
src/backend/access/transam/commit_ts.c | 6 --
src/backend/access/transam/slru.c  | 4 
3 files changed, 4 insertions(+), 13 deletions(-)



pgsql: Allow WaitLatch() to be used without a latch.

2020-09-22 Thread Thomas Munro
Allow WaitLatch() to be used without a latch.

Due to flaws in commit 3347c982bab, using WaitLatch() without
WL_LATCH_SET could cause an assertion failure or crash.  Repair.

While here, also add a check that the latch we're switching to belongs
to this backend, when changing from one latch to another.

Discussion: 
https://postgr.es/m/CA%2BhUKGK1607VmtrDUHQXrsooU%3Dap4g4R2yaoByWOOA3m8xevUQ%40mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/733fa9aa51c526582f100aa0d375e0eb9a6bce8b

Modified Files
--
src/backend/storage/ipc/latch.c | 23 +++
1 file changed, 19 insertions(+), 4 deletions(-)



pgsql: Code review for dynahash change.

2020-09-18 Thread Thomas Munro
Code review for dynahash change.

Commit be0a left behind a comment about the order of some tests that
didn't make sense without the expensive division, and in fact we might
as well change the order to one that fails more cheaply most of the time
as a micro-optimization.  Also, remove the "+ 1" applied to max_bucket,
to drop an instruction and match the original behavior.  Per review
from Tom Lane.

Discussion: 
https://postgr.es/m/VI1PR0701MB696044FC35013A96FECC7AC8F62D0%40VI1PR0701MB6960.eurprd07.prod.outlook.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/ff28809feb442eabd303955277f05cd16d9c6d8a

Modified Files
--
src/backend/utils/hash/dynahash.c | 7 +++
1 file changed, 3 insertions(+), 4 deletions(-)



pgsql: Remove large fill factor support from dynahash.c.

2020-09-18 Thread Thomas Munro
Remove large fill factor support from dynahash.c.

Since ancient times we have had support for a fill factor (maximum load
factor) to be set for a dynahash hash table, but:

1.  It was an integer, whereas for in-memory hash tables interesting
load factor targets are probably somewhere near the 0.75-1.0 range.

2.  It was implemented in a way that performed an expensive division
operation that regularly showed up in profiles.

3.  We are not aware of anyone ever having used a non-default value.

Therefore, remove support, effectively fixing it at 1.

Author: Jakub Wartak 
Reviewed-by: Alvaro Herrera 
Reviewed-by: Tomas Vondra 
Reviewed-by: Thomas Munro 
Reviewed-by: David Rowley 
Discussion: 
https://postgr.es/m/VI1PR0701MB696044FC35013A96FECC7AC8F62D0%40VI1PR0701MB6960.eurprd07.prod.outlook.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/be0a656ec3f68eb7d8e7abab5139fcd47012

Modified Files
--
src/backend/utils/hash/dynahash.c | 20 ++--
src/include/utils/hsearch.h   |  2 --
2 files changed, 6 insertions(+), 16 deletions(-)



pgsql: Add d_type to our Windows dirent emulation.

2020-09-07 Thread Thomas Munro
Add d_type to our Windows dirent emulation.

This allows us to skip some stat calls, by extending commit 861c6e7c to
cover Windows systems.

Author: Juan José Santamaría Flecha 
Reviewed-by: Alvaro Herrera 
Reviewed-by: Andres Freund 
Reviewed-by: Magnus Hagander 
Reviewed-by: Thomas Munro 
Discussion: 
https://postgr.es/m/CA%2BhUKG%2BFzxupGGN4GpUdbzZN%2Btn6FQPHo8w0Q%2BAPH5Wz8RG%2Bww%40mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/87e6ed7c8c6abb6dd62119259d2fd89169a04ac0

Modified Files
--
src/include/port/win32_msvc/dirent.h | 11 +++
src/port/dirent.c| 10 ++
2 files changed, 21 insertions(+)



pgsql: Skip unnecessary stat() calls in walkdir().

2020-09-06 Thread Thomas Munro
Skip unnecessary stat() calls in walkdir().

Some kernels can tell us the type of a "dirent", so we can avoid a call
to stat() or lstat() in many cases.  Define a new function
get_dirent_type() to contain that logic, for use by the backend and
frontend versions of walkdir(), and perhaps other callers in future.

Reviewed-by: Tom Lane 
Reviewed-by: Juan José Santamaría Flecha 
Discussion: 
https://postgr.es/m/CA%2BhUKG%2BFzxupGGN4GpUdbzZN%2Btn6FQPHo8w0Q%2BAPH5Wz8RG%2Bww%40mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/861c6e7c8e4dfdd842442dde47cc653764baff4f

Modified Files
--
src/backend/storage/file/fd.c|  33 ++--
src/common/Makefile  |   2 +-
src/common/file_utils.c  | 109 ---
src/include/common/file_utils.h  |  20 ++-
src/tools/msvc/Mkvcbuild.pm  |   4 +-
src/tools/pgindent/typedefs.list |   1 +
6 files changed, 129 insertions(+), 40 deletions(-)



pgsql: Fix rare failure in LDAP tests.

2020-08-02 Thread Thomas Munro
Fix rare failure in LDAP tests.

Instead of writing a query to psql's stdin, use -c.  This avoids a
failure where psql exits before we write, seen a few times on the build
farm.  Thanks to Tom Lane for the suggestion.

Back-patch to 11, where the LDAP tests arrived.

Reviewed-by: Noah Misch 
Discussion: 
https://postgr.es/m/CA%2BhUKGLFmW%2BHQYPeKiwSp5sdFFHtFViCpw4Mh6yAgEx74r5-Cw%40mail.gmail.com

Branch
--
REL_11_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/1beb3ac5184fd32e8a1a79f4ace477a9e7ea27a7

Modified Files
--
src/test/ldap/t/001_auth.pl | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)



pgsql: Fix rare failure in LDAP tests.

2020-08-02 Thread Thomas Munro
Fix rare failure in LDAP tests.

Instead of writing a query to psql's stdin, use -c.  This avoids a
failure where psql exits before we write, seen a few times on the build
farm.  Thanks to Tom Lane for the suggestion.

Back-patch to 11, where the LDAP tests arrived.

Reviewed-by: Noah Misch 
Discussion: 
https://postgr.es/m/CA%2BhUKGLFmW%2BHQYPeKiwSp5sdFFHtFViCpw4Mh6yAgEx74r5-Cw%40mail.gmail.com

Branch
--
REL_13_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/f5293fb09e7346bb663f2f5c63081e8aabe61a8e

Modified Files
--
src/test/ldap/t/001_auth.pl | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)



pgsql: Fix rare failure in LDAP tests.

2020-08-02 Thread Thomas Munro
Fix rare failure in LDAP tests.

Instead of writing a query to psql's stdin, use -c.  This avoids a
failure where psql exits before we write, seen a few times on the build
farm.  Thanks to Tom Lane for the suggestion.

Back-patch to 11, where the LDAP tests arrived.

Reviewed-by: Noah Misch 
Discussion: 
https://postgr.es/m/CA%2BhUKGLFmW%2BHQYPeKiwSp5sdFFHtFViCpw4Mh6yAgEx74r5-Cw%40mail.gmail.com

Branch
--
REL_12_STABLE

Details
---
https://git.postgresql.org/pg/commitdiff/76b2b3e72438dda2ec0566ee85feadde3224ff2f

Modified Files
--
src/test/ldap/t/001_auth.pl | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)



pgsql: Fix rare failure in LDAP tests.

2020-08-02 Thread Thomas Munro
Fix rare failure in LDAP tests.

Instead of writing a query to psql's stdin, use -c.  This avoids a
failure where psql exits before we write, seen a few times on the build
farm.  Thanks to Tom Lane for the suggestion.

Back-patch to 11, where the LDAP tests arrived.

Reviewed-by: Noah Misch 
Discussion: 
https://postgr.es/m/CA%2BhUKGLFmW%2BHQYPeKiwSp5sdFFHtFViCpw4Mh6yAgEx74r5-Cw%40mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/f44b9b625bedd8e0bca67b3b42ba10ce482fa31b

Modified Files
--
src/test/ldap/t/001_auth.pl | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)



pgsql: Correct comment in simplehash.h.

2020-08-02 Thread Thomas Munro
Correct comment in simplehash.h.

Post-commit review for commit 84c0e4b9.

Author: David Rowley 
Discussion: 
https://postgr.es/m/CAApHDvptBx_%2BUPAzY0uXzopbvPVGKPeZ6Hoy8rnPcWz20Cr0Bw%40mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/63e9aa6879cc5b87c77bab9afea3740748a4f00b

Modified Files
--
src/include/lib/simplehash.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)



Re: pgsql: Fix some issues with step generation in partition pruning.

2020-08-01 Thread Thomas Munro
On Tue, Jul 28, 2020 at 2:01 PM Etsuro Fujita  wrote:
> src/backend/partitioning/partprune.c  | 187 ++

Hi Fujita-san

I wonder if this build farm failure is related?

Program terminated with signal 11, Segmentation fault.
...
#0  0x59c15c in gen_partprune_steps_internal (context=0x40223d28, clauses=0x0)
at partprune.c:1483
1483 for (i = 0; i < pc->keyno; i++)

https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=gaur&dt=2020-08-01%2004%3A12%3A08




pgsql: Use pg_pread() and pg_pwrite() in slru.c.

2020-08-01 Thread Thomas Munro
Use pg_pread() and pg_pwrite() in slru.c.

This avoids lseek() system calls at every SLRU I/O, as was
done for relation files in commit c24dcd0c.

Reviewed-by: Ashwin Agrawal 
Reviewed-by: Andres Freund 
Discussion: 
https://postgr.es/m/CA%2BhUKG%2Biqke4uTRFj8D8uEUUgj%2BRokPSp%2BCWM6YYzaaamG9Wvg%40mail.gmail.com
Discussion: 
https://postgr.es/m/CA%2BhUKGJ%2BoHhnvqjn3%3DHro7xu-YDR8FPr0FL6LF35kHRX%3D_bUzg%40mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/e2b37d9e7cabc90633c4bd822e1bcfdd1bda44c4

Modified Files
--
src/backend/access/transam/slru.c | 25 -
1 file changed, 4 insertions(+), 21 deletions(-)



pgsql: Improve programmer docs for simplehash and dynahash.

2020-07-31 Thread Thomas Munro
Improve programmer docs for simplehash and dynahash.

When reading the code it's not obvious when one should prefer dynahash
over simplehash and vice-versa, so, for programmer-friendliness, add
comments to inform that decision.

Show sample simplehash method signatures.

Author: James Coleman 
Discussion: 
https://postgr.es/m/CAAaqYe_dOF39gAJ8rL-a3YO3Qo96MHMRQ2whFjK5ZcU6YvMQSA%40mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/84c0e4b9bce794da914fe9c062753bf21369745f

Modified Files
--
src/backend/utils/hash/dynahash.c | 12 ++-
src/include/lib/simplehash.h  | 73 ---
2 files changed, 80 insertions(+), 5 deletions(-)



Re: pgsql: Preallocate some DSM space at startup.

2020-07-31 Thread Thomas Munro
On Fri, Jul 31, 2020 at 6:26 PM Michael Paquier  wrote:
> longfin is complaning on this one:
> https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=longfin&dt=2020-07-31%2005%3A59%3A08
> guc.c:2241:38: error: implicit conversion from 'unsigned long' to
> 'int' changes value from 17592186044415 to -1
> [-Werror,-Wconstant-conversion]
> 0, 0, Min(INT_MAX, SIZE_MAX / 1024 / 1024),
>   ~^~~

Thanks.  I pushed a fix after checking on Clang 11 and GCC 8 that it's
warning-free and produces the value I want on 32 and 64 bit builds.




pgsql: Fix compiler warning from Clang.

2020-07-31 Thread Thomas Munro
Fix compiler warning from Clang.

Per build farm.

Discussion: https://postgr.es/m/20200731062626.GD3317%40paquier.xyz

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/7be04496a9f763fc4d4c1d06ce9ccc250e52df31

Modified Files
--
src/backend/utils/misc/guc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)



pgsql: Preallocate some DSM space at startup.

2020-07-30 Thread Thomas Munro
Preallocate some DSM space at startup.

Create an optional region in the main shared memory segment that can be
used to acquire and release "fast" DSM segments, and can benefit from
huge pages allocated at cluster startup time, if configured.  Fall back
to the existing mechanisms when that space is full.  The size is
controlled by a new GUC min_dynamic_shared_memory, defaulting to 0.

Main region DSM segments initially contain whatever garbage the memory
held last time they were used, rather than zeroes.  That change revealed
that DSA areas failed to initialize themselves correctly in memory that
wasn't zeroed first, so fix that problem.

Discussion: 
https://postgr.es/m/CA%2BhUKGLAE2QBv-WgGp%2BD9P_J-%3Dyne3zof9nfMaqq1h3EGHFXYQ%40mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/84b1c63ad41872792d47e523363fce1f0e230022

Modified Files
--
doc/src/sgml/config.sgml  |  24 
src/backend/storage/ipc/dsm.c | 191 +++---
src/backend/storage/ipc/dsm_impl.c|   3 +
src/backend/storage/ipc/ipci.c|   3 +
src/backend/utils/misc/guc.c  |  11 ++
src/backend/utils/misc/postgresql.conf.sample |   1 +
src/backend/utils/mmgr/dsa.c  |   5 +-
src/include/storage/dsm.h |   3 +
src/include/storage/dsm_impl.h|   1 +
9 files changed, 216 insertions(+), 26 deletions(-)



pgsql: Cache smgrnblocks() results in recovery.

2020-07-30 Thread Thomas Munro
Cache smgrnblocks() results in recovery.

Avoid repeatedly calling lseek(SEEK_END) during recovery by caching
the size of each fork.  For now, we can't use the same technique in
other processes, because we lack a shared invalidation mechanism.

Do this by generalizing the pre-existing caching used by FSM and VM
to support all forks.

Discussion: 
https://postgr.es/m/CAEepm%3D3SSw-Ty1DFcK%3D1rU-K6GSzYzfdD4d%2BZwapdN7dTa6%3DnQ%40mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/c5315f4f44843c20ada876fdb0d0828795dfbdf5

Modified Files
--
contrib/pg_visibility/pg_visibility.c |  2 +-
src/backend/access/heap/visibilitymap.c   | 18 +---
src/backend/catalog/storage.c |  4 +--
src/backend/storage/freespace/freespace.c | 27 +
src/backend/storage/smgr/smgr.c   | 49 +++
src/include/storage/smgr.h| 12 
6 files changed, 66 insertions(+), 46 deletions(-)



pgsql: Introduce a WaitEventSet for the stats collector.

2020-07-29 Thread Thomas Munro
Introduce a WaitEventSet for the stats collector.

This avoids avoids some epoll/kqueue system calls for every wait.

Reviewed-by: Kyotaro Horiguchi 
Discussion: 
https://postgr.es/m/CA%2BhUKGJAC4Oqao%3DqforhNey20J8CiG2R%3DoBPqvfR0vOJrFysGw%40mail.gmail.com

Branch
--
master

Details
---
https://git.postgresql.org/pg/commitdiff/e7591fd3cae6c64236ef29d3c87e69b96608a19b

Modified Files
--
src/backend/postmaster/pgstat.c | 24 ++--
1 file changed, 14 insertions(+), 10 deletions(-)



<    3   4   5   6   7   8   9   10   11   12   >