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 1sr8Uy-00FciF-4y for pgsql-hackers@arkaria.postgresql.org; Thu, 19 Sep 2024 04:10:32 +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 1sr8Uw-003QLO-Ja for pgsql-hackers@arkaria.postgresql.org; Thu, 19 Sep 2024 04:10:30 +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 1sr8Uw-003QLG-9y for pgsql-hackers@lists.postgresql.org; Thu, 19 Sep 2024 04:10:30 +0000 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sr8Ut-001uZz-NV for pgsql-hackers@lists.postgresql.org; Thu, 19 Sep 2024 04:10:29 +0000 Received: by mail-wm1-x32a.google.com with SMTP id 5b1f17b1804b1-42cb57f8b41so4325945e9.0 for ; Wed, 18 Sep 2024 21:10:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1726719025; x=1727323825; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=M8x90gRoPBs0MEa6XmigyCev8LYvxdw4LPx4aWJEe3M=; b=m+FY49vpkgV9jS/dWfOBGHFo0Pm3iuPJTIOngCnuDOEmCD4exlYIoY5DDwKCPk+8fJ WCd7h116zUko+j2ad+dPbBNh5qnN4Jcd6Qvz16a+jrhew7Im3Fc4uckQNCfldoVLi0AB fJckZtrY55YpIYZ88nDd9m1Wj2NZ5Z0jAA+U1+3hclWgTwVO/rUH5OzoLwc2WBlzN/5D qCqqxtbybf2aK4veM0FOExT6HR4RQH8sRNmmxHxBvRbw+qu6mn97IYv6ePVXz3wklR/9 wJqp5FW/eo7WXM0ArZSMX/XIaJ3zqAGgEzZSHvpG0bg1zgEnCwlTzPDDsudVwvE+Rj71 38Wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726719025; x=1727323825; h=content-transfer-encoding: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=M8x90gRoPBs0MEa6XmigyCev8LYvxdw4LPx4aWJEe3M=; b=PA3DOYpt9t53MJ/CU0jgohL6rSBwnCFhIIDr7pG2rljDqToMal3xdQ8sEJmImDEBNU VPr/Xel3znJLxgom2DsqEealfZQSwuUn/j/5rYjQWTgnF/TB74+ABcMzQHMOfIKrUPjq NbyO/XL1popem1vS0XGH3C41PNoxAdk5hh+VaNTzmYnljdV3DVeo1UeJlaX/P+/Sz5y6 D/eBUE7FYRZQOsSd6C1LmdQiAdUOT+3iMR7KXBVzMOvJPSXz9oLJWBdBXizNLwGnPXSE Iled7Yicg5wzNvNnEbmOVOtBP2P6QEdS+m4JP0nia/y+dQxm1R501x3HOVkD4bYeC76W 5JIw== X-Forwarded-Encrypted: i=1; AJvYcCUMKuWCxHjSnewCUANaY5pLrl22ZV4mqyLWxREKQ84d64oQDcGfdo9pFmIIh/NmSHcG4gsgaXBgBLRcMuvI@lists.postgresql.org X-Gm-Message-State: AOJu0YxkOOfuNtouja3DImKbBVnLjjWhHHtGnuNyjWFzP4mH9vXrjobz Sc3E0zBpKlG1B4eOdN5U3+kG21fLKO1TzcRqEgY66/+Auctnuet++9SIUpTNHEncGmINe6I03uH Ux5bJ6vxpRU5H0TG8uMS61v+818s= X-Google-Smtp-Source: AGHT+IFoxYZyEYOk3brv+gixy1WgzaRXVoUL3Xr5A857R1OtLJ48esD9TvUKB87fGv1ql7FaW9+tMGRGMzWOCjBr+cs= X-Received: by 2002:a05:600c:4f41:b0:42c:b950:6821 with SMTP id 5b1f17b1804b1-42d90829e60mr185168825e9.19.1726719024325; Wed, 18 Sep 2024 21:10:24 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: shveta malik Date: Thu, 19 Sep 2024 09:40:12 +0530 Message-ID: Subject: Re: Introduce XID age and inactive timeout based replication slot invalidation To: Bharath Rupireddy Cc: Peter Smith , Amit Kapila , Ajin Cherian , Bertrand Drouvot , Masahiko Sawada , Nathan Bossart , PostgreSQL Hackers , shveta malik 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 Wed, Sep 18, 2024 at 3:31=E2=80=AFPM shveta malik wrote: > > On Wed, Sep 18, 2024 at 2:49=E2=80=AFPM shveta malik wrote: > > > > > > Please find the attached v46 patch having changes for the above rev= iew > > > > comments and your test review comments and Shveta's review comments= . > > > > > When we promote hot standby with synced logical slots to become new primary, the logical slots are never invalidated with 'inactive_timeout' on new primary. It seems the check in SlotInactiveTimeoutCheckAllowed() is wrong. We should allow invalidation of slots on primary even if they are marked as 'synced'. Please see [4]. I have raised 4 issues so far on v46, the first 3 are in [1],[2],[3]. Once all these are addressed, I can continue reviewing further. [1]: https://www.postgresql.org/message-id/CAJpy0uAwxc49Dz6t%3D-y_-z-MU%2BA= 4RWX4BR3Zri_jj2qgGMq_8g%40mail.gmail.com [2]: https://www.postgresql.org/message-id/CAJpy0uC6nN3SLbEuCvz7-CpaPdNdXxH= %3DfeW5MhYQch-JWV0tLg%40mail.gmail.com [3]: https://www.postgresql.org/message-id/CAJpy0uBXXJC6f04%2BFU1axKaU%2Bp7= 8wN0SEhUNE9XoqbjXj%3Dhhgw%40mail.gmail.com [4]: -------------------- postgres=3D# select pg_is_in_recovery(); -------- f postgres=3D# show replication_slot_inactive_timeout; replication_slot_inactive_timeout ----------------------------------- 10s postgres=3D# select slot_name, inactive_since, invalidation_reason, synced from pg_replication_slots; slot_name | inactive_since | invalidation_reason | syn= ced -------------+----------------------------------+---------------------+----= ------+-------- mysubnew1_1 | 2024-09-19 09:04:09.714283+05:30 | | t postgres=3D# select now(); now ---------------------------------- 2024-09-19 09:06:28.871354+05:30 postgres=3D# checkpoint; CHECKPOINT postgres=3D# select slot_name, inactive_since, invalidation_reason, synced from pg_replication_slots; slot_name | inactive_since | invalidation_reason | syn= ced -------------+----------------------------------+---------------------+----= ------+-------- mysubnew1_1 | 2024-09-19 09:04:09.714283+05:30 | | t -------------------- thanks Shveta