PostgreSQL Source Code git master
walsender_private.h File Reference
#include "access/xlog.h"
#include "lib/ilist.h"
#include "nodes/nodes.h"
#include "nodes/replnodes.h"
#include "replication/syncrep.h"
#include "storage/condition_variable.h"
#include "storage/shmem.h"
#include "storage/spin.h"
Include dependency graph for walsender_private.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  WalSnd
 
struct  WalSndCtlData
 

Typedefs

typedef enum WalSndState WalSndState
 
typedef struct WalSnd WalSnd
 

Enumerations

enum  WalSndState {
  WALSNDSTATE_STARTUP = 0 , WALSNDSTATE_BACKUP , WALSNDSTATE_CATCHUP , WALSNDSTATE_STREAMING ,
  WALSNDSTATE_STOPPING
}
 

Functions

void WalSndSetState (WalSndState state)
 
int replication_yyparse (Node **replication_parse_result_p, yyscan_t yyscanner)
 
int replication_yylex (union YYSTYPE *yylval_param, yyscan_t yyscanner)
 
pg_noreturn void replication_yyerror (Node **replication_parse_result_p, yyscan_t yyscanner, const char *message)
 
void replication_scanner_init (const char *str, yyscan_t *yyscannerp)
 
void replication_scanner_finish (yyscan_t yyscanner)
 
bool replication_scanner_is_replication_command (yyscan_t yyscanner)
 

Variables

PGDLLIMPORT WalSndMyWalSnd
 
PGDLLIMPORT WalSndCtlDataWalSndCtl
 

Typedef Documentation

◆ WalSnd

typedef struct WalSnd WalSnd

◆ WalSndState

typedef enum WalSndState WalSndState

Enumeration Type Documentation

◆ WalSndState

Enumerator
WALSNDSTATE_STARTUP 
WALSNDSTATE_BACKUP 
WALSNDSTATE_CATCHUP 
WALSNDSTATE_STREAMING 
WALSNDSTATE_STOPPING 

Definition at line 24 of file walsender_private.h.

25{
WalSndState
@ WALSNDSTATE_STREAMING
@ WALSNDSTATE_BACKUP
@ WALSNDSTATE_CATCHUP
@ WALSNDSTATE_STARTUP
@ WALSNDSTATE_STOPPING

Function Documentation

◆ replication_scanner_finish()

void replication_scanner_finish ( yyscan_t  yyscanner)

Definition at line 284 of file repl_scanner.l.

285{
286 pfree(yyextra);
287 yylex_destroy(yyscanner);
288}
void pfree(void *pointer)
Definition: mcxt.c:1524
#define yyextra
Definition: scan.l:1118

References pfree(), and yyextra.

Referenced by exec_replication_command().

◆ replication_scanner_init()

void replication_scanner_init ( const char *  str,
yyscan_t yyscannerp 
)

Definition at line 268 of file repl_scanner.l.

269{
270 yyscan_t yyscanner;
272
273 if (yylex_init(yyscannerp) != 0)
274 elog(ERROR, "yylex_init() failed: %m");
275
276 yyscanner = *yyscannerp;
277
278 yyset_extra(yyext, yyscanner);
279
280 yy_scan_string(str, yyscanner);
281}
void * yyscan_t
Definition: cubedata.h:67
#define ERROR
Definition: elog.h:39
#define elog(elevel,...)
Definition: elog.h:225
#define palloc0_object(type)
Definition: fe_memutils.h:75
const char * str

References elog, ERROR, palloc0_object, and str.

Referenced by exec_replication_command().

◆ replication_scanner_is_replication_command()

bool replication_scanner_is_replication_command ( yyscan_t  yyscanner)

Definition at line 299 of file repl_scanner.l.

300{
301 YYSTYPE dummy;
302 int first_token = replication_yylex(&dummy, yyscanner);
303
304 switch (first_token)
305 {
306 case K_IDENTIFY_SYSTEM:
307 case K_BASE_BACKUP:
308 case K_START_REPLICATION:
309 case K_CREATE_REPLICATION_SLOT:
310 case K_DROP_REPLICATION_SLOT:
311 case K_ALTER_REPLICATION_SLOT:
312 case K_READ_REPLICATION_SLOT:
313 case K_TIMELINE_HISTORY:
314 case K_UPLOAD_MANIFEST:
315 case K_SHOW:
316 /* Yes; push back the first token so we can parse later. */
317 yyextra->repl_pushed_back_token = first_token;
318 return true;
319 default:
320 /* Nope; we don't bother to push back the token. */
321 return false;
322 }
323}
int YYSTYPE
Definition: psqlscanslash.l:39
int replication_yylex(union YYSTYPE *yylval_param, yyscan_t yyscanner)

References replication_yylex(), and yyextra.

Referenced by exec_replication_command().

◆ replication_yyerror()

pg_noreturn void replication_yyerror ( Node **  replication_parse_result_p,
yyscan_t  yyscanner,
const char *  message 
)

Definition at line 260 of file repl_scanner.l.

261{
263 (errcode(ERRCODE_SYNTAX_ERROR),
264 errmsg_internal("%s", message)));
265}
int errmsg_internal(const char *fmt,...)
Definition: elog.c:1157
int errcode(int sqlerrcode)
Definition: elog.c:853
#define ereport(elevel,...)
Definition: elog.h:149

References ereport, errcode(), errmsg_internal(), and ERROR.

◆ replication_yylex()

int replication_yylex ( union YYSTYPE yylval_param,
yyscan_t  yyscanner 
)

◆ replication_yyparse()

int replication_yyparse ( Node **  replication_parse_result_p,
yyscan_t  yyscanner 
)

◆ WalSndSetState()

void WalSndSetState ( WalSndState  state)

Definition at line 3782 of file walsender.c.

3783{
3784 WalSnd *walsnd = MyWalSnd;
3785
3787
3788 if (walsnd->state == state)
3789 return;
3790
3791 SpinLockAcquire(&walsnd->mutex);
3792 walsnd->state = state;
3793 SpinLockRelease(&walsnd->mutex);
3794}
Assert(PointerIsAligned(start, uint64))
#define SpinLockRelease(lock)
Definition: spin.h:61
#define SpinLockAcquire(lock)
Definition: spin.h:59
slock_t mutex
WalSndState state
Definition: regguts.h:323
WalSnd * MyWalSnd
Definition: walsender.c:113
bool am_walsender
Definition: walsender.c:116

References am_walsender, Assert(), WalSnd::mutex, MyWalSnd, SpinLockAcquire, SpinLockRelease, and WalSnd::state.

Referenced by exec_replication_command(), SendBaseBackup(), StartLogicalReplication(), StartReplication(), WalSndErrorCleanup(), WalSndLoop(), and XLogSendPhysical().

Variable Documentation

◆ MyWalSnd

◆ WalSndCtl