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 1sRz7M-002ptG-5V for pgsql-hackers@arkaria.postgresql.org; Thu, 11 Jul 2024 19:06:12 +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 1sRz7J-00HMjF-E7 for pgsql-hackers@arkaria.postgresql.org; Thu, 11 Jul 2024 19:06:09 +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 1sRz7I-00HMj4-SC for pgsql-hackers@lists.postgresql.org; Thu, 11 Jul 2024 19:06:08 +0000 Received: from mail-qk1-x736.google.com ([2607:f8b0:4864:20::736]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sRz7B-001Zub-Ui for pgsql-hackers@postgresql.org; Thu, 11 Jul 2024 19:06:07 +0000 Received: by mail-qk1-x736.google.com with SMTP id af79cd13be357-79f323f084eso79402985a.3 for ; Thu, 11 Jul 2024 12:06:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1720724761; x=1721329561; darn=postgresql.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=xm2wwwtNX3yHaT7zlnlaFS+INpqnQKJwZ/LmsgRSi18=; b=hW8aX64e8fHeqxw6KJRokHFPdFM0L2KBdELyrw7OLqLuXDk6VbJOI9Kk0am4KjMgOn UDSwsLlhWrQt/+R+pfLlVuZvNqlvnC3yMGpcJ9NJYhQXDO1fJDU2bEqd6tYdpQCqSLl/ WhbhWxMCbFjoli/yD2UIfCDWlIlLXUCtEsdJUrIZ7ef6qm9HC2lwAXvRcXm+zVAxyxIM uSdRRlqLIVEaTovZwE7injB+DnB9+goPRmDYqyYonWrY3OsV05CHrgJawVmb2cVvaeXz JbA+XuDYdueqv4EEbOWUnd1VTIcu7jjqscKuAJ9ZLvkbLYnDss4QBW7xRz/Xhg360IM8 xJKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720724761; x=1721329561; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xm2wwwtNX3yHaT7zlnlaFS+INpqnQKJwZ/LmsgRSi18=; b=HoEG1J5+/GFopu9G2XI6SSGOybHpSC9+gZfVrXMArschUkKve3b3Jv1JE4r/1qgQlK Ho9JZ4j1rJigeN00XGB1AVpNPVzh7TIJdJHy+3dAKOEH4Ta2Z/iSVGs0MDoKbJEKmn0N GccCM6HURleM5fsRe2Ysj6aLYtz7+tf9sdzTTWEWEV3oZVnIBKqAW+v2GYr8U1NX7xk/ mXhTC8YA4AN9+u9F341lTA57Uq3rW9c7xogjDfEEmo/A0XXnO4HyzeWvgzsvljmQnoXr QfrmN72jHJDEMZBCz1MgOHjHG/o7IHKVOkEb8xvm6Anuci871JfS3RBDS483d93PHPCM FZNg== X-Forwarded-Encrypted: i=1; AJvYcCWaE+a0VDAJfCHcLjqEmuZB1mNyHTb28tgD1hESQVZfvq8+tuENHRswYHLPR9Fy8TcJdthkq6gMVExen8aYn7FDCBf9fikc3JSD+cvu X-Gm-Message-State: AOJu0YzH52CFeSWAOZ3UDLcEINa4C+hHLCKQeEXGWNw7IeoAyOQ9M75W QyVo6pbhM9nuMcNM1o0DMHUOrA49mDLJAMVjM67ybudym+wml1rw X-Google-Smtp-Source: AGHT+IHIrGIqrreNoLDdyPiMt3d0/vI3u5lfH+bnPPV4UgSl+lo9B6Atr5a14J6Uei0Pibdu416//A== X-Received: by 2002:a05:620a:5e54:b0:79f:bc0:4067 with SMTP id af79cd13be357-79f19bf0220mr1007913785a.73.1720724761069; Thu, 11 Jul 2024 12:06:01 -0700 (PDT) Received: from smtpclient.apple ([52.95.4.23]) by smtp.gmail.com with ESMTPSA id af79cd13be357-79f1909f145sm321169085a.103.2024.07.11.12.05.59 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Jul 2024 12:06:00 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.600.62\)) Subject: Re: Restart pg_usleep when interrupted From: Sami Imseih In-Reply-To: Date: Thu, 11 Jul 2024 13:10:25 -0500 Cc: Bertrand Drouvot , Tom Lane , Robert Haas , "pgsql-hackers@postgresql.org" Content-Transfer-Encoding: quoted-printable Message-Id: <2F781744-69B8-4BC2-A6EF-3998DCCDB634@gmail.com> References: <01000190606e3d2a-116ead16-84d2-4449-8d18-5053da66b1f4-000000@email.amazonses.com> <7D50DC5B-80C6-47B5-8DA8-A6C68A115EE5@gmail.com> <2100439.1719610468@sss.pgh.pa.us> <373D199B-2312-431D-8018-F2808913F979@gmail.com> <3712E898-03DA-4E03-AF51-D3E24DE68216@gmail.com> To: Nathan Bossart X-Mailer: Apple Mail (2.3774.600.62) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk >=20 > I'm curious why we wouldn't just subtract "elapsed_time" from "delay" = at > the bottom of the while loop to avoid needing this extra check. =20 Can you elaborate further? I am not sure how this will work since delay = is a timespec=20 and elapsed time is an instr_time.=20 Also, in every iteration of the loop, the delay must be set to the = remaining time. The purpose of the elapsed_time is to make sure that we don=E2=80=99t = surpass requested time delay as an additional safeguard. > Also, I > think we need some commentary about why we want to retry after an = interrupt > in this case. I will elaborate further in the comments for the next revision. Regards, Sami=20