Re: pgsql: pgstat: Bring up pgstat in BaseInit() to fix uninitialized use o

2021-08-12 Thread Masahiko Sawada
On Thu, Aug 12, 2021 at 3:16 PM Amit Kapila wrote: > > On Thu, Aug 12, 2021 at 11:38 AM Dilip Kumar wrote: > > > > On Thu, Aug 12, 2021 at 7:39 AM Masahiko Sawada > > wrote: > > > > > > On Wed, Aug 11, 2021 at 10:47 PM Amit Kapila > > > wrote: > > > > > > > > On Tue, Aug 10, 2021 at 4:37 PM M

Re: pgsql: pgstat: Bring up pgstat in BaseInit() to fix uninitialized use o

2021-08-12 Thread Dilip Kumar
On Thu, Aug 12, 2021 at 1:13 PM Masahiko Sawada wrote: > > On Thu, Aug 12, 2021 at 3:16 PM Amit Kapila wrote: > > > > On Thu, Aug 12, 2021 at 11:38 AM Dilip Kumar wrote: > > > > > > On Thu, Aug 12, 2021 at 7:39 AM Masahiko Sawada > > > wrote: > > > > > > > > On Wed, Aug 11, 2021 at 10:47 PM Am

Re: pgsql: pgstat: Bring up pgstat in BaseInit() to fix uninitialized use o

2021-08-12 Thread Amit Kapila
On Thu, Aug 12, 2021 at 1:13 PM Masahiko Sawada wrote: > > On Thu, Aug 12, 2021 at 3:16 PM Amit Kapila wrote: > > > > > > I have also tested and fix works for me. The fix works because > > pgstat_initialize() is called before we register clean up in > > SharedFileSetInit(). I am not sure if we ne

pgsql: Fix segfault during EvalPlanQual with mix of local and foreign p

2021-08-12 Thread Heikki Linnakangas
Fix segfault during EvalPlanQual with mix of local and foreign partitions. It's not sensible to re-evaluate a direct-modify Foreign Update or Delete during EvalPlanQual. However, ExecInitForeignScan() can still get called if a table mixes local and foreign partitions. EvalPlanQualStart() left the

pgsql: Fix segfault during EvalPlanQual with mix of local and foreign p

2021-08-12 Thread Heikki Linnakangas
Fix segfault during EvalPlanQual with mix of local and foreign partitions. It's not sensible to re-evaluate a direct-modify Foreign Update or Delete during EvalPlanQual. However, ExecInitForeignScan() can still get called if a table mixes local and foreign partitions. EvalPlanQualStart() left the

pgsql: Avoid unnecessary shared invalidations in ROLLBACK PREPARED

2021-08-12 Thread Michael Paquier
Avoid unnecessary shared invalidations in ROLLBACK PREPARED The performance gain is minimal, but this makes the logic more consistent with AtEOXact_Inval(). No other invalidation is needed in this case as PREPARE takes already care of sending any local ones. Author: Liu Huailing Reviewed-by: Tom

pgsql: Fix grammar mistake in hash index README

2021-08-12 Thread John Naylor
Fix grammar mistake in hash index README Dilip Kumar Discussion: https://www.postgresql.org/message-id/CAFiTN-tjZbuY6vy7kZZ6xO%2BD4mVcO5wOPB5KiwJ3AHhpytd8fg%40mail.gmail.com Branch -- master Details --- https://git.postgresql.org/pg/commitdiff/b05f7ecec44be22f6de703e5afdeb4ff3559315a

pgsql: Last-minute updates for release notes.

2021-08-12 Thread Tom Lane
Last-minute updates for release notes. Security: CVE-2021-3677 Branch -- REL_12_STABLE Details --- https://git.postgresql.org/pg/commitdiff/c6afcafafe95df08f98eea7ac5d5b3ab30f22db4 Modified Files -- doc/src/sgml/release-12.sgml | 46 +++---

pgsql: Last-minute updates for release notes.

2021-08-12 Thread Tom Lane
Last-minute updates for release notes. Security: CVE-2021-3677 Branch -- REL_11_STABLE Details --- https://git.postgresql.org/pg/commitdiff/f334490131be5ef1935c56bece186f3afa5fbded Modified Files -- doc/src/sgml/release-11.sgml | 46 +++---

pgsql: Last-minute updates for release notes.

2021-08-12 Thread Tom Lane
Last-minute updates for release notes. Security: CVE-2021-3677 Branch -- REL_13_STABLE Details --- https://git.postgresql.org/pg/commitdiff/0145ec9be92b2146e7b94f286cb3dab9eb77ef70 Modified Files -- doc/src/sgml/release-13.sgml | 46 +++---

Re: pgsql: pgstat: Bring up pgstat in BaseInit() to fix uninitialized use o

2021-08-12 Thread Andres Freund
Hi, On 2021-08-12 11:46:09 +0530, Amit Kapila wrote: > On Thu, Aug 12, 2021 at 11:38 AM Dilip Kumar wrote: > > On Thu, Aug 12, 2021 at 7:39 AM Masahiko Sawada > > wrote: > > > It seems to me that moving the shared fileset cleanup to > > > before_shmem_exit() is the right approach to fix this pr

Re: pgsql: pgstat: Bring up pgstat in BaseInit() to fix uninitialized use o

2021-08-12 Thread Amit Kapila
On Thu, Aug 12, 2021 at 1:52 PM Andres Freund wrote: > > On 2021-08-12 11:46:09 +0530, Amit Kapila wrote: > > On Thu, Aug 12, 2021 at 11:38 AM Dilip Kumar wrote: > > > On Thu, Aug 12, 2021 at 7:39 AM Masahiko Sawada > > > wrote: > > > > It seems to me that moving the shared fileset cleanup to >

Re: pgsql: pgstat: Bring up pgstat in BaseInit() to fix uninitialized use o

2021-08-12 Thread Andres Freund
Hi, On 2021-08-12 15:06:23 +0530, Amit Kapila wrote: > On Thu, Aug 12, 2021 at 1:52 PM Andres Freund wrote: > > I'm not so sure. Why does sharedfileset have its own proc exit hook in the > > first place? ISTM that this should be dealt with using resowners, rathers > > than > > a sharedfileset sp

Re: pgsql: pgstat: Bring up pgstat in BaseInit() to fix uninitialized use o

2021-08-12 Thread Andres Freund
Hi, On 2021-08-12 05:48:19 -0700, Andres Freund wrote: > I think SharedFileSetInit() needs a comment explaining that it needs to be > called in a process-lifetime memory context if used without dsm > segments. Because otherwise SharedFileSetDeleteOnProcExit() will access > already freed memory (bo

pgsql: Speed up generation of Unicode hash functions.

2021-08-12 Thread John Naylor
Speed up generation of Unicode hash functions. Sets of Unicode keys are picky about the primes used when generating a perfect hash function for them. Callers can spend many seconds iterating through all the possible combinations of candidate multipliers and seeds to find one that works. Unicode u

pgsql: Use appropriate tuple descriptor in FDW batching

2021-08-12 Thread Tomas Vondra
Use appropriate tuple descriptor in FDW batching The FDW batching code was using the same tuple descriptor both for all slots (regular and plan slots), but that's incorrect - the subplan may use a different descriptor. Currently this is benign, because batching is used only for INSERTs, and in tha

pgsql: Use appropriate tuple descriptor in FDW batching

2021-08-12 Thread Tomas Vondra
Use appropriate tuple descriptor in FDW batching The FDW batching code was using the same tuple descriptor both for all slots (regular and plan slots), but that's incorrect - the subplan may use a different descriptor. Currently this is benign, because batching is used only for INSERTs, and in tha

pgsql: Make EXEC_BACKEND more convenient on macOS.

2021-08-12 Thread Thomas Munro
Make EXEC_BACKEND more convenient on macOS. It's hard to disable ASLR on current macOS releases, for testing with -DEXEC_BACKEND. You could already set the environment variable PG_SHMEM_ADDR to something not likely to collide with mappings created earlier in process startup. Let's also provide a

pgsql: Make EXEC_BACKEND more convenient on macOS.

2021-08-12 Thread Thomas Munro
Make EXEC_BACKEND more convenient on macOS. It's hard to disable ASLR on current macOS releases, for testing with -DEXEC_BACKEND. You could already set the environment variable PG_SHMEM_ADDR to something not likely to collide with mappings created earlier in process startup. Let's also provide a

pgsql: Make EXEC_BACKEND more convenient on macOS.

2021-08-12 Thread Thomas Munro
Make EXEC_BACKEND more convenient on macOS. It's hard to disable ASLR on current macOS releases, for testing with -DEXEC_BACKEND. You could already set the environment variable PG_SHMEM_ADDR to something not likely to collide with mappings created earlier in process startup. Let's also provide a

pgsql: Make EXEC_BACKEND more convenient on macOS.

2021-08-12 Thread Thomas Munro
Make EXEC_BACKEND more convenient on macOS. It's hard to disable ASLR on current macOS releases, for testing with -DEXEC_BACKEND. You could already set the environment variable PG_SHMEM_ADDR to something not likely to collide with mappings created earlier in process startup. Let's also provide a

pgsql: Make EXEC_BACKEND more convenient on macOS.

2021-08-12 Thread Thomas Munro
Make EXEC_BACKEND more convenient on macOS. It's hard to disable ASLR on current macOS releases, for testing with -DEXEC_BACKEND. You could already set the environment variable PG_SHMEM_ADDR to something not likely to collide with mappings created earlier in process startup. Let's also provide a

pgsql: Make EXEC_BACKEND more convenient on macOS.

2021-08-12 Thread Thomas Munro
Make EXEC_BACKEND more convenient on macOS. It's hard to disable ASLR on current macOS releases, for testing with -DEXEC_BACKEND. You could already set the environment variable PG_SHMEM_ADDR to something not likely to collide with mappings created earlier in process startup. Let's also provide a

pgsql: Make EXEC_BACKEND more convenient on macOS.

2021-08-12 Thread Thomas Munro
Make EXEC_BACKEND more convenient on macOS. It's hard to disable ASLR on current macOS releases, for testing with -DEXEC_BACKEND. You could already set the environment variable PG_SHMEM_ADDR to something not likely to collide with mappings created earlier in process startup. Let's also provide a

pgsql: Fix incorrect hash table resizing code in simplehash.h

2021-08-12 Thread David Rowley
Fix incorrect hash table resizing code in simplehash.h This fixes a bug in simplehash.h which caused an incorrect size mask to be used when the hash table grew to SH_MAX_SIZE (2^32). The code was incorrectly setting the size mask to 0 when the hash tables reached the maximum possible number of bu

pgsql: Fix incorrect hash table resizing code in simplehash.h

2021-08-12 Thread David Rowley
Fix incorrect hash table resizing code in simplehash.h This fixes a bug in simplehash.h which caused an incorrect size mask to be used when the hash table grew to SH_MAX_SIZE (2^32). The code was incorrectly setting the size mask to 0 when the hash tables reached the maximum possible number of bu

pgsql: Fix incorrect hash table resizing code in simplehash.h

2021-08-12 Thread David Rowley
Fix incorrect hash table resizing code in simplehash.h This fixes a bug in simplehash.h which caused an incorrect size mask to be used when the hash table grew to SH_MAX_SIZE (2^32). The code was incorrectly setting the size mask to 0 when the hash tables reached the maximum possible number of bu

pgsql: Fix incorrect hash table resizing code in simplehash.h

2021-08-12 Thread David Rowley
Fix incorrect hash table resizing code in simplehash.h This fixes a bug in simplehash.h which caused an incorrect size mask to be used when the hash table grew to SH_MAX_SIZE (2^32). The code was incorrectly setting the size mask to 0 when the hash tables reached the maximum possible number of bu

pgsql: Fix incorrect hash table resizing code in simplehash.h

2021-08-12 Thread David Rowley
Fix incorrect hash table resizing code in simplehash.h This fixes a bug in simplehash.h which caused an incorrect size mask to be used when the hash table grew to SH_MAX_SIZE (2^32). The code was incorrectly setting the size mask to 0 when the hash tables reached the maximum possible number of bu

pgsql: Fix incorrect hash table resizing code in simplehash.h

2021-08-12 Thread David Rowley
Fix incorrect hash table resizing code in simplehash.h This fixes a bug in simplehash.h which caused an incorrect size mask to be used when the hash table grew to SH_MAX_SIZE (2^32). The code was incorrectly setting the size mask to 0 when the hash tables reached the maximum possible number of bu