| 1 |
|
| 2 |
# Copyright (c) 2021-2025, PostgreSQL Global Development Group |
| 3 |
|
| 4 |
# Verify that pg_verifybackup handles hex-encoded filenames correctly. |
| 5 |
|
| 6 |
use strict; |
| 7 |
use warnings FATAL => 'all'; |
| 8 |
use PostgreSQL::Test::Cluster; |
| 9 |
use PostgreSQL::Test::Utils; |
| 10 |
use Test::More; |
| 11 |
|
| 12 |
my $primary = PostgreSQL::Test::Cluster->new('primary'); |
| 13 |
$primary->init(allows_streaming => 1); |
| 14 |
$primary->start; |
| 15 |
my $backup_path = $primary->backup_dir . '/test_encoding'; |
| 16 |
$primary->command_ok( |
| 17 |
[ |
| 18 |
'pg_basebackup', |
| 19 |
'--pgdata' => $backup_path, |
| 20 |
'--no-sync', |
| 21 |
'--checkpoint' => 'fast', |
| 22 |
'--manifest-force-encode', |
| 23 |
], |
| 24 |
"backup ok with forced hex encoding"); |
| 25 |
|
| 26 |
my $manifest = slurp_file("$backup_path/backup_manifest"); |
| 27 |
my $count_of_encoded_path_in_manifest = (() = $manifest =~ /Encoded-Path/mig); |
| 28 |
cmp_ok($count_of_encoded_path_in_manifest, |
| 29 |
'>', 100, "many paths are encoded in the manifest"); |
| 30 |
|
| 31 |
command_like( |
| 32 |
[ 'pg_verifybackup', '--skip-checksums', $backup_path ], |
| 33 |
qr/backup successfully verified/, |
| 34 |
'backup with forced encoding verified'); |
| 35 |
|
| 36 |
done_testing(); |