agora inbox for [email protected]help / color / mirror / Atom feed
[PATCH v3 2/3] New test for timeline-tracking of walsender 2+ messages / 2 participants [nested] [flat]
* [PATCH v3 2/3] New test for timeline-tracking of walsender @ 2020-12-09 08:21 Kyotaro Horiguchi <[email protected]> 0 siblings, 0 replies; 2+ messages in thread From: Kyotaro Horiguchi @ 2020-12-09 08:21 UTC (permalink / raw) Walsender should track timeline changes while sending a historic timeline. Add a test for it. --- src/test/recovery/t/001_stream_rep.pl | 41 ++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/src/test/recovery/t/001_stream_rep.pl b/src/test/recovery/t/001_stream_rep.pl index 9e31a53de7..e78e98fb43 100644 --- a/src/test/recovery/t/001_stream_rep.pl +++ b/src/test/recovery/t/001_stream_rep.pl @@ -2,8 +2,9 @@ use strict; use warnings; use PostgresNode; +use Time::HiRes qw(usleep); use TestLib; -use Test::More tests => 36; +use Test::More tests => 37; # Initialize primary node my $node_primary = get_new_node('primary'); @@ -409,3 +410,41 @@ ok( ($phys_restart_lsn_pre cmp $phys_restart_lsn_post) == 0, my $primary_data = $node_primary->data_dir; ok(!-f "$primary_data/pg_wal/$segment_removed", "WAL segment $segment_removed recycled after physical slot advancing"); + +# +# Check if timeline-increment works while reading a historic timeline. +my $node_primary_2 = get_new_node('primary_2'); +# archiving is needed to create .paritial segment +$node_primary_2->init(allows_streaming => 1, has_archiving => 1); +$node_primary_2->start; +$node_primary_2->backup($backup_name); +my $node_standby_3 = get_new_node('standby_3'); +$node_standby_3->init_from_backup($node_primary_2, $backup_name, + has_streaming => 1); +$node_primary_2->stop; +$node_primary_2->set_standby_mode; # increment primary timeline +$node_primary_2->start; +$node_primary_2->promote; +my $logstart = $node_standby_3->current_log_position(); +$node_standby_3->start; + +my $success = 0; +for (my $i = 0 ; $i < 1000; $i++) +{ + if ($node_standby_3->find_in_log( + "requested WAL segment [0-9A-F]+ has already been removed", + $logstart)) + { + last; + } + elsif ($node_standby_3->find_in_log( + "End of WAL reached on timeline", + $logstart)) + { + $success = 1; + last; + } + usleep(100_000); +} + +ok($success, 'Timeline increment while reading a historic timeline'); -- 2.27.0 ----Next_Part(Tue_Jan__5_17_26_02_2021_224)-- Content-Type: Text/X-Patch; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="v3-0003-Fix-timeline-tracking-failure-while-sending-a-his.patch" ^ permalink raw reply [nested|flat] 2+ messages in thread
* [PATCH v20260912 3/4] add unlikely hint for enlargeStringInfo. @ 2024-09-11 04:25 Andy Fan <[email protected]> 0 siblings, 0 replies; 2+ messages in thread From: Andy Fan @ 2024-09-11 04:25 UTC (permalink / raw) enlargeStringInfo has a noticeable ratio in perf peport with a "select * from pg_class" workload). So add a unlikely hint in enlargeStringinfo to avoid some overhead. --- src/common/stringinfo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/stringinfo.c b/src/common/stringinfo.c index ae39540e468..a725ef132d7 100644 --- a/src/common/stringinfo.c +++ b/src/common/stringinfo.c @@ -345,7 +345,7 @@ enlargeStringInfo(StringInfo str, int needed) * Guard against out-of-range "needed" values. Without this, we can get * an overflow or infinite loop in the following. */ - if (needed < 0) /* should not happen */ + if (unlikely(needed < 0)) /* should not happen */ { #ifndef FRONTEND elog(ERROR, "invalid string enlargement request size: %d", needed); @@ -354,7 +354,7 @@ enlargeStringInfo(StringInfo str, int needed) exit(EXIT_FAILURE); #endif } - if (((Size) needed) >= (MaxAllocSize - (Size) str->len)) + if (unlikely(((Size) needed) >= (MaxAllocSize - (Size) str->len))) { #ifndef FRONTEND ereport(ERROR, -- 2.43.0 --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=v20260912-0001-Refactor-float8out_internval-for-better-pe.patch ^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2024-09-11 04:25 UTC | newest] Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2020-12-09 08:21 [PATCH v3 2/3] New test for timeline-tracking of walsender Kyotaro Horiguchi <[email protected]> 2024-09-11 04:25 [PATCH v20260912 3/4] add unlikely hint for enlargeStringInfo. Andy Fan <[email protected]>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox