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 1sk3tp-007GMD-Cj for pgsql-hackers@arkaria.postgresql.org; Fri, 30 Aug 2024 15:50:57 +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 1sk3tn-006Re3-7b for pgsql-hackers@arkaria.postgresql.org; Fri, 30 Aug 2024 15:50:55 +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 1sk3tm-006Rdv-To for pgsql-hackers@lists.postgresql.org; Fri, 30 Aug 2024 15:50:55 +0000 Received: from mail-io1-xd2f.google.com ([2607:f8b0:4864:20::d2f]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sk3tl-002COp-3Q for pgsql-hackers@postgresql.org; Fri, 30 Aug 2024 15:50:54 +0000 Received: by mail-io1-xd2f.google.com with SMTP id ca18e2360f4ac-82a245753bfso48145739f.3 for ; Fri, 30 Aug 2024 08:50:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1725033052; x=1725637852; darn=postgresql.org; h=content-transfer-encoding:mime-version:in-reply-to:references :thread-topic:message-id:cc:to:from:subject:date:user-agent:from:to :cc:subject:date:message-id:reply-to; bh=NZjlYHQpfFqqvmmHsVNwcN8d58irVXmk5piJh35RKUw=; b=kjwSd4a3f4nGklIKvm0T43DmLUS2YK4jbiVQmb5LxcxQVjmpwrN3zqlvgfKeIIQhUl VHKWriCx1VaIk7rUorwB6Hg34V0swvAMSdECAngcwCMVOtYFvQaXQSdldSnjViI33Krh Q4tC52wscMQBl9QXEPtCJ9CB4d2KF3iYMMwZJwJSIRRWRtyrVm0Z6V6PVss8D22APT3y oL6/QV+oJ1seKFEoKvhuS7pihcjER799UlS6eBr1GuikG46MWZSJgamAAmrWva4XNKpX KeDlgqzkTe8/B4r38SqTUhstVFRLIXByJ6Gyyp0Rz7e0WKWsngAKjxeWYxx9LMiUYjg6 H2wg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725033052; x=1725637852; h=content-transfer-encoding:mime-version:in-reply-to:references :thread-topic:message-id:cc:to:from:subject:date:user-agent :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=NZjlYHQpfFqqvmmHsVNwcN8d58irVXmk5piJh35RKUw=; b=RUHbkGMwV1G2SXsHhMm5I5ks+2fS1kl0pYyQwI6KePOT1Xqj4ruhv7XNGVb7xs+pXM mBW4C2R83K6dmxxyTsaTq9drZLOs3gGB530ceQGWwrdSWWOSOVc919CG0/duKKio56Ae 451x3Tr6MCL3wmcqmwIJwbnvE5dU4IRl8txDjzK60rEzIbstKnT7HY0fdYo3p734+yWm F30ohyYxNMXsSQdwj9VbeIgUnO5J/A9ASZe6FVMB+dk9K7S74AXZWcBb0jjkwj1E7Fzh iQHxinnO3wWg9T4lvfo65n+Ucscj0uKBE0hMUeN/pLHCjy4hzS0jR7m+gWb8NrZu9Mdx k2wg== X-Forwarded-Encrypted: i=1; AJvYcCXOfhGPSnc/RroQtkP9kIQSTHIanWm7kKbAOzNfk06+rUwQxbqOnuddESoAjgFSK7P/Dw5bOmDjquYGD7/U@postgresql.org X-Gm-Message-State: AOJu0Yx1BkSb9yE/K3qoV4QaQUPb98iaZVC36YUrbn/XsRcO6aQU2pJh LWUxvJEkCFclDsB+3+wC43ATGzl7cEdU1YVqGVjTeg0n3o6O3OpcBNtQ+6AQ X-Google-Smtp-Source: AGHT+IGkhC8Gi3IX0eikXZZr3MxRrr2w234baZ5lR3yoSi8rYEIazpg49aeD6o+uXJ9MJ9MSIPPkWg== X-Received: by 2002:a05:6602:490:b0:825:3a02:f935 with SMTP id ca18e2360f4ac-82a110713bbmr787119139f.11.1725033051846; Fri, 30 Aug 2024 08:50:51 -0700 (PDT) Received: from [192.168.87.22] (c-73-74-200-24.hsd1.il.comcast.net. [73.74.200.24]) by smtp.gmail.com with ESMTPSA id ca18e2360f4ac-82a1a412f07sm91953739f.15.2024.08.30.08.50.50 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 30 Aug 2024 08:50:51 -0700 (PDT) User-Agent: Microsoft-MacOutlook/16.86.24062313 Date: Fri, 30 Aug 2024 10:50:49 -0500 Subject: Re: Restart pg_usleep when interrupted From: Sami Imseih To: Bertrand Drouvot CC: Nathan Bossart , Heikki Linnakangas , Tom Lane , Robert Haas , "pgsql-hackers@postgresql.org" Message-ID: <67571176-4783-43B4-AFD1-556037A88DF7@gmail.com> Thread-Topic: Restart pg_usleep when interrupted References: <2b5ac681-11d5-470d-af40-89ead9a868aa@gmail.com> <90ec1618-58db-46b3-8c9b-13616ac839a7@gmail.com> <40F4611D-C92D-4569-8C4A-87A7DAAC4A09@gmail.com> In-Reply-To: Mime-version: 1.0 Content-type: text/plain; charset="UTF-8" Content-transfer-encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > From this discussion, there is desire for a sleep function that: > 1/ Sleeps for the full duration of the requested time > 2/ Continues to handle important interrupts during the sleep > > While something like CF 5118 will take care of point #1, > I'm not sure, even with CF entry 5118, nanosleep() could be interrupted. But I > agree that the leader won't be interrupted by PqMsg_Progress anymore. Correct. > 1. we should still implement the "1 Hz" stuff as 1.1/ it could be useful if CF > 5118 gets committed and we move to WaitLatchUs() and 2.2/ it won't break anything > if CF gets committed and we don't move to WaitLatchUs(). For 1.1 it would still > prevent the leader to be waked up too frequently by the parallel workers. Yes, regardless of any changes that may occur in the future that change the behaior of pg_usleep, preventing a leader from being woken up too frequently is good to have. The "1 Hz" work is still good to have. > 2. still discuss the "need" and get a consensus regarding a sleep that could > ensure the wait duration (in some cases and depending of the reason why the > process is waked up). Unless there is objection, I will withdraw the CF [1] entry for this patch next week. This discussion however should be one of the points that CF 5118 must deal with. That is, 5118 will change the behavior of pg_usleep when dealing with interrupts previously signaled by SIGUSR1. [1] https://commitfest.postgresql.org/49/5161/ Regards, Sami