Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iHSBD-0001YR-P8 for pgsql-hackers@arkaria.postgresql.org; Mon, 07 Oct 2019 12:32:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iHSBC-00068S-Bo for pgsql-hackers@arkaria.postgresql.org; Mon, 07 Oct 2019 12:31:58 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iHSBB-00068A-TR for pgsql-hackers@lists.postgresql.org; Mon, 07 Oct 2019 12:31:58 +0000 Received: from cyclops.postgrespro.ru ([93.174.131.138] helo=mail.postgrespro.ru) by makus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1iHSB4-0003wu-Ad for pgsql-hackers@postgresql.org; Mon, 07 Oct 2019 12:31:56 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id 972A321C410C; Mon, 7 Oct 2019 15:31:46 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at postgrespro.ru X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=x tagged_above=-99 required=4 WHITELISTED tests=[] autolearn=unavailable Received: from [192.168.27.223] (gw.postgrespro.ru [93.174.131.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mail.postgrespro.ru (Postfix) with ESMTPSA id 75E5521C404F; Mon, 7 Oct 2019 15:31:45 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1570451506; bh=aAIHlgxDlI/Sk6VmasLrUjRJGekaXFFNYS2FTJNkKPY=; h=Subject:To:Cc:References:From:Date:In-Reply-To; b=hKy0lxyF50jYv8Xa/8T3cpWqQRAjd5C1Ed/Kei1tmAwL1sjDoGoPxCKmHCQSTE68G 7+jQEqyXkDDptVX4H2iah/HOtdxGDegsFeTnJmyCVFmo4A36gDVI5vOGxxKKr1Zz8a wF6RUrOeiH2Nw0sQaea4k0lRl1iRtDrN1Umuhj9o= Subject: Re: Two pg_rewind patches (auto generate recovery conf and ensure clean shutdown) To: Michael Paquier Cc: Alvaro Herrera , Paul Guo , Thomas Munro , pgsql-hackers , Jimmy Yih , Ashwin Agrawal References: <20190930171349.GA21905@alvherre.pgsql> <7ca88204-3e0b-2f4c-c8af-acadc4b266e5@postgrespro.ru> <20191003030752.GE1586@paquier.xyz> <20191004083721.GA1829@paquier.xyz> <20191007010651.GD14532@paquier.xyz> From: Alexey Kondratov Message-ID: <88ef8c84-ffc7-f5d6-073b-83464e8bf2e7@postgrespro.ru> Date: Mon, 7 Oct 2019 15:31:45 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20191007010651.GD14532@paquier.xyz> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 07.10.2019 4:06, Michael Paquier wrote: > On Fri, Oct 04, 2019 at 05:21:25PM +0300, Alexey Kondratov wrote: >> I've checked your patch, but it seems that it cannot be applied as is, since >> it e.g. adds a comment to 005_same_timeline.pl without actually changing the >> test. So I've slightly modified your patch and tried to fit both dry-run and >> ensureCleanShutdown testing together. It works just fine and fails >> immediately if any of recent fixes is reverted. I still think that dry-run >> testing is worth adding, since it helped to catch this v12 refactoring >> issue, but feel free to throw it way if it isn't commitable right now, of >> course. > I can guarantee the last patch I sent can be applied on top of HEAD: > https://www.postgresql.org/message-id/20191004083721.GA1829@paquier.xyz Yes, it did, but my comment was about these lines: diff --git a/src/bin/pg_rewind/t/005_same_timeline.pl b/src/bin/pg_rewind/t/005_same_timeline.pl index 40dbc44caa..df469d3939 100644 --- a/src/bin/pg_rewind/t/005_same_timeline.pl +++ b/src/bin/pg_rewind/t/005_same_timeline.pl @@ -1,3 +1,7 @@ +# +# Test that running pg_rewind with the source and target clusters +# on the same timeline runs successfully. +# You have added this new comment section, but kept the old one, which was pretty much the same [1]. > Regarding the rest, I have hacked my way through as per the attached. > The previous set of patches did the following, which looked either > overkill or not necessary: > - Why running test 005 with the remote mode? OK, it was definitely an overkill, since remote control file fetch will be also tested in any other remote test case. > - --dry-run coverage is basically the same with the local and remote > modes, so it seems like a waste of resource to run it for all the > tests and all the modes. My point was to test --dry-run + --write-recover-conf in remote, since the last one may cause recovery configuration write without doing any actual work, due to some wrong refactoring for example. > - There is no need for the script checking for options combinations to > initialize a data folder. It is important to design the tests to be > cheap and meaningful. Yes, I agree, moving some of those tests to just a 001_basic seems to be a proper optimization. > Patch v3-0002 also had a test to make sure that the source server is > shut down cleanly before using it. I have included that part as > well, as the flow feels right. > > So, Alexey, what do you think? It looks good for me. Two minor remarks: +    # option combinations.  As the code paths taken by those tests +    # does not change for the "local" and "remote" modes, just run them I am far from being fluent in English, but should it be 'do not change' instead? +command_fails( +    [ +        'pg_rewind',     '--target-pgdata', +        $primary_pgdata, '--source-pgdata', +        $standby_pgdata, 'extra_arg1' +    ], Here and below I would prefer traditional options ordering "'--key', 'value'". It should be easier to recognizefrom the reader perspective: +command_fails( +    [ +        'pg_rewind', +        '--target-pgdata', $primary_pgdata, +        '--source-pgdata', $standby_pgdata, +        'extra_arg1' +    ], [1] https://github.com/postgres/postgres/blob/caa078353ecd1f3b3681c0d4fa95ad4bb8c2308a/src/bin/pg_rewind/t/005_same_timeline.pl#L15 -- Alexey Kondratov Postgres Professional https://www.postgrespro.com Russian Postgres Company