Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0885390

Browse files
committed
pg_waldump: Add test case for notice message
Add a test case for the "first record is after" message. Also, thismessage 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
1 parent96063e2 commit0885390

File tree

2 files changed

+25
-6
lines changed

2 files changed

+25
-6
lines changed

‎src/bin/pg_waldump/pg_waldump.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1220,12 +1220,12 @@ main(int argc, char **argv)
12201220
*/
12211221
if (first_record!=private.startptr&&
12221222
XLogSegmentOffset(private.startptr,WalSegSz)!=0)
1223-
printf(ngettext("first record is after %X/%X, at %X/%X, skipping over %u byte\n",
1224-
"first record is after %X/%X, at %X/%X, skipping over %u bytes\n",
1225-
(first_record-private.startptr)),
1226-
LSN_FORMAT_ARGS(private.startptr),
1227-
LSN_FORMAT_ARGS(first_record),
1228-
(uint32) (first_record-private.startptr));
1223+
pg_log_info(ngettext("first record is after %X/%X, at %X/%X, skipping over %u byte",
1224+
"first record is after %X/%X, at %X/%X, skipping over %u bytes",
1225+
(first_record-private.startptr)),
1226+
LSN_FORMAT_ARGS(private.startptr),
1227+
LSN_FORMAT_ARGS(first_record),
1228+
(uint32) (first_record-private.startptr));
12291229

12301230
if (config.stats== true&& !config.quiet)
12311231
stats.startptr=first_record;

‎src/bin/pg_waldump/t/001_basic.pl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,25 @@
153153
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');
154154

155155

156+
# Test for: Display a message that we're skipping data if `from`
157+
# wasn't a pointer to the start of a record.
158+
{
159+
# Construct a new LSN that is one byte past the original
160+
# start_lsn.
161+
my ($part1,$part2) =splitqr{/},$start_lsn;
162+
my$lsn2 =hex$part2;
163+
$lsn2++;
164+
my$new_start =sprintf("%s/%X",$part1,$lsn2);
165+
166+
my (@cmd,$stdout,$stderr,$result);
167+
168+
@cmd = ('pg_waldump','--start',$new_start,$node->data_dir .'/pg_wal/' .$start_walfile );
169+
$result = IPC::Run::run \@cmd,'>', \$stdout,'2>', \$stderr;
170+
ok($result,"runs with start segment and start LSN specified");
171+
like($stderr,qr/first record is after/,'info message printed');
172+
}
173+
174+
156175
# Helper function to test various options. Pass options as arguments.
157176
# Output lines are returned as array.
158177
subtest_pg_waldump

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp