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 1sehmq-00Auyy-Mv for pgsql-hackers@arkaria.postgresql.org; Thu, 15 Aug 2024 21:13:36 +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 1sehmp-001TOE-4Z for pgsql-hackers@arkaria.postgresql.org; Thu, 15 Aug 2024 21:13:35 +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 1sehmo-001TO5-RA for pgsql-hackers@lists.postgresql.org; Thu, 15 Aug 2024 21:13:34 +0000 Received: from mail-il1-x12f.google.com ([2607:f8b0:4864:20::12f]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sehmm-004v06-C3 for pgsql-hackers@postgresql.org; Thu, 15 Aug 2024 21:13:33 +0000 Received: by mail-il1-x12f.google.com with SMTP id e9e14a558f8ab-39d2256ee11so3307195ab.1 for ; Thu, 15 Aug 2024 14:13:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723756411; x=1724361211; darn=postgresql.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=hDlnRiiLpL3I6nR38Q2J5Vthtg8dRnVljcP9l2lRlIo=; b=m6ltSf3nxnOCsGLUSDFcDq2urMfJ47X/93hbvPAXPMDEjvN2xCc0A8LpZ1lnYs+OUV Zg/wJNf85PmviLO4BHdIj0GEHhu6IHqZw5zCjh01zBlEtPcoVeD1J6Bj6PZAgHlQfQgB qd7A9LIQvEj36DYE+cwIhQ3/uWs9KIGOlJmveoWPPe8ujEITM9QJNNT/o3QoNmHyVipm KYP3NqCrUxWCFCqwoRH6fTgUoYK7TDayq8Ww+PxouxULF8YEatSw1RhxfEE989d+j35H REsMLxq5CFatky1f1lwwlMo0hV1E2QKgImWd1iwcWgiWspp8Z/4JXTIJR8Glmf0U9YeL 89Rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723756411; x=1724361211; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=hDlnRiiLpL3I6nR38Q2J5Vthtg8dRnVljcP9l2lRlIo=; b=DzRUN3fROmEBrgharD/ZT/fcIw87Ncn2hYpxnJp/pE+ZafI0pzFTGtno3++lh0fNnF wPdQSGHyRUicouQ/XDkFhx9/TIZVasbTh042y5yuL8T9wuL2+utHHvtUfMOkuHEKFN+F hl3zNYPdL7dYiuR2tb+y8lo7oISdXNK1JfYFZAaEY32CR+vEbsUlapRKH3YA8VptYBBQ 7fbJ8scuhWMTz8kwX86BN3wCmNJIfbSExYLiIIeLZOKlKk1EoIyb0eDqSkOqlLuha89V vJfndesnSZVRFoBWsrnV/NZpE1fAlOeKZ0XBt2tFIFb2DtmnVNOHDeYwqq+JKvYbrfxj b1Vg== X-Forwarded-Encrypted: i=1; AJvYcCWlAiWJkDT5qUcUvxgRFuG0H5q+2mGcM0o1U5YM9/Sa3kWIaQvuflFyD1U+yoIyps8zgpRyM1P6vqA+gJfVc73yf94TN56vFe/XIRQw X-Gm-Message-State: AOJu0YwAuybi40PsZIftmcF1K9qXeAKALDn+FlPk/hZElwj3wg16bdKO wZdHDcJCduBrOzXLV5xdWASuZBWYQtRwiAg/vpD12L9V6UpItNTV X-Google-Smtp-Source: AGHT+IEeGXGBm0M2BrJt7lKzLDY8QdUdoQmMvt8mQ4l4VIUtzriswSvevO1vWQEYBoNc4wsurNEXCw== X-Received: by 2002:a05:6e02:158a:b0:398:4bda:cf66 with SMTP id e9e14a558f8ab-39d26d653fcmr14863785ab.18.1723756411497; Thu, 15 Aug 2024 14:13:31 -0700 (PDT) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-39d1ed5e620sm8338105ab.66.2024.08.15.14.13.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Aug 2024 14:13:31 -0700 (PDT) Date: Thu, 15 Aug 2024 16:13:29 -0500 From: Nathan Bossart To: Bertrand Drouvot Cc: "Imseih (AWS), Sami" , Heikki Linnakangas , Tom Lane , Robert Haas , "pgsql-hackers@postgresql.org" Subject: Re: Restart pg_usleep when interrupted Message-ID: References: <2b5ac681-11d5-470d-af40-89ead9a868aa@gmail.com> <90ec1618-58db-46b3-8c9b-13616ac839a7@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Aug 14, 2024 at 06:00:06AM +0000, Bertrand Drouvot wrote: > I gave it more thoughts and I don't think we have to choose between the two. > The 1 Hz approach reduces the number of interrupts and Sami's patch provides a > way to get "accurate" delay in case of interrupts. I think both have their own > benefit. Is it really that important to delay with that level of accuracy? In most cases, the chances of actually interrupting a given vacuum delay point are pretty small. Even in the extreme scenario you tested with ~350K interrupts in a 19 minute vacuum, you only saw a 10-15% difference in total time. I wouldn't say I'm diametrically opposed to this patch, but I do think we need to carefully consider whether it's worth the extra code. Separately, I've been wondering whether it's worth allowing the sleep to be interrupted in certain cases, such as SIGINT and SIGTERM. That should address one of Heikki's points. -- nathan