• Fujii Masao's avatar
    Fix bug so logical rep launcher saves correctly time of last startup of worker. · 9f11fcec
    Fujii Masao authored
    Previously the logical replication launcher stored the last timestamp
    when it started the worker, in the local variable "last_start_time",
    in order to check whether wal_retrive_retry_interval elapsed since
    the last startup of worker. If it has elapsed, the launcher sees
    pg_subscription and starts new worker if necessary. This is for
    limitting the startup of worker to once a wal_retrieve_retry_interval.
    
    The bug was that the variable "last_start_time" was defined and
    always initialized with 0 at the beginning of the launcher's main loop.
    So even if it's set to the last timestamp in later phase of the loop,
    it's always reset to 0. Therefore the launcher could not check
    correctly whether wal_retrieve_retry_interval elapsed since
    the last startup.
    
    This patch moves the variable "last_start_time" outside the main loop
    so that it will not be reset.
    
    Reviewed-by: Petr Jelinek
    Discussion: http://postgr.es/m/CAHGQGwGJrPO++XM4mFENAwpy1eGXKsGdguYv43GUgLgU-x8nTQ@mail.gmail.com
    9f11fcec
launcher.c 24.6 KB