From 9cc8f83e9ffe4a667e526d7ef2bea1be0608a185 Mon Sep 17 00:00:00 2001 From: Jakub Wartak Date: Thu, 30 Jul 2026 11:02:13 +0200 Subject: [PATCH v22092026 01/11] pg_basebackup: rename the "blackhole" backup target to "server-blackhole" The built-in "blackhole" backup target discards the backup on the server side. Rename it to "server-blackhole" to make the location of the discard explicit and to leave room for a "client-blackhole" in the follow-up commit. Author: Jakub Wartak --- doc/src/sgml/protocol.sgml | 2 +- doc/src/sgml/ref/pg_basebackup.sgml | 6 +++--- src/backend/backup/basebackup_target.c | 4 ++-- src/bin/pg_basebackup/t/010_pg_basebackup.pl | 12 ++++++------ 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/doc/src/sgml/protocol.sgml b/doc/src/sgml/protocol.sgml index 49f81676712..f5d4cf4440a 100644 --- a/doc/src/sgml/protocol.sgml +++ b/doc/src/sgml/protocol.sgml @@ -3174,7 +3174,7 @@ psql "dbname=postgres replication=database" -c "IDENTIFY_SYSTEM;" sent to the client. If it is server, the backup data is written to the server at the pathname specified by the TARGET_DETAIL option. If it is - blackhole, the backup data is not sent + server-blackhole, the backup data is not sent anywhere; it is simply discarded. diff --git a/doc/src/sgml/ref/pg_basebackup.sgml b/doc/src/sgml/ref/pg_basebackup.sgml index 3117968d125..6ae7637afb9 100644 --- a/doc/src/sgml/ref/pg_basebackup.sgml +++ b/doc/src/sgml/ref/pg_basebackup.sgml @@ -268,9 +268,9 @@ PostgreSQL documentation /some/path directory. Storing a backup on the server requires superuser privileges or having privileges of the pg_write_server_files role. If the target is set to - blackhole, the contents are discarded and not - stored anywhere. This should only be used for testing purposes, as you - will not end up with an actual backup. + server-blackhole, the contents are discarded by the + server and not stored anywhere. This should only be used for testing + purposes, as you will not end up with an actual backup. diff --git a/src/backend/backup/basebackup_target.c b/src/backend/backup/basebackup_target.c index 1c250d2895c..61465458638 100644 --- a/src/backend/backup/basebackup_target.c +++ b/src/backend/backup/basebackup_target.c @@ -40,7 +40,7 @@ static void *server_check_detail(char *target, char *target_detail); static BaseBackupTargetType builtin_backup_targets[] = { { - "blackhole", reject_target_detail, blackhole_get_sink + "server-blackhole", reject_target_detail, blackhole_get_sink }, { "server", server_check_detail, server_get_sink @@ -185,7 +185,7 @@ initialize_target_list(void) /* * Normally, a get_sink function should construct and return a new bbsink that - * implements the backup target, but the 'blackhole' target just throws the + * implements the backup target, but the 'server-blackhole' target just throws the * data away. We could implement that by adding a bbsink that does nothing * but forward, but it's even cheaper to implement that by not adding a bbsink * at all. diff --git a/src/bin/pg_basebackup/t/010_pg_basebackup.pl b/src/bin/pg_basebackup/t/010_pg_basebackup.pl index 2442131e179..17977b474b8 100644 --- a/src/bin/pg_basebackup/t/010_pg_basebackup.pl +++ b/src/bin/pg_basebackup/t/010_pg_basebackup.pl @@ -683,13 +683,13 @@ $node->command_ok( 'pg_basebackup --wal-method fetch runs'); $node->command_fails_like( - [ @pg_basebackup_defs, '--target' => 'blackhole' ], + [ @pg_basebackup_defs, '--target' => 'server-blackhole' ], qr/WAL cannot be streamed when a backup target is specified/, 'backup target requires --wal-method'); $node->command_fails_like( [ @pg_basebackup_defs, - '--target' => 'blackhole', + '--target' => 'server-blackhole', '--wal-method' => 'stream' ], qr/WAL cannot be streamed when a backup target is specified/, @@ -701,7 +701,7 @@ $node->command_fails_like( $node->command_fails_like( [ @pg_basebackup_defs, - '--target' => 'blackhole', + '--target' => 'server-blackhole', '--wal-method' => 'none', '--pgdata' => "$tempdir/blackhole" ], @@ -710,7 +710,7 @@ $node->command_fails_like( $node->command_fails_like( [ @pg_basebackup_defs, - '--target' => 'blackhole', + '--target' => 'server-blackhole', '--wal-method' => 'none', '--format' => 'tar' ], @@ -719,7 +719,7 @@ $node->command_fails_like( $node->command_ok( [ @pg_basebackup_defs, - '--target' => 'blackhole', + '--target' => 'server-blackhole', '--wal-method' => 'none' ], 'backup target blackhole'); @@ -780,7 +780,7 @@ $node->command_fails_like( $node->command_fails_like( [ @pg_basebackup_defs, - '--target' => 'blackhole', + '--target' => 'server-blackhole', '--pgdata' => "$tempdir/blackhole" ], qr/cannot specify both output directory and backup target/, -- 2.43.5