Thread

  1. Re: Excessive LOG messages from replication slot sync worker

    Japin Li <japinli@hotmail.com> — 2025-08-12T09:25:30Z

    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.