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 1rodkl-002Y0c-PL for pgsql-hackers@arkaria.postgresql.org; Mon, 25 Mar 2024 06:24:16 +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 1rodkk-000F2k-8r for pgsql-hackers@arkaria.postgresql.org; Mon, 25 Mar 2024 06:24:14 +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 1rodkj-000F2b-Qv for pgsql-hackers@lists.postgresql.org; Mon, 25 Mar 2024 06:24:14 +0000 Received: from mail-wr1-x42b.google.com ([2a00:1450:4864:20::42b]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rodkb-006Hpl-Nf for pgsql-hackers@lists.postgresql.org; Mon, 25 Mar 2024 06:24:12 +0000 Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-341cce3e5f0so637538f8f.1 for ; Sun, 24 Mar 2024 23:24:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711347845; x=1711952645; 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=s7XPCVWpfXIEYTetwaAIFqmztoHETBHnw6WhfIEly5Q=; b=T+WqqNRfuhaVfcnGN+kNOk/z6AHgVV4BaKmST8QOS/QVgMy2S6+rBjJqxjp2+fQY3h 2NCiapWlzieJ1TqrJfIBbGR6TCEItumPXmtUiYune+ON2o89wfVKMY+aYNA0ClpcmTiR z+j4RTfm9XRI28PssgeBwxg6HqOXopC8oFP7DiTsew0DYs+Ja79jBlOAkU/9N3Huj8Qo YWAKVLePfN5nFPsQNLN7FQShYTgRCO7+bAuMO7zEURyrnVNZrH9QUV7bK3Hmw2P/sBYQ 8f4rWbZVLL73Fv1M/Q7yMu8T4EYCHXRjhsd4k0Zp5G8ydLMkLP7X482sDzHYMsmLAVAn Iizw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711347845; x=1711952645; 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=s7XPCVWpfXIEYTetwaAIFqmztoHETBHnw6WhfIEly5Q=; b=lk1/fnJyM2NJl9hrmfyJKS2fMCCNaPMjR6+7fEr0i6MS29bCurZMe867AUQA6wSBTY T1uMjtzfrYDsBvRfDSR9GL70jvqomd4iK4jkujqdEHxFz6igeY0w6kfnlpOePlqo8WeH Cwv0t5CGQKIPM6IMyD3dhS0C9imLaG2TptEMLZhvalp4L27/7BigFAHdu8jZ14GAgiGb 8ktzcMXdqVS0dSmuW7xuiDQkGNxECflY/CwpdAVRPpu367nFZU4h+jfvfXFBpyaIJ61t a3R0jarPxeHC/lixJVUDO8kQwMKCdDMjtwEuwR2xl+9s3RCzF1zors/EITArgoMNoZ2Z e0og== X-Forwarded-Encrypted: i=1; AJvYcCWVcUaFU0c+aNF9h2e0hODXACv7s8fo2LnlLT1AmyDYS8dvl3s2+G6uOI9mKJB5ysjD7LVC6HLWfP8rFVTG8X6Yp9UycWKrjjaMqMbRVYy5zsM0 X-Gm-Message-State: AOJu0YyfJmfpRhCH4AumjHOnl79GmkfuQAlFXoNX80y9LBB2rtquCXVQ gTUOnPnRt3mXhJ8HCsqdgb+gP+dArcZy/2WNdC+dkCjL/Q9bwC9zYInmxN/cBuJze8kBSmEOZlH b5Yep+97edlhQoJW3uBTmiEuC993+HhV97g4= X-Google-Smtp-Source: AGHT+IE3NcaL5fIECsNaPxFdb/uACNXly9ubn+XfuxxZ55cIHVh1craYtgDSLlKFQntsTa8rN+bSlToLc4doNFDU/IU= X-Received: by 2002:adf:e98c:0:b0:33e:76a1:d031 with SMTP id h12-20020adfe98c000000b0033e76a1d031mr5717798wrm.50.1711347845151; Sun, 24 Mar 2024 23:24:05 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: shveta malik Date: Mon, 25 Mar 2024 11:53:53 +0530 Message-ID: Subject: Re: Introduce XID age and inactive timeout based replication slot invalidation To: Bharath Rupireddy Cc: Amit Kapila , Bertrand Drouvot , 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 Mon, Mar 25, 2024 at 10:33=E2=80=AFAM shveta malik wrote: > > On Sun, Mar 24, 2024 at 3:06=E2=80=AFPM Bharath Rupireddy > wrote: > > > > I've attached the v18 patch set here. > I have a question. Don't we allow creating subscriptions on an existing slot with a non-null 'inactive_timeout' set where 'inactive_timeout' of the slot is retained even after subscription creation? I tried this: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --On publisher, create slot with 120sec inactive_timeout: SELECT * FROM pg_create_logical_replication_slot('logical_slot1', 'pgoutput', false, true, true, 120); --On subscriber, create sub using logical_slot1 create subscription mysubnew1_1 connection 'dbname=3Dnewdb1 host=3Dlocalhost user=3Dshveta port=3D5433' publication mypubnew1_1 WITH (failover =3D true, create_slot=3Dfalse, slot_name=3D'logical_slot1'); --Before creating sub, pg_replication_slots output: slot_name | failover | synced | active | temp | conf | lat | inactive_timeout ---------------+----------+--------+--------+------+------+----------------= ------------------+------------------ logical_slot1 | t | f | f | f | f | 2024-03-25 11:11:55.375736+05:30 | 120 --After creating sub pg_replication_slots output: (inactive_timeout is 0 n= ow): slot_name |failover | synced | active | temp | conf | | lat | inactive_timeout ---------------+---------+--------+--------+------+------+-+-----+---------= --------- logical_slot1 |t | f | t | f | f | | | 0 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D In CreateSubscription, we call 'walrcv_alter_slot()' / 'ReplicationSlotAlter()' when create_slot is false. This call ends up setting active_timeout from 120sec to 0. Is it intentional? thanks Shveta