PostgreSQL Source Code git master
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
basebackup_sink.h File Reference
#include "access/xlogdefs.h"
#include "common/compression.h"
#include "nodes/pg_list.h"
Include dependency graph for basebackup_sink.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  bbsink_state
 
struct  bbsink
 
struct  bbsink_ops
 

Typedefs

typedef struct bbsink bbsink
 
typedef struct bbsink_ops bbsink_ops
 
typedef struct bbsink_state bbsink_state
 

Functions

static void bbsink_begin_backup (bbsink *sink, bbsink_state *state, int buffer_length)
 
static void bbsink_begin_archive (bbsink *sink, const char *archive_name)
 
static void bbsink_archive_contents (bbsink *sink, size_t len)
 
static void bbsink_end_archive (bbsink *sink)
 
static void bbsink_begin_manifest (bbsink *sink)
 
static void bbsink_manifest_contents (bbsink *sink, size_t len)
 
static void bbsink_end_manifest (bbsink *sink)
 
static void bbsink_end_backup (bbsink *sink, XLogRecPtr endptr, TimeLineID endtli)
 
static void bbsink_cleanup (bbsink *sink)
 
void bbsink_forward_begin_backup (bbsink *sink)
 
void bbsink_forward_begin_archive (bbsink *sink, const char *archive_name)
 
void bbsink_forward_archive_contents (bbsink *sink, size_t len)
 
void bbsink_forward_end_archive (bbsink *sink)
 
void bbsink_forward_begin_manifest (bbsink *sink)
 
void bbsink_forward_manifest_contents (bbsink *sink, size_t len)
 
void bbsink_forward_end_manifest (bbsink *sink)
 
void bbsink_forward_end_backup (bbsink *sink, XLogRecPtr endptr, TimeLineID endtli)
 
void bbsink_forward_cleanup (bbsink *sink)
 
bbsinkbbsink_copystream_new (bool send_to_client)
 
bbsinkbbsink_gzip_new (bbsink *next, pg_compress_specification *)
 
bbsinkbbsink_lz4_new (bbsink *next, pg_compress_specification *)
 
bbsinkbbsink_zstd_new (bbsink *next, pg_compress_specification *)
 
bbsinkbbsink_progress_new (bbsink *next, bool estimate_backup_size)
 
bbsinkbbsink_server_new (bbsink *next, char *pathname)
 
bbsinkbbsink_throttle_new (bbsink *next, uint32 maxrate)
 
void basebackup_progress_wait_checkpoint (void)
 
void basebackup_progress_estimate_backup_size (void)
 
void basebackup_progress_wait_wal_archive (bbsink_state *)
 
void basebackup_progress_transfer_wal (void)
 
void basebackup_progress_done (void)
 

Typedef Documentation

◆ bbsink

typedef struct bbsink bbsink

Definition at line 36 of file basebackup_sink.h.

◆ bbsink_ops

typedef struct bbsink_ops bbsink_ops

Definition at line 37 of file basebackup_sink.h.

◆ bbsink_state

typedef struct bbsink_state bbsink_state

Function Documentation

◆ basebackup_progress_done()

void basebackup_progress_done ( void  )

Definition at line 239 of file basebackup_progress.c.

240{
242}
void pgstat_progress_end_command(void)

References pgstat_progress_end_command().

Referenced by perform_base_backup().

◆ basebackup_progress_estimate_backup_size()

void basebackup_progress_estimate_backup_size ( void  )

Definition at line 196 of file basebackup_progress.c.

197{
200}
void pgstat_progress_update_param(int index, int64 val)
#define PROGRESS_BASEBACKUP_PHASE_ESTIMATE_BACKUP_SIZE
Definition: progress.h:134
#define PROGRESS_BASEBACKUP_PHASE
Definition: progress.h:126

References pgstat_progress_update_param(), PROGRESS_BASEBACKUP_PHASE, and PROGRESS_BASEBACKUP_PHASE_ESTIMATE_BACKUP_SIZE.

Referenced by perform_base_backup().

◆ basebackup_progress_transfer_wal()

void basebackup_progress_transfer_wal ( void  )

◆ basebackup_progress_wait_checkpoint()

void basebackup_progress_wait_checkpoint ( void  )

◆ basebackup_progress_wait_wal_archive()

void basebackup_progress_wait_wal_archive ( bbsink_state state)

Definition at line 206 of file basebackup_progress.c.

207{
208 const int index[] = {
211 };
212 int64 val[2];
213
214 /*
215 * We report having finished all tablespaces at this point, even if the
216 * archive for the main tablespace is still open, because what's going to
217 * be added is WAL files, not files that are really from the main
218 * tablespace.
219 */
221 val[1] = list_length(state->tablespaces);
223}
void pgstat_progress_update_multi_param(int nparam, const int *index, const int64 *val)
int64_t int64
Definition: c.h:482
long val
Definition: informix.c:689
static int list_length(const List *l)
Definition: pg_list.h:152
#define PROGRESS_BASEBACKUP_PHASE_WAIT_WAL_ARCHIVE
Definition: progress.h:136
#define PROGRESS_BASEBACKUP_TBLSPC_STREAMED
Definition: progress.h:130
Definition: type.h:96
Definition: regguts.h:323

References list_length(), pgstat_progress_update_multi_param(), PROGRESS_BASEBACKUP_PHASE, PROGRESS_BASEBACKUP_PHASE_WAIT_WAL_ARCHIVE, PROGRESS_BASEBACKUP_TBLSPC_STREAMED, and val.

Referenced by perform_base_backup().

◆ bbsink_archive_contents()

static void bbsink_archive_contents ( bbsink sink,
size_t  len 
)
inlinestatic

Definition at line 200 of file basebackup_sink.h.

201{
202 Assert(sink != NULL);
203
204 /*
205 * The caller should make a reasonable attempt to fill the buffer before
206 * calling this function, so it shouldn't be completely empty. Nor should
207 * it be filled beyond capacity.
208 */
209 Assert(len > 0 && len <= sink->bbs_buffer_length);
210
211 sink->bbs_ops->archive_contents(sink, len);
212}
#define Assert(condition)
Definition: c.h:812
const void size_t len
void(* archive_contents)(bbsink *sink, size_t len)
const bbsink_ops * bbs_ops

References bbsink_ops::archive_contents, Assert, bbsink::bbs_ops, and len.

Referenced by _tarWriteHeader(), _tarWritePadding(), bbsink_forward_archive_contents(), perform_base_backup(), push_to_sink(), sendFile(), and sendFileWithContent().

◆ bbsink_begin_archive()

static void bbsink_begin_archive ( bbsink sink,
const char *  archive_name 
)
inlinestatic

Definition at line 191 of file basebackup_sink.h.

192{
193 Assert(sink != NULL);
194
195 sink->bbs_ops->begin_archive(sink, archive_name);
196}
void(* begin_archive)(bbsink *sink, const char *archive_name)

References Assert, bbsink::bbs_ops, and bbsink_ops::begin_archive.

Referenced by bbsink_forward_begin_archive(), and perform_base_backup().

◆ bbsink_begin_backup()

static void bbsink_begin_backup ( bbsink sink,
bbsink_state state,
int  buffer_length 
)
inlinestatic

Definition at line 175 of file basebackup_sink.h.

176{
177 Assert(sink != NULL);
178
179 Assert(buffer_length > 0);
180
181 sink->bbs_state = state;
182 sink->bbs_buffer_length = buffer_length;
183 sink->bbs_ops->begin_backup(sink);
184
185 Assert(sink->bbs_buffer != NULL);
186 Assert((sink->bbs_buffer_length % BLCKSZ) == 0);
187}
void(* begin_backup)(bbsink *sink)
bbsink_state * bbs_state
char * bbs_buffer
size_t bbs_buffer_length

References Assert, bbsink::bbs_buffer, bbsink::bbs_buffer_length, bbsink::bbs_ops, bbsink::bbs_state, and bbsink_ops::begin_backup.

Referenced by bbsink_forward_begin_backup(), and perform_base_backup().

◆ bbsink_begin_manifest()

static void bbsink_begin_manifest ( bbsink sink)
inlinestatic

Definition at line 225 of file basebackup_sink.h.

226{
227 Assert(sink != NULL);
228
229 sink->bbs_ops->begin_manifest(sink);
230}
void(* begin_manifest)(bbsink *sink)

References Assert, bbsink::bbs_ops, and bbsink_ops::begin_manifest.

Referenced by bbsink_forward_begin_manifest(), and SendBackupManifest().

◆ bbsink_cleanup()

static void bbsink_cleanup ( bbsink sink)
inlinestatic

Definition at line 265 of file basebackup_sink.h.

266{
267 Assert(sink != NULL);
268
269 sink->bbs_ops->cleanup(sink);
270}
void(* cleanup)(bbsink *sink)

References Assert, bbsink::bbs_ops, and bbsink_ops::cleanup.

Referenced by bbsink_forward_cleanup(), and SendBaseBackup().

◆ bbsink_copystream_new()

bbsink * bbsink_copystream_new ( bool  send_to_client)

Definition at line 108 of file basebackup_copy.c.

109{
111
112 *((const bbsink_ops **) &sink->base.bbs_ops) = &bbsink_copystream_ops;
113 sink->send_to_client = send_to_client;
114
115 /* Set up for periodic progress reporting. */
118
119 return &sink->base;
120}
TimestampTz GetCurrentTimestamp(void)
Definition: timestamp.c:1644
static const bbsink_ops bbsink_copystream_ops
#define UINT64CONST(x)
Definition: c.h:500
void * palloc0(Size size)
Definition: mcxt.c:1347
TimestampTz last_progress_report_time
uint64 bytes_done_at_last_time_check

References bbsink_copystream::base, bbsink::bbs_ops, bbsink_copystream_ops, bbsink_copystream::bytes_done_at_last_time_check, GetCurrentTimestamp(), bbsink_copystream::last_progress_report_time, palloc0(), bbsink_copystream::send_to_client, and UINT64CONST.

Referenced by SendBaseBackup().

◆ bbsink_end_archive()

static void bbsink_end_archive ( bbsink sink)
inlinestatic

Definition at line 216 of file basebackup_sink.h.

217{
218 Assert(sink != NULL);
219
220 sink->bbs_ops->end_archive(sink);
221}
void(* end_archive)(bbsink *sink)

References Assert, bbsink::bbs_ops, and bbsink_ops::end_archive.

Referenced by bbsink_forward_end_archive(), and perform_base_backup().

◆ bbsink_end_backup()

static void bbsink_end_backup ( bbsink sink,
XLogRecPtr  endptr,
TimeLineID  endtli 
)
inlinestatic

Definition at line 255 of file basebackup_sink.h.

256{
257 Assert(sink != NULL);
259
260 sink->bbs_ops->end_backup(sink, endptr, endtli);
261}
void(* end_backup)(bbsink *sink, XLogRecPtr endptr, TimeLineID endtli)
List * tablespaces

References Assert, bbsink::bbs_ops, bbsink::bbs_state, bbsink_ops::end_backup, list_length(), bbsink_state::tablespace_num, and bbsink_state::tablespaces.

Referenced by bbsink_forward_end_backup(), and perform_base_backup().

◆ bbsink_end_manifest()

static void bbsink_end_manifest ( bbsink sink)
inlinestatic

Definition at line 246 of file basebackup_sink.h.

247{
248 Assert(sink != NULL);
249
250 sink->bbs_ops->end_manifest(sink);
251}
void(* end_manifest)(bbsink *sink)

References Assert, bbsink::bbs_ops, and bbsink_ops::end_manifest.

Referenced by bbsink_forward_end_manifest(), and SendBackupManifest().

◆ bbsink_forward_archive_contents()

void bbsink_forward_archive_contents ( bbsink sink,
size_t  len 
)

◆ bbsink_forward_begin_archive()

void bbsink_forward_begin_archive ( bbsink sink,
const char *  archive_name 
)

Definition at line 37 of file basebackup_sink.c.

38{
39 Assert(sink->bbs_next != NULL);
40 bbsink_begin_archive(sink->bbs_next, archive_name);
41}
static void bbsink_begin_archive(bbsink *sink, const char *archive_name)

References Assert, bbsink::bbs_next, and bbsink_begin_archive().

Referenced by bbsink_server_begin_archive(), and bbsink_shell_begin_archive().

◆ bbsink_forward_begin_backup()

void bbsink_forward_begin_backup ( bbsink sink)

Definition at line 24 of file basebackup_sink.c.

25{
26 Assert(sink->bbs_next != NULL);
27 Assert(sink->bbs_state != NULL);
29 sink->bbs_buffer_length);
30 sink->bbs_buffer = sink->bbs_next->bbs_buffer;
31}
static void bbsink_begin_backup(bbsink *sink, bbsink_state *state, int buffer_length)

References Assert, bbsink::bbs_buffer, bbsink::bbs_buffer_length, bbsink::bbs_next, bbsink::bbs_state, and bbsink_begin_backup().

Referenced by bbsink_progress_begin_backup(), and bbsink_throttle_begin_backup().

◆ bbsink_forward_begin_manifest()

void bbsink_forward_begin_manifest ( bbsink sink)

Definition at line 76 of file basebackup_sink.c.

77{
78 Assert(sink->bbs_next != NULL);
80}
static void bbsink_begin_manifest(bbsink *sink)

References Assert, bbsink::bbs_next, and bbsink_begin_manifest().

Referenced by bbsink_server_begin_manifest(), and bbsink_shell_begin_manifest().

◆ bbsink_forward_cleanup()

void bbsink_forward_cleanup ( bbsink sink)

Definition at line 121 of file basebackup_sink.c.

122{
123 Assert(sink->bbs_next != NULL);
125}
static void bbsink_cleanup(bbsink *sink)

References Assert, bbsink::bbs_next, and bbsink_cleanup().

◆ bbsink_forward_end_archive()

void bbsink_forward_end_archive ( bbsink sink)

Definition at line 66 of file basebackup_sink.c.

67{
68 Assert(sink->bbs_next != NULL);
70}
static void bbsink_end_archive(bbsink *sink)

References Assert, bbsink::bbs_next, and bbsink_end_archive().

Referenced by bbsink_progress_end_archive(), bbsink_server_end_archive(), and bbsink_shell_end_archive().

◆ bbsink_forward_end_backup()

void bbsink_forward_end_backup ( bbsink sink,
XLogRecPtr  endptr,
TimeLineID  endtli 
)

Definition at line 111 of file basebackup_sink.c.

112{
113 Assert(sink->bbs_next != NULL);
114 bbsink_end_backup(sink->bbs_next, endptr, endtli);
115}
static void bbsink_end_backup(bbsink *sink, XLogRecPtr endptr, TimeLineID endtli)

References Assert, bbsink::bbs_next, and bbsink_end_backup().

◆ bbsink_forward_end_manifest()

void bbsink_forward_end_manifest ( bbsink sink)

Definition at line 101 of file basebackup_sink.c.

102{
103 Assert(sink->bbs_next != NULL);
105}
static void bbsink_end_manifest(bbsink *sink)

References Assert, bbsink::bbs_next, and bbsink_end_manifest().

Referenced by bbsink_server_end_manifest(), and bbsink_shell_end_manifest().

◆ bbsink_forward_manifest_contents()

void bbsink_forward_manifest_contents ( bbsink sink,
size_t  len 
)

◆ bbsink_gzip_new()

bbsink * bbsink_gzip_new ( bbsink next,
pg_compress_specification compress 
)

Definition at line 62 of file basebackup_gzip.c.

63{
64#ifndef HAVE_LIBZ
66 (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
67 errmsg("gzip compression is not supported by this build")));
68 return NULL; /* keep compiler quiet */
69#else
70 bbsink_gzip *sink;
71 int compresslevel;
72
73 Assert(next != NULL);
74
75 compresslevel = compress->level;
76 Assert((compresslevel >= 1 && compresslevel <= 9) ||
77 compresslevel == Z_DEFAULT_COMPRESSION);
78
79 sink = palloc0(sizeof(bbsink_gzip));
80 *((const bbsink_ops **) &sink->base.bbs_ops) = &bbsink_gzip_ops;
81 sink->base.bbs_next = next;
82 sink->compresslevel = compresslevel;
83
84 return &sink->base;
85#endif
86}
static int32 next
Definition: blutils.c:219
int errcode(int sqlerrcode)
Definition: elog.c:853
int errmsg(const char *fmt,...)
Definition: elog.c:1070
#define ERROR
Definition: elog.h:39
#define ereport(elevel,...)
Definition: elog.h:149
static int compresslevel
Definition: pg_receivewal.c:45

References Assert, compresslevel, ereport, errcode(), errmsg(), ERROR, pg_compress_specification::level, next, and palloc0().

Referenced by SendBaseBackup().

◆ bbsink_lz4_new()

bbsink * bbsink_lz4_new ( bbsink next,
pg_compress_specification compress 
)

Definition at line 62 of file basebackup_lz4.c.

63{
64#ifndef USE_LZ4
66 (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
67 errmsg("lz4 compression is not supported by this build")));
68 return NULL; /* keep compiler quiet */
69#else
70 bbsink_lz4 *sink;
71 int compresslevel;
72
73 Assert(next != NULL);
74
75 compresslevel = compress->level;
76 Assert(compresslevel >= 0 && compresslevel <= 12);
77
78 sink = palloc0(sizeof(bbsink_lz4));
79 *((const bbsink_ops **) &sink->base.bbs_ops) = &bbsink_lz4_ops;
80 sink->base.bbs_next = next;
81 sink->compresslevel = compresslevel;
82
83 return &sink->base;
84#endif
85}

References Assert, compresslevel, ereport, errcode(), errmsg(), ERROR, pg_compress_specification::level, next, and palloc0().

Referenced by SendBaseBackup().

◆ bbsink_manifest_contents()

static void bbsink_manifest_contents ( bbsink sink,
size_t  len 
)
inlinestatic

Definition at line 234 of file basebackup_sink.h.

235{
236 Assert(sink != NULL);
237
238 /* See comments in bbsink_archive_contents. */
239 Assert(len > 0 && len <= sink->bbs_buffer_length);
240
241 sink->bbs_ops->manifest_contents(sink, len);
242}
void(* manifest_contents)(bbsink *sink, size_t len)

References Assert, bbsink::bbs_ops, len, and bbsink_ops::manifest_contents.

Referenced by bbsink_forward_manifest_contents(), and SendBackupManifest().

◆ bbsink_progress_new()

bbsink * bbsink_progress_new ( bbsink next,
bool  estimate_backup_size 
)

Definition at line 59 of file basebackup_progress.c.

60{
61 bbsink *sink;
62
63 Assert(next != NULL);
64
65 sink = palloc0(sizeof(bbsink));
66 *((const bbsink_ops **) &sink->bbs_ops) = &bbsink_progress_ops;
67 sink->bbs_next = next;
68
69 /*
70 * Report that a base backup is in progress, and set the total size of the
71 * backup to -1, which will get translated to NULL. If we're estimating
72 * the backup size, we'll insert the real estimate when we have it.
73 */
76
77 return sink;
78}
void pgstat_progress_start_command(ProgressCommandType cmdtype, Oid relid)
@ PROGRESS_COMMAND_BASEBACKUP
static const bbsink_ops bbsink_progress_ops
#define InvalidOid
Definition: postgres_ext.h:36
#define PROGRESS_BASEBACKUP_BACKUP_TOTAL
Definition: progress.h:127

References Assert, bbsink::bbs_next, bbsink::bbs_ops, bbsink_progress_ops, InvalidOid, next, palloc0(), pgstat_progress_start_command(), pgstat_progress_update_param(), PROGRESS_BASEBACKUP_BACKUP_TOTAL, and PROGRESS_COMMAND_BASEBACKUP.

Referenced by SendBaseBackup().

◆ bbsink_server_new()

bbsink * bbsink_server_new ( bbsink next,
char *  pathname 
)

Definition at line 60 of file basebackup_server.c.

61{
62 bbsink_server *sink = palloc0(sizeof(bbsink_server));
63
64 *((const bbsink_ops **) &sink->base.bbs_ops) = &bbsink_server_ops;
65 sink->pathname = pathname;
66 sink->base.bbs_next = next;
67
68 /* Replication permission is not sufficient in this case. */
70 if (!has_privs_of_role(GetUserId(), ROLE_PG_WRITE_SERVER_FILES))
72 (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
73 errmsg("permission denied to create backup stored on server"),
74 errdetail("Only roles with privileges of the \"%s\" role may create a backup stored on the server.",
75 "pg_write_server_files")));
77
78 /*
79 * It's not a good idea to store your backups in the same directory that
80 * you're backing up. If we allowed a relative path here, that could
81 * easily happen accidentally, so we don't. The user could still
82 * accomplish the same thing by including the absolute path to $PGDATA in
83 * the pathname, but that's likely an intentional bad decision rather than
84 * an accident.
85 */
86 if (!is_absolute_path(pathname))
88 (errcode(ERRCODE_INVALID_NAME),
89 errmsg("relative path not allowed for backup stored on server")));
90
91 switch (pg_check_dir(pathname))
92 {
93 case 0:
94
95 /*
96 * Does not exist, so create it using the same permissions we'd
97 * use for a new subdirectory of the data directory itself.
98 */
99 if (MakePGDirectory(pathname) < 0)
102 errmsg("could not create directory \"%s\": %m", pathname)));
103 break;
104
105 case 1:
106 /* Exists, empty. */
107 break;
108
109 case 2:
110 case 3:
111 case 4:
112 /* Exists, not empty. */
114 (errcode(ERRCODE_DUPLICATE_FILE),
115 errmsg("directory \"%s\" exists but is not empty",
116 pathname)));
117 break;
118
119 default:
120 /* Access problem. */
123 errmsg("could not access directory \"%s\": %m",
124 pathname)));
125 }
126
127 return &sink->base;
128}
bool has_privs_of_role(Oid member, Oid role)
Definition: acl.c:5268
static const bbsink_ops bbsink_server_ops
int errcode_for_file_access(void)
Definition: elog.c:876
int errdetail(const char *fmt,...)
Definition: elog.c:1203
int MakePGDirectory(const char *directoryName)
Definition: fd.c:3936
Oid GetUserId(void)
Definition: miscinit.c:517
#define is_absolute_path(filename)
Definition: port.h:103
int pg_check_dir(const char *dir)
Definition: pgcheckdir.c:33
void StartTransactionCommand(void)
Definition: xact.c:3051
void CommitTransactionCommand(void)
Definition: xact.c:3149

References bbsink_server::base, bbsink::bbs_next, bbsink::bbs_ops, bbsink_server_ops, CommitTransactionCommand(), ereport, errcode(), errcode_for_file_access(), errdetail(), errmsg(), ERROR, GetUserId(), has_privs_of_role(), is_absolute_path, MakePGDirectory(), next, palloc0(), bbsink_server::pathname, pg_check_dir(), and StartTransactionCommand().

Referenced by server_get_sink().

◆ bbsink_throttle_new()

bbsink * bbsink_throttle_new ( bbsink next,
uint32  maxrate 
)

Definition at line 68 of file basebackup_throttle.c.

69{
70 bbsink_throttle *sink;
71
72 Assert(next != NULL);
73 Assert(maxrate > 0);
74
75 sink = palloc0(sizeof(bbsink_throttle));
76 *((const bbsink_ops **) &sink->base.bbs_ops) = &bbsink_throttle_ops;
77 sink->base.bbs_next = next;
78
79 sink->throttling_sample =
81
82 /*
83 * The minimum amount of time for throttling_sample bytes to be
84 * transferred.
85 */
87
88 return &sink->base;
89}
#define THROTTLING_FREQUENCY
static const bbsink_ops bbsink_throttle_ops
#define USECS_PER_SEC
Definition: timestamp.h:134
static int32 maxrate
TimeOffset elapsed_min_unit

References Assert, bbsink_throttle::base, bbsink::bbs_next, bbsink::bbs_ops, bbsink_throttle_ops, bbsink_throttle::elapsed_min_unit, maxrate, next, palloc0(), THROTTLING_FREQUENCY, bbsink_throttle::throttling_sample, and USECS_PER_SEC.

Referenced by SendBaseBackup().

◆ bbsink_zstd_new()

bbsink * bbsink_zstd_new ( bbsink next,
pg_compress_specification compress 
)

Definition at line 61 of file basebackup_zstd.c.

62{
63#ifndef USE_ZSTD
65 (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
66 errmsg("zstd compression is not supported by this build")));
67 return NULL; /* keep compiler quiet */
68#else
69 bbsink_zstd *sink;
70
71 Assert(next != NULL);
72
73 sink = palloc0(sizeof(bbsink_zstd));
74 *((const bbsink_ops **) &sink->base.bbs_ops) = &bbsink_zstd_ops;
75 sink->base.bbs_next = next;
76 sink->compress = compress;
77
78 return &sink->base;
79#endif
80}

References Assert, ereport, errcode(), errmsg(), ERROR, next, and palloc0().

Referenced by SendBaseBackup().