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 1mLgl1-0002Pi-MZ for pgsql-hackers@arkaria.postgresql.org; Thu, 02 Sep 2021 07:03:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mLgl0-00012X-Ht for pgsql-hackers@arkaria.postgresql.org; Thu, 02 Sep 2021 07:03:30 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mLgl0-00012P-8v for pgsql-hackers@lists.postgresql.org; Thu, 02 Sep 2021 07:03:30 +0000 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mLgkx-00026T-Rv for pgsql-hackers@lists.postgresql.org; Thu, 02 Sep 2021 07:03:29 +0000 Received: by mail-wm1-x334.google.com with SMTP id g138so514501wmg.4 for ; Thu, 02 Sep 2021 00:03:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aiven.io; s=google; h=from:to:cc:subject:date:message-id:organization:in-reply-to :references:mime-version:content-transfer-encoding; bh=SFjrMMWlEbcL8k3w1qrUPC1gsEADh51s4qn2OGGGXBI=; b=MPW9Cj8/Kh1lcLFEdZ01CwThDqbJcCsS93gD95r5vRzMCLnEJmqe+pdozmsrvlqSwS iD4tgDGh8VBYulQtplVlGa4w4e8UOuXMQgkKxT7QdVkGSWUnAhUb3X4eqe+9vJg2wBjA G59wUwKX5UUSxvvOkcStOacbk1A/hNqA+kVv4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:organization :in-reply-to:references:mime-version:content-transfer-encoding; bh=SFjrMMWlEbcL8k3w1qrUPC1gsEADh51s4qn2OGGGXBI=; b=eur8WTRQsZ2YkiO2wKMyoyqeEpS2yoQ4iuAgLTeC+6Mck7R8EimdjfmR4I8tEep99F smq5KZDxjaI1VeCoQeg9NXgCpNHWsvHbqEBfTgRQcqVsCpndym+6+8VStFoYky5h3dFt 5Y44XEq3X2cvO61iuyjgGMCmFh7ennolvfX7VRzcoOdKnnv6igoGg+23arkHBY0C9Tz+ bc0wW0Bb0GbBOCFv2lmDcfHwvAgMZ/z9hpZTAjdnPEOVZCxAZ1RH4sQn5f17Uscrr+Ge Dy1VQpsxjJYntotuC4fUjHdQfL9iOmOPyxhqCk8VOBjA/27UHC7F9W90NCdRTeiwZnu/ KHHQ== X-Gm-Message-State: AOAM531sSwuKoR8m08qJNmvrA9fJYNJ3oOHJP2I42nkE2N9w8F/mAdtd mJzp0W0pLcPToCeGKC0fYtJe6A== X-Google-Smtp-Source: ABdhPJzUVfyOLIl45D2Xdg3sk+8+YxisgFmXGwKE3Aiub1vfVKzy7gCNnumEVOLpA50TnXW8okMaXA== X-Received: by 2002:a7b:c5d2:: with SMTP id n18mr1588714wmk.97.1630566206652; Thu, 02 Sep 2021 00:03:26 -0700 (PDT) Received: from aivenronan.localnet (static-176-158-121-96.ftth.abo.bbox.fr. [176.158.121.96]) by smtp.gmail.com with ESMTPSA id c15sm767856wmr.8.2021.09.02.00.03.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Sep 2021 00:03:26 -0700 (PDT) From: Ronan Dunklau To: Kyotaro Horiguchi , Bharath Rupireddy Cc: PostgreSQL Hackers , Masahiko Sawada Subject: Re: pg_receivewal starting position Date: Thu, 02 Sep 2021 09:02:57 +0200 Message-ID: <3025343.EqsfBnhMdK@aivenronan> Organization: aiven In-Reply-To: References: <20210902.144554.1303720268994714850.horikyota.ntt@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-1" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Le jeudi 2 septembre 2021, 08:42:22 CEST Bharath Rupireddy a =E9crit : > On Thu, Sep 2, 2021 at 11:15 AM Kyotaro Horiguchi >=20 > wrote: > > At Wed, 1 Sep 2021 10:30:05 +0530, Bharath Rupireddy > > wrote in>=20 > > > On Mon, Aug 30, 2021 at 3:26 PM Ronan Dunklau =20 wrote: > > > > > 7) How about we let pg_receivewal use READ_REPLICATION_SLOT as an > > > > > option? > > > >=20 > > > > From my point of view, I already expected it to use something like > > > > that when using a replication slot. Maybe an option to turn it off > > > > could be useful ?> >=20 > > > IMO, pg_receivewal should have a way to turn off/on using > > > READ_REPLICATION_SLOT. Imagine if the postgres server doesn't support > > > READ_REPLICATION_SLOT (a lower version) but for some reasons the > > > pg_receivewal(running separately) is upgraded to the version that uses > > > READ_REPLICATION_SLOT, knowing that the server doesn't support > > > READ_REPLICATION_SLOT why should user let pg_receivewal run an > > > unnecessary code? > >=20 > > If I read the patch correctly the situation above is warned by the > > following message then continue to the next step giving up to identify > > start position from slot data. > >=20 > > > "server does not suport fetching the slot's position, resuming from t= he > > > current server position instead">=20 > > (The message looks a bit too long, though..) > >=20 > > However, if the operator doesn't know the server is old, pg_receivewal > > starts streaming from unexpected position, which is a kind of > > disaster. So I'm inclined to agree to Bharath, but rather I imagine of > > an option to explicitly specify how to determine the start position. > >=20 > > --start-source=3D[server,wal,slot] specify starting-LSN source, defaul= t is > >=20 > > trying all of them in the order of wal, slot, serv= er. > >=20 > > I don't think the option doesn't need to accept multiple values at once. >=20 > If --start-source =3D 'wal' fails, then pg_receivewal should show up an > error saying "cannot find start position from <> > directory, try with "server" or "slot" for --start-source". We might > end having similar errors for other options as well. Isn't this going > to create unnecessary complexity? >=20 > The existing way the pg_receivewal fetches start pos i.e. first from > wal directory and then from server start position, isn't known to the > user at all, no verbose message or anything specified in the docs. Why > do we need to expose this with the --start-source option? IMO, we can > keep it that way and we can just have a way to turn off the new > behaviour that we are proposing here, i.e.fetching the start position > from the slot's restart_lsn. Then it should probably be documented. We write in the docs that it is=20 strongly recommended to use a replication slot, but do not mention how we=20 resume from have been already processed. If someone really cares about having control over how the start position is= =20 defined instead of relying on the auto detection, it would be wiser to add = a -- startpos parameter similar to the endpos one, which would override everythi= ng=20 else, instead of different flags for different behaviours. Regards, =2D-=20 Ronan Dunklau