Re: Excessive LOG messages from replication slot sync worker

From: Japin Li <japinli(at)hotmail(dot)com>
To: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Cc: shveta malik <shveta(dot)malik(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Excessive LOG messages from replication slot sync worker
Date: 2025-08-12 09:25:30
Message-ID: ME0P300MB0445C8CBB8DF94A275015747B62BA@ME0P300MB0445.AUSP300.PROD.OUTLOOK.COM
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: 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(at)hotmail(dot)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 Content-Type Size
v2-0001-Standardize-snapshot-filename-formatting.patch text/x-diff 2.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2025-08-12 09:27:49 Re: [Patch] add new parameter to pg_replication_origin_session_setup
Previous Message Amit Kapila 2025-08-12 09:14:15 Re: Parallel Apply