mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-09-08 15:09:24 +02:00
c538592959
There are a lot of Perl scripts in the tree, mostly code generation and TAP tests. Occasionally, these scripts produce warnings. These are probably always mistakes on the developer side (true positives). Typical examples are warnings from genbki.pl or related when you make a mess in the catalog files during development, or warnings from tests when they massage a config file that looks different on different hosts, or mistakes during merges (e.g., duplicate subroutine definitions), or just mistakes that weren't noticed because there is a lot of output in a verbose build. This changes all warnings into fatal errors, by replacing use warnings; by use warnings FATAL => 'all'; in all Perl files. Discussion: https://www.postgresql.org/message-id/flat/06f899fd-1826-05ab-42d6-adeb1fd5e200%40eisentraut.org
65 lines
1.5 KiB
Perl
65 lines
1.5 KiB
Perl
|
|
# Copyright (c) 2021-2023, PostgreSQL Global Development Group
|
|
|
|
# Test CREATE INDEX CONCURRENTLY with concurrent modifications
|
|
use strict;
|
|
use warnings FATAL => 'all';
|
|
|
|
use PostgreSQL::Test::Cluster;
|
|
use PostgreSQL::Test::Utils;
|
|
|
|
use Test::More;
|
|
|
|
my ($node, $result);
|
|
|
|
#
|
|
# Test set-up
|
|
#
|
|
$node = PostgreSQL::Test::Cluster->new('CIC_test');
|
|
$node->init;
|
|
$node->append_conf('postgresql.conf',
|
|
'lock_timeout = ' . (1000 * $PostgreSQL::Test::Utils::timeout_default));
|
|
$node->start;
|
|
$node->safe_psql('postgres', q(CREATE EXTENSION amcheck));
|
|
$node->safe_psql('postgres', q(CREATE TABLE tbl(i int)));
|
|
$node->safe_psql('postgres', q(CREATE INDEX idx ON tbl(i)));
|
|
|
|
#
|
|
# Stress CIC with pgbench.
|
|
#
|
|
# pgbench might try to launch more than one instance of the CIC
|
|
# transaction concurrently. That would deadlock, so use an advisory
|
|
# lock to ensure only one CIC runs at a time.
|
|
#
|
|
$node->pgbench(
|
|
'--no-vacuum --client=5 --transactions=100',
|
|
0,
|
|
[qr{actually processed}],
|
|
[qr{^$}],
|
|
'concurrent INSERTs and CIC',
|
|
{
|
|
'002_pgbench_concurrent_transaction' => q(
|
|
BEGIN;
|
|
INSERT INTO tbl VALUES(0);
|
|
COMMIT;
|
|
),
|
|
'002_pgbench_concurrent_transaction_savepoints' => q(
|
|
BEGIN;
|
|
SAVEPOINT s1;
|
|
INSERT INTO tbl VALUES(0);
|
|
COMMIT;
|
|
),
|
|
'002_pgbench_concurrent_cic' => q(
|
|
SELECT pg_try_advisory_lock(42)::integer AS gotlock \gset
|
|
\if :gotlock
|
|
DROP INDEX CONCURRENTLY idx;
|
|
CREATE INDEX CONCURRENTLY idx ON tbl(i);
|
|
SELECT bt_index_check('idx',true);
|
|
SELECT pg_advisory_unlock(42);
|
|
\endif
|
|
)
|
|
});
|
|
|
|
$node->stop;
|
|
done_testing();
|