Re: Logical Replication of sequences

2024-08-07 Thread shveta malik
On Wed, Aug 7, 2024 at 1:45 PM vignesh C wrote: > > > The remaining comments have been addressed, and the changes are > included in the attached v20240807 version patch. Thanks for addressing the comment. Please find few comments for v20240807 : patch002: 1) create_publication.sgml: --I think i

Re: Restart pg_usleep when interrupted

2024-08-07 Thread Bertrand Drouvot
Hi, On Wed, Aug 07, 2024 at 09:36:59AM -0500, Nathan Bossart wrote: > Also, do we need to worry about overflow here? It looks like the rest of > instr_time.h is oblivious about overflow, so maybe this is better discussed > in a separate thread... Yeah, a separate thread would be better. FWIW an

Don't overwrite scan key in systable_beginscan()

2024-08-07 Thread Peter Eisentraut
When systable_beginscan() and systable_beginscan_ordered() choose an index scan, they remap the attribute numbers in the passed-in scan keys to the attribute numbers of the index, and then write those remapped attribute numbers back into the scan key passed by the caller. This second part is s

Re: [bug fix] prepared transaction might be lost when max_prepared_transactions is zero on the subscriber

2024-08-07 Thread Amit Kapila
On Thu, Aug 8, 2024 at 10:37 AM Hayato Kuroda (Fujitsu) wrote: > ... > > An easiest fix is to reset session replication origin before calling the > RecordTransactionAbort(). I think this can happen when 1) > LogicalRepApplyLoop() > raises an ERROR or 2) apply worker exits. Attached patch can fix

Re: Logical Replication of sequences

2024-08-07 Thread Peter Smith
On Thu, Aug 8, 2024 at 1:55 PM Amit Kapila wrote: > > On Wed, Aug 7, 2024 at 10:12 AM Peter Smith wrote: > > > > This is mostly a repeat of my previous mail from a while ago [1] but > > includes some corrections, answers, and more examples. I'm going to > > try to persuade one last time because t

RE: Found issues related with logical replication and 2PC

2024-08-07 Thread Hayato Kuroda (Fujitsu)
Dear Amit, > Can we start a separate thread to issue 2? I understand that this one > is also related to two_phase but since both are different issues it is > better to discuss in separate threads. This will also help us refer to > the discussion in future if required. You are right, we should dis

[bug fix] prepared transaction might be lost when max_prepared_transactions is zero on the subscriber

2024-08-07 Thread Hayato Kuroda (Fujitsu)
Dear hackers, This thread forks from [1]. Here can be used to discuss second item. Below part contains the same statements written in [1], but I did copy-and-paste just in case. Attached patch is almost the same but bit modified based on the comment from Amit [2] - an unrelated change is removed.

Re: Found issues related with logical replication and 2PC

2024-08-07 Thread Amit Kapila
On Wed, Jul 24, 2024 at 12:25 PM Hayato Kuroda (Fujitsu) wrote: > > While creating a patch which allows ALTER SUBSCRIPTION SET (two_phase) [1], > we found some issues related with logical replication and two_phase. I think > this > can happen not only HEAD but PG14+, but for now I shared patches

Re: Found issues related with logical replication and 2PC

2024-08-07 Thread Amit Kapila
On Thu, Aug 8, 2024 at 8:54 AM shveta malik wrote: > > On Wed, Aug 7, 2024 at 5:43 PM Amit Kapila wrote: > > > So, if my > > analysis is correct, this shouldn't be a bug and ideally, we should > > update local_end LSN as InvalidXLogRecPtr and add appropriate > > comments. > > Okay, we can do that

Re: Logical Replication of sequences

2024-08-07 Thread Amit Kapila
On Wed, Aug 7, 2024 at 10:12 AM Peter Smith wrote: > > This is mostly a repeat of my previous mail from a while ago [1] but > includes some corrections, answers, and more examples. I'm going to > try to persuade one last time because the current patch is becoming > stable, so I wanted to revisit t

Re: Found issues related with logical replication and 2PC

2024-08-07 Thread shveta malik
On Wed, Aug 7, 2024 at 5:43 PM Amit Kapila wrote: > > On Wed, Aug 7, 2024 at 3:32 PM Amit Kapila wrote: > > > > I also think so. Additionally, I feel a test case (or some description > > of the bug that can arise) should be provided for issue-1. > > > > IIUC, the problem could be that we would en

[patch] Imporve pqmq

2024-08-07 Thread Xiaoran Wang
Hi, When I use the 'pqmq' recently, I found some issues, just fix them. Allow the param 'dsm_segment *seg' to be NULL in function 'pq_redirect_to_shm_mq'. As sometimes the shm_mq is created in shared memory instead of DSM. Add function 'pq_leave_shm_mq' to allow the process t

Re: Detailed release notes

2024-08-07 Thread jian he
On Tue, Aug 6, 2024 at 11:12 PM Andres Freund wrote: > > Hi, > > On 2024-08-06 12:02:59 -0300, Euler Taveira wrote: > > Talking about the patch, do we want to rely on an external resource? I > > suggest > > that we use a postgresql.org subdomain. It can point to > > > > https://git.postgresql.org

Re: Logical Replication of sequences

2024-08-07 Thread Peter Smith
Hi Vignesh, Here are my v20240807-0003 review comments. == 1. GENERAL DOCS. IMO the replication of SEQUENCES is a big enough topic that it deserves to have its own section in the docs chapter 31 [1]. Some of the create/alter subscription docs content would stay where it is in, but a new chap

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

2024-08-07 Thread Hayato Kuroda (Fujitsu)
Dear Fujii-san, Thanks for reviewing! PSA new version. > > postgres_fdw_get_connections( >IN check_conn boolean DEFAULT false, OUT server_name text, >OUT valid boolean, OUT used_in_xact boolean, OUT closed boolean) >returns setof record > > In the documentation, thi

Re: [BUG] Fix DETACH with FK pointing to a partitioned table fails

2024-08-07 Thread Tender Wang
Alvaro Herrera 于2024年8月8日周四 06:50写道: > On 2024-Jul-26, Tender Wang wrote: > > > Junwang Zhao 于2024年7月26日周五 14:57写道: > > > > > There is a bug report[0] Tender comments might be the same issue as > > > this one, but I tried Alvaro's and mine patch, neither could solve > > > that problem, I did not

Re: Support specify tablespace for each merged/split partition

2024-08-07 Thread Junwang Zhao
Hi Fujii, Thanks for your review. On Wed, Aug 7, 2024 at 9:54 PM Fujii Masao wrote: > > > > On 2024/08/06 19:28, Junwang Zhao wrote: > > Attached v2 addressed all the problems you mentioned, thanks. > > Thanks for updating the patches! > > > In the ALTER TABLE documentation, v1 patch updated the

Re: Remove dependence on integer wrapping

2024-08-07 Thread Joseph Koshakow
On Wed, Aug 7, 2024 at 11:08 AM Nathan Bossart wrote: > > I started looking at 0001 again with the intent of committing it, and this > caught my eye: > > -/* make the amount positive for digit-reconstruction loop */ > -value = -value; > +/* > + * make the amount pos

Re: Enable data checksums by default

2024-08-07 Thread Michael Paquier
On Aug 7, 2024, at 23:18, Greg Sabino Mullane wrote:On Wed, Aug 7, 2024 at 4:43 AM Michael Banck wrote:. Does it make sense to add -K (capital k) as a short-cut for this? I think this is how we distinguish on/off for pg_dump (-t/-T etc.) but maybe that is not wider project policy.

Re: Unused expression indexes

2024-08-07 Thread Maciek Sakrejda
Great, thank you both for the info.

Re: Cutting support for OpenSSL 1.0.1 and 1.0.2 in 17~?

2024-08-07 Thread Michael Paquier
> On Aug 7, 2024, at 22:49, Daniel Gustafsson wrote: > I think it's highly likely that we will see complaints for any support we > deprecate. OpenSSL 1.0.2 will however still be supported for another 5 years > with v17 (which is ~9years past its EOL date) so I don't feel too bad about > it. I

Re: POC, WIP: OR-clause support for indexes

2024-08-07 Thread Alena Rybakina
On 07.08.2024 04:11, Alexander Korotkov wrote: On Mon, Aug 5, 2024 at 11:24 PM Alena Rybakina wrote: Ok, thank you for your work) I think we can leave only the two added libraries in the first patch, others are superfluous. Thank you. I also have fixed some grammar issues. Thank you) I add

Re: [BUG] Fix DETACH with FK pointing to a partitioned table fails

2024-08-07 Thread Alvaro Herrera
On 2024-Jul-26, Tender Wang wrote: > Junwang Zhao 于2024年7月26日周五 14:57写道: > > > There is a bug report[0] Tender comments might be the same issue as > > this one, but I tried Alvaro's and mine patch, neither could solve > > that problem, I did not tried Tender's earlier patch thought. I post > > t

Re: Remaining dependency on setlocale()

2024-08-07 Thread Jeff Davis
On Wed, 2024-08-07 at 13:28 -0400, Joe Conway wrote: > FWIW I see all of these in glibc: > > isalnum_l, isalpha_l, isascii_l, isblank_l, iscntrl_l, isdigit_l, > isgraph_l,  islower_l, isprint_l, ispunct_l, isspace_l, isupper_l, > isxdigit_l My point was just that there are a lot of those call s

Re: New GUC autovacuum_max_threshold ?

2024-08-07 Thread Nathan Bossart
I've attached a new patch to show roughly what I think this new GUC should look like. I'm hoping this sparks more discussion, if nothing else. On Tue, Jun 18, 2024 at 12:36:42PM +0200, Frédéric Yhuel wrote: > By the way, I wonder if there were any off-list discussions after Robert's > conference

Re: Remaining dependency on setlocale()

2024-08-07 Thread Thomas Munro
On Thu, Aug 8, 2024 at 6:18 AM Robert Haas wrote: > On Wed, Aug 7, 2024 at 1:29 PM Joe Conway wrote: > > FWIW I see all of these in glibc: > > > > isalnum_l, isalpha_l, isascii_l, isblank_l, iscntrl_l, isdigit_l, > > isgraph_l, islower_l, isprint_l, ispunct_l, isspace_l, isupper_l, > > isxdigit_

Re: Restart pg_usleep when interrupted

2024-08-07 Thread Sami Imseih
v7-0001-vaccum_delay-with-absolute-time-nanosleep.patch Description: Binary data > > On Wed, Aug 07, 2024 at 06:00:53AM +, Bertrand Drouvot wrote: >> +SleepEx((microsec < 500 ? 1 : (microsec + 500) / 1000), FALSE); > > I think this deserves a comment. > Done >> +#define INS

Re: Remaining dependency on setlocale()

2024-08-07 Thread Thomas Munro
On Thu, Aug 8, 2024 at 5:16 AM Jeff Davis wrote: > There are a ton of calls to, for example, isspace(), used mostly for > parsing. > > I wouldn't expect a lot of differences in behavior from locale to > locale, like might be the case with iswspace(), but behavior can be > different at least in the

Re: tiny step toward threading: reduce dependence on setlocale()

2024-08-07 Thread Peter Eisentraut
On 06.08.24 23:40, Jeff Davis wrote: With these changes, collations are no longer dependent on the environment locale (setlocale()) at all for either collation behavior (ORDER BY) or ctype behavior (LOWER(), etc.). Additionally, unless I missed something, nothing in the server is dependent on LC

Re: Add trim_trailing_whitespace to editorconfig file

2024-08-07 Thread Jelte Fennema-Nio
On Wed, 7 Aug 2024 at 21:09, Andrew Dunstan wrote: > You're not meant to use our pg_bsd_indent on its own without the > appropriate flags, namely (from src/tools/pgindent/pgindent): Ah sorry, I wasn't clear in what I meant then. I meant that if you look at the sources of pg_bsd_indent (such as sr

Re: Add new protocol message to change GUCs for usage with future protocol-only GUCs

2024-08-07 Thread Robert Haas
On Mon, Jun 24, 2024 at 9:19 AM Jelte Fennema-Nio wrote: > > I agree with 0002 except for the change from PG_PROTOCOL_MINOR(proto) > > > PG_PROTOCOL_MINOR(PG_PROTOCOL_LATEST) to proto > PG_PROTOCOL_LATEST. > > I prefer that test the way it is; I think the intent is clearer with > > the existing co

Re: pgsql: Introduce hash_search_with_hash_value() function

2024-08-07 Thread Alexander Korotkov
On Wed, Aug 7, 2024 at 9:01 PM Robert Haas wrote: > On Wed, Aug 7, 2024 at 1:15 PM Nathan Bossart > wrote: > > > We could use git notes. The UI is a bit inconvenient (they have to be > > > pushed and pulled separately from commits), but they seem useful enough. > > > > Yeah, I spend a lot of ti

Re: Add LSN <-> time conversion functionality

2024-08-07 Thread Melanie Plageman
On Wed, Aug 7, 2024 at 1:06 PM Robert Haas wrote: > > As I mentioned to you off-list, I feel like this needs some sort of > recency bias. Certainly vacuum, and really almost any conceivable user > of this facility, is going to care more about accurate answers for new > data than for old data. If t

Re: Add trim_trailing_whitespace to editorconfig file

2024-08-07 Thread Andrew Dunstan
On 2024-08-07 We 1:09 PM, Jelte Fennema-Nio wrote: On Tue, 9 Apr 2024 at 12:42, Jelte Fennema-Nio wrote: Okay, I spent the time to add a script to generate the editorconfig based on .gitattributes after all. So attached is a patch that adds that. I would love to see this patch merged (or at

Re: Remaining dependency on setlocale()

2024-08-07 Thread Robert Haas
On Wed, Aug 7, 2024 at 1:29 PM Joe Conway wrote: > FWIW I see all of these in glibc: > > isalnum_l, isalpha_l, isascii_l, isblank_l, iscntrl_l, isdigit_l, > isgraph_l, islower_l, isprint_l, ispunct_l, isspace_l, isupper_l, > isxdigit_l On my MacBook (Ventura, 13.6.7), I see all of these except f

Re: Proposal for implementing OCSP Stapling in PostgreSQL

2024-08-07 Thread David Zhang
Hi Daniel, Thank you for all the information. On 2024-08-07 12:20 a.m., Daniel Gustafsson wrote: While I have only skimmed the patch so far and need more review before I can comment on it, I do have a question on the expected use of OCSP support in postgres. With OCSP becoming optional [0], an

Re: pgsql: Introduce hash_search_with_hash_value() function

2024-08-07 Thread Robert Haas
On Wed, Aug 7, 2024 at 1:15 PM Nathan Bossart wrote: > > We could use git notes. The UI is a bit inconvenient (they have to be > > pushed and pulled separately from commits), but they seem useful enough. > > Yeah, I spend a lot of time on commit messages because they're pretty much > written in s

Re: pg_verifybackup: TAR format backup verification

2024-08-07 Thread Robert Haas
On Wed, Aug 7, 2024 at 1:05 PM Amul Sul wrote: > The main issue I have is computing the total_size of valid files that > will be checksummed and that exist in both the manifests and the > backup, in the case of a tar backup. This cannot be done in the same > way as with a plain backup. I think yo

Re: Remaining dependency on setlocale()

2024-08-07 Thread Joe Conway
On 8/7/24 13:16, Jeff Davis wrote: On Wed, 2024-08-07 at 19:07 +1200, Thomas Munro wrote: How far can we get by using more _l() functions? There are a ton of calls to, for example, isspace(), used mostly for parsing. I wouldn't expect a lot of differences in behavior from locale to locale, li

Re: Remaining dependency on setlocale()

2024-08-07 Thread Jeff Davis
On Wed, 2024-08-07 at 19:07 +1200, Thomas Munro wrote: > How far can we get by using more _l() functions? There are a ton of calls to, for example, isspace(), used mostly for parsing. I wouldn't expect a lot of differences in behavior from locale to locale, like might be the case with iswspace(),

Re: pgsql: Introduce hash_search_with_hash_value() function

2024-08-07 Thread Nathan Bossart
On Wed, Aug 07, 2024 at 01:08:35PM -0400, Alvaro Herrera wrote: > On 2024-Aug-07, Robert Haas wrote: >> I really wish there was some way to fix commit messages. I had a typo >> in mine today, too. > > We could use git notes. The UI is a bit inconvenient (they have to be > pushed and pulled separa

Re: Add trim_trailing_whitespace to editorconfig file

2024-08-07 Thread Jelte Fennema-Nio
On Tue, 9 Apr 2024 at 12:42, Jelte Fennema-Nio wrote: > Okay, I spent the time to add a script to generate the editorconfig > based on .gitattributes after all. So attached is a patch that adds > that. I would love to see this patch merged (or at least some feedback on the latest version). I thin

Re: pgsql: Introduce hash_search_with_hash_value() function

2024-08-07 Thread Alvaro Herrera
On 2024-Aug-07, Robert Haas wrote: > I really wish there was some way to fix commit messages. I had a typo > in mine today, too. We could use git notes. The UI is a bit inconvenient (they have to be pushed and pulled separately from commits), but they seem useful enough. https://initialcommit.c

Re: Add LSN <-> time conversion functionality

2024-08-07 Thread Robert Haas
Melanie, As I mentioned to you off-list, I feel like this needs some sort of recency bias. Certainly vacuum, and really almost any conceivable user of this facility, is going to care more about accurate answers for new data than for old data. If there's no recency bias, then I think that eventuall

Re: pg_verifybackup: TAR format backup verification

2024-08-07 Thread Amul Sul
On Wed, Aug 7, 2024 at 9:12 PM Robert Haas wrote: > > [ I committed 0001, then noticed I had a type in the subject line of > the commit message. Argh. ] > > On Wed, Aug 7, 2024 at 9:41 AM Amul Sul wrote: > > With the patch, I am concerned that we won't be able to give an > > accurate progress rep

Re: Add LSN <-> time conversion functionality

2024-08-07 Thread Melanie Plageman
Attached v7 changes the SQL-callable functions to return ranges of LSNs and times covering the target time or LSN instead of linearly interpolating an approximate answer. I also changed the frequency and conditions under which the background writer updates the global LSNTimeStream. There is now a

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

2024-08-07 Thread Fujii Masao
On 2024/08/02 14:56, Hayato Kuroda (Fujitsu) wrote: I moved the function to connection.c, which uses the SearchSysCache1(). I've tried both ways, and they worked well. One difference is that when we use the extended ConnCacheEntry approach and the entry has been invalidated, we cannot distin

Re: pg_verifybackup: TAR format backup verification

2024-08-07 Thread Robert Haas
[ I committed 0001, then noticed I had a type in the subject line of the commit message. Argh. ] On Wed, Aug 7, 2024 at 9:41 AM Amul Sul wrote: > With the patch, I am concerned that we won't be able to give an > accurate progress report as before. We add all the file sizes in the > backup manifes

Re: Remaining dependency on setlocale()

2024-08-07 Thread Robert Haas
On Wed, Aug 7, 2024 at 9:42 AM Joe Conway wrote: > I guess in many/most places we use atoi we don't care, but maybe it > matters for some? I think we should move in the direction of replacing atoi() calls with strtol() and actually checking for errors. In many places where use atoi(), it's unlike

Re: Remove dependence on integer wrapping

2024-08-07 Thread Nathan Bossart
I started looking at 0001 again with the intent of committing it, and this caught my eye: -/* make the amount positive for digit-reconstruction loop */ -value = -value; +/* + * make the amount positive for digit-reconstruction loop, we can + * leave INT64_MI

Re: Fsync (flush) all inserted WAL records

2024-08-07 Thread Aleksander Alekseev
Hi, > I use asynchronous commit (without XLogFlush/fsync at commit). At some moment > I would like to XLogFlush (fsync) all already asynchronously committed > transactions (inserted but not flushed/fsynced yet WAL records). Assume, that > there is no any active transactions at this moment, no a

Re: Optimizing nbtree ScalarArrayOp execution, allowing multi-column ordered scans, skip scan

2024-08-07 Thread Peter Geoghegan
On Wed, Jul 31, 2024 at 12:47 AM Anton A. Melnikov wrote: > From the 5bf748b86bc commit message: > > > There is a theoretical risk that removing restrictions on SAOP index > > paths from the planner will break compatibility with amcanorder-based > > index AMs maintained as extensions. Such an in

Re: Interrupts vs signals

2024-08-07 Thread Heikki Linnakangas
On 10/07/2024 09:48, Thomas Munro wrote: The next problems to remove are, I think, the various SIGUSR2, SIGINT, SIGTERM signals sent by the postmaster. These should clearly become SendInterrupt() or ProcSetLatch(). The problem here is that the postmaster doesn't have the proc numbers yet. One

Re: Fsync (flush) all inserted WAL records

2024-08-07 Thread Vitaly Davydov
On Wednesday, August 07, 2024 16:55 MSK, Aleksander Alekseev wrote:   Perhaps you could give more context on the use cases for this function? The value of it is not quite clear. What people typically need is making sure if a given LSN was fsync'ed and/or replicated and/or applied on a replica. Y

Re: Restart pg_usleep when interrupted

2024-08-07 Thread Nathan Bossart
On Wed, Aug 07, 2024 at 06:00:53AM +, Bertrand Drouvot wrote: > + SleepEx((microsec < 500 ? 1 : (microsec + 500) / 1000), FALSE); I think this deserves a comment. > +#define INSTR_TIME_ADD_MICROSEC(x,t) \ > + ((x).ticks += t * NS_PER_US) I'd add parentheses around "t" to ensu

Re: Restart pg_usleep when interrupted

2024-08-07 Thread Bertrand Drouvot
Hi, On Wed, Aug 07, 2024 at 09:11:19AM -0500, Sami Imseih wrote: > > > > On Aug 7, 2024, at 1:00 AM, Bertrand Drouvot > > wrote: > > > > add t (in microseconds) to x” > > > I was attempting to be more verbose in the comment, > but what you have above matches the format of > the other commen

Re: Enable data checksums by default

2024-08-07 Thread Greg Sabino Mullane
On Wed, Aug 7, 2024 at 4:43 AM Michael Banck wrote: > I think the last time we dicussed this the consensus was that > computational overhead of computing the checksums is pretty small for > most systems (so the above change seems warranted regardless of whether > we switch the default), but turni

Re: Restart pg_usleep when interrupted

2024-08-07 Thread Sami Imseih
> On Aug 7, 2024, at 1:00 AM, Bertrand Drouvot > wrote: > > add t (in microseconds) to x” I was attempting to be more verbose in the comment, but what you have above matches the format of the other comments. I am ok with your revision. Regards. Sami

Re: Fsync (flush) all inserted WAL records

2024-08-07 Thread Aleksander Alekseev
Hi Vitaly, > I would propose a new function to fulfill my requirements like this (see > below) but I prefer not to create new functions unreasonably: > > XLogRecPtr > GetXLogLastInsertEndRecPtr(void) > { > XLogCtlInsert *Insert = &XLogCtl->Insert; > uint64 current_bytepos; > SpinLockA

Re: Support specify tablespace for each merged/split partition

2024-08-07 Thread Fujii Masao
On 2024/08/06 19:28, Junwang Zhao wrote: Attached v2 addressed all the problems you mentioned, thanks. Thanks for updating the patches! In the ALTER TABLE documentation, v1 patch updated the syntax, but the descriptions for MERGE and SPLIT should also be updated to explain the tablespace

Re: Cutting support for OpenSSL 1.0.1 and 1.0.2 in 17~?

2024-08-07 Thread Daniel Gustafsson
> On 5 Aug 2024, at 15:36, Joe Conway wrote: > It would not shock me to see complaints from others after we rip out support > for 1.0.2, but maybe not ¯\_(ツ)_/¯ I think it's highly likely that we will see complaints for any support we deprecate. OpenSSL 1.0.2 will however still be supported fo

Re: Remaining dependency on setlocale()

2024-08-07 Thread Joe Conway
On 8/7/24 03:07, Thomas Munro wrote: How far can we get by using more _l() functions? For example, [1] shows a use of strftime() that I think can be converted to strftime_l() so that it doesn't depend on setlocale(). Since POSIX doesn't specify every obvious _l function, we might need to provid

Re: Fsync (flush) all inserted WAL records

2024-08-07 Thread Vitaly Davydov
Hi Aleksander, On Wednesday, August 07, 2024 12:19 MSK, Aleksander Alekseev wrote:  > Does pg_current_wal_flush_lsn() [1] return what you need? > > [1]: > https://www.postgresql.org/docs/current/functions-admin.html#FUNCTIONS-RECOVERY-CONTROL If not, take a look at its implementation and func

Re: pg_verifybackup: TAR format backup verification

2024-08-07 Thread Amul Sul
On Tue, Aug 6, 2024 at 10:39 PM Robert Haas wrote: > > On Thu, Aug 1, 2024 at 9:19 AM Amul Sul wrote: > > > I think I would have made this pass context->show_progress to > > > progress_report() instead of the whole verifier_context, but that's an > > > arguable stylistic choice, so I'll defer to

Re: BlastRADIUS mitigation

2024-08-07 Thread Heikki Linnakangas
On 06/08/2024 03:58, Thomas Munro wrote: On Tue, Aug 6, 2024 at 2:41 AM Heikki Linnakangas wrote: What if the message contains multiple attribute of the same type? If there's a duplicate Message-Authenticator, we should surely reject the packet. I don't know if duplicate attributes are legal in

Cross-version Compatibility of postgres_fdw

2024-08-07 Thread Fujii Masao
Hi, The documentation states that postgres_fdw can be used with remote servers as far back as PostgreSQL 8.3. https://www.postgresql.org/docs/devel/postgres-fdw.html#POSTGRES-FDW-CROSS-VERSION-COMPATIBILITY However, when using PostgreSQL 9.4 or earlier as a remote server, INSERT ON CONFLICT on a

Re: Found issues related with logical replication and 2PC

2024-08-07 Thread Amit Kapila
On Wed, Aug 7, 2024 at 3:32 PM Amit Kapila wrote: > > I also think so. Additionally, I feel a test case (or some description > of the bug that can arise) should be provided for issue-1. > IIUC, the problem could be that we would end up updating the wrong local_end LSN in lsn_mappings via store_fl

Little cleanup of ShmemInit function names

2024-08-07 Thread Heikki Linnakangas
It's bothered me for a long time that some of the shmem initialization functions have non-standard names. Most of them are called FoobarShmemSize() and FoobarShmemInit(), but there are a few exceptions: InitBufferPool InitLocks InitPredicateLocks CreateSharedProcArray CreateSharedBackendStatus

Call rm_redo in a temporary memory context

2024-08-07 Thread Heikki Linnakangas
Many resource managers set up a temporary memory context which is reset after replaying the record. It seems a bit silly for each rmgr to do that on their own, so I propose that we do it in a centralized fashion. The attached patch creates one new temporary context and switches to it for each r

Re: Historic snapshot doesn't track txns committed in BUILDING_SNAPSHOT state

2024-08-07 Thread Bertrand Drouvot
Hi, On Mon, Jun 10, 2024 at 10:04:31PM +0800, cca5507 wrote: > Thank you for reply!I am trying to fix it. This patch (pass check-world) will > track txns > committed in BUILDING_SNAPSHOT state and can fix this bug. Thanks for the report and the patch! I did not look at the patch in detail but I

Re: [PATCH] Add crc32(text) & crc32(bytea)

2024-08-07 Thread Aleksander Alekseev
Hi, > Yeah, I was surprised to learn there wasn't yet an easy way to do this. > I'm not sure how much of a factor this should play in deciding the return > value for the CRC functions, but IMHO it's a reason to reconsider returning > text as you originally proposed. OK, here is the corrected patc

Re: Found issues related with logical replication and 2PC

2024-08-07 Thread Amit Kapila
On Wed, Aug 7, 2024 at 12:38 PM shveta malik wrote: > > On Wed, Jul 24, 2024 at 12:25 PM Hayato Kuroda (Fujitsu) > wrote: > > > > Issue #1 > > > > When handling a PREPARE message, the subscriber mistook the wrong lsn > > position > > (the end position of the last commit) as the end position of t

Re: Issues with ON CONFLICT UPDATE and REINDEX CONCURRENTLY

2024-08-07 Thread Michail Nikolaev
Hell, everyone! Using the brand-new injection points support in specs, I created a spec to reproduce the issue. It fails like this currently: make -C src/test/modules/injection_points/ check @@ -64,6 +64,7 @@ step s3_s1: <... completed> step s2_s1: <... completed> +ERROR: duplicate key valu

Re: Fsync (flush) all inserted WAL records

2024-08-07 Thread Aleksander Alekseev
Hi, > > Could you please advice which way to go? > > Does pg_current_wal_flush_lsn() [1] return what you need? > > [1]: > https://www.postgresql.org/docs/current/functions-admin.html#FUNCTIONS-RECOVERY-CONTROL If not, take a look at its implementation and functions around, GetInsertRecPtr() and

Re: Fsync (flush) all inserted WAL records

2024-08-07 Thread Aleksander Alekseev
Hi, > I use async commits. At some moment, I would like to make sure that all > inserted WAL records are fsync-ed. I can use XLogFlush function but I have > some doubts which LSN to specify. There is a number of functions which return > write or insert LSNs but they are not applicable. > > I ca

Re: Enable data checksums by default

2024-08-07 Thread Michael Banck
Hi, On Tue, Aug 06, 2024 at 06:46:52PM -0400, Greg Sabino Mullane wrote: > Please find attached a patch to enable data checksums by default. > > Currently, initdb only enables data checksums if passed the > --data-checksums or -k argument. There was some hesitation years ago when > this feature w

Re: Conflict detection and logging in logical replication

2024-08-07 Thread shveta malik
On Wed, Aug 7, 2024 at 1:08 PM Zhijie Hou (Fujitsu) wrote: > > On Wednesday, August 7, 2024 3:00 PM Kuroda, Hayato/黒田 隼人 > wrote: > > > > While playing with the 0003 patch (the patch may not be ready), I found that > > when the insert_exists event occurred, both apply_error_count and > > insert_

Re: Logical Replication of sequences

2024-08-07 Thread vignesh C
On Wed, 7 Aug 2024 at 08:09, Amit Kapila wrote: > > On Tue, Aug 6, 2024 at 5:13 PM vignesh C wrote: > > > > On Mon, 5 Aug 2024 at 18:05, shveta malik wrote: > > > > > > On Mon, Aug 5, 2024 at 11:04 AM vignesh C wrote: > > > > > > > > On Wed, 31 Jul 2024 at 14:39, shveta malik > > > > wrote: >

Re: Logical Replication of sequences

2024-08-07 Thread vignesh C
On Mon, 5 Aug 2024 at 17:28, Amit Kapila wrote: > > On Mon, Aug 5, 2024 at 2:36 PM vignesh C wrote: > > > > On Fri, 2 Aug 2024 at 14:24, shveta malik wrote: > > > > > > On Thu, Aug 1, 2024 at 9:26 AM shveta malik > > > wrote: > > > > > > > > On Mon, Jul 29, 2024 at 4:17 PM vignesh C wrote: >

Re: Logical Replication of sequences

2024-08-07 Thread vignesh C
On Tue, 6 Aug 2024 at 09:28, shveta malik wrote: > > On Tue, Aug 6, 2024 at 8:49 AM shveta malik wrote: > > > > Do we need some kind of coordination between table sync and sequence > sync for internally generated sequences? Lets say we have an identity > column with a 'GENERATED ALWAYS' sequence.

Re: Pgoutput not capturing the generated columns

2024-08-07 Thread Peter Smith
Hi Shubham, Here are my review comments for patch v24-0001 I think the TAP tests have incorrect expected results for the nogen-to-gen case. Whereas the HEAD code will cause "ERROR" for this test scenario, patch 0001 does not. IMO the behaviour should be unchanged for this scenario which has no g

Re: Thread-unsafe MD5 on big-endian systems with no OpenSSL

2024-08-07 Thread Heikki Linnakangas
On 06/08/2024 18:11, Michael Paquier wrote: On Aug 6, 2024, at 23:05, Robert Haas wrote: On Tue, Aug 6, 2024 at 8:23 AM Heikki Linnakangas wrote: This only affects big-endian systems that are compiled without OpenSSL. LGTM. Nice catch, looks fine to me as well. Committed, thanks --

RE: Conflict detection and logging in logical replication

2024-08-07 Thread Zhijie Hou (Fujitsu)
On Wednesday, August 7, 2024 3:00 PM Kuroda, Hayato/黒田 隼人 wrote: > > While playing with the 0003 patch (the patch may not be ready), I found that > when the insert_exists event occurred, both apply_error_count and > insert_exists_count was counted. Thanks for testing. 0003 is a separate feature

Re: [PoC] Federated Authn/z with OAUTHBEARER

2024-08-07 Thread Peter Eisentraut
On 05.08.24 19:53, Jacob Champion wrote: On Fri, Aug 2, 2024 at 11:48 AM Peter Eisentraut wrote: Yes, I think with an adjusted comment and commit message, the actual change makes sense. Done in v25. ...along with a bunch of other stuff: I have committed 0001, and I plan to backpatch it onc

Re: Remove TRACE_SORT macro?

2024-08-07 Thread Heikki Linnakangas
On 07/08/2024 09:56, Peter Eisentraut wrote: I think we could remove the TRACE_SORT macro. The TRACE_SORT macro has guarded the availability of the trace_sort GUC setting.  But it has been enabled by default ever since it was introduced in PostgreSQL 8.1, and there have been no reports that so

Re: Proposal for implementing OCSP Stapling in PostgreSQL

2024-08-07 Thread Daniel Gustafsson
While I have only skimmed the patch so far and need more review before I can comment on it, I do have a question on the expected use of OCSP support in postgres. With OCSP becoming optional [0], and big providers like Let's Encrypt deprecating OCSP [1], is this mainly targeting organizations runni

Re: Found issues related with logical replication and 2PC

2024-08-07 Thread shveta malik
On Wed, Jul 24, 2024 at 12:25 PM Hayato Kuroda (Fujitsu) wrote: > > Hi hackers, > > While creating a patch which allows ALTER SUBSCRIPTION SET (two_phase) [1], > we found some issues related with logical replication and two_phase. I think > this > can happen not only HEAD but PG14+, but for now I

Re: Remaining dependency on setlocale()

2024-08-07 Thread Thomas Munro
On Wed, Aug 7, 2024 at 10:23 AM Tom Lane wrote: > Jeff Davis writes: > > But there are a couple problems: > > > 1. I don't think it's supported on Windows. > > Can't help with that, but surely Windows has some thread-safe way. It does. It's not exactly the same, instead there is a thing you can

RE: Conflict detection and logging in logical replication

2024-08-07 Thread Hayato Kuroda (Fujitsu)
Dear Hou, While playing with the 0003 patch (the patch may not be ready), I found that when the insert_exists event occurred, both apply_error_count and insert_exists_count was counted. ``` -- insert a tuple on the subscriber subscriber =# INSERT INTO tab VALUES (1); -- insert the same tuple on