Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kVJXM-00066c-DU for pgsql-bugs@arkaria.postgresql.org; Wed, 21 Oct 2020 19:12:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kVJXI-0003uc-Qs for pgsql-bugs@arkaria.postgresql.org; Wed, 21 Oct 2020 19:12:36 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kVJXI-0003uV-JB for pgsql-bugs@lists.postgresql.org; Wed, 21 Oct 2020 19:12:36 +0000 Received: from mail-ot1-x329.google.com ([2607:f8b0:4864:20::329]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kVJXF-0002aP-Fn for pgsql-bugs@lists.postgresql.org; Wed, 21 Oct 2020 19:12:35 +0000 Received: by mail-ot1-x329.google.com with SMTP id n11so2880855ota.2 for ; Wed, 21 Oct 2020 12:12:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=endpoint.com; s=google; h=from:message-id:mime-version:subject:date:in-reply-to:cc:to :references; bh=uQwCgawx44+QqvtUaIVCPoRp91OUwmc609V94Qwu2Vg=; b=o7Lsi1bTcc8StVH3v/bBzXhJXpLt4MSeBaFLREIkzUrKkkYoShRd6vdRiJr5baA0jG NIcgUcMmkCkyv5MxeaqQrjXZQK/D34uBhaNFz3o/OD/ntGmZ2PLIZkbTcrhkvDcIi4nJ W/2C/3sJnuCM8PA05bUVaXjw56kzHx8T2PCdiWc+c7J25nM3oLbUHCkgMz6XbUstGuT/ 0xpY9NmzbRyjyx9qKggT2wunMBflB+iSG33AT/6iP+DcYxcFihjhL/WVumREqZwW0t1E lKWJuGjCwGtRXkTn6JoHouJpF29su+BkGEM1/x9GmzZBbh8VSqLGVzNhvPYZ3gQDnfZP c57g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:mime-version:subject:date :in-reply-to:cc:to:references; bh=uQwCgawx44+QqvtUaIVCPoRp91OUwmc609V94Qwu2Vg=; b=aci4wGeWIH3OrGvQtqub20ZZgRDRlCsQGuf/qC3QT+hvmfdzM7d3UFEOh+8hk5mk3/ t66gkyMZTQgFrxhVoF0pE347mR99sJ4ToaXam3q5OIGz/op65NCeKrfYXw3jfjWcchZR YpQW0eAKUlRodraR6NmfrOy418bbsrRlHSCnRVNrcKWHpbvHmuL8y0MZA/GrWj2BNHQV KAqZUB3nevdZO4KfRjbjwA0JkR8hpJgJmxWdQGjkjMnH3hLjBzbuiq9igB0dTGJ/fTr8 iCmMZcG2ymD28k0FRT2OQg7devS9ErLe6ENhFxCI029jo+Ko5ej35fzdqQl/kfSK27ci KOCA== X-Gm-Message-State: AOAM532Bl94vkzKXaFVQBo4p9W1aWllLenM7bVuoDTAZj3omlQ6yi1Q8 /k6wSRBWVKHWL1dVV4G7cj700A== X-Google-Smtp-Source: ABdhPJwhuqW30Dd2luetz5kKMUj0k0XuSHBHogwPm/IE5xUHQlUJwmlSzufl3K357W3GzXpnC6+tbQ== X-Received: by 2002:a9d:3b84:: with SMTP id k4mr3912431otc.4.1603307552412; Wed, 21 Oct 2020 12:12:32 -0700 (PDT) Received: from [192.168.100.67] (108-241-52-134.lightspeed.mssnks.sbcglobal.net. [108.241.52.134]) by smtp.gmail.com with ESMTPSA id a80sm936860oib.2.2020.10.21.12.12.30 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Oct 2020 12:12:31 -0700 (PDT) From: David Christensen Message-Id: Content-Type: multipart/signed; boundary="Apple-Mail=_199DAED5-6413-4BB2-BDBE-0F02E0A498EF"; protocol="application/pgp-signature"; micalg=pgp-sha256 Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.4\)) Subject: Re: BUG #16676: SELECT ... FETCH FIRST ROW WITH TIES FOR UPDATE SKIP LOCKED locks rows it doesn't return Date: Wed, 21 Oct 2020 14:12:29 -0500 In-Reply-To: <7EA65D44-7C3A-4FC2-8DE1-1F59BBB10B37@endpoint.com> Cc: pgsql-bugs@lists.postgresql.org To: Tom Lane , Alvaro Herrera References: <7B98FC76-00EE-4441-AF10-A4A805DC021E@endpoint.com> <7EA65D44-7C3A-4FC2-8DE1-1F59BBB10B37@endpoint.com> X-Mailer: Apple Mail (2.3608.120.23.2.4) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --Apple-Mail=_199DAED5-6413-4BB2-BDBE-0F02E0A498EF Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Oct 19, 2020, at 7:33 PM, David Christensen = wrote: >=20 > Maybe splitting LockRows into two nodes, one for locking and one for = emitting unlocked nodes then interleaving Limit in between? (Or only = doing something along these lines for this admittedly narrow use case. ) This does appear to be quite a bit harder than originally hoped for on = the surface; creating a node to =E2=80=9Cpass-thru=E2=80=9D unlocked = tuples without locking them would require building out some additional = infrastructure that does not appear to be present in all AMs; something = to allow a test for locks without actually calling table_tuple_lock() = formally. Perhaps adding a param to indicate =E2=80=9Ctest=E2=80=9D = only=E2=80=94not sure if something like similar to heapam's = =E2=80=9Ctest_lockmode_for_conflict()=E2=80=9D is something we=E2=80=99d = need to had. (Or even a new lock mode which doesn=E2=80=99t create = RowMarks but skips any conflicting modes.) That said, I think it might be worth trying to go down the road of = =E2=80=9Cforbid this behavior=E2=80=9D, particularly if a workaround is = available. Perhaps looking into why =C3=81lvaro=E2=80=99s plan was = generating the multiple LockRows nodes would be more fruitful and less = likely to cause backpatching pain. David -- David Christensen Senior Software and Database Engineer End Point Corporation david@endpoint.com 785-727-1171 --Apple-Mail=_199DAED5-6413-4BB2-BDBE-0F02E0A498EF Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEECKA1l4YEfF4eK4/eN0ojyd+bZbgFAl+QiB0ACgkQN0ojyd+b Zbgu+Q//To6l/OCtrJo9ugBvd1IXKwcBLaDQwPpDMRJzp7SeZO7YAXEXSztvRh59 p+kYGPMefPCfvpxlw3PzkKACNM6AAq1kbCdagIVSx3KU0c+yf6DGDFxA/Xwyevpk HudL9JmQ09lo/+nyZTA1CxP5sIolNSAGGizqjm0/L2g9o281QrUxilMB9XRqS/Lj wmb9sTgfZpWmFYkzaVK1sy7IcWMMtmRRzd2fxGcAUx6nxV99iP8P58nvYr+jXZGQ Tz9mVZnfuuihyfslYwOGyBhoxokNmadHxPAZ5y0EAIg5pXvypoHkHb2NJADK9uo5 4OPbYep3hconUTGHScIsIcA32Y54uF1lMT81hrCJeMi82O5O/e+f0bMBjUHsxL11 LjG/aUoc8TPKocgdBLZ1SZULACXrPtEwSdOtXVUbZ6ygy03KUrXGfrUSZE1MmNxC 3VZ/Z5dZkTWoKa6Uu0Vcn/Qg6KvcMZbXujRBL0CZ5qVMtBn/NhKFDB//0JgYJ7Qp /2W5e1UE4h26eY439A84DepxQI764zKTF8EYLR0NWJGWnb7ciYYEY8o+p5O8RbDY BuNLlqdsKyFUuT97PkquyRsv9PvucRmxmVFqztGmeS4Yaim88HUx2UkjIhi8U/yq IJUL49yhJXptApsU3ZsegJoNZ7yqjKaU9dBfng6MC+vHJH/D4To= =xG3/ -----END PGP SIGNATURE----- --Apple-Mail=_199DAED5-6413-4BB2-BDBE-0F02E0A498EF--