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.96) (envelope-from ) id 1wiCeC-0004AM-0h for pgsql-hackers@arkaria.postgresql.org; Fri, 10 Jul 2026 14:56:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wiCeA-000oJ1-1R for pgsql-hackers@arkaria.postgresql.org; Fri, 10 Jul 2026 14:56:11 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wiCeA-000oIs-0K for pgsql-hackers@lists.postgresql.org; Fri, 10 Jul 2026 14:56:10 +0000 Received: from mail-oi1-x232.google.com ([2607:f8b0:4864:20::232]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wiCe7-00000000fSj-3nXH for pgsql-hackers@lists.postgresql.org; Fri, 10 Jul 2026 14:56:10 +0000 Received: by mail-oi1-x232.google.com with SMTP id 5614622812f47-497d3e4460aso2435008b6e.1 for ; Fri, 10 Jul 2026 07:56:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1783695366; cv=none; d=google.com; s=arc-20260327; b=JZgLqHiYpLetPEf6L1o1NhqJ0QNc9nXHHR3/cXACzTJoilgCNdRALUmrL6CDAZFDu8 4QYLs7/UsWbOh/6cv9cFpSOpWfNyTfCo0qYUDnmXzuivLYUQWdtUoXLvW+YuJQbR3PuC 5ZKPwSDY7/4+WbA/2JDoUf/xcWL6nMQmH3QYU59cYb8jjAMD8Fxr+1HVcsyo66g5lEjj 5G4Npi71bx7NY4/GoZpJ/hOJ+6+8+FCOHPtZKj7H5+6uw4XA3yjoVRFLWjQ5V3yjZT+i HtVluMcOVvGohFT4M/uwfdDJxo5AEeWcixqLWoaZtgkGZ84LHKTrut4Pg0q08qAEsOZN 7gBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20260327; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=mUETyZnGG2n0OkJuZmd86M2Sw5xElFnL04fcgxnmUWs=; fh=k6LCqNNQ6m26xVX+EhI+49+hMDWhVwM1wOUa0dLJF6U=; b=oa50NY5WXikuZ8/u1MBokEOMY1Ib+8Ty3lJruiwti7OAHyGnPLlGYrcgTstXz2YyWA wjrbdnhwgEUKdtATqQxBFhsam+F5yC85jf3dPid1NSOHx1q3lbQZ3PYV+UaVLwYj4qYU qFtyroozbrDSYQnVTHs1B1B9uMapq962HRTIdNPtbp+X25eDbbCQQYJW7SFGROjIg3CW dFOpW+aHnG6RSty2Vi7yyzRJvS+hjZ66Wn5+tgS8nch6AwVBpbtVRvIoVDJ6wfRLFHmc hCAbNHEYLZSmPTzX2RSYqNjLOkktbRSov3cLPhuRNTloyiuilhuBjesOd3bFbgZCqmHV odbg==; darn=lists.postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1783695366; x=1784300166; darn=lists.postgresql.org; h=content-transfer-encoding:content-type:cc:to:subject:message-id :date:from:in-reply-to:references:mime-version:from:to:cc:subject :date:message-id:reply-to:content-type; bh=mUETyZnGG2n0OkJuZmd86M2Sw5xElFnL04fcgxnmUWs=; b=MKKV+LGYKpNpd0pUpApp0ak1cVs0nfsmOJvV9mmk4uMh1mRx96BCxvr0hLba6A+oP8 Lju0L8+aJki2LCUsxQweG+kq6646y4zi2tpXqtiS5f2OH/1aC9+XsTe7UVAgHTd/eXX0 3OyYyZHmG0QrPKwtPERnIkLr6slti6P6RoCy9SXqMAIyms+1bcYFFV/jPWIxaNeEVdfr E/mB1A3kAlP4ytSZx6gEBIO2U11PNGJQsxA6MToKY5/4EATKCrxSHOXMuMMCeUiTzlaW 9u0NjE619QYjfz140HuYbXa01I1zKJ0PpQqtxAYjjTpjWEkC5AGOgZ64pU6cJtIDuibB SS4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783695366; x=1784300166; h=content-transfer-encoding:content-type:cc:to:subject:message-id :date:from:in-reply-to:references:mime-version:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=mUETyZnGG2n0OkJuZmd86M2Sw5xElFnL04fcgxnmUWs=; b=YrYx8bHxunZuAcX4JSnpH9qeD3s0DjGmF+TA8tIUvion/YYXXu9g3DlTt1knQA5/aa L04/1URRX/ZHzz8X9kjx7p21OcPGI4+fILqWR6cG1bUQsioK4aszm0UVvrs3bJac+KHB XAJxwu2QSAXpZTR41TXlp/mndrjR0A4dGBWOZvAtPqEmPUwjYjlkQOwVdRhuLHyln/0B OIGNFtVTRr977ptxQVhyEJN7JBnpa2byUmUkOBdl8cMIPqaAtf7TTVA9rrhSkwQ8KDN3 UN/kSlVH1sfLvY5ID6vwxKuU40vVS5weX6ljjE9zGwb3w1NsIXY2lAd1tMlXvI6oBCA8 40ng== X-Gm-Message-State: AOJu0YxIRm1+iMoln/16LBb3DRamUbiU+5BOIVzPL/nF3RInAFK/OKX3 Ph2yT/GbEzqZYa2slpmWnGoqV5ZBTMVgQfS4CFodxJqg8fnEz9dIF2VQ+5RTAQTH8UOVanfPKmf 3MA0waHRMC/dMRGZhxdL9AsaKypKzwEI= X-Gm-Gg: AfdE7ckb6/e0m88TtiSU366jQrRO/j95gblDtyVejuLig62kQIsaQuWpz5j2xE79EHc tiyOVy9lVw7pb3QkjU5y0tizX4JF7JT10imxhQV49mhzxK0IYlxzoWVLdrlx904VQqWDTCQ9wFe WxkaCTZBs2vO0qGuLBUIfKhbiB/E17j4H4ossO5X5dJkvS5DCjV6QMt/FzHSSJU33MNyKZAM//3 xFUJlUn+sRe++P95qloKreP8+bTxgPGhTYGPEAvY/IXqH0RQySrku5K+VjDEI/HqSE6SPR9caeW ABgHUrgjuvQqxR6Bi3v9szi7ok/joth5RfIG4D7EnYmEqB1mN0N0tq2YiaOF7iFYeRRm6vWlo/U DJe6QFbeRs1Mq X-Received: by 2002:a05:6808:228d:b0:4a3:cea7:4ab9 with SMTP id 5614622812f47-4a40f012489mr2160817b6e.26.1783695365768; Fri, 10 Jul 2026 07:56:05 -0700 (PDT) MIME-Version: 1.0 References: <177894945149.1016.16623043430281952415.pgcf@coridan.postgresql.org> In-Reply-To: <177894945149.1016.16623043430281952415.pgcf@coridan.postgresql.org> From: Fujii Masao Date: Fri, 10 Jul 2026 23:55:49 +0900 X-Gm-Features: AUfX_mzslJ6yU4uX4VXc7ftS0XjiTNlAYG5xkSZvWl2zxdcCUdzJArro2Ud8PXA Message-ID: Subject: Re: Checkpoint replication slots later To: =?UTF-8?Q?H=C3=BCseyin_Demir?= Cc: pgsql-hackers@lists.postgresql.org, Ants Aasma Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sun, May 17, 2026 at 1:38=E2=80=AFAM H=C3=BCseyin Demir wrote: > > Hi Ant, > > Good idea. +1. CheckPointSnapBuild() and CheckPointLogicalRewriteHeap() call ReplicationSlotsComputeLogicalRestartLSN(), which seems to use last_saved_restart_lsn for persistent logical slots. Since last_saved_restart_lsn is updated by CheckPointReplicationSlots(), if those functions run before it, their cleanup decisions are still based on the restart_lsn saved at the previous checkpoint. So, isn't it better to move them after CheckPointReplicationSlots() as well, so that logical snapshot and rewrite mapping cleanup can use the newly saved restart_lsn? Of course, we'd first need to confirm that doing so is safe, though. Regards, --=20 Fujii Masao