LCOV - code coverage report
Current view: top level - src/include/replication - walsender.h (source / functions) Hit Total Coverage
Test: PostgreSQL 17devel Lines: 6 6 100.0 %
Date: 2024-04-23 06:11:44 Functions: 1 1 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*-------------------------------------------------------------------------
       2             :  *
       3             :  * walsender.h
       4             :  *    Exports from replication/walsender.c.
       5             :  *
       6             :  * Portions Copyright (c) 2010-2024, PostgreSQL Global Development Group
       7             :  *
       8             :  * src/include/replication/walsender.h
       9             :  *
      10             :  *-------------------------------------------------------------------------
      11             :  */
      12             : #ifndef _WALSENDER_H
      13             : #define _WALSENDER_H
      14             : 
      15             : #include "access/xlogdefs.h"
      16             : 
      17             : /*
      18             :  * What to do with a snapshot in create replication slot command.
      19             :  */
      20             : typedef enum
      21             : {
      22             :     CRS_EXPORT_SNAPSHOT,
      23             :     CRS_NOEXPORT_SNAPSHOT,
      24             :     CRS_USE_SNAPSHOT,
      25             : } CRSSnapshotAction;
      26             : 
      27             : /* global state */
      28             : extern PGDLLIMPORT bool am_walsender;
      29             : extern PGDLLIMPORT bool am_cascading_walsender;
      30             : extern PGDLLIMPORT bool am_db_walsender;
      31             : extern PGDLLIMPORT bool wake_wal_senders;
      32             : 
      33             : /* user-settable parameters */
      34             : extern PGDLLIMPORT int max_wal_senders;
      35             : extern PGDLLIMPORT int wal_sender_timeout;
      36             : extern PGDLLIMPORT bool log_replication_commands;
      37             : 
      38             : extern void InitWalSender(void);
      39             : extern bool exec_replication_command(const char *cmd_string);
      40             : extern void WalSndErrorCleanup(void);
      41             : extern void WalSndResourceCleanup(bool isCommit);
      42             : extern void PhysicalWakeupLogicalWalSnd(void);
      43             : extern XLogRecPtr GetStandbyFlushRecPtr(TimeLineID *tli);
      44             : extern void WalSndSignals(void);
      45             : extern Size WalSndShmemSize(void);
      46             : extern void WalSndShmemInit(void);
      47             : extern void WalSndWakeup(bool physical, bool logical);
      48             : extern void WalSndInitStopping(void);
      49             : extern void WalSndWaitStopping(void);
      50             : extern void HandleWalSndInitStopping(void);
      51             : extern void WalSndRqstFileReload(void);
      52             : 
      53             : /*
      54             :  * Remember that we want to wakeup walsenders later
      55             :  *
      56             :  * This is separated from doing the actual wakeup because the writeout is done
      57             :  * while holding contended locks.
      58             :  */
      59             : #define WalSndWakeupRequest() \
      60             :     do { wake_wal_senders = true; } while (0)
      61             : 
      62             : /*
      63             :  * wakeup walsenders if there is work to be done
      64             :  */
      65             : static inline void
      66      240924 : WalSndWakeupProcessRequests(bool physical, bool logical)
      67             : {
      68      240924 :     if (wake_wal_senders)
      69             :     {
      70      222392 :         wake_wal_senders = false;
      71      222392 :         if (max_wal_senders > 0)
      72      173956 :             WalSndWakeup(physical, logical);
      73             :     }
      74      240924 : }
      75             : 
      76             : #endif                          /* _WALSENDER_H */

Generated by: LCOV version 1.14