Re: Add --tablespace option to reindexdb

From: Mark Dilger <mark(dot)dilger(at)enterprisedb(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Add --tablespace option to reindexdb
Date: 2021-03-01 18:12:54
Message-ID: ED77749E-33D8-49AC-88D8-D1320316086D@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> On Feb 25, 2021, at 10:49 PM, Michael Paquier <michael(at)paquier(dot)xyz> wrote:
>
> Anyway, I would rather group the whole set of
> tests together, and using the --tablespace option introduced here
> within a TAP test does the job.

Your check verifies that reindexing a system table on a new tablespace fails, but does not verify what the failure was. I wonder if you might want to make it more robust, something like:

diff --git a/src/bin/scripts/t/090_reindexdb.pl b/src/bin/scripts/t/090_reindexdb.pl
index 6946268209..8453acc817 100644
--- a/src/bin/scripts/t/090_reindexdb.pl
+++ b/src/bin/scripts/t/090_reindexdb.pl
@@ -3,7 +3,7 @@ use warnings;

use PostgresNode;
use TestLib;
-use Test::More tests => 54;
+use Test::More tests => 58;

program_help_ok('reindexdb');
program_version_ok('reindexdb');
@@ -108,23 +108,35 @@ $node->issues_sql_like(
# names, and CONCURRENTLY cannot be used in transaction blocks, preventing
# the use of TRY/CATCH blocks in a custom function to filter error
# messages.
-$node->command_fails(
+$node->command_checks_all(
[ 'reindexdb', '-t', $toast_table, '--tablespace', $tbspace, 'postgres' ],
+ 1,
+ [ ],
+ [ qr/cannot move system relation/ ],
'reindex toast table with tablespace');
-$node->command_fails(
+$node->command_checks_all(
[
'reindexdb', '--concurrently', '-t', $toast_table,
'--tablespace', $tbspace, 'postgres'
],
+ 1,
+ [ ],
+ [ qr/cannot move system relation/ ],
'reindex toast table concurrently with tablespace');
-$node->command_fails(
+$node->command_checks_all(
[ 'reindexdb', '-i', $toast_index, '--tablespace', $tbspace, 'postgres' ],
+ 1,
+ [ ],
+ [ qr/cannot move system relation/ ],
'reindex toast index with tablespace');
-$node->command_fails(
+$node->command_checks_all(
[
'reindexdb', '--concurrently', '-i', $toast_index,
'--tablespace', $tbspace, 'postgres'
],
+ 1,
+ [ ],
+ [ qr/cannot move system relation/ ],
'reindex toast index concurrently with tablespace');

# connection strings


Mark Dilger
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2021-03-01 18:16:08 Re: [PATCH] Bug fix in initdb output
Previous Message Mark Dilger 2021-03-01 17:47:57 Re: Add --tablespace option to reindexdb