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 1tH0Er-002RSf-AD for pgsql-hackers@arkaria.postgresql.org; Fri, 29 Nov 2024 12:36:49 +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 1tH0Eo-007M43-Pm for pgsql-hackers@arkaria.postgresql.org; Fri, 29 Nov 2024 12:36:48 +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.94.2) (envelope-from ) id 1tH0Eo-007M3q-FL for pgsql-hackers@lists.postgresql.org; Fri, 29 Nov 2024 12:36:47 +0000 Received: from mail-lf1-x12a.google.com ([2a00:1450:4864:20::12a]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1tH0En-00095N-1m for pgsql-hackers@lists.postgresql.org; Fri, 29 Nov 2024 12:36:47 +0000 Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-53dde4f0f23so1879429e87.3 for ; Fri, 29 Nov 2024 04:36:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732883805; x=1733488605; 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=zqwGICGerT5klOyaqMnbRdIHEp7MurutFBIoMBNrxU0=; b=b4rThYRSJxIt0a6tyA2PMIgdkPdrGGtw59MqIDui5OtZTeDlmbRZJhVJV6WJDkYAT4 5slsLG/aBOsxPBjglANPb+kDPqkBQdIpB6AQDes+4g0/oX/a6R3hJmpS5OXSeIsuu6rg SpACbD66hKB+KgbSrKPqZO0sBf4Pq0ehyRRraK64FAGvExyALTJhQVItCfOgy9bG54Ai kmpWrxHqvz0d5UakJSVuNAMcQw3Jub0RWUHXPVVLOa8ENMhk8ap1GSJ3k2ZsWigeJs0s rlPZLIvL92JRSCRp/PztxKtwyfy/agAxHI52LNmvMScGgcadj720EQQxocTipbmburGD 98wA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732883805; x=1733488605; 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=zqwGICGerT5klOyaqMnbRdIHEp7MurutFBIoMBNrxU0=; b=qVblMYUpeB8a1y76kgBZqFz5dnuV9X9TOYkzjGJ2iqzlig6Fs3qIQfqiyS54K68Ba1 hSGFpiEQQhacKOvYmnG109CsIMQkcluHWkz8KPHkUYivvlFsE4PhL+IGRn4p/mpVke5C fYKPaR7d+5rtLadbvmehJ9cnG79+IAZlooeE0f3Lt/6GRKqHWyqhfE0jLwcFFUqVv8uf L26Klk29kPi+v4aYZQKHTYP5m3QzVjbscjoos+ARJpE7jytmuRnrqIrJwW/aDwfBx3Pb yCf7qQnDhAMHRR3TThjXjWH2NXp2Y9nR7HftRKDC39hNuzvAMDSAUdfmVg6oAdcAMeKb Bdkg== X-Forwarded-Encrypted: i=1; AJvYcCVFpvGy9KmfOhspZusgOAYdihf3RcX3J5m8NgarxOM/3KiRjoR1bJgv6fHv+8ziobftQ6/qPqRSSkco4njB@lists.postgresql.org X-Gm-Message-State: AOJu0YyDWSCMN5vEqCmc2GVgTMv2V0WPjixFmF2Rl21o5cnkFTseUHPg IiersBKBgf7HAQ2ba3GbEBv6kRQunwyqMWaXhU9EWQ6ACLTclIdYp/VZbNfstk7Qmbet/t+PHP9 FxFlm+dN/1IhsHYADFBHGqyDj8XMOD9876Q== X-Gm-Gg: ASbGncsd6u1b9wBNzRWEr5ttMrZLm6VLQsbsE0ufb5Iohw0InfEGVmwbDqgNFzANDyR 6qud+nMKpAHyCQ0EhMt52/MDi0GALIbPV X-Google-Smtp-Source: AGHT+IFSX7MM4GUVFKEmdHemID/DiwTaT9VlS9U2aeiHYRgEX5FIu4EMxa8jLRfPh5SLQFDpuHv8Rm9UZWKygHkdfuQ= X-Received: by 2002:a05:6512:3b9e:b0:53d:e88b:ebd with SMTP id 2adb3069b0e04-53df00d037cmr6380519e87.19.1732883804740; Fri, 29 Nov 2024 04:36:44 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Nisha Moond Date: Fri, 29 Nov 2024 18:06:33 +0530 Message-ID: Subject: Re: Introduce XID age and inactive timeout based replication slot invalidation To: Peter Smith Cc: shveta malik , Bharath Rupireddy , Amit Kapila , Ajin Cherian , Bertrand Drouvot , Masahiko Sawada , Nathan Bossart , PostgreSQL Hackers 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 Tue, Nov 19, 2024 at 12:47=E2=80=AFPM Nisha Moond wrote: > > On Thu, Nov 14, 2024 at 5:29=E2=80=AFAM Peter Smith wrote: > > > > > > 12. > > /* > > - * If the slot can be acquired, do so and mark it invalidated > > - * immediately. Otherwise we'll signal the owning process, below, and > > - * retry. > > + * If the slot can be acquired, do so and mark it as invalidated. If > > + * the slot is already ours, mark it as invalidated. Otherwise, we'll > > + * signal the owning process below and retry. > > */ > > - if (active_pid =3D=3D 0) > > + if (active_pid =3D=3D 0 || > > + (MyReplicationSlot =3D=3D s && > > + active_pid =3D=3D MyProcPid)) > > > > I wasn't sure how this change belongs to this patch, because the logic > > of the previous review comment said for the case of invalidation due > > to inactivity that active_id must be 0. e.g. Assert(s->active_pid =3D= =3D > > 0); > > > > I don't fully understand the purpose of this change yet. I'll look > into it further and get back. > This change applies to all types of invalidation, not just inactive_timeout case, so moved the change to patch-001. It=E2=80=99s a general optimization for the case when the current process is the active PID for the slot. Also, the Assert(s->active_pid =3D=3D 0); has been removed (in v50) as it was unnecessary. -- Thanks, Nisha