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 1kUsXk-0000QY-99 for pgsql-bugs@arkaria.postgresql.org; Tue, 20 Oct 2020 14:23:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kUsXj-0007uG-3E for pgsql-bugs@arkaria.postgresql.org; Tue, 20 Oct 2020 14:23:15 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kUsXi-0007th-RX for pgsql-bugs@lists.postgresql.org; Tue, 20 Oct 2020 14:23:14 +0000 Received: from mail-oo1-xc2b.google.com ([2607:f8b0:4864:20::c2b]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kUsXg-0001zB-CR for pgsql-bugs@lists.postgresql.org; Tue, 20 Oct 2020 14:23:14 +0000 Received: by mail-oo1-xc2b.google.com with SMTP id j6so498388oot.3 for ; Tue, 20 Oct 2020 07:23:11 -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=nIsSbIJIf5YnOrxWiF0nDIkMkzlMIPPc5OLnXuto8p0=; b=kVQcsYIB+90nG2awOW1Wb7ETjGzzkLEj8CuPNSaAO45hN69l2CBBPOtFRa6/UA4qIC +rZoZ8lNeb801fj5fBCsAOh7418cTzCw0RaBy884TuBMxkjWAe/N8zHJnZOcudSs7nkD 6eKJiIzxOk7kZH+ITYCJF59Rjh/boeEoA6SQCMx5GLuIZs0lDStulHK0Ci2oHrTuhEhw z11F0xDzbWNHVC9pXWtNZwyFxZ9PYbTLkSBbTHT877E+WePzObgQq6l/t2QEfSY4XSA2 4LYflaUtV1tPh4W1yjefd9uSuuKftPde0ZsSEwtoOAEZZW0flnWY5voXZNnUiP/saCXQ dc3A== 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=nIsSbIJIf5YnOrxWiF0nDIkMkzlMIPPc5OLnXuto8p0=; b=N52MKJYS952JfEvnn3uB2Ena2g6HBo3LQ4iVjUG3bqzD2hbulFMuEaAcpSJHOrRikJ UbNhPyCsZeWRs1zHSGQ6s35vS1WowUJE368OmbSKtU3695V0MwY/SmxHvzJr9jjk17Ac 47cxauO/T+tMldZV7SgYgwQpDWK2pPuJYbMtHfO93aiEKUApmI+kNC6UEIiq+ooaaYf1 7x0PDVBotlWrztu1HK2/Na/hP5y89MnFq8Q1z9C/uc0MAR0jnRic7Ibstz+rlhQd95am 4AngyPrNinP/o962Yv1igN5ABq1lggrbacDKFPKPS/kEWfua7Qr17PrY7HMyoEwxvlFt 9baw== X-Gm-Message-State: AOAM530joopczh0IR6IwNU6RqVa5arrWSGY/fpQpHNm1HZJeQgVKkAbV mDfgSKwdJUyBgv+WFumWhPYW3w== X-Google-Smtp-Source: ABdhPJzlJB8ALkOb3YCZ3CxpajheI4P5OIw+WQxQmVEOJic3FUNlV5Z5NVEt6NM4ULV8CilKJzcw7w== X-Received: by 2002:a4a:5258:: with SMTP id d85mr2041106oob.13.1603203789530; Tue, 20 Oct 2020 07:23:09 -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 q8sm453905otf.7.2020.10.20.07.23.08 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Oct 2020 07:23:08 -0700 (PDT) From: David Christensen Message-Id: <05226762-2C0B-44DE-A584-D9FCCFF06B5F@endpoint.com> Content-Type: multipart/signed; boundary="Apple-Mail=_182897DA-F6AF-473E-B06F-5DF3EB87054A"; 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: Tue, 20 Oct 2020 09:23:06 -0500 In-Reply-To: <604509.1603203416@sss.pgh.pa.us> Cc: Alvaro Herrera , pgsql-bugs@lists.postgresql.org To: Tom Lane References: <20201020134114.GA11045@alvherre.pgsql> <604509.1603203416@sss.pgh.pa.us> 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=_182897DA-F6AF-473E-B06F-5DF3EB87054A Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Oct 20, 2020, at 9:16 AM, Tom Lane wrote: >=20 > Alvaro Herrera writes: >> On 2020-Oct-19, David Christensen wrote: >>> 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.) >=20 >> I was having a similar idea, but the main reason I don't think it's a >> good fix is that we can't backpatch such a change to pg13. >=20 > Um, why not? I don't have a position yet on whether this is a good = way > to fix it; but if we did do it, AFAICS the only thing we'd have to be > careful of in v13 is not renumbering existing NodeTag values. >=20 > If your concern is just that EXPLAIN plans will look different, the = same > could be said of David's other proposal. If we can determine the scope to which these different nodes might be = used and make it so it still uses the existing node structure for most = existing cases (i.e., maybe an additional parameter to = create_lockrows_plan or similar) then that might work; AFAIK, this is = the first time we=E2=80=99ve had to consider this sort of thing (though = I do wonder if there might be something in window functions which might = bump into this sort of issue). I=E2=80=99m working on an isolation test to formalize this failure, = which I can do as a separate patch if we want to have this prior to = implementing a fix. -- David Christensen Senior Software and Database Engineer End Point Corporation david@endpoint.com 785-727-1171 --Apple-Mail=_182897DA-F6AF-473E-B06F-5DF3EB87054A 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+O8soACgkQN0ojyd+b Zbivxw/7BlKBx7qiGAmlcIMggCaaUqXU1fuaR0MfBGi4IjrSCw078hHP2rax/R2F 6qFmbG/fYcq4GvbssR3MPm5NoSKX/AWy4OB4712xYTuZhqnNTEYB8ZQPpzx8Z9Rh U7s94/FqHm19ekUgR3GwAq4BhhWXjMjFqEJuzFo/mSly7fKjacVsJ7oSAp67aNIA a5GkYwOyaQsMJPMSBgiWrqeNL/O/clnEn4NCPFITovp6jPVuVGTSbsEiJWIqh0ae QORyDT7e4IxvvDe793KOzripKamSRGpV6BXb0TMzAfaK6RWgr6g0AZLUTNFFzSyA 14D5hC8O5AlTb4BtDxJFmPqR/ozeU0RBtwgbWs+BQ0EmDQwg08D8+6jWqYHdssD4 eys2g89KatQRsTKHqMuzeiVhdgCHWXDOh9CzNkdwIaKG3JT+btpyza71JpF12npd kdyBgCM7zyMzYcLawhmyQDnfeIRExBA5mk6Y+1TTP1IGy3cwMCP2411WrUmo5n9H xk0kwQILs8dYXZmtTyRhXCUwiNi5OcvpzZxhBUF6KUfFrUI0Kdql4dpmWejCs/1W P70SFa3hNVNv63KlaPepEHm7kiUUXJ/09A7/psPBmv+BAKp3RPWTtLsRZIhghnsw p1gTKvG1wYBiIoxlHt8ePoW9fMnoeoLoEW2+XAUYdI4aNWhb6lQ= =weRY -----END PGP SIGNATURE----- --Apple-Mail=_182897DA-F6AF-473E-B06F-5DF3EB87054A--