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 1pzHGN-0007ax-Vp for pgsql-general@arkaria.postgresql.org; Wed, 17 May 2023 13:32:20 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pzHGM-00012c-KZ for pgsql-general@arkaria.postgresql.org; Wed, 17 May 2023 13:32:18 +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 1pzHGM-00012T-56 for pgsql-general@lists.postgresql.org; Wed, 17 May 2023 13:32:18 +0000 Received: from mail-ed1-x536.google.com ([2a00:1450:4864:20::536]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1pzHGJ-000Jf3-6M for pgsql-general@lists.postgresql.org; Wed, 17 May 2023 13:32:16 +0000 Received: by mail-ed1-x536.google.com with SMTP id 4fb4d7f45d1cf-510d0e40c6eso1024210a12.2 for ; Wed, 17 May 2023 06:32:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20221208.gappssmtp.com; s=20221208; t=1684330333; x=1686922333; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=eBNPe872gWUP8zflmdk5mqlg8yOUWTYFWLgl1vvDauQ=; b=GlDzUN90GdQMZQUAUhMsK+fpKEU/ZJU/VNl0c+T+r87BzwJq/auPKxHyXl208oN5rj lm0XoVHpZmz9glSBG2bnsXgL7btqGhJfqbhDSxcX9CXTO/cHFHyNKJYyI4OD/CjeOHV7 YTlF0BzdK+D/dvcTxXkEvnGkhmdVQS+/E4JuNOseQbHip5kWAkehL3mkcODzvd/AiLY/ Cbgw01imwMr2ZsaZUfv4/HFRLlLd41wGjbTiR0jAOYn6R+kvt8gb4pPiEhGVLkebZc0x n8gTrwXuOT7IEYdUlLUfxuRgOD6zOP6EqPqwXzTvfgZNbNjJadQf79z7wpYqvs73rXyB ALtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684330333; x=1686922333; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=eBNPe872gWUP8zflmdk5mqlg8yOUWTYFWLgl1vvDauQ=; b=Pk/Y4HQgLL3nBVyO5sM8hvLSg6NFoKvIzE7JwJlxoE+q+V3qJSF4AR1ogzCozXKAst KvXIpbWIwOzIZ16NqRV+BMyLklgH+JicsxdVAL5tWa4luP+BctaZHvz3d6gI1fA+PxOz cO5Wm2dGNReFgTMikmP4uN2TXcQKVVov+NLO6emyusdh4d0bqsXC5LJiZyX+0D4OSiuk W/QyQqDoqqejLfDGg3VQWZY4aUmTY3J9jYM2t+J22uhliIYbDW+aJC9Bgsersu/vr4Ne L000wSfydV2tMgURi8xwdAkwCHzUJGOic+eWRTu6U9rd5JnHH7r8D/uCsRjrDp+feLn6 vIrw== X-Gm-Message-State: AC+VfDy+B6s/qWqV+u4DHXXyKn60Xlop9yox9WF25yB8VABU6YhDC5Sz MHC5oBoYWzc9xSLglcSYKtXgsUSTuyU6gJAklnw= X-Google-Smtp-Source: ACHHUZ4hwKhgSFNhuVIR2QjmlJ247svVyQChyMfcs0Y78iUTwr+7kGrKmaSpPF1rx4MFuxGPhyDbBw== X-Received: by 2002:a05:6402:783:b0:508:41df:b276 with SMTP id d3-20020a056402078300b0050841dfb276mr2263674edy.22.1684330333487; Wed, 17 May 2023 06:32:13 -0700 (PDT) Received: from localhost.localdomain ([2001:871:5e:9b91:d7b6:a85c:1ae1:bda6]) by smtp.gmail.com with ESMTPSA id c2-20020aa7c742000000b0050bc13e5aa9sm9220227eds.63.2023.05.17.06.32.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 May 2023 06:32:13 -0700 (PDT) Message-ID: <98dbe2183e75f5527cb43815aa57b745012a5ed6.camel@cybertec.at> Subject: Re: How can I change replication slot's restart_lsn from SQL? From: Laurenz Albe To: depesz@depesz.com Cc: pgsql-general Date: Wed, 17 May 2023 15:32:09 +0200 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.4 (3.46.4-1.fc37) MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, 2023-05-17 at 08:21 +0200, hubert depesz lubaczewski wrote: > On Wed, May 17, 2023 at 08:16:41AM +0200, Laurenz Albe wrote: > > On Tue, 2023-05-16 at 19:35 +0200, hubert depesz lubaczewski wrote: > > > > I'm working on a workaround for a bug in Pg > > > > (https://www.postgresql.org/message-id/flat/Yz2hivgyjS1RfMKs%40depe= sz.com) > > > > I want to create replication slot, and advance is manually, keeping= it > > > > always a bit lagging behind real replication slot. > > > >=20 > > > > How can I advance restart_lsn of a slot? > > >=20 > > > if doing it via SQL is not an option, is there any way to have > > > replication slot and modify it's restart_lsn, regardless of whether i= t > > > will b e physical, or logical, and what tool shoudl I use. > > >=20 > > > I tried with pg_recvlogical, and read > > > https://www.postgresql.org/docs/current/protocol-replication.html=C2= =A0but > > > I don't see how I can make restart_lsn advance to anything. > >=20 > > You could shutdown the server and edit the file in "pg_replslot" with > > a hex editor.=C2=A0 Not very convenient, and you'd have to study the so= urce > > to understand the format of the file. >=20 > OK. Shutting down production server every 5 minutes to advance the slot > isn't really an option. >=20 > How do "normal" wal consumers update restart_lsn? Is there a reason why > it can't be done using pg_rec(eive|v)* ? I thought that was a one-time operation. No idea if there are alternatives= . Yours, Laurenz Albe