• Alexander Korotkov's avatar
    Implement waiting for given lsn at transaction start · 0f5ca02f
    Alexander Korotkov authored
    This commit adds following optional clause to BEGIN and START TRANSACTION
    commands.
    
      WAIT FOR LSN lsn [ TIMEOUT timeout ]
    
    New clause pospones transaction start till given lsn is applied on standby.
    This clause allows user be sure, that changes previously made on primary would
    be visible on standby.
    
    New shared memory struct is used to track awaited lsn per backend.  Recovery
    process wakes up backend once required lsn is applied.
    
    Author: Ivan Kartyshov, Anna Akenteva
    Reviewed-by: Craig Ringer, Thomas Munro, Robert Haas, Kyotaro Horiguchi
    Reviewed-by: Masahiko Sawada, Ants Aasma, Dmitry Ivanov, Simon Riggs
    Reviewed-by: Amit Kapila, Alexander Korotkov
    Discussion: https://postgr.es/m/0240c26c-9f84-30ea-fca9-93ab2df5f305%40postgrespro.ru
    0f5ca02f
wait.h 737 Bytes