From: | Andres Freund <andres(at)anarazel(dot)de> |
---|---|
To: | Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> |
Cc: | Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, amit(dot)kapila16(at)gmail(dot)com, michael(at)paquier(dot)xyz, jkatz(at)postgresql(dot)org, jcasanov(at)systemguards(dot)com(dot)ec, pgsql-hackers(at)postgresql(dot)org, john(dot)naylor(at)enterprisedb(dot)com, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Subject: | Re: START_REPLICATION SLOT causing a crash in an assert build |
Date: | 2022-10-19 21:54:21 |
Message-ID: | 20221019215421.cr2t7w4oimfoedfr@awork3.anarazel.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
On 2022-10-13 15:57:28 +0900, Masahiko Sawada wrote:
> I've attached an updated patch. I've added the common function to
> start pg_recvlogical and wait for it to become active. Please review
> it.
> +# Start pg_recvlogical process and wait for it to become active.
> +sub start_pg_recvlogical
> +{
> + my ($node, $slot_name, $create_slot) = @_;
> +
> + my @cmd = (
> + 'pg_recvlogical', '-S', "$slot_name", '-d',
> + $node->connstr('postgres'),
> + '--start', '--no-loop', '-f', '-');
> + push @cmd, '--create-slot' if $create_slot;
> +
> + # start pg_recvlogical process.
> + my $pg_recvlogical = IPC::Run::start(@cmd);
> +
> + # Wait for the replication slot to become active.
> + $node->poll_query_until('postgres',
> + "SELECT EXISTS (SELECT 1 FROM pg_replication_slots WHERE slot_name = '$slot_name' AND active_pid IS NOT NULL)"
> + ) or die "slot never became active";
> +
> + return $pg_recvlogical;
> +}
Because you never process the output from pg_recvlogical I think this test
will fail if the pipe buffer is small (or more changes are made). I think
either it needs to output to a file, or we need to process the output.
A file seems the easier solution in this case, we don't really care about what
changes are streamed to the client, right?
> +$node = PostgreSQL::Test::Cluster->new('test2');
> +$node->init(allows_streaming => 'logical');
> +$node->start;
> +$node->safe_psql('postgres', "CREATE TABLE test(i int)");
Why are we creating a new cluster? Initdbs takes a fair bit of time on some
platforms, so this seems unnecessary?
Greetings,
Andres Freund
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Geoghegan | 2022-10-19 21:58:37 | Decoupling antiwraparound autovacuum from special rules around auto cancellation |
Previous Message | Andres Freund | 2022-10-19 21:39:53 | pg_recvlogical prints bogus error when interrupted |