diff options
Diffstat (limited to 'src/include/commands/waitlsn.h')
-rw-r--r-- | src/include/commands/waitlsn.h | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/include/commands/waitlsn.h b/src/include/commands/waitlsn.h new file mode 100644 index 00000000000..10ef63f0c09 --- /dev/null +++ b/src/include/commands/waitlsn.h @@ -0,0 +1,43 @@ +/*------------------------------------------------------------------------- + * + * waitlsn.h + * Declarations for LSN waiting routines. + * + * Copyright (c) 2024, PostgreSQL Global Development Group + * + * src/include/commands/waitlsn.h + * + *------------------------------------------------------------------------- + */ +#ifndef WAIT_LSN_H +#define WAIT_LSN_H + +#include "postgres.h" +#include "port/atomics.h" +#include "storage/spin.h" +#include "tcop/dest.h" + +/* Shared memory structures */ +typedef struct WaitLSNProcInfo +{ + int procnum; + XLogRecPtr waitLSN; +} WaitLSNProcInfo; + +typedef struct WaitLSNState +{ + pg_atomic_uint64 minLSN; + slock_t mutex; + int numWaitedProcs; + WaitLSNProcInfo procInfos[FLEXIBLE_ARRAY_MEMBER]; +} WaitLSNState; + +extern PGDLLIMPORT struct WaitLSNState *waitLSN; + +extern void WaitForLSN(XLogRecPtr targetLSN, int64 timeout); +extern Size WaitLSNShmemSize(void); +extern void WaitLSNShmemInit(void); +extern void WaitLSNSetLatches(XLogRecPtr currentLSN); +extern void WaitLSNCleanup(void); + +#endif /* WAIT_LSN_H */ |