Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qoiPG-002Yhd-C2 for pgsql-hackers@arkaria.postgresql.org; Fri, 06 Oct 2023 10:50:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qoiPE-005f69-5y for pgsql-hackers@arkaria.postgresql.org; Fri, 06 Oct 2023 10:50:05 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qoiPD-005f5c-RW for pgsql-hackers@lists.postgresql.org; Fri, 06 Oct 2023 10:50:04 +0000 Received: from mail-ot1-x32e.google.com ([2607:f8b0:4864:20::32e]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qoiPC-000IfJ-0i for pgsql-hackers@lists.postgresql.org; Fri, 06 Oct 2023 10:50:03 +0000 Received: by mail-ot1-x32e.google.com with SMTP id 46e09a7af769-6bc57401cb9so449090a34.0 for ; Fri, 06 Oct 2023 03:50:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1696589401; x=1697194201; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=Yht6JbKobBKXwp61HihfXGA3NNIKgpuYJGXfhCQEiaQ=; b=gvtdOcay352l0ZJZqanMYk3EJrHOHBaO1dtD//haqgwV+0mhR2BzWS8rI++Gpav/Nn 72Z4vu/NazA6W06UjP+nkbR0aiAr/EmHDYFIYTKj2Rqhu10WuqBtSK9eiAfb219eOzf7 CCzcmbmr368zsapC2meAiL914Ta7YeInxlKNN5Qs+L0QnDg+5lS8/BCqpZ3lJU9K483u n1pdkYzZ7DLKKRMcd4qMNn5FAgGJDThKZbdSyqb5iI1+wpJx3WXJ7w5XHY3QaVGgjQb0 WoAbwEHEWMiBPMzUYXZoznO2QT064xo9IikXOVnwSYBoh7yQmesTEBiCeRi5U1XTaDwu y4QA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696589401; x=1697194201; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Yht6JbKobBKXwp61HihfXGA3NNIKgpuYJGXfhCQEiaQ=; b=VjINh0NoBFffUhdb8gJiAYLDMpsSrvKECtqryW4qi6bdZF2L25Sf0NmruVbiKxc2rs MmjXVgJFrbHC5fm+fnNmGjJBCOonyA1AWACcHae4yLk81xVrRQodTWXUoMErXa/RujBd ZY2CdwQXJuqF9ax9ZQgYibx11utpvDamxlg7dRSPvz6KebhKs//IR/jTARohRAgTMsFC OknKBEEs3/kuu2wSfC89A1rEVlpBE7uxQMqf6f/DtFCZw0+rtNy74kGNtt5cRQrCalXW SROs9/4YFqkLmU9xpzyTQWy1eT+UlHKgto2mgEj2sUFeG4bDPvjfjrzmvWXc/Osbg9x3 YUqw== X-Gm-Message-State: AOJu0Yx9bYqrpfXwEC9ksDiQH9GkzICD1ZfOCCWVXGupd3KUx2LeZxl8 UdZOeW/Pk+YaG5OKOmOGtpoG+lN78E79KsGlNLNHYsifdO8= X-Google-Smtp-Source: AGHT+IEDT52ZzzYdTwrAqDmJ68YH0Lmofoi8rVpZNLxn0cDA0kbCjF3jr4Scgml8ZYbeEAHwYg0XTc4NXyZn4ZE7omM= X-Received: by 2002:a05:6870:f708:b0:1d5:1a99:537f with SMTP id ej8-20020a056870f70800b001d51a99537fmr8297143oab.2.1696589400654; Fri, 06 Oct 2023 03:50:00 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Fabrice Chapuis Date: Fri, 6 Oct 2023 12:49:49 +0200 Message-ID: Subject: Re: wal recycling problem To: Christoph Moench-Tegeder Cc: PostgreSQL Hackers Content-Type: multipart/alternative; boundary="0000000000008e477606070a0029" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000008e477606070a0029 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Thanks Christoph for your message. Now I understand why the wals are preserved if logical replication is configured and enabled. The problem is that when a large volume of data is loaded into a database, for example during a pg_restore, the wal sender process associated with the logical replication slot will have to decrypt all of the wals generated during this operation which will take a long time and the restart_lsn will not be modified. From a conceptual point of view I think that specific wals per subscription should be used and stored in the pg_replslot folder in order to avoid working directly on the wals of the instance. What do you think about this proposal? Regards Fabrice On Mon, Oct 2, 2023 at 12:06=E2=80=AFPM Christoph Moench-Tegeder wrote: > Hi, > > ## Fabrice Chapuis (fabrice636861@gmail.com): > > > on the other hand there are 2 slots for logical replication which displ= ay > > status extended. I don't understand why given that the > confirmed_flush_lsn > > field that is up to date. The restart_lsn remains frozen, for what > reason? > > There you have it - "extended" means "holding wal". And as long as the > restart_lsn does not advance, checkpointer cannot free any wal beyond > that lsn. My first idea would be some long-running (or huge) transaction > which is in process (active or still being streamed). I'd recommend > looking into what the clients on these slots are doing. > > Regards, > Christoph > > -- > Spare Space > --0000000000008e477606070a0029 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Thanks Christoph for your message.
Now I understand wh= y the wals are preserved if logical replication is configured and enabled. = The problem is that when a large volume of data is loaded into a database, = for example during a pg_restore, the wal sender process associated with the= logical replication slot will have to decrypt all of the wals generated du= ring this operation which will take a long time and the restart_lsn will no= t be modified.
From a conceptual point of view I think that specific wal= s per subscription should be used and stored in the pg_replslot folder in o= rder to avoid working directly on the wals of the instance.=C2=A0

What do you think about this proposal?

=
Regards=C2=A0

Fabrice


On Mon, Oct 2, 2023 at 12:06=E2=80=AFPM Christoph Moench-Tegeder <cmt@burggraben.net> wrote:
Hi,

## Fabrice Chapuis (fabrice636861@gmail.com):

> on the other hand there are 2 slots for logical replication which disp= lay
> status extended. I don't understand why given that the confirmed_f= lush_lsn
> field that is up to date. The restart_lsn remains frozen, for what rea= son?

There you have it - "extended" means "holding wal". And= as long as the
restart_lsn does not advance, checkpointer cannot free any wal beyond
that lsn. My first idea would be some long-running (or huge) transaction which is in process (active or still being streamed). I'd recommend
looking into what the clients on these slots are doing.

Regards,
Christoph

--
Spare Space
--0000000000008e477606070a0029--