Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jnRNL-00012q-PE for pgsql-hackers@arkaria.postgresql.org; Mon, 22 Jun 2020 18:41:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jnRNI-0003Pd-Hm for pgsql-hackers@arkaria.postgresql.org; Mon, 22 Jun 2020 18:40:56 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jnRNI-0003PW-0i for pgsql-hackers@lists.postgresql.org; Mon, 22 Jun 2020 18:40:56 +0000 Received: from mail-il1-x141.google.com ([2607:f8b0:4864:20::141]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jnRNF-000239-1l for pgsql-hackers@lists.postgresql.org; Mon, 22 Jun 2020 18:40:54 +0000 Received: by mail-il1-x141.google.com with SMTP id p5so16906012ile.6 for ; Mon, 22 Jun 2020 11:40:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :in-reply-to:user-agent; bh=ze7uSS5zepIKJQ63+vmCkICmBYn+i/xPR8w/gv5XLAo=; b=N3yeeRWAFDvu50fdn2JiYmcj778EcuAe15idM0gqyrjPAfs8wyyy5Qe7dHiNUdxiZS pUi/dEPVlSlxkOS/gedbv7Zu4EJ3wQ4uVBKlv47Ps71EST7iayQqmKAxJxjZLdOFMhZj VazB59OzThrHRRifIlkx3QDACINCYy8JkpDRBfA4+gZll7wK9aSRTybCEDnvp6Qus2nK U1mEeMCLTNHxXc2nAdtsQwVFISdoQv01HOB7k2uEbaHqvznuCzDpP6QtAKdpojgBnyVx suyR5MeWKx0oDBhD8lMa6U+UUxIs8tu0WtSBHn5XgarMerWP9quLFWtrQ0oA69slqgb3 suaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:in-reply-to:user-agent; bh=ze7uSS5zepIKJQ63+vmCkICmBYn+i/xPR8w/gv5XLAo=; b=DusR907EknrcAbmWO2gXcn+1sT1umSefma1KMokJfq0LiJrOHEAHmYCBfED8mZyp8w 5JB6z0ctfjXPug1qC7487YKeBsVwOr+O8Xu/4KNz90TN0zfu0ChAQxnRQoSbz756TNyS tT6moi4FMPHkOuIfeLH3p3iM4XVedBUYLRGAhqNiy/jB9ci17khlJrnHOL7fn56yniy/ DVZx5l1ghwcY/+R6ym3EPI9D0zJdnSx0OOHnrM52VeTJXW2Pc5elS9drULtG1HeRHBBO wpqLsmYkppWBogPi5nqCK0WQgCjoQWh4CYPoJL05WWDLm+JCjJI6vJ6p0H4N7eAY61EY K4FA== X-Gm-Message-State: AOAM532m6fmFG9E8k0q3pGjDE/HeBgD4hyWNipqlmJ+v9sTaUw6w6pxQ zR7msSC83pRQZNJr0wc9QzyJwQ== X-Google-Smtp-Source: ABdhPJxXMIteh+Ned7lA9k0nGxfiGn7aoZWAtFDVV4W3sqn/S9aRsSWNy4VotuzQUm4A/pJKN94tpg== X-Received: by 2002:a92:8411:: with SMTP id l17mr2421202ild.83.1592851252043; Mon, 22 Jun 2020 11:40:52 -0700 (PDT) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id p124sm4517552iod.32.2020.06.22.11.40.50 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 Jun 2020 11:40:50 -0700 (PDT) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 47A2F8008C3; Mon, 22 Jun 2020 13:40:48 -0500 (CDT) Date: Mon, 22 Jun 2020 13:40:48 -0500 From: Justin Pryzby To: David Gilman Cc: pgsql-hackers@lists.postgresql.org, Jim Woodworth Subject: Re: Warn when parallel restoring a custom dump without data offsets Message-ID: <20200622184048.GX17995@telsasoft.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="K3vkeaB0MlFjg8U+" Content-Disposition: inline In-Reply-To: <20200622131951.GM17995@telsasoft.com> <20200621194225.GE17995@telsasoft.com> <20200613225121.GN14879@telsasoft.com> User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --K3vkeaB0MlFjg8U+ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Adding Jim, since he ask about helping with perl. You can read the history of the patch here: https://commitfest.postgresql.org/28/2568/ https://www.postgresql.org/message-id/flat/CALBH9DDuJ+scZc4MEvw5uO-=vRyR2=QF9+Yh=3hPEnKHWfS81A@mail.gmail.com Some context: David is adding a test case for a bugfix he made. We want to test parallel pg_restore of a pg_dump created with a nonseekable FD. I suggested to make the patch smaller by creating a nonseekable FD using a pipe. The postgres test code is using IPC::Run, but currently passing a single argument. I think we want to change that to pass *multiple* arguments, so we can use '>' and/or '|'. I have a patch which partially works, and another patch which I didn't try very hard to make work, since the first part already took me a long time.. You'll want to start with a git checkout and do: time ./configure --enable-tap-tests ... And apply David's patches from the above thread. The goal is to make a test case that fails without his patch and passes with it. And maybe apply my patches if they're useful. I've been running the pg_dump checks like this: time make -C src/bin/pg_dump check On Sun, Jun 21, 2020 at 02:42:25PM -0500, Justin Pryzby wrote: > On Sun, Jun 21, 2020 at 03:18:58PM -0400, David Gilman wrote: > > Thank you for taking a stab at the perl thing. I took the question to > > StackOverflow, I haven't yet looped back to try their suggestion but I > > think there is hope by messing with the Perl references. > > https://stackoverflow.com/questions/62086173/using-the-right-perl-array-references-with-ipcrun > > I finally got this to work using IPC:Run's '>' redirection operator, but it > seems like that opens a file which *is* seekable, so doesn't work for this > purpose. Since "cat" isn't portable (duh), the next best thing seems to be to > pipe to perl -pe '' >ouput. Otherwise maybe your way of adding an > --disable-seeking option is best. > > See if you can do anything with the attached. [fixed patch I sent to David offlist] [and another patch which doesn't work yet] -- Justin PS. The patches are named *.txt so that the patch tester doesn't try to test them, as they're known to be incomplete. --K3vkeaB0MlFjg8U+ Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-Write-to-stdout-instead-of-disable-seeking.txt" From 737abbc1115ee1360ac950bcf6abe1677f1eaa79 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sat, 13 Jun 2020 15:29:48 -0700 Subject: [PATCH 1/3] Write to stdout instead of --disable-seeking --- src/bin/pg_dump/t/002_pg_dump.pl | 4 ++-- src/test/perl/TestLib.pm | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/bin/pg_dump/t/002_pg_dump.pl b/src/bin/pg_dump/t/002_pg_dump.pl index 2423ec5b1d..8c89488a12 100644 --- a/src/bin/pg_dump/t/002_pg_dump.pl +++ b/src/bin/pg_dump/t/002_pg_dump.pl @@ -153,8 +153,8 @@ my %pgdump_runs = ( defaults_custom_format_no_seek_parallel_restore => { test_key => 'defaults', dump_cmd => [ - 'pg_dump', '-Fc', '-Z6', '--no-sync', '--disable-seeking', - "--file=$tempdir/defaults_custom_format_no_seek_parallel_restore.dump", 'postgres', + [ 'pg_dump', '-Fc', '-Z6', '--no-sync', 'postgres', ], + '>', "$tempdir/defaults_custom_format_no_seek_parallel_restore.dump", # stdout disables seeking ], restore_cmd => [ 'pg_restore', '-Fc', '--jobs=2', diff --git a/src/test/perl/TestLib.pm b/src/test/perl/TestLib.pm index d579d5c177..dd7b64e4c4 100644 --- a/src/test/perl/TestLib.pm +++ b/src/test/perl/TestLib.pm @@ -338,8 +338,14 @@ The return value from the command is passed through. sub run_log { - print("# Running: " . join(" ", @{ $_[0] }) . "\n"); - return IPC::Run::run(@_); + my @x = @{$_[0]}; + if (ref($x[0]) ne '') { + print("# Running: " . join(" ", @{ $x[0] }) . " @x[1,scalar(@x)-1]\n"); + return IPC::Run::run(@x); + } else { + print("# Running: " . join(" ", @{ $_[0] }) . "\n"); + return IPC::Run::run(@_); + } } =pod -- 2.24.2 --K3vkeaB0MlFjg8U+ Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0002-fix.txt" From e855b9212f6ea178a3c5f913cec6e933e371e0b1 Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 15 Jun 2020 03:28:18 -0700 Subject: [PATCH 2/3] fix --- src/bin/pg_dump/t/002_pg_dump.pl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/bin/pg_dump/t/002_pg_dump.pl b/src/bin/pg_dump/t/002_pg_dump.pl index 8c89488a12..d28988b870 100644 --- a/src/bin/pg_dump/t/002_pg_dump.pl +++ b/src/bin/pg_dump/t/002_pg_dump.pl @@ -154,6 +154,8 @@ my %pgdump_runs = ( test_key => 'defaults', dump_cmd => [ [ 'pg_dump', '-Fc', '-Z6', '--no-sync', 'postgres', ], + '|', + [ 'perl', '-pe', '', ], '>', "$tempdir/defaults_custom_format_no_seek_parallel_restore.dump", # stdout disables seeking ], restore_cmd => [ -- 2.24.2 --K3vkeaB0MlFjg8U+--