Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit63db0ac

Browse files
committed
Add more TAP tests for pg_dump with attribute compression
Some relations with LZ4 used as the toast compression methods have beenleft around in the main regression test suite to stress pg_upgrade, butpg_dump, that includes tests much more picky in terms of outputgenerated, had no actual coverage with this feature.Similarly to collations, tests only working with LZ4 are tracked with anadditional flag, and this uses TestLib::check_pg_config() to check ifthe build supports LZ4 or not. This stresses more scenarios withtables, materialized views and pg_dump --no-toast-compression.Author: Dilip KumarReviewed-by: Michael PaquierDiscussion:https://postgr.es/m/CAFiTN-twgPmohG7qj1HXhySq16h123y5OowsQR+5h1YeZE9fmQ@mail.gmail.com
1 parent02a93e7 commit63db0ac

File tree

1 file changed

+82
-1
lines changed

1 file changed

+82
-1
lines changed

‎src/bin/pg_dump/t/002_pg_dump.pl

Lines changed: 82 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,13 @@
233233
'--exclude-database','*dump_test*','--no-sync',
234234
],
235235
},
236+
no_toast_compression=> {
237+
dump_cmd=> [
238+
'pg_dump','--no-sync',
239+
"--file=$tempdir/no_toast_compression.sql",
240+
'--no-toast-compression','postgres',
241+
],
242+
},
236243
no_blobs=> {
237244
dump_cmd=> [
238245
'pg_dump','--no-sync',
@@ -377,6 +384,10 @@
377384
# of the pg_dump runs happening. This is what "seeds" the
378385
# system with objects to be dumped out.
379386
#
387+
# There can be a flag called 'lz4', which can be set if the test
388+
# case depends on LZ4. Tests marked with this flag are skipped if
389+
# the build used does not support LZ4.
390+
#
380391
# Building of this hash takes a bit of time as all of the regexps
381392
# included in it are compiled. This greatly improves performance
382393
# as the regexps are used for each run the test applies to.
@@ -397,6 +408,7 @@
397408
exclude_dump_test_schema=> 1,
398409
exclude_test_table=> 1,
399410
exclude_test_table_data=> 1,
411+
no_toast_compression=> 1,
400412
no_blobs=> 1,
401413
no_owner=> 1,
402414
no_privs=> 1,
@@ -2071,6 +2083,28 @@
20712083
unlike => { exclude_dump_test_schema => 1, },
20722084
},
20732085
2086+
'CREATE MATERIALIZED VIEW matview_compression' => {
2087+
create_order => 20,
2088+
create_sql => 'CREATE MATERIALIZED VIEW
2089+
dump_test.matview_compression (col2) AS
2090+
SELECT col2 FROM dump_test.test_table;
2091+
ALTER MATERIALIZED VIEW dump_test.matview_compression
2092+
ALTER COLUMN col2 SET COMPRESSION lz4;',
2093+
regexp => qr/^
2094+
\QCREATE MATERIALIZED VIEW dump_test.matview_compression AS\E
2095+
\n\s+\QSELECT test_table.col2\E
2096+
\n\s+\QFROM dump_test.test_table\E
2097+
\n\s+\QWITH NO DATA;\E
2098+
.*
2099+
\QALTER TABLE ONLY dump_test.matview_compression ALTER COLUMN col2 SET COMPRESSION lz4;\E\n
2100+
/xms,
2101+
lz4 => 1,
2102+
like =>
2103+
{%full_runs,%dump_test_schema_runs, section_pre_data => 1, },
2104+
unlike =>
2105+
{ exclude_dump_test_schema => 1, no_toast_compression => 1, },
2106+
},
2107+
20742108
'CREATE POLICY p1 ON test_table' => {
20752109
create_order => 22,
20762110
create_sql => 'CREATE POLICY p1 ON dump_test.test_table
@@ -2279,7 +2313,7 @@
22792313
create_order => 3,
22802314
create_sql => 'CREATE TABLE dump_test.test_table (
22812315
col1 serial primary key,
2282-
col2 text,
2316+
col2 text COMPRESSION pglz,
22832317
col3 text,
22842318
col4 text,
22852319
CHECK (col1 <= 1000)
@@ -2337,6 +2371,27 @@
23372371
unlike => { exclude_dump_test_schema => 1, },
23382372
},
23392373
2374+
'CREATE TABLE test_compression' => {
2375+
create_order => 3,
2376+
create_sql => 'CREATE TABLE dump_test.test_compression (
2377+
col1 int,
2378+
col2 text COMPRESSION lz4
2379+
);',
2380+
regexp => qr/^
2381+
\QCREATE TABLE dump_test.test_compression (\E\n
2382+
\s+\Qcol1 integer,\E\n
2383+
\s+\Qcol2 text\E\n
2384+
\);\n
2385+
.*
2386+
\QALTER TABLE ONLY dump_test.test_compression ALTER COLUMN col2 SET COMPRESSION lz4;\E\n
2387+
/xms,
2388+
lz4 => 1,
2389+
like =>
2390+
{%full_runs,%dump_test_schema_runs, section_pre_data => 1, },
2391+
unlike =>
2392+
{ exclude_dump_test_schema => 1, no_toast_compression => 1, },
2393+
},
2394+
23402395
'CREATE TABLE measurement PARTITIONED BY' => {
23412396
create_order => 90,
23422397
create_sql => 'CREATE TABLE dump_test.measurement (
@@ -2686,6 +2741,7 @@
26862741
defaults => 1,
26872742
exclude_test_table => 1,
26882743
exclude_test_table_data => 1,
2744+
no_toast_compression => 1,
26892745
no_blobs => 1,
26902746
no_privs => 1,
26912747
no_owner => 1,
@@ -2758,6 +2814,7 @@
27582814
exclude_dump_test_schema => 1,
27592815
exclude_test_table => 1,
27602816
exclude_test_table_data => 1,
2817+
no_toast_compression => 1,
27612818
no_blobs => 1,
27622819
no_privs => 1,
27632820
no_owner => 1,
@@ -3391,6 +3448,9 @@
33913448
$collation_support = 1;
33923449
}
33933450
3451+
# Determine whether build supports LZ4.
3452+
my$supports_lz4 = check_pg_config("#define HAVE_LIBLZ4 1");
3453+
33943454
# Create a second database for certain tests to work against
33953455
$node->psql('postgres', 'create database regress_pg_dump_test;');
33963456
@@ -3448,6 +3508,13 @@
34483508
next;
34493509
}
34503510
3511+
# Skip tests specific to LZ4 if this build does not support
3512+
# this option.
3513+
if (!$supports_lz4 && defined($tests{$test}->{lz4}))
3514+
{
3515+
next;
3516+
}
3517+
34513518
# If there is a like entry, but no unlike entry, then we will test the like case
34523519
if ($tests{$test}->{like}->{$test_key}
34533520
&& !defined($tests{$test}->{unlike}->{$test_key}))
@@ -3505,6 +3572,13 @@
35053572
next;
35063573
}
35073574
3575+
# Skip tests specific to LZ4 if this build does not support
3576+
# this option.
3577+
if (!$supports_lz4 && defined($tests{$test}->{lz4}))
3578+
{
3579+
next;
3580+
}
3581+
35083582
# Add terminating semicolon
35093583
$create_sql{$test_db} .=$tests{$test}->{create_sql} . ";";
35103584
}
@@ -3603,6 +3677,13 @@
36033677
next;
36043678
}
36053679
3680+
# Skip tests specific to LZ4 if this build does not support
3681+
# this option.
3682+
if (!$supports_lz4 && defined($tests{$test}->{lz4}))
3683+
{
3684+
next;
3685+
}
3686+
36063687
if ($run_db ne$test_db)
36073688
{
36083689
next;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp