PostgreSQL Source Code git master
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
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 (yyscan_t yyscanner)
 
int replication_yylex (union YYSTYPE *yylval_param, yyscan_t yyscanner)
 
void replication_yyerror (yyscan_t yyscanner, const char *message) pg_attribute_noreturn()
 
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
 
PGDLLIMPORT Nodereplication_parse_result
 

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 280 of file repl_scanner.l.

281{
282 pfree(yyextra);
283 yylex_destroy(yyscanner);
284}
void pfree(void *pointer)
Definition: mcxt.c:1521
static core_yyscan_t yyscanner
Definition: pl_scanner.c:106
#define yyextra
Definition: scan.l:1127

References pfree(), yyextra, and yyscanner.

Referenced by exec_replication_command().

◆ replication_scanner_init()

void replication_scanner_init ( const char *  str,
yyscan_t yyscannerp 
)

Definition at line 264 of file repl_scanner.l.

265{
268
269 if (yylex_init(yyscannerp) != 0)
270 elog(ERROR, "yylex_init() failed: %m");
271
272 yyscanner = *yyscannerp;
273
274 yyset_extra(yyext, yyscanner);
275
276 yy_scan_string(str, yyscanner);
277}
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, str, and yyscanner.

Referenced by exec_replication_command().

◆ replication_scanner_is_replication_command()

bool replication_scanner_is_replication_command ( yyscan_t  yyscanner)

Definition at line 295 of file repl_scanner.l.

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

References replication_yylex(), yyextra, and yyscanner.

Referenced by exec_replication_command().

◆ replication_yyerror()

void replication_yyerror ( yyscan_t  yyscanner,
const char *  message 
)

Definition at line 256 of file repl_scanner.l.

257{
259 (errcode(ERRCODE_SYNTAX_ERROR),
260 errmsg_internal("%s", message)));
261}
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 ( 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}
#define Assert(condition)
Definition: c.h:812
#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:112
bool am_walsender
Definition: walsender.c:115

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

◆ replication_parse_result

PGDLLIMPORT Node* replication_parse_result
extern

◆ WalSndCtl