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.92) (envelope-from ) id 1jBgzE-0000xr-24 for pgsql-hackers@arkaria.postgresql.org; Tue, 10 Mar 2020 15:40:04 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1jBgzC-0004iA-Sa for pgsql-hackers@arkaria.postgresql.org; Tue, 10 Mar 2020 15:40:02 +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 1jBgzC-0004i1-GR for pgsql-hackers@lists.postgresql.org; Tue, 10 Mar 2020 15:40:02 +0000 Received: from mail-qk1-x741.google.com ([2607:f8b0:4864:20::741]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jBgz9-0000sW-AJ for pgsql-hackers@postgresql.org; Tue, 10 Mar 2020 15:40:01 +0000 Received: by mail-qk1-x741.google.com with SMTP id e16so13134912qkl.6 for ; Tue, 10 Mar 2020 08:39:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=hv9t6u7MHackfLWdcXbxYgkyR7B8xyiOU9cFWpY/8zs=; b=tlwMfnve8wy1vH/XiHoEhht4led7WZitj6hwBeJF6B1ZNwIm0RoHC+5N74DZnuGMD0 knq6YnnObOSzkx0t6l6jTskGggj2HsP8SAmOD/bbz3BdbLzJgnw9dngxvLv/cBckY/27 dLXKihCkxFCIhIjTn6nHzo85rYc2FfRIiAwYaukbCstJVQ8MZLCfJ6CtRVIYLwr9ySvY nWzGLYstH0jsWMXcZ/Zn0mlZk2CEorWRB5RuHsITB6KswQpbcfPrkRXeOzP3F+RiUNF8 0Lw0YOLcgSskmVtNbZB5Jk/XR7WjZ8Po3wb2sNLK2Q+9xSxS2iSJCxEEE5eAi2Si3r0P N08w== 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:content-transfer-encoding:in-reply-to :user-agent; bh=hv9t6u7MHackfLWdcXbxYgkyR7B8xyiOU9cFWpY/8zs=; b=aeQ2PMdPHay2GU0Uz8AjCthYi19/IR6+XwkFOipV7wEkcVBezLT1x7zE3ET6RQV5hz 1UqbAcjUv/o7OaVlcvzZcJLXXEX3JNDxafJqgg4c3/FVNyzym0j2abgFBgFYNI2/OVMf k954XDmJcE9JJbu3sP/IW7ct5ppb62eljS55LlkejRfDzICYLzUl9MBg5ilpXF6FWt9q tBqKAaQCMjVBgxamcFDvgzjh6g9PTCR+HddRU/hKWr/v2bKnfMuUZYiINnpldRfk4QI1 l39/SbY+PA9wUEIkEW9jJzXPGgxhLAhCNFRQzVeSnA0CM9RYiSi9wNyF2XBfjJYuwjP8 KdLQ== X-Gm-Message-State: ANhLgQ0GVAk/TnYoCrqnpLw1+cFwpSbYY2Ely9URSCu/G5wL8fCkeOH7 N+9z+cuW9MCPAA9Rr3QKgp5VLA== X-Google-Smtp-Source: ADFU+vvoIc/YAU7WRKCA5Ss7gM+fusUXGGq1iuTQQpjLzQsvqZLxaMiFdMP0IyLx0iWCXpWTyHus8A== X-Received: by 2002:a37:b89:: with SMTP id 131mr19950297qkl.199.1583854797916; Tue, 10 Mar 2020 08:39:57 -0700 (PDT) Received: from nimloth.alvh.no-ip.org ([191.125.227.206]) by smtp.gmail.com with ESMTPSA id c191sm9372250qkg.49.2020.03.10.08.39.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Mar 2020 08:39:56 -0700 (PDT) Received: by nimloth.alvh.no-ip.org (Postfix, from userid 1000) id 64A77300945; Tue, 10 Mar 2020 12:39:53 -0300 (-03) Date: Tue, 10 Mar 2020 12:39:53 -0300 From: Alvaro Herrera To: Michael Paquier Cc: Alexander Korotkov , Kuntal Ghosh , Alexey Kondratov , Liudmila Mantrova , Thomas Munro , Andrey Borodin , David Steele , Andres Freund , PostgreSQL-development , Dmitry Dolgov <9erthalion6@gmail.com>, vladimirlesk@yandex-team.ru, dsarafan@yandex-team.ru Subject: Re: [Patch] pg_rewind: options to use restore_command from recovery.conf or command line Message-ID: <20200310153953.GA14468@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200310124358.GB1538@paquier.xyz> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2020-Mar-10, Michael Paquier wrote: > On Tue, Mar 10, 2020 at 01:05:40PM +0300, Alexander Korotkov wrote: > > Two options seem reasonable to me in this case. The first is to pass > > length as additional argument as you did. The second option is to > > make argument a pointer to fixed-size array as following. Another option is to return the command as a palloc'ed string (per psprintf), instead of using a caller-stack-allocated variable. Passing the buffer len is widely used, but more error prone (and I think getting this one wrong might be more catastrophic than a mistake elsewhere.) This is not a performance-critical path enough that we *need* the optimization that avoids the palloc is important. (Failure can be reported by returning NULL.) Also, I think the function comment could stand some more detailing. Also, I think Msvcbuild.pm could follow Makefile's ideas of one line per file. Maybe no need to fix all of that in this patch, but let's start by adding the new file it its own line rather than reflowing two adjacent lines (oh wait ... does perltidy put it that way? if so, nevermind.) -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services