mirror of
https://git.postgresql.org/git/postgresql.git
synced 2025-02-17 19:30:00 +08:00
pg_waldump: Add test case for notice message
Add a test case for the "first record is after" message. Also, this message should really go to stderr, so change to use pg_log_info. Reviewed-by: Tristen Raab <tristen.raab@highgo.ca> Discussion: https://www.postgresql.org/message-id/flat/CAAcByaKM7zyJSDkPWv6_%2BapupY4fXXM3q3SRXas9MMNVPUGcsQ%40mail.gmail.com
This commit is contained in:
parent
96063e2836
commit
0885390151
@ -1220,12 +1220,12 @@ main(int argc, char **argv)
|
||||
*/
|
||||
if (first_record != private.startptr &&
|
||||
XLogSegmentOffset(private.startptr, WalSegSz) != 0)
|
||||
printf(ngettext("first record is after %X/%X, at %X/%X, skipping over %u byte\n",
|
||||
"first record is after %X/%X, at %X/%X, skipping over %u bytes\n",
|
||||
(first_record - private.startptr)),
|
||||
LSN_FORMAT_ARGS(private.startptr),
|
||||
LSN_FORMAT_ARGS(first_record),
|
||||
(uint32) (first_record - private.startptr));
|
||||
pg_log_info(ngettext("first record is after %X/%X, at %X/%X, skipping over %u byte",
|
||||
"first record is after %X/%X, at %X/%X, skipping over %u bytes",
|
||||
(first_record - private.startptr)),
|
||||
LSN_FORMAT_ARGS(private.startptr),
|
||||
LSN_FORMAT_ARGS(first_record),
|
||||
(uint32) (first_record - private.startptr));
|
||||
|
||||
if (config.stats == true && !config.quiet)
|
||||
stats.startptr = first_record;
|
||||
|
@ -153,6 +153,25 @@ command_like([ 'pg_waldump', '--quiet', $node->data_dir . '/pg_wal/' . $start_wa
|
||||
command_fails_like([ 'pg_waldump', '--quiet', '-p', $node->data_dir, '--start', $start_lsn ], qr/error: error in WAL record at/, 'errors are shown with --quiet');
|
||||
|
||||
|
||||
# Test for: Display a message that we're skipping data if `from`
|
||||
# wasn't a pointer to the start of a record.
|
||||
{
|
||||
# Construct a new LSN that is one byte past the original
|
||||
# start_lsn.
|
||||
my ($part1, $part2) = split qr{/}, $start_lsn;
|
||||
my $lsn2 = hex $part2;
|
||||
$lsn2++;
|
||||
my $new_start = sprintf("%s/%X", $part1, $lsn2);
|
||||
|
||||
my (@cmd, $stdout, $stderr, $result);
|
||||
|
||||
@cmd = ( 'pg_waldump', '--start', $new_start, $node->data_dir . '/pg_wal/' . $start_walfile );
|
||||
$result = IPC::Run::run \@cmd, '>', \$stdout, '2>', \$stderr;
|
||||
ok($result, "runs with start segment and start LSN specified");
|
||||
like($stderr, qr/first record is after/, 'info message printed');
|
||||
}
|
||||
|
||||
|
||||
# Helper function to test various options. Pass options as arguments.
|
||||
# Output lines are returned as array.
|
||||
sub test_pg_waldump
|
||||
|
Loading…
Reference in New Issue
Block a user