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 1rpIoh-0064Ad-Qk for pgsql-hackers@arkaria.postgresql.org; Wed, 27 Mar 2024 02:15:04 +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 1rpIog-008gko-8v for pgsql-hackers@arkaria.postgresql.org; Wed, 27 Mar 2024 02:15:02 +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 1rpIof-008gkX-Ua for pgsql-hackers@lists.postgresql.org; Wed, 27 Mar 2024 02:15:01 +0000 Received: from mail-io1-xd2e.google.com ([2607:f8b0:4864:20::d2e]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rpIob-006cph-Sz for pgsql-hackers@lists.postgresql.org; Wed, 27 Mar 2024 02:15:00 +0000 Received: by mail-io1-xd2e.google.com with SMTP id ca18e2360f4ac-7c8ad87b2acso165824039f.3 for ; Tue, 26 Mar 2024 19:14:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=extrahop.com; s=google; t=1711505698; x=1712110498; 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=Nv21SjcNmilPwSnGdEupv4CdngbnmMRbkUKHYMlay6Q=; b=EORYQMuiStBUjJZsOF+JenRA5iUJMO08rPGuC5PFyOFPfBKjrqN0uZvm5Ac3opYuzH ryPnJDiK1FpoESSxF4vMSBqYEl+Hgd6W+ycLXNapj7G3iDCeofqN07yE/P8eOUZ1AFRc A0eyj+FA0RE3ywq1gOAo7c6BYEBiA3YTlf9ouVLCwde57h77kOQHLhGRbc/OorjDVS/u KJUrluzMD+YaAh2VkQSynskqwC/Yr25jgq3yFKaaCngl8UZ9bUrTJAkgko8J4NiGxJB6 hOhk1n+G4U74mIn8wXm8Yh97x6g2Zk+ecOFCdWeotFdIW5s6IQ8AqUfwS7KOLz0b7v8/ B2fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711505698; x=1712110498; 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=Nv21SjcNmilPwSnGdEupv4CdngbnmMRbkUKHYMlay6Q=; b=h/O2IAozqiDty8OlBa+RREg3BVDPcQTbAJZQHc1Y07gYyNcAZVOjRAlDTD3FlOISz2 82I2Q/YcdiilVlEuFVAuUbdCsAlWv4px24Cm0amUFOmQXhWhDaSTYiHQn91kn/6/cQ+R 2daeiTl+W92uz4+kpDUcYFWLj0NteGEQmYob+SK4l5IrmHqDcsNDRAvzLKq4q7wrbLb+ X7IMbc2SaiT+G+okiR0X08MA8p+RIUlRvHbCHsAP8Pjtx+o/0zS1Dq9pq8BO3XMqTULQ AmVQCGCf/qPQf8dJ1f2TqbeEr9g/q4YH1f5/K691rkP9eQSgSx1CZFsk/fkOvfnptogw UtvA== X-Forwarded-Encrypted: i=1; AJvYcCVzAAJxxcMx2rrataDBFqxBGZBon6sQOi5W0ek5Q6/8mkyBryNFNg+C/0iBKtX28gRgDJNlp0qtYek7gTR1LIfiZfltDONgpH0u1Cub+S72NpZ6 X-Gm-Message-State: AOJu0YxDKyTbeUDR+V46F8lSEZZQ7jm+DCiULBxCw25qmmkhN4hcBgtW Pg3bCHsM3pnFhROlhnqh7ghRnIfcZm/vsBQ0b3oVbE61jRbvrJoo1cHbFudJyURzQf0ND7yzLLy yLmDVlluE0L/ECeaxE0Tp2uWifxt7R+EP9wD6 X-Google-Smtp-Source: AGHT+IEKWIgyoY6/rcl9xjZkIpIYpvgyyLhfhKOYaRTT+3plz+w619Rz2XRFEiS7PKy0waq3fMGY3+jLcLEWJJPI6y0= X-Received: by 2002:a92:4b12:0:b0:368:a16a:d924 with SMTP id m18-20020a924b12000000b00368a16ad924mr1599859ilg.10.1711505698201; Tue, 26 Mar 2024 19:14:58 -0700 (PDT) MIME-Version: 1.0 References: <20231128165139.rgmqsiw7mkedopze@awork3.anarazel.de> <202402081828091711555@qq.com> In-Reply-To: From: Will Mortensen Date: Tue, 26 Mar 2024 19:14:32 -0700 Message-ID: Subject: Re: [PATCH] LockAcquireExtended improvement To: Robert Haas Cc: Jingxian Li , andres , 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 Thu, Mar 14, 2024 at 1:15=E2=80=AFPM Robert Haas = wrote: > Seeing no further discussion, I have committed my version of this > patch, with your test case. This comment on ProcSleep() seems to have the values of dontWait backward (double negatives are tricky): * Result: PROC_WAIT_STATUS_OK if we acquired the lock, PROC_WAIT_STATUS_ERROR * if not (if dontWait =3D true, this is a deadlock; if dontWait =3D fal= se, we * would have had to wait). Also there's a minor typo in a comment in LockAcquireExtended(): * Check the proclock entry status. If dontWait =3D true, this is an * expected case; otherwise, it will open happen if something in the * ipc communication doesn't work correctly. "open" should be "only".