aboutsummaryrefslogtreecommitdiff
path: root/src/test/perl/PostgreSQL/Test/Cluster.pm
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2021-10-28 11:45:14 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2021-10-28 11:45:14 -0400
commit7f580aa5d88a9b03d66fcb9a1d7c4fcd69d9e126 (patch)
treee48465514b802cd233456ca22378a9d8aab0dbde /src/test/perl/PostgreSQL/Test/Cluster.pm
parent46dea2419ee7895a4eb3d048317682e6f18a17e1 (diff)
downloadpostgresql-7f580aa5d88a9b03d66fcb9a1d7c4fcd69d9e126.tar.gz
postgresql-7f580aa5d88a9b03d66fcb9a1d7c4fcd69d9e126.zip
Improve contrib/amcheck's tests for CREATE INDEX CONCURRENTLY.
Commits fdd965d07 and 3cd9c3b92 tested CREATE INDEX CONCURRENTLY by launching two separate pgbench runs concurrently. This was needed so that only a single client thread would run CREATE INDEX CONCURRENTLY, avoiding deadlock between two CICs. However, there's a better way, which is to use an advisory lock to prevent concurrent CICs. That's better in part because the test code is shorter and more readable, but mostly because it automatically scales things to launch an appropriate number of CICs relative to the number of INSERT transactions. As committed, typically half to three-quarters of the CIC transactions were pointless because the INSERT transactions had already stopped. In passing, remove background_pgbench, which was added to support these tests and isn't needed anymore. We can always put it back if we find a use for it later. Back-patch to v12; older pgbench versions lack the conditional-execution features needed for this method. Tom Lane and Andrey Borodin Discussion: https://postgr.es/m/139687.1635277318@sss.pgh.pa.us
Diffstat (limited to 'src/test/perl/PostgreSQL/Test/Cluster.pm')
-rw-r--r--src/test/perl/PostgreSQL/Test/Cluster.pm48
1 files changed, 0 insertions, 48 deletions
diff --git a/src/test/perl/PostgreSQL/Test/Cluster.pm b/src/test/perl/PostgreSQL/Test/Cluster.pm
index 86eb920ea10..9467a199c8f 100644
--- a/src/test/perl/PostgreSQL/Test/Cluster.pm
+++ b/src/test/perl/PostgreSQL/Test/Cluster.pm
@@ -2070,54 +2070,6 @@ sub pgbench
=pod
-=item $node->background_pgbench($opts, $files, \$stdout, $timer) => harness
-
-Invoke B<pgbench> and return an IPC::Run harness object. The process's stdin
-is empty, and its stdout and stderr go to the $stdout scalar reference. This
-allows the caller to act on other parts of the system while B<pgbench> is
-running. Errors from B<pgbench> are the caller's problem.
-
-The specified timer object is attached to the harness, as well. It's caller's
-responsibility to select the timeout length, and to restart the timer after
-each command if the timeout is per-command.
-
-Be sure to "finish" the harness when done with it.
-
-=over
-
-=item $opts
-
-Options as a string to be split on spaces.
-
-=item $files
-
-Reference to filename/contents dictionary.
-
-=back
-
-=cut
-
-sub background_pgbench
-{
- my ($self, $opts, $files, $stdout, $timer) = @_;
-
- my @cmd =
- ('pgbench', split(/\s+/, $opts), $self->_pgbench_make_files($files));
-
- local %ENV = $self->_get_env();
-
- my $stdin = "";
- # IPC::Run would otherwise append to existing contents:
- $$stdout = "" if ref($stdout);
-
- my $harness = IPC::Run::start \@cmd, '<', \$stdin, '>', $stdout, '2>&1',
- $timer;
-
- return $harness;
-}
-
-=pod
-
=item $node->connect_ok($connstr, $test_name, %params)
Attempt a connection with a custom connection string. This is expected