PostgreSQL Source Code git master
Loading...
Searching...
No Matches
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
 

Macros

#define SYNC_STANDBY_INIT   (1 << 0)
 
#define SYNC_STANDBY_DEFINED   (1 << 1)
 

Typedefs

typedef enum WalSndState WalSndState
 
typedef struct WalSnd WalSnd
 
typedef voidyyscan_t
 

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
 

Macro Definition Documentation

◆ SYNC_STANDBY_DEFINED

#define SYNC_STANDBY_DEFINED   (1 << 1)

Definition at line 132 of file walsender_private.h.

◆ SYNC_STANDBY_INIT

#define SYNC_STANDBY_INIT   (1 << 0)

Definition at line 125 of file walsender_private.h.

Typedef Documentation

◆ WalSnd

◆ WalSndState

◆ yyscan_t

Definition at line 144 of file walsender_private.h.

Enumeration Type Documentation

◆ WalSndState

Enumerator
WALSNDSTATE_STARTUP 
WALSNDSTATE_BACKUP 
WALSNDSTATE_CATCHUP 
WALSNDSTATE_STREAMING 
WALSNDSTATE_STOPPING 

Definition at line 24 of file walsender_private.h.

Function Documentation

◆ replication_scanner_finish()

void replication_scanner_finish ( yyscan_t  yyscanner)
extern

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:1616
static int fb(int x)
#define yyextra
Definition scan.l:1093

References fb(), pfree(), and yyextra.

Referenced by exec_replication_command().

◆ replication_scanner_init()

void replication_scanner_init ( const char str,
yyscan_t yyscannerp 
)
extern

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:65
#define ERROR
Definition elog.h:39
#define elog(elevel,...)
Definition elog.h:226
#define palloc0_object(type)
Definition fe_memutils.h:75
const char * str

References elog, ERROR, fb(), palloc0_object, and str.

Referenced by exec_replication_command().

◆ replication_scanner_is_replication_command()

bool replication_scanner_is_replication_command ( yyscan_t  yyscanner)
extern

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 {
307 case K_BASE_BACKUP:
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
int replication_yylex(union YYSTYPE *yylval_param, yyscan_t yyscanner)

References fb(), 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 
)
extern

Definition at line 260 of file repl_scanner.l.

261{
264 errmsg_internal("%s", message)));
265}
int errmsg_internal(const char *fmt,...)
Definition elog.c:1170
int errcode(int sqlerrcode)
Definition elog.c:863
#define ereport(elevel,...)
Definition elog.h:150

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

◆ replication_yylex()

int replication_yylex ( union YYSTYPE yylval_param,
yyscan_t  yyscanner 
)
extern

◆ replication_yyparse()

int replication_yyparse ( Node **  replication_parse_result_p,
yyscan_t  yyscanner 
)
extern

◆ WalSndSetState()

void WalSndSetState ( WalSndState  state)
extern

Definition at line 3942 of file walsender.c.

3943{
3945
3947
3948 if (walsnd->state == state)
3949 return;
3950
3951 SpinLockAcquire(&walsnd->mutex);
3952 walsnd->state = state;
3953 SpinLockRelease(&walsnd->mutex);
3954}
#define Assert(condition)
Definition c.h:873
#define SpinLockRelease(lock)
Definition spin.h:61
#define SpinLockAcquire(lock)
Definition spin.h:59
WalSnd * MyWalSnd
Definition walsender.c:120
bool am_walsender
Definition walsender.c:123

References am_walsender, Assert, fb(), MyWalSnd, SpinLockAcquire, and SpinLockRelease.

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

Variable Documentation

◆ MyWalSnd

◆ WalSndCtl