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 1tLaZJ-00FjqS-Lt for pgsql-hackers@arkaria.postgresql.org; Thu, 12 Dec 2024 04:12:53 +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 1tLaZH-006eul-75 for pgsql-hackers@arkaria.postgresql.org; Thu, 12 Dec 2024 04:12:52 +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 1tLaZG-006eud-Tl for pgsql-hackers@lists.postgresql.org; Thu, 12 Dec 2024 04:12:52 +0000 Received: from mail-yw1-x112e.google.com ([2607:f8b0:4864:20::112e]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1tLaZF-002OaC-A0 for pgsql-hackers@lists.postgresql.org; Thu, 12 Dec 2024 04:12:51 +0000 Received: by mail-yw1-x112e.google.com with SMTP id 00721157ae682-6f145e5cd83so1464057b3.1 for ; Wed, 11 Dec 2024 20:12:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733976768; x=1734581568; 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=xPu0trePSCgSkdSLiZKmUZd6n5dSgmmrxRQGZu0He5g=; b=nLNNQDGMZctijsGgfSygSrMiQy8Z3ZR2zTF8HlOjuvnFcxReO9Vq+NSZpVAuTYQtfQ vwkeem8bTo6vwlfXBCQfEdr71V30z6+fEC/QWxRyzGRAWIvojrpL2g5wFJ14OXL/Xkbd qkGSdCbAWqit2wMbNS9G8R5iOlJ9/8d3cGc2FPGF0NcAIeJETeEJQRl5BrFE5mQhgliQ L0Y2P8e04/TzXiiy8WyXidGWZQ+6jX4NwTCkKIIMGdSDNGd4K62qmsrfzp9BUlCJslcm zl/RwJms3ckn10wWNAXLS4KzhYrtwzHb/cfxvcA0cJ/Y0KYQAeGWgukqmj3W4yF7I4TL FmSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733976768; x=1734581568; 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=xPu0trePSCgSkdSLiZKmUZd6n5dSgmmrxRQGZu0He5g=; b=gRJjux465ERVfup4nIsSAa2WdGZKCNa4Z0rqiUXRrXaco89NHetfFGXrHeLZEeQ+xj Xk5WDjMWeFuEieGw/Ily16qVR4WwS2tWGgxou82fAZ2gS3EE4P+cepR+D9UTx8lmINEE BB2WD4ruFugUrBXLJ2bvxq7itmCw2gRf1G3q62edTXhgUzvkWqcBqZt5y1Fkp/zrVjTw E64WHJ4X7m4K4hjO9yCYU0Kr8pf97szilAA/ocHkBd8gm5li92sKry8Oc57o97GZ8IyU z+NTfYs2IuJlyHp/Yd93hpaHkxgOvUoZ3Ijg1D8qV74te3tmKLSA5XBwED32+xEGRSDA C7PQ== X-Forwarded-Encrypted: i=1; AJvYcCWD7C2PS5nx8pElyHrHymTNlyhL3mTyhdVzEkz7QwG2UhR6DnmJ2rydM7IMThRD5H+gA16vyAdoqHzpVeJ3@lists.postgresql.org X-Gm-Message-State: AOJu0YwjMjc6ttvzMrTBRr5ja6SnTUg+RHYcg6B0IREoJFa0alGrd8uZ 4J39hmq5syr2FsJ2XR1LYRB7fNpJd8ejTrS2Uk7CWgZm+q7wC8yczKO2FXwYFT1z1VJG5pjKYOQ NjCq/NP8qwQFQUMHrsxxb5rjIwXc= X-Gm-Gg: ASbGnctl21YsLUTga9zF8ktqMGvZBf6jSbnDD+JKKoyVSAw9u9GkX6+3o3t+hnen9QC qfR9huOeIKcTUVPc+yc3E7qAqJ6igoO8bInNokBBD9B2fEDk+JHMHqPxEBYQG1S/IqTzuyco= X-Google-Smtp-Source: AGHT+IHBxK672K7TRzEkmqSbdmL9BOr/Y14TLsfTvCrHZDpIBpJ17pYUm9zNdP8HuunWxgduxnX6hzXv8EgMvr0k5fU= X-Received: by 2002:a05:690c:3589:b0:6ef:79d8:c908 with SMTP id 00721157ae682-6f19e4f12afmr20105127b3.14.1733976768502; Wed, 11 Dec 2024 20:12:48 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: vignesh C Date: Thu, 12 Dec 2024 09:42:35 +0530 Message-ID: Subject: Re: Introduce XID age and inactive timeout based replication slot invalidation To: Nisha Moond Cc: Peter Smith , "Hayato Kuroda (Fujitsu)" , 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, 10 Dec 2024 at 17:21, Nisha Moond wrote: > > On Fri, Dec 6, 2024 at 11:04=E2=80=AFAM vignesh C w= rote: > > > > > > Determining the correct time may be challenging for users, as it > > depends on when the active_since value is set, as well as when the > > checkpoint_timeout occurs and the subsequent checkpoint is triggered. > > Even if the user sets it to an appropriate value, there is still a > > possibility of delayed identification due to the timing of when the > > slot's active_timeout is being set. Including this information in the > > documentation should be sufficient. > > > > +1 > v54 documents this information as suggested. > > Attached the v54 patch-set addressing all the comments till now in > [1], [2] and [3]. Now that we support idle_replication_slot_timeout in milliseconds, we can set this value from 1s to 1ms or 10millseconds and change sleep to usleep, this will bring down the test execution time significantly: +# Set timeout GUC on the standby to verify that the next checkpoint will n= ot +# invalidate synced slots. +my $idle_timeout_1s =3D 1; +$standby1->safe_psql( + 'postgres', qq[ + ALTER SYSTEM SET idle_replication_slot_timeout TO '${idle_timeout_1s}s= '; +]); +$standby1->reload; + +# Sync the primary slots to the standby +$standby1->safe_psql('postgres', "SELECT pg_sync_replication_slots();"); + +# Confirm that the logical failover slot is created on the standby +is( $standby1->safe_psql( + 'postgres', + q{SELECT count(*) =3D 1 FROM pg_replication_slots + WHERE slot_name =3D 'sync_slot1' AND synced + AND NOT temporary + AND invalidation_reason IS NULL;} + ), + "t", + 'logical slot sync_slot1 is synced to standby'); + +# Give enough time for inactive_since to exceed the timeout +sleep($idle_timeout_1s + 1); Regards, Vignesh