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


Reply via email to