PostgreSQL Source Code  git master
parallel.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * parallel.h
4  *
5  * Parallel support for pg_dump and pg_restore
6  *
7  * Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
8  * Portions Copyright (c) 1994, Regents of the University of California
9  *
10  * IDENTIFICATION
11  * src/bin/pg_dump/parallel.h
12  *
13  *-------------------------------------------------------------------------
14  */
15 
16 #ifndef PG_DUMP_PARALLEL_H
17 #define PG_DUMP_PARALLEL_H
18 
19 #include "pg_backup_archiver.h"
20 
21 /* Function to call in master process on completion of a worker task */
22 typedef void (*ParallelCompletionPtr) (ArchiveHandle *AH,
23  TocEntry *te,
24  int status,
25  void *callback_data);
26 
27 /* Wait options for WaitForWorkers */
28 typedef enum
29 {
35 
36 /* ParallelSlot is an opaque struct known only within parallel.c */
37 typedef struct ParallelSlot ParallelSlot;
38 
39 /* Overall state for parallel.c */
40 typedef struct ParallelState
41 {
42  int numWorkers; /* allowed number of workers */
43  /* these arrays have numWorkers entries, one per worker: */
44  TocEntry **te; /* item being worked on, or NULL */
45  ParallelSlot *parallelSlot; /* private info about each worker */
47 
48 #ifdef WIN32
49 extern bool parallel_init_done;
50 extern DWORD mainThreadId;
51 #endif
52 
53 extern void init_parallel_dump_utils(void);
54 
55 extern bool IsEveryWorkerIdle(ParallelState *pstate);
56 extern void WaitForWorkers(ArchiveHandle *AH, ParallelState *pstate,
57  WFW_WaitOption mode);
58 
61  ParallelState *pstate,
62  TocEntry *te,
63  T_Action act,
65  void *callback_data);
66 extern void ParallelBackupEnd(ArchiveHandle *AH, ParallelState *pstate);
67 
69 
70 #endif /* PG_DUMP_PARALLEL_H */
void init_parallel_dump_utils(void)
Definition: parallel.c:251
struct ParallelState ParallelState
void WaitForWorkers(ArchiveHandle *AH, ParallelState *pstate, WFW_WaitOption mode)
Definition: parallel.c:1477
bool IsEveryWorkerIdle(ParallelState *pstate)
Definition: parallel.c:1292
PGconn * conn
Definition: streamutil.c:46
static void callback(struct sockaddr *addr, struct sockaddr *mask, void *unused)
Definition: test_ifaddrs.c:48
WFW_WaitOption
Definition: parallel.h:28
void(* ParallelCompletionPtr)(ArchiveHandle *AH, TocEntry *te, int status, void *callback_data)
Definition: parallel.h:22
void DispatchJobForTocEntry(ArchiveHandle *AH, ParallelState *pstate, TocEntry *te, T_Action act, ParallelCompletionPtr callback, void *callback_data)
Definition: parallel.c:1229
ParallelSlot * parallelSlot
Definition: parallel.h:45
void set_archive_cancel_info(ArchiveHandle *AH, PGconn *conn)
Definition: parallel.c:744
TocEntry ** te
Definition: parallel.h:44
void ParallelBackupEnd(ArchiveHandle *AH, ParallelState *pstate)
Definition: parallel.c:1081
static void static void status(const char *fmt,...) pg_attribute_printf(1
Definition: pg_regress.c:225
int numWorkers
Definition: parallel.h:42
ParallelState * ParallelBackupStart(ArchiveHandle *AH)
Definition: parallel.c:911