Re: Excessive LOG messages from replication slot sync worker - Mailing list pgsql-hackers

From Japin Li
Subject Re: Excessive LOG messages from replication slot sync worker
Date
Msg-id ME0P300MB0445C8CBB8DF94A275015747B62BA@ME0P300MB0445.AUSP300.PROD.OUTLOOK.COM
Whole thread Raw
In response to Re: Excessive LOG messages from replication slot sync worker  (Fujii Masao <masao.fujii@gmail.com>)
Responses Re: Excessive LOG messages from replication slot sync worker
List pgsql-hackers
On Tue, Aug 12, 2025 at 05:57:45PM +0900, Fujii Masao wrote:
> On Tue, Aug 12, 2025 at 4:38 PM Japin Li <japinli@hotmail.com> wrote:
> >
> > On Tue, Aug 12, 2025 at 12:24:10PM +0530, shveta malik wrote:
> > > It looks like commit 2633dae (mistakenly) introduced a change ([1]) in
> > > SnapBuildSnapshotExists(), altering the format used for snapshot file
> > > names during the search. However, SnapBuildSerialize still uses the
> > > old format ("%s/%X-%X.snap"), which led to the slot-sync worker being
> > > unable to locate existing snapshot files.
> 
> Thanks for the investigation!
> 
> 
> > Sorry, it's my fault.  I forgot to update the format in SnapBuildSerialize().
> >
> > I'd prefer to update the format in SnapBuildSerialize() instead of reverting
> > this change.
> 
> +1.
> If we make this change, we should also update other places using "%X-%X"?
> 
Agreed.

> $ git grep -E "%X-%X.(snap|tmp)"
> contrib/pg_logicalinspect/pg_logicalinspect.c:  if (sscanf(filename,
> "%X-%X.snap", &hi, &lo) != 2)
> contrib/pg_logicalinspect/pg_logicalinspect.c:  sprintf(tmpfname,
> "%X-%X.snap", hi, lo);
> src/backend/replication/logical/snapbuild.c:    sprintf(path, "%s/%X-%X.snap",
> src/backend/replication/logical/snapbuild.c:    sprintf(tmppath,
> "%s/%X-%X.snap.%d.tmp",
> src/backend/replication/logical/snapbuild.c:    sprintf(path, "%s/%X-%X.snap",
> src/backend/replication/logical/snapbuild.c:            if
> (sscanf(snap_de->d_name, "%X-%X.snap", &hi, &lo) != 2)
> 

I believe that the format %X-%X also works with sscanf(). However, to maintain
consistency, the format for sscanf() has been updated as well.

-- 
Best regards,
Japin Li
ChengDu WenWu Information Technology Co., LTD.

Attachment

pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: Parallel Apply
Next
From: Amit Kapila
Date:
Subject: Re: [Patch] add new parameter to pg_replication_origin_session_setup