pgsql: Change one AssertMacro to Assert

2022-04-06 Thread Peter Eisentraut
Change one AssertMacro to Assert What surrounds it is no longer a macro (e27f4ee0a701). Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/b604a1c204fce2600730cb60aa78e04e949fa588 Modified Files -- src/include/access/htup_details.h | 2 +- 1 file changed, 1

pgsql: Fix unsigned output format in SLRU error reporting

2022-04-06 Thread Peter Eisentraut
Fix unsigned output format in SLRU error reporting Avoid printing signed values as unsigned. (No impact in practice expected.) Author: Pavel Borisov Discussion: https://www.postgresql.org/message-id/flat/CALT9ZEHN7hWJo6MgJKqoDMGj%3DGOzQU50wTvOYZXDj7x%3DsUK-kw%40mail.gmail.com Branch -- ma

Re: pgsql: pg_rewind: Fetch small files according to new size.

2022-04-06 Thread Alvaro Herrera
On 2022-Apr-05, Daniel Gustafsson wrote: > local_source.c:118:15: error: format specifies type 'unsigned long long' but > the argument has type 'size_t' (aka 'unsigned int') [-Werror,-Wformat] > srcpath, len, written_len); > ~~

Re: pgsql: pg_rewind: Fetch small files according to new size.

2022-04-06 Thread Daniel Gustafsson
> On 6 Apr 2022, at 10:44, Alvaro Herrera wrote: > Hmm, it is typical to cast file sizes to long long and print with %lld. > See d914eb347fcd for a recent example. > > .. oh, I see you pushed already. Not sure this is worth fixing, since > the original commit message claimed to involve only "sm

pgsql: Reduce running time of jsonb_sqljson test

2022-04-06 Thread Andrew Dunstan
Reduce running time of jsonb_sqljson test The test created a 1m row table in order to test parallel operation of JSON_VALUE. However, this was more than were needed for the test, so save time by halving it, and also by making the table unlogged. Experimentation shows that this size is only a littl

Re: pgsql: Reduce running time of jsonb_sqljson test

2022-04-06 Thread Tom Lane
Andrew Dunstan writes: > The test created a 1m row table in order to test parallel operation of > JSON_VALUE. Egad. > However, this was more than were needed for the test, so > save time by halving it, and also by making the table unlogged. This seems like a rather inappropriate fix. I would s

pgsql: Allow granting SET and ALTER SYSTEM privileges on GUC parameters

2022-04-06 Thread Tom Lane
Allow granting SET and ALTER SYSTEM privileges on GUC parameters. This patch allows "PGC_SUSET" parameters to be set by non-superusers if they have been explicitly granted the privilege to do so. The privilege to perform ALTER SYSTEM SET/RESET on a specific parameter can also be granted. Such priv

pgsql: Further improve jsonb_sqljson parallel test

2022-04-06 Thread Andrew Dunstan
Further improve jsonb_sqljson parallel test Instead of using a very large table, use some settings to encourage use of parallelism. Also, drop the table so it doesn't upset the recovery test. per suggestion from Andres Freund Discussion: https://postgr.es/m/20220406022118.3ocqvhxr6kciw...@alap3

pgsql: Remove exclusive backup mode

2022-04-06 Thread Stephen Frost
Remove exclusive backup mode Exclusive-mode backups have been deprecated since 9.6 (when non-exclusive backups were introduced) due to the issues they can cause should the system crash while one is running and generally because non-exclusive provides a much better interface. Further, exclusive bac

Re: pgsql: Remove exclusive backup mode

2022-04-06 Thread Stephen Frost
Greetings, * Stephen Frost (sfr...@snowman.net) wrote: > Remove exclusive backup mode ... and that should have included a catversion bump, sorry about that, though it had just been bumped a couple commits before too. Thanks, Stephen signature.asc Description: PGP signature

pgsql: Forgotten catversion bump for 39969e2a1e4d7f5a37f3ef37d53bbfe171

2022-04-06 Thread Stephen Frost
Forgotten catversion bump for 39969e2a1e4d7f5a37f3ef37d53bbfe171e7d77a Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/e99546f56670491370d7dc63b0693c3aadaa3112 Modified Files -- src/include/catalog/catversion.h | 2 +- 1 file changed, 1 insertion(+), 1 de

pgsql: dsm: allow use in single user mode.

2022-04-06 Thread Andres Freund
dsm: allow use in single user mode. It might seem pointless to allow use of dsm in single user mode, but otherwise subsystems might need dedicated single user mode code paths. Besides changing the assert, all that's needed is to make some windows code assuming the presence of postmaster condition

pgsql: pgstat: move pgstat_report_autovac() to pgstat_database.c.

2022-04-06 Thread Andres Freund
pgstat: move pgstat_report_autovac() to pgstat_database.c. I got the location wrong in 13619598f10. The name did make it sound like it belonged in pgstat_relation.c... Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/c3e9b07936f70388c6f5341b68d6a04d40e07b86 Modified

pgsql: pgstat: move transactional code into pgstat_xact.c.

2022-04-06 Thread Andres Freund
pgstat: move transactional code into pgstat_xact.c. The transactional integration code is largely independent from the rest of pgstat.c. Subsequent commits will add more related code. Author: Andres Freund Reviewed-By: Thomas Munro Discussion: https://postgr.es/m/20220404041516.cctrvpadhuria..

pgsql: pgstat: stats collector references in comments.

2022-04-06 Thread Andres Freund
pgstat: stats collector references in comments. Soon the stats collector will be no more, with statistics instead getting stored in shared memory. There are a lot of references to the stats collector in comments. This commit replaces most of these references with "cumulative statistics system", wi

pgsql: Suppress "variable 'pagesaving' set but not used" warning.

2022-04-06 Thread Tom Lane
Suppress "variable 'pagesaving' set but not used" warning. With asserts disabled, late-model clang notices that this variable is incremented but never otherwise read. Discussion: https://postgr.es/m/3171401.1649275...@sss.pgh.pa.us Branch -- REL_14_STABLE Details --- https://git.postgre

pgsql: Suppress "variable 'pagesaving' set but not used" warning.

2022-04-06 Thread Tom Lane
Suppress "variable 'pagesaving' set but not used" warning. With asserts disabled, late-model clang notices that this variable is incremented but never otherwise read. Discussion: https://postgr.es/m/3171401.1649275...@sss.pgh.pa.us Branch -- REL_13_STABLE Details --- https://git.postgre

pgsql: Suppress "variable 'pagesaving' set but not used" warning.

2022-04-06 Thread Tom Lane
Suppress "variable 'pagesaving' set but not used" warning. With asserts disabled, late-model clang notices that this variable is incremented but never otherwise read. Discussion: https://postgr.es/m/3171401.1649275...@sss.pgh.pa.us Branch -- master Details --- https://git.postgresql.org

pgsql: pgstat: rename some pgstat_send_* functions to pgstat_report_*.

2022-04-06 Thread Andres Freund
pgstat: rename some pgstat_send_* functions to pgstat_report_*. Only the pgstat_send_* functions that are called from outside pgstat*.c are renamed (the rest will go away). This is done separately from the - quite large - shared memory statistics patch to make review easier. Author: Andres Freund

pgsql: pgstat: add pgstat_copy_relation_stats().

2022-04-06 Thread Andres Freund
pgstat: add pgstat_copy_relation_stats(). Until now index_concurrently_swap() directly modified pgstat internal datastructures. That will break with the introduction of shared memory statistics and seems off architecturally. This is done separately from the - quite large - shared memory statistic

pgsql: Use ISB as a spin-delay instruction on ARM64.

2022-04-06 Thread Tom Lane
Use ISB as a spin-delay instruction on ARM64. This seems beneficial on high-core-count machines, and not harmful on lesser hardware. However, older ARM32 gear doesn't have this instruction, so restrict the patch to ARM64. Geoffrey Blake Discussion: https://postgr.es/m/78338f29-9d7f-4dc8-bd71-e9

pgsql: Add option --config-file to pg_rewind

2022-04-06 Thread Michael Paquier
Add option --config-file to pg_rewind This option is useful to do a rewind with the server configuration file (aka postgresql.conf) located outside the data directory, which is something that some Linux distributions and some HA tools like to rely on. As a result, this can simplify the logic arou

Re: pgsql: pgstat: add pgstat_copy_relation_stats().

2022-04-06 Thread Michael Paquier
On Wed, Apr 06, 2022 at 09:35:17PM +, Andres Freund wrote: > pgstat: add pgstat_copy_relation_stats(). > > Until now index_concurrently_swap() directly modified pgstat internal > datastructures. That will break with the introduction of shared memory > statistics and seems off architecturally.

pgsql: pgstat: prepare APIs used by pgstatfuncs for shared memory stats

2022-04-06 Thread Andres Freund
pgstat: prepare APIs used by pgstatfuncs for shared memory stats. With the introduction of PgStat_Kind PgStat_Single_Reset_Type, PgStat_Shared_Reset_Target don't make sense anymore. Replace them with PgStat_Kind. Instead of having dedicated reset functions for different kinds of stats, use two ge

pgsql: pgstat: introduce PgStat_Kind enum.

2022-04-06 Thread Andres Freund
pgstat: introduce PgStat_Kind enum. Will be used by following commits to generalize stats infrastructure. Kept separate to allow commits stand reasonably on their own. Reviewed-By: Kyotaro Horiguchi Discussion: https://postgr.es/m/20220404041516.cctrvpadhuria...@alap3.anarazel.de Branch --

pgsql: pgstat: scaffolding for transactional stats creation / drop.

2022-04-06 Thread Andres Freund
pgstat: scaffolding for transactional stats creation / drop. One problematic part of the current statistics collector design is that there is no reliable way of getting rid of statistics entries. Because of that pgstat_vacuum_stat() (called by [auto-]vacuum) matches all stats for the current datab

pgsql: pgstat: revise replication slot API in preparation for shared me

2022-04-06 Thread Andres Freund
pgstat: revise replication slot API in preparation for shared memory stats. Previously the pgstat <-> replication slots API was done with on the basis of names. However, the upcoming move to storing stats in shared memory makes it more convenient to use a integer as key. Change the replication sl

pgsql: Reorder subskiplsn in pg_subscription to avoid alignment issues.

2022-04-06 Thread Amit Kapila
Reorder subskiplsn in pg_subscription to avoid alignment issues. The column 'subskiplsn' uses TYPALIGN_DOUBLE (which has 4 bytes alignment on AIX) for storage. But the C Struct (Form_pg_subscription) has 8-byte alignment for this field, so retrieving it from storage causes an unaligned read. To f

pgsql: pgstat: rename STATS_COLLECTOR GUC group to STATS_CUMULATIVE.

2022-04-06 Thread Andres Freund
pgstat: rename STATS_COLLECTOR GUC group to STATS_CUMULATIVE. Reviewed-By: Kyotaro Horiguchi Author: Andres Freund Discussion: https://postgr.es/m/20220303021600.hs34ghqcw6zco...@alap3.anarazel.de Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/1db4e5a4eeec0c5e24

pgsql: pgstat: remove stats_temp_directory.

2022-04-06 Thread Andres Freund
pgstat: remove stats_temp_directory. With stats now being stored in shared memory, the GUC isn't needed anymore. However, the pg_stat_tmp directory and PG_STAT_TMP_DIR define are kept, as pg_stat_statements (and some out-of-core extensions) store data in it. Docs will be updated in a subsequent c

pgsql: pgstat: move pgstat.c to utils/activity.

2022-04-06 Thread Andres Freund
pgstat: move pgstat.c to utils/activity. Now that pgstat is not related to postmaster anymore, src/backend/postmaster is not a well fitting directory. Author: Andres Freund Discussion: https://postgr.es/m/20220303021600.hs34ghqcw6zco...@alap3.anarazel.de Branch -- master Details --- h

pgsql: pgstat: store statistics in shared memory.

2022-04-06 Thread Andres Freund
pgstat: store statistics in shared memory. Previously the statistics collector received statistics updates via UDP and shared statistics data by writing them out to temporary files regularly. These files can reach tens of megabytes and are written out up to twice a second. This has repeatedly prev

pgsql: pgstat: normalize function naming.

2022-04-06 Thread Andres Freund
pgstat: normalize function naming. Most of pgstat uses pgstat__() or just _(). But not all (some introduced fairly recently by me). Rename ones that aren't intentionally following a different scheme (e.g. AtEOXact_*). Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/

pgsql: Add single-item cache when looking at topmost XID of a subtrans

2022-04-06 Thread Michael Paquier
Add single-item cache when looking at topmost XID of a subtrans XID This change affects SubTransGetTopmostTransaction(), used to find the topmost transaction ID of a given transaction ID. The cache is able to store one value, so as we can save the backend from unnecessary lookups at pg_subtrans/

pgsql: Update config.guess and config.sub

2022-04-06 Thread Peter Eisentraut
Update config.guess and config.sub Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/a8cfb0c1a964ebbe830c5138d389b0d2627ec298 Modified Files -- config/config.guess | 1236 +++ config/config.sub | 92 ++-- 2

Re: pgsql: pgstat: store statistics in shared memory.

2022-04-06 Thread Michael Paquier
On Thu, Apr 07, 2022 at 04:37:02AM +, Andres Freund wrote: > pgstat: store statistics in shared memory. > > Previously the statistics collector received statistics updates via UDP and > shared statistics data by writing them out to temporary files regularly. These > files can reach tens of meg

pgsql: Custom WAL Resource Managers.

2022-04-06 Thread Jeff Davis
Custom WAL Resource Managers. Allow extensions to specify a new custom resource manager (rmgr), which allows specialized WAL. This is meant to be used by a Table Access Method or Index Access Method. Prior to this commit, only Generic WAL was available, which offers support for recovery and physi

pgsql: Fix compilation with WAL_DEBUG.

2022-04-06 Thread Andres Freund
Fix compilation with WAL_DEBUG. Broke with 5c279a6d350. But looks like it had been half-broken since 70e81861fad, because 'rmid' didn't refer to the current record's rmid anymore, but to rmid from "Initialize resource managers" - a constant. Branch -- master Details --- https://git.postg

Re: pgsql: pgstat: store statistics in shared memory.

2022-04-06 Thread Andres Freund
Hi, On 2022-04-07 15:09:27 +0900, Michael Paquier wrote: > On Thu, Apr 07, 2022 at 04:37:02AM +, Andres Freund wrote: > > pgstat: store statistics in shared memory. > > > > Previously the statistics collector received statistics updates via UDP and > > shared statistics data by writing them o

pgsql: pgstat: fix small bug in pgstat_drop_relation().

2022-04-06 Thread Andres Freund
pgstat: fix small bug in pgstat_drop_relation(). Just after committing 5891c7a8ed8, a test running with debug_discard_caches=1 failed locally... pgstat_drop_relation() neither checked pgstat_should_count_relation() nor called pgstat_prep_relation_pending(). With debug_discard_caches=1 rel->pgstat

pgsql: pgstat: prevent fix pgstat_reinit_entry() from zeroing out lwloc

2022-04-06 Thread Andres Freund
pgstat: prevent fix pgstat_reinit_entry() from zeroing out lwlock. Zeroing out an lwlock in a normal build turns out to not trigger any alarms, if nobody can use the lwlock at that moment (as the case here). But with --disable-spinlocks --disable-atomics, the sema field needs to be initialized. W

pgsql: pgstat: add pg_stat_force_next_flush(), use it to simplify tests

2022-04-06 Thread Andres Freund
pgstat: add pg_stat_force_next_flush(), use it to simplify tests. In the stats collector days it was hard to write tests for the stats system, because fundamentally delivery of stats messages over UDP was not synchronous (nor guaranteed). Now we easily can force pending stats updates to be flushed