Re: [PoC] Let libpq reject unexpected authentication requests

2022-11-11 Thread Aleksander Alekseev
Hi Jacob, > > Assigning a negative number to uint32 doesn't necessarily work on all > > platforms. I suggest using PG_UINT32_MAX. > > Hmm -- on which platforms is "-1 converted to unsigned" not equivalent > to the maximum value? Are they C-compliant? I did a little more research and I think you

Re: Typo about subxip in comments

2022-11-11 Thread Amit Kapila
On Fri, Nov 11, 2022 at 2:45 PM Japin Li wrote: > > On Fri, 11 Nov 2022 at 15:23, Amit Kapila wrote: > > On Fri, Nov 11, 2022 at 12:16 PM Richard Guo wrote: > >> > >> On Fri, Nov 11, 2022 at 11:26 AM Japin Li wrote: > >>> > >>> Recently, when I read the XidInMVCCSnapshot(), and find there are

Re: [PoC] Let libpq reject unexpected authentication requests

2022-11-11 Thread Jacob Champion
On 11/11/22 05:52, Aleksander Alekseev wrote: > I noticed that this patchset stuck a bit so I decided to take a look. Thanks! > Assigning a negative number to uint32 doesn't necessarily work on all > platforms. I suggest using PG_UINT32_MAX. Hmm -- on which platforms is "-1 converted to

Re: Add test module for Custom WAL Resource Manager feature

2022-11-11 Thread Jeff Davis
On Fri, 2022-11-11 at 17:01 +0530, Bharath Rupireddy wrote: > Hi, > > Inspired by recent commits 9fcdf2c, e813e0e and many small test > modules/extensions under src/test/modules, I would like to propose > one > such test module for Custom WAL Resource Manager feature introduced > by > commit

Re: Document WAL rules related to PD_ALL_VISIBLE in README

2022-11-11 Thread Peter Geoghegan
On Fri, Nov 11, 2022 at 2:14 PM Jeff Davis wrote: > The typical WAL rules are broken for setting PD_ALL_VISIBLE. I'm OK > with that -- rules are meant to be broken -- but it's confusing enough > that I think we should (internally) document it better. +1. I think that there is a lot of value in

Re: libpq support for NegotiateProtocolVersion

2022-11-11 Thread Jacob Champion
On 11/11/22 07:13, Peter Eisentraut wrote: > On 09.11.22 00:08, Jacob Champion wrote: >> pqGetNegotiateProtocolVersion3() is still ignoring the message length, >> though; it won't necessarily stop at the message boundary. > > I don't follow. The calls to pqGetInt(), pqGets(), etc. check the >

Document WAL rules related to PD_ALL_VISIBLE in README

2022-11-11 Thread Jeff Davis
Proposed wording attached. The typical WAL rules are broken for setting PD_ALL_VISIBLE. I'm OK with that -- rules are meant to be broken -- but it's confusing enough that I think we should (internally) document it better. This doesn't guarantee things won't change again in the future, but this

Making Bitmapsets be valid Nodes

2022-11-11 Thread Tom Lane
Per the discussion at [1], it seems like it'd be a good idea to make Bitmapsets into full-fledged, tagged Nodes, so that we could do things like print or copy lists of them without special-case logic. The extra space for the NodeTag is basically free due to alignment considerations, at least on

Re: Add index scan progress to pg_stat_progress_vacuum

2022-11-11 Thread Imseih (AWS), Sami
>I don't think any of these progress callbacks should be done while pinning > a >buffer and ... Good point. >I also don't understand why info->parallel_progress_callback exists? It's > only >set to parallel_vacuum_progress_report(). Why make this stuff more > expensive >

Re: Reducing the WAL overhead of freezing in VACUUM by deduplicating per-tuple freeze plans

2022-11-11 Thread Peter Geoghegan
On Thu, Nov 10, 2022 at 7:00 PM Justin Pryzby wrote: > Note that this comment is dangling in your patch: Attached is v4, which removes the old comments you pointed out were now out of place (they weren't adding much anyway). Also fixed bitrot against HEAD from today's visibility map commit from

Re: Add LSN along with offset to error messages reported for WAL file read/write/validate header failures

2022-11-11 Thread Alvaro Herrera
Hmm, in 0002, why not return the timeline from the LSN too? It seems a waste not to have it. + ereport(ERROR, + (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE), +errmsg("\"offset\" must not be negative or greater than or "

Re: ExecRTCheckPerms() and many prunable partitions

2022-11-11 Thread Tom Lane
Alvaro Herrera writes: > On 2022-Oct-06, Amit Langote wrote: >> Actually, List of Bitmapsets turned out to be something that doesn't >> just-work with our Node infrastructure, which I found out thanks to >> -DWRITE_READ_PARSE_PLAN_TREES. So, I had to go ahead and add >> first-class support for

Re: [PATCH] Use indexes on the subscriber when REPLICA IDENTITY is full on the publisher

2022-11-11 Thread Önder Kalacı
Hi hackers, I rebased the changes to the current master branch, reflected pg_indent suggestions and also made a few minor style changes. Also, tested the patch with a few new PG 15 features in combination (such as row/column filter in logical replication, NULLS NOT DISTINCT indexes etc.) as

Re: [PATCH] Support % wildcard in extension upgrade filenames

2022-11-11 Thread Christoph Berg
Re: Sandro Santilli > I'm attaching an updated version of the patch. This time the patch > is tested. Nothing changes unless the .control file for the subject > extension doesn't have a "wildcard_upgrades = true" statement. > > When wildcard upgrades are enabled, a file with a "%" symbol as > the

Re: [PATCH] Support % wildcard in extension upgrade filenames

2022-11-11 Thread Christoph Berg
Re: Tom Lane > The existing logic to find multi-step upgrade paths is going to make > this a very pressing problem. For example, if you provide both > extension--%--2.0.sql and extension--%--2.1.sql, it's not at all > clear whether the code would try to use both of those or just one > to get from

Re: Call lazy_check_wraparound_failsafe earlier for parallel vacuum

2022-11-11 Thread Imseih (AWS), Sami
>Yeah, it's a little inconsistent. Yes, this should be corrected by calling the failsafe inside the parallel vacuum loops and handling the case by exiting the loop and parallel vacuum if failsafe kicks in. >I meant that there should definitely be a check between each round of >index

Re: A problem about join ordering

2022-11-11 Thread Tom Lane
Richard Guo writes: > I'm wondering whether we need to insist on being strict for the lower > OJ's min_righthand. What if we instead check strictness for its whole > syn_righthand? Surely not. What if the only point of strictness is for a rel that isn't part of the min_righthand? Then we

Re: Optimize join selectivity estimation by not reading MCV stats for unique join attributes

2022-11-11 Thread Tom Lane
David Geier writes: > eqjoinsel() can be optimized by not reading MCV stats if at least one of > the two join attributes is unique. There won't *be* any MCV stats for a column that ANALYZE perceives to be unique, so I'm not quite sure where the claimed savings comes from. > With this change we

Re: libpq support for NegotiateProtocolVersion

2022-11-11 Thread Peter Eisentraut
On 09.11.22 00:08, Jacob Champion wrote: On 11/8/22 00:40, Peter Eisentraut wrote: On 02.11.22 20:02, Jacob Champion wrote: This new code path doesn't go through the message length checks that are done for the 'R' and 'E' cases, and pqGetNegotiateProtocolVersion3() doesn't take the message

Re: psql: Add command to use extended query protocol

2022-11-11 Thread Peter Eisentraut
On 09.11.22 20:10, Daniel Verite wrote: Peter Eisentraut wrote: Is there a use case for a global setting? I assume that we may sometimes want to use the extended protocol on all queries of a script, like pgbench does with --protocol=extended. But is there an actual use case for

Re: Meson doesn't define HAVE_LOCALE_T for mscv

2022-11-11 Thread Peter Eisentraut
On 10.11.22 10:59, Juan José Santamaría Flecha wrote: Meson doesn't see the redefinition of locale_t done in src/include/port/win32_port.h, so is not defining HAVE_LOCALE_T, HAVE_WCSTOMBS_L nor HAVE_MBSTOWCS_L as the current src/tools/msvc/build.pl script does. Please find

Re: Collation version tracking for macOS

2022-11-11 Thread Peter Eisentraut
On 22.10.22 03:22, Thomas Munro wrote: I'd love to hear others' thoughts on how we can turn this into a workable solution. Hopefully while staying simple... I played with this patch a bit. It looks like a reasonable approach. Attached is a small patch to get the dynamic libicu* lookup

Re: Lockless queue of waiters in LWLock

2022-11-11 Thread Alexander Korotkov
Hi, Pavel! On Fri, Nov 11, 2022 at 2:40 PM Pavel Borisov wrote: > I've done some more measurements to check the hypotheses regarding the > performance of a previous patch v2, and explain the results of tests > in [1]. > > The results below are the same (tps vs connections) plots as in [1], > and

Re: [PATCH] Teach pg_waldump to extract FPIs from the WAL

2022-11-11 Thread David Christensen
On Fri, Nov 11, 2022 at 8:15 AM Justin Pryzby wrote: > > On Wed, Nov 09, 2022 at 02:37:29PM -0600, David Christensen wrote: > > On Wed, Nov 9, 2022 at 2:08 PM David Christensen > > wrote: > > > Justin sez: > > > > I was wondering if there's any reason to do "CREATE DATABASE". The vast > > > >

Re: [PATCH] Teach pg_waldump to extract FPIs from the WAL

2022-11-11 Thread Justin Pryzby
On Wed, Nov 09, 2022 at 02:37:29PM -0600, David Christensen wrote: > On Wed, Nov 9, 2022 at 2:08 PM David Christensen > wrote: > > Justin sez: > > > I was wondering if there's any reason to do "CREATE DATABASE". The vast > > > majority of TAP tests don't. > > > > > > $ git grep -ho 'safe_psql[^

Re: Privileges on PUBLICATION

2022-11-11 Thread Peter Eisentraut
On 04.11.22 08:28, Antonin Houska wrote: I thought about the whole concept a bit more and I doubt if the PUBLICATION privilege is the best approach. In particular, the user specified in CREATE SUBSCRIPTION ... CONNECTION ... (say "subscription user") needs to have SELECT privilege on the tables

Re: [PoC] Let libpq reject unexpected authentication requests

2022-11-11 Thread Aleksander Alekseev
Hi Jacob, > v11 makes an attempt at this (see 0003), using the proposed string list. I noticed that this patchset stuck a bit so I decided to take a look. In 0001: ``` +conn->auth_required = false; +conn->allowed_auth_methods = -1; ... +uint32

Re: Lockless queue of waiters in LWLock

2022-11-11 Thread Pavel Borisov
CFbot isn't happy because of additional patches in the previous message, so here I attach v3 patch alone. Regards, Pavel v3-0001-Lockless-queue-of-LWLock-waiters.patch Description: Binary data

Re: Printing backtrace of postgres processes

2022-11-11 Thread Bharath Rupireddy
On Fri, Nov 11, 2022 at 7:59 AM Kyotaro Horiguchi wrote: > > At Thu, 10 Nov 2022 15:56:35 +0530, Bharath Rupireddy > wrote in > > On Mon, Apr 18, 2022 at 9:10 AM vignesh C wrote: > > > > > > The attached v21 patch has the changes for the same. > > > > Thanks for the patch. Here are some

Re: Add LSN along with offset to error messages reported for WAL file read/write/validate header failures

2022-11-11 Thread Maxim Orlov
Hi! I've watched over the patch and consider it useful. Applies without conflicts. The functionality of the patch itself is meets declared functionality. But, in my view, some improvements may be proposed. We should be more, let's say, cautious (or a paranoid if you wish), in

Optimize join selectivity estimation by not reading MCV stats for unique join attributes

2022-11-11 Thread David Geier
Hi hackers, eqjoinsel() can be optimized by not reading MCV stats if at least one of the two join attributes is unique. As primary keys are implicitly unique this situation can occur frequently. For unique columns no MCV stats are stored and eqjoinsel_inner() and eqjoinsel_semi(), called from

Re: Perform streaming logical transactions by background workers and parallel apply

2022-11-11 Thread Amit Kapila
On Thu, Nov 10, 2022 at 8:41 PM houzj.f...@fujitsu.com wrote: > > On Monday, November 7, 2022 6:18 PM Masahiko Sawada > > > > Here are comments on v42-0001: > > Thanks for the comments. > > > We have the following three similar name functions regarding to > > starting a new parallel apply

Add test module for Custom WAL Resource Manager feature

2022-11-11 Thread Bharath Rupireddy
Hi, Inspired by recent commits 9fcdf2c, e813e0e and many small test modules/extensions under src/test/modules, I would like to propose one such test module for Custom WAL Resource Manager feature introduced by commit 5c279a6. It not only covers the code a bit, but it also demonstrates usage of

A problem about join ordering

2022-11-11 Thread Richard Guo
While reviewing the outer-join Vars patch, I encountered something confusing me which can also be seen on HEAD. According to outer join identity 3 (A leftjoin (B leftjoin C on (Pbc)) on (Pab)) left join D on (Pcd) should be equal to ((A leftjoin B on (Pab)) leftjoin C on (Pbc)) left join D

Re: [PATCH] Teach pg_waldump to extract FPIs from the WAL

2022-11-11 Thread Bharath Rupireddy
On Thu, Nov 10, 2022 at 9:52 PM David Christensen wrote: > > > > > 2. I'm unable to understand the use-case for --fixup-fpi option. > > > > pg_waldump is supposed to be just WAL reader, and must not return any > > > > modified information, with --fixup-fpi option, the patch violates this > > > >

Re: Lack of PageSetLSN in heap_xlog_visible

2022-11-11 Thread Konstantin Knizhnik
On 11.11.2022 03:20, Jeff Davis wrote: On Thu, 2022-10-13 at 12:49 -0700, Jeff Davis wrote: It may violate our torn page protections for checksums, as well... I could not reproduce a problem here, but I believe one exists when checksums are enabled, because it bypasses the protections of

Re: [Proposal] Add foreign-server health checks infrastructure

2022-11-11 Thread Önder Kalacı
Hi Hayota Kuroda, > I (and my company) worried about overnight batch processing that > contains some accesses to foreign servers. If the transaction is opened > overnight and > one of foreign servers is crashed during it, the transaction must be > rollbacked. > But there is a possibility that

Re: Use pg_pwritev_with_retry() instead of write() in dir_open_for_write() to avoid partial writes?

2022-11-11 Thread John Naylor
On Fri, Nov 11, 2022 at 2:12 PM Michael Paquier wrote: > > On Fri, Nov 11, 2022 at 11:53:08AM +0530, Bharath Rupireddy wrote: > > On Fri, Nov 11, 2022 at 11:14 AM John Naylor < john.nay...@enterprisedb.com> wrote: > >> Was there supposed to be an attachment here? > > > > Nope. The patches have

Re: slab allocator performance issues

2022-11-11 Thread John Naylor
On Wed, Oct 12, 2022 at 4:37 PM David Rowley wrote: > [v3] + /* + * Compute a shift that guarantees that shifting chunksPerBlock with it + * yields is smaller than SLAB_FREELIST_COUNT - 1 (one freelist is used for full blocks). + */ + slab->freelist_shift = 0; + while ((slab->chunksPerBlock >>

Re: Typo about subxip in comments

2022-11-11 Thread Japin Li
On Fri, 11 Nov 2022 at 15:23, Amit Kapila wrote: > On Fri, Nov 11, 2022 at 12:16 PM Richard Guo wrote: >> >> On Fri, Nov 11, 2022 at 11:26 AM Japin Li wrote: >>> >>> Recently, when I read the XidInMVCCSnapshot(), and find there are some >>> typos in the comments. >> >> >> Hmm, it seems to me

Re: proposal: possibility to read dumped table's name from file

2022-11-11 Thread Julien Rouhaud
Hi, On Sat, Nov 05, 2022 at 08:54:57PM +0100, Pavel Stehule wrote: > > pá 4. 11. 2022 v 14:28 odesílatel Julien Rouhaud > napsal: > > > > But one thing I noticed is that "optarg" looks wrong here: > > > > > > simple_string_list_append(>triggerNames, optarg); > > > > Ah indeed, good catch! Maybe