Thread

Commits

  1. Remove duplicate assignment when initializing logical decoder context

  1. Accidental setting of XLogReaderState.private_data ?

    Antonin Houska <ah@cybertec.at> — 2019-04-15T11:51:34Z

    StartupDecodingContext() initializes ctx->reader->private_data with ctx, and
    it even does so twice. I couldn't find a place in the code where the
    (LogicalDecodingContext *) pointer is retrieved from the reader, and a simple
    test of logical replication works if the patch below is applied. Thus I assume
    that assignment is a thinko, isn't it?
    
    -- 
    Antonin Houska
    Web: https://www.cybertec-postgresql.com
    
    
  2. Re: Accidental setting of XLogReaderState.private_data ?

    Tom Lane <tgl@sss.pgh.pa.us> — 2019-04-15T15:06:18Z

    Antonin Houska <ah@cybertec.at> writes:
    > StartupDecodingContext() initializes ctx->reader->private_data with ctx, and
    > it even does so twice. I couldn't find a place in the code where the
    > (LogicalDecodingContext *) pointer is retrieved from the reader, and a simple
    > test of logical replication works if the patch below is applied. Thus I assume
    > that assignment is a thinko, isn't it?
    
    Hmm.  The second, duplicate assignment is surely pointless, but I think
    that setting the ctx as the private_data is a good idea.  It hardly seems
    out of the question that it might be needed in future.
    
    			regards, tom lane
    
    
    
    
  3. Re: Accidental setting of XLogReaderState.private_data ?

    Michael Paquier <michael@paquier.xyz> — 2019-04-16T06:13:00Z

    On Mon, Apr 15, 2019 at 11:06:18AM -0400, Tom Lane wrote:
    > Hmm.  The second, duplicate assignment is surely pointless, but I think
    > that setting the ctx as the private_data is a good idea.  It hardly seems
    > out of the question that it might be needed in future.
    
    Agreed that we should keep the assignment done with
    XLogReaderAllocate().  I have committed the patch which removes the
    useless assignment though.
    --
    Michael