1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-05 23:56:58 +03:00

Move basebackup code to new directory src/backend/backup

Reviewed by David Steele and Justin Pryzby

Discussion: http://postgr.es/m/CA+TgmoafqboATDSoXHz8VLrSwK_MDhjthK4hEpYjqf9_1Fmczw%40mail.gmail.com
This commit is contained in:
Robert Haas 2022-08-10 14:03:09 -04:00
parent ad3e07c156
commit f88798c098
23 changed files with 73 additions and 53 deletions

View File

@ -11,8 +11,8 @@
#include "postgres.h" #include "postgres.h"
#include "access/xact.h" #include "access/xact.h"
#include "backup/basebackup_target.h"
#include "miscadmin.h" #include "miscadmin.h"
#include "replication/basebackup_target.h"
#include "storage/fd.h" #include "storage/fd.h"
#include "utils/acl.h" #include "utils/acl.h"
#include "utils/guc.h" #include "utils/guc.h"

View File

@ -17,7 +17,8 @@ subdir = src/backend
top_builddir = ../.. top_builddir = ../..
include $(top_builddir)/src/Makefile.global include $(top_builddir)/src/Makefile.global
SUBDIRS = access bootstrap catalog parser commands executor foreign lib libpq \ SUBDIRS = access backup bootstrap catalog parser commands executor \
foreign lib libpq \
main nodes optimizer partitioning port postmaster \ main nodes optimizer partitioning port postmaster \
regex replication rewrite \ regex replication rewrite \
statistics storage tcop tsearch utils $(top_builddir)/src/timezone \ statistics storage tcop tsearch utils $(top_builddir)/src/timezone \

View File

@ -63,6 +63,7 @@
#include "access/xlogreader.h" #include "access/xlogreader.h"
#include "access/xlogrecovery.h" #include "access/xlogrecovery.h"
#include "access/xlogutils.h" #include "access/xlogutils.h"
#include "backup/basebackup.h"
#include "catalog/catversion.h" #include "catalog/catversion.h"
#include "catalog/pg_control.h" #include "catalog/pg_control.h"
#include "catalog/pg_database.h" #include "catalog/pg_database.h"
@ -77,7 +78,6 @@
#include "postmaster/bgwriter.h" #include "postmaster/bgwriter.h"
#include "postmaster/startup.h" #include "postmaster/startup.h"
#include "postmaster/walwriter.h" #include "postmaster/walwriter.h"
#include "replication/basebackup.h"
#include "replication/logical.h" #include "replication/logical.h"
#include "replication/origin.h" #include "replication/origin.h"
#include "replication/slot.h" #include "replication/slot.h"

View File

@ -40,6 +40,7 @@
#include "access/xlogreader.h" #include "access/xlogreader.h"
#include "access/xlogrecovery.h" #include "access/xlogrecovery.h"
#include "access/xlogutils.h" #include "access/xlogutils.h"
#include "backup/basebackup.h"
#include "catalog/pg_control.h" #include "catalog/pg_control.h"
#include "commands/tablespace.h" #include "commands/tablespace.h"
#include "common/file_utils.h" #include "common/file_utils.h"
@ -47,7 +48,6 @@
#include "pgstat.h" #include "pgstat.h"
#include "postmaster/bgwriter.h" #include "postmaster/bgwriter.h"
#include "postmaster/startup.h" #include "postmaster/startup.h"
#include "replication/basebackup.h"
#include "replication/walreceiver.h" #include "replication/walreceiver.h"
#include "storage/fd.h" #include "storage/fd.h"
#include "storage/ipc.h" #include "storage/ipc.h"

View File

@ -0,0 +1,30 @@
#-------------------------------------------------------------------------
#
# Makefile--
# Makefile for src/backend/backup
#
# IDENTIFICATION
# src/backend/backup/Makefile
#
#-------------------------------------------------------------------------
subdir = src/backend/backup
top_builddir = ../../..
include $(top_builddir)/src/Makefile.global
override CPPFLAGS := -I. -I$(srcdir) $(CPPFLAGS)
OBJS = \
backup_manifest.o \
basebackup.o \
basebackup_copy.o \
basebackup_gzip.o \
basebackup_lz4.o \
basebackup_zstd.o \
basebackup_progress.o \
basebackup_server.o \
basebackup_sink.o \
basebackup_target.o \
basebackup_throttle.o
include $(top_srcdir)/src/backend/common.mk

View File

@ -6,18 +6,18 @@
* Portions Copyright (c) 2010-2022, PostgreSQL Global Development Group * Portions Copyright (c) 2010-2022, PostgreSQL Global Development Group
* *
* IDENTIFICATION * IDENTIFICATION
* src/backend/replication/backup_manifest.c * src/backend/backup/backup_manifest.c
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
#include "postgres.h" #include "postgres.h"
#include "access/timeline.h" #include "access/timeline.h"
#include "backup/backup_manifest.h"
#include "backup/basebackup_sink.h"
#include "libpq/libpq.h" #include "libpq/libpq.h"
#include "libpq/pqformat.h" #include "libpq/pqformat.h"
#include "mb/pg_wchar.h" #include "mb/pg_wchar.h"
#include "replication/backup_manifest.h"
#include "replication/basebackup_sink.h"
#include "utils/builtins.h" #include "utils/builtins.h"
#include "utils/json.h" #include "utils/json.h"

View File

@ -6,7 +6,7 @@
* Portions Copyright (c) 2010-2022, PostgreSQL Global Development Group * Portions Copyright (c) 2010-2022, PostgreSQL Global Development Group
* *
* IDENTIFICATION * IDENTIFICATION
* src/backend/replication/basebackup.c * src/backend/backup/basebackup.c
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -17,9 +17,13 @@
#include <time.h> #include <time.h>
#include "access/xlog_internal.h" /* for pg_start/stop_backup */ #include "access/xlog_internal.h" /* for pg_start/stop_backup */
#include "backup/backup_manifest.h"
#include "backup/basebackup.h"
#include "backup/basebackup_sink.h"
#include "backup/basebackup_target.h"
#include "commands/defrem.h"
#include "common/compression.h" #include "common/compression.h"
#include "common/file_perm.h" #include "common/file_perm.h"
#include "commands/defrem.h"
#include "lib/stringinfo.h" #include "lib/stringinfo.h"
#include "miscadmin.h" #include "miscadmin.h"
#include "nodes/pg_list.h" #include "nodes/pg_list.h"
@ -27,10 +31,6 @@
#include "pgtar.h" #include "pgtar.h"
#include "port.h" #include "port.h"
#include "postmaster/syslogger.h" #include "postmaster/syslogger.h"
#include "replication/basebackup.h"
#include "replication/basebackup_sink.h"
#include "replication/basebackup_target.h"
#include "replication/backup_manifest.h"
#include "replication/walsender.h" #include "replication/walsender.h"
#include "replication/walsender_private.h" #include "replication/walsender_private.h"
#include "storage/bufpage.h" #include "storage/bufpage.h"

View File

@ -19,17 +19,17 @@
* Portions Copyright (c) 2010-2022, PostgreSQL Global Development Group * Portions Copyright (c) 2010-2022, PostgreSQL Global Development Group
* *
* IDENTIFICATION * IDENTIFICATION
* src/backend/replication/basebackup_copy.c * src/backend/backup/basebackup_copy.c
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
#include "postgres.h" #include "postgres.h"
#include "backup/basebackup.h"
#include "backup/basebackup_sink.h"
#include "catalog/pg_type_d.h" #include "catalog/pg_type_d.h"
#include "libpq/libpq.h" #include "libpq/libpq.h"
#include "libpq/pqformat.h" #include "libpq/pqformat.h"
#include "replication/basebackup.h"
#include "replication/basebackup_sink.h"
#include "utils/timestamp.h" #include "utils/timestamp.h"
typedef struct bbsink_copystream typedef struct bbsink_copystream

View File

@ -6,7 +6,7 @@
* Portions Copyright (c) 2010-2022, PostgreSQL Global Development Group * Portions Copyright (c) 2010-2022, PostgreSQL Global Development Group
* *
* IDENTIFICATION * IDENTIFICATION
* src/backend/replication/basebackup_gzip.c * src/backend/backup/basebackup_gzip.c
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -16,7 +16,7 @@
#include <zlib.h> #include <zlib.h>
#endif #endif
#include "replication/basebackup_sink.h" #include "backup/basebackup_sink.h"
#ifdef HAVE_LIBZ #ifdef HAVE_LIBZ
typedef struct bbsink_gzip typedef struct bbsink_gzip

View File

@ -6,7 +6,7 @@
* Portions Copyright (c) 2010-2022, PostgreSQL Global Development Group * Portions Copyright (c) 2010-2022, PostgreSQL Global Development Group
* *
* IDENTIFICATION * IDENTIFICATION
* src/backend/replication/basebackup_lz4.c * src/backend/backup/basebackup_lz4.c
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -16,7 +16,7 @@
#include <lz4frame.h> #include <lz4frame.h>
#endif #endif
#include "replication/basebackup_sink.h" #include "backup/basebackup_sink.h"
#ifdef USE_LZ4 #ifdef USE_LZ4

View File

@ -25,16 +25,16 @@
* Portions Copyright (c) 2010-2022, PostgreSQL Global Development Group * Portions Copyright (c) 2010-2022, PostgreSQL Global Development Group
* *
* IDENTIFICATION * IDENTIFICATION
* src/backend/replication/basebackup_progress.c * src/backend/backup/basebackup_progress.c
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
#include "postgres.h" #include "postgres.h"
#include "backup/basebackup.h"
#include "backup/basebackup_sink.h"
#include "commands/progress.h" #include "commands/progress.h"
#include "miscadmin.h" #include "miscadmin.h"
#include "replication/basebackup.h"
#include "replication/basebackup_sink.h"
#include "pgstat.h" #include "pgstat.h"
#include "storage/latch.h" #include "storage/latch.h"
#include "utils/timestamp.h" #include "utils/timestamp.h"

View File

@ -4,17 +4,17 @@
* store basebackup archives on the server * store basebackup archives on the server
* *
* IDENTIFICATION * IDENTIFICATION
* src/backend/replication/basebackup_server.c * src/backend/backup/basebackup_server.c
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
#include "postgres.h" #include "postgres.h"
#include "access/xact.h" #include "access/xact.h"
#include "backup/basebackup.h"
#include "backup/basebackup_sink.h"
#include "catalog/pg_authid.h" #include "catalog/pg_authid.h"
#include "miscadmin.h" #include "miscadmin.h"
#include "replication/basebackup.h"
#include "replication/basebackup_sink.h"
#include "storage/fd.h" #include "storage/fd.h"
#include "utils/acl.h" #include "utils/acl.h"
#include "utils/timestamp.h" #include "utils/timestamp.h"

View File

@ -5,14 +5,14 @@
* *
* Portions Copyright (c) 2010-2022, PostgreSQL Global Development Group * Portions Copyright (c) 2010-2022, PostgreSQL Global Development Group
* *
* src/backend/replication/basebackup_sink.c * src/backend/backup/basebackup_sink.c
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
#include "postgres.h" #include "postgres.h"
#include "replication/basebackup_sink.h" #include "backup/basebackup_sink.h"
/* /*
* Forward begin_backup callback. * Forward begin_backup callback.

View File

@ -9,13 +9,13 @@
* Portions Copyright (c) 2010-2022, PostgreSQL Global Development Group * Portions Copyright (c) 2010-2022, PostgreSQL Global Development Group
* *
* IDENTIFICATION * IDENTIFICATION
* src/backend/replication/basebackup_target.c * src/backend/backup/basebackup_target.c
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
#include "postgres.h" #include "postgres.h"
#include "replication/basebackup_target.h" #include "backup/basebackup_target.h"
#include "utils/memutils.h" #include "utils/memutils.h"
typedef struct BaseBackupTargetType typedef struct BaseBackupTargetType

View File

@ -8,14 +8,14 @@
* Portions Copyright (c) 2010-2022, PostgreSQL Global Development Group * Portions Copyright (c) 2010-2022, PostgreSQL Global Development Group
* *
* IDENTIFICATION * IDENTIFICATION
* src/backend/replication/basebackup_throttle.c * src/backend/backup/basebackup_throttle.c
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
#include "postgres.h" #include "postgres.h"
#include "backup/basebackup_sink.h"
#include "miscadmin.h" #include "miscadmin.h"
#include "replication/basebackup_sink.h"
#include "pgstat.h" #include "pgstat.h"
#include "storage/latch.h" #include "storage/latch.h"
#include "utils/timestamp.h" #include "utils/timestamp.h"

View File

@ -6,7 +6,7 @@
* Portions Copyright (c) 2010-2022, PostgreSQL Global Development Group * Portions Copyright (c) 2010-2022, PostgreSQL Global Development Group
* *
* IDENTIFICATION * IDENTIFICATION
* src/backend/replication/basebackup_zstd.c * src/backend/backup/basebackup_zstd.c
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -16,7 +16,7 @@
#include <zstd.h> #include <zstd.h>
#endif #endif
#include "replication/basebackup_sink.h" #include "backup/basebackup_sink.h"
#ifdef USE_ZSTD #ifdef USE_ZSTD

View File

@ -15,17 +15,6 @@ include $(top_builddir)/src/Makefile.global
override CPPFLAGS := -I. -I$(srcdir) $(CPPFLAGS) override CPPFLAGS := -I. -I$(srcdir) $(CPPFLAGS)
OBJS = \ OBJS = \
backup_manifest.o \
basebackup.o \
basebackup_copy.o \
basebackup_gzip.o \
basebackup_lz4.o \
basebackup_zstd.o \
basebackup_progress.o \
basebackup_server.o \
basebackup_sink.o \
basebackup_target.o \
basebackup_throttle.o \
repl_gram.o \ repl_gram.o \
slot.o \ slot.o \
slotfuncs.o \ slotfuncs.o \

View File

@ -57,6 +57,7 @@
#include "access/xlogreader.h" #include "access/xlogreader.h"
#include "access/xlogrecovery.h" #include "access/xlogrecovery.h"
#include "access/xlogutils.h" #include "access/xlogutils.h"
#include "backup/basebackup.h"
#include "catalog/pg_authid.h" #include "catalog/pg_authid.h"
#include "catalog/pg_type.h" #include "catalog/pg_type.h"
#include "commands/dbcommands.h" #include "commands/dbcommands.h"
@ -68,7 +69,6 @@
#include "nodes/replnodes.h" #include "nodes/replnodes.h"
#include "pgstat.h" #include "pgstat.h"
#include "postmaster/interrupt.h" #include "postmaster/interrupt.h"
#include "replication/basebackup.h"
#include "replication/decode.h" #include "replication/decode.h"
#include "replication/logical.h" #include "replication/logical.h"
#include "replication/slot.h" #include "replication/slot.h"

View File

@ -28,6 +28,7 @@
#endif #endif
#include "access/xlog_internal.h" #include "access/xlog_internal.h"
#include "backup/basebackup.h"
#include "bbstreamer.h" #include "bbstreamer.h"
#include "common/compression.h" #include "common/compression.h"
#include "common/file_perm.h" #include "common/file_perm.h"
@ -37,7 +38,6 @@
#include "fe_utils/recovery_gen.h" #include "fe_utils/recovery_gen.h"
#include "getopt_long.h" #include "getopt_long.h"
#include "receivelog.h" #include "receivelog.h"
#include "replication/basebackup.h"
#include "streamutil.h" #include "streamutil.h"
#define ERRCODE_DATA_CORRUPTED "XX001" #define ERRCODE_DATA_CORRUPTED "XX001"

View File

@ -5,16 +5,16 @@
* *
* Portions Copyright (c) 2010-2022, PostgreSQL Global Development Group * Portions Copyright (c) 2010-2022, PostgreSQL Global Development Group
* *
* src/include/replication/backup_manifest.h * src/include/backup/backup_manifest.h
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
#ifndef BACKUP_MANIFEST_H #ifndef BACKUP_MANIFEST_H
#define BACKUP_MANIFEST_H #define BACKUP_MANIFEST_H
#include "backup/basebackup_sink.h"
#include "common/checksum_helper.h" #include "common/checksum_helper.h"
#include "pgtime.h" #include "pgtime.h"
#include "replication/basebackup_sink.h"
#include "storage/buffile.h" #include "storage/buffile.h"
typedef enum manifest_option typedef enum manifest_option

View File

@ -5,7 +5,7 @@
* *
* Portions Copyright (c) 2010-2022, PostgreSQL Global Development Group * Portions Copyright (c) 2010-2022, PostgreSQL Global Development Group
* *
* src/include/replication/basebackup.h * src/include/backup/basebackup.h
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */

View File

@ -19,7 +19,7 @@
* *
* Portions Copyright (c) 2010-2022, PostgreSQL Global Development Group * Portions Copyright (c) 2010-2022, PostgreSQL Global Development Group
* *
* src/include/replication/basebackup_sink.h * src/include/backup/basebackup_sink.h
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */

View File

@ -5,14 +5,14 @@
* *
* Portions Copyright (c) 2010-2022, PostgreSQL Global Development Group * Portions Copyright (c) 2010-2022, PostgreSQL Global Development Group
* *
* src/include/replication/basebackup_target.h * src/include/backup/basebackup_target.h
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
#ifndef BASEBACKUP_TARGET_H #ifndef BASEBACKUP_TARGET_H
#define BASEBACKUP_TARGET_H #define BASEBACKUP_TARGET_H
#include "replication/basebackup_sink.h" #include "backup/basebackup_sink.h"
struct BaseBackupTargetHandle; struct BaseBackupTargetHandle;
typedef struct BaseBackupTargetHandle BaseBackupTargetHandle; typedef struct BaseBackupTargetHandle BaseBackupTargetHandle;