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.96) (envelope-from ) id 1wXrug-003Wjb-1k for pgsql-hackers@arkaria.postgresql.org; Fri, 12 Jun 2026 02:46:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wXruf-000MS2-1Q for pgsql-hackers@arkaria.postgresql.org; Fri, 12 Jun 2026 02:46:29 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wXruf-000MRu-0V for pgsql-hackers@lists.postgresql.org; Fri, 12 Jun 2026 02:46:29 +0000 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wXrud-00000002eag-0z16 for pgsql-hackers@postgresql.org; Fri, 12 Jun 2026 02:46:28 +0000 Received: by mail-pf1-x429.google.com with SMTP id d2e1a72fcca58-8419ab3a297so257811b3a.2 for ; Thu, 11 Jun 2026 19:46:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1781232385; cv=none; d=google.com; s=arc-20240605; b=PhddRo9UN0xQev0HG9jmUFarowf2XCh4VaFSbpqGY9e/F9ZMKoZE/S6fuORcNF+J+g o6pfXZKzFW8DJXEVSBSA7xne7I8ikn8i1wLtW1KrBKjVbSWkOTlqAyrCPsWOsj9sTb84 stq21tZBqSNJxp8b7ZZL8V4o24Fq0kI6qw/HpmRx7iGOJBfLehMtnH49r/SktrNq0Wpf EGRajRcxwFs8AC7cnT5F59sJHbX9+lOhAFFQSByiuuIpl8oq3lVOrCyxqhnSyUbJ0ESr ce/wq3pCC3Stpbofb3tUEwTpayWQt9KoG38D1lvkyke90yFzT7lZWYgGtShYONs6cr9s gTZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=rOj61oAqGBAPZetrzF9XOgBRpzyIcbs9BewT7hGn9tQ=; fh=OGllBTdllGw2mTKBnrKcldLpWtqYoC3LSeGydTH/28s=; b=Rzl2XIxjrorwGTZB0dNa2z/g96dUWkHacX8QaHuj82zNv9UdveneWS/J2nJbb7N1nK 442uxjo1uPwEC332n/qH3D0RrFUce7MMVrHLkUwOlBbL0TMC/EWrNkO4QU2E9clqrx4y sCRlztaCsxJBDKX2jw0sL9/XYlbg/i43HKI9d5RIwXiMmaWDGmZUSDob2hq2EbWVGjKR LKu99lI5zutB62ChCzBXftkRGaphBr2Drq/IBuu93IAZzIeXBHdFttawGIXsSTdKq4xK E8oZT2oTeOjyNLW77Oxv/yJNlEdadnhxVmgeVmTqOcyKqo+kQuSm+k4REy0CvRwD8WRU nItw==; darn=postgresql.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1781232385; x=1781837185; darn=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=rOj61oAqGBAPZetrzF9XOgBRpzyIcbs9BewT7hGn9tQ=; b=nFYWl1CD6ERFRiYDBdraFt4eAQiZgnBkHxU269fGJ0ZxoOZkCtfdPrWjmzIt931T7O VP2HXGb3aKBi/RFgNyrwAXFZ2AKeh3XEVRuPg/QYrOtdtSVv+qO+sRm2v16BL+RLFn5M n4lwxjnVaovDIhzuc9a3I+IfzqWFoqo/YhI10Th8/4uEy1d2pN/oCb8921cAte/xAS/F 0paOwdyLe974NLzrViJRoe3sIi4/MVcgqqGHwvJML09qAeg0erL3r1axHOfLZwVkEEfb GDEAYuGdhQANbB3O6Yo6vpEyUb/nLr6widmWP7nCY+/850IOfLZpLIihuyGQw+cb16y+ FtGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781232385; x=1781837185; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=rOj61oAqGBAPZetrzF9XOgBRpzyIcbs9BewT7hGn9tQ=; b=QsRzwHBYGdv9/klzQa0z1GrSyXGvEfEwDsXziIXz/x3I6qCpPktbhfPHBA7zmMb09I s0agvAAxxCpUp/tFgmHqqEu7QnPAL3n8zrU+zmXPTRhVKl9Jqii/568ZNqWCaCejU8Nc ylMY6bV2YcfhDcGTREuVkWkPyBXNeAGh3Y6TuytcDl/u0BrDkjZH8HyFPfKWYcm0E1AA IUukO3T2kMXIpNExppMnYDiI2kD694hcT9jni3PajNGc7n23hLDNB7si/bFYCK3Dxs7E pgtq7ejSoZ9aBAHJr43hcBJv9upIxSZ5d9UtxZpMCpqu4uPFJ9a1nYKAk4ihEny0l9Cl DogQ== X-Forwarded-Encrypted: i=1; AFNElJ8fsYTsNWZ5TvoNPT2nZT0jShTTranA83nun5ou5yrl+lVBfmUhQTkHkdcefsFzGWz6l4HpH7slqV3UD5we@postgresql.org X-Gm-Message-State: AOJu0Yx2RcsLHkGxPu5iWenESqxLF58AVvR41jJgt/Kt8Zk1SDMiHntg QTDER8JRyNZe2g/okMSj6qRkzPaMtPiNu+NdXNC3m6tCBFd7Yp43ogFEkoUf+H92yTHzgb2S7nm vhVDqHMZ/kQRSZYslOTWhjnS9eXruYGw= X-Gm-Gg: Acq92OG+sV+FG6rd/bS+719MgSyYdssonWIbhDEmpNGNjZoUR9+NPr7VbeMFTeRnwov ig/boD9eUpw45D8ymB2cgTXv97KE+Uuiv7aORkbxHQRW5mBX5aYfnMI+sgn0KRNRxtYypgPOkNf +/NEGOigkUmCHkKSZlGI96eG7bnv8xk/VAUfpEXsi2giYJYhb26CtpM/ituwW+Mlz1ghdF9v8Qe vmtUX6VCDX49q+jA8L2AwWVpMLo68NrVWG1qNB8fb0wWHUvioFklZyjIgKnKrOGFfc5S09O3HAq 6I6OKyxDIfHiKBzlRNaM02hYqMXmJbRa4nlXDOeuPD0hPILlwA6Hz2ULnwS0enisuDpOH2adlo7 s0YF6Cm4N1e2sD8eBDvFQ X-Received: by 2002:a05:6a00:3a08:b0:842:5da3:9b83 with SMTP id d2e1a72fcca58-8434cf43068mr723422b3a.33.1781232384638; Thu, 11 Jun 2026 19:46:24 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Amit Langote Date: Fri, 12 Jun 2026 11:46:07 +0900 X-Gm-Features: AVVi8CfEcA9vmbyOdwaZgzh34Sy-wAzeo86H0r9vAO2E669iJ2uLm-EoQY7cd8c Message-ID: Subject: Re: PG19 FK fast path: OOB write and missed FK checks during batched To: Junwang Zhao Cc: Ayush Tiwari , Nikolay Samokhvalov , pgsql-hackers mailing list , Andrey Borodin , Kirk Wolak 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, Jun 11, 2026 at 7:47=E2=80=AFPM Amit Langote wrote: > > On Thu, Jun 11, 2026 at 6:51=E2=80=AFPM Junwang Zhao = wrote: > > On Thu, Jun 11, 2026 at 5:05=E2=80=AFPM Amit Langote wrote: > > > > > > On Thu, Jun 11, 2026 at 5:18=E2=80=AFPM Junwang Zhao wrote: > > > > I only reviewed and applied patch 0001 on my local machine, and it > > > > successfully fixed the crash. > > > > > > > > One minor comment: > > > > > > > > + if (fpentry->flushing) > > > > + { > > > > + ri_FastPathCheck(riinfo, fk_rel, newslot); > > > > + return; > > > > + } > > > > > > > > Would it be worth wrapping the condition with unlikely()? It seems > > > > this branch is expected to be false in most cases, not a strong > > > > opinion though. > > > > > > Good idea. Will do. > > > > > > Are you planning to look at 0002? > > > > I just applied 0002 and ran the regression successfully. > > > > I have one trivial comment, subXact abort doesn't NULL the > > ri_fastpath_cache, so I think the following comment of > > RI_FastPathEntry should be polished accordingly by removing the > > `SubXactCallback`. > > > > * ri_FastPathEndBatch(); on abort, ResourceOwner releases the cached > > * relations and the XactCallback/SubXactCallback NULL the static cache = pointer > > * to prevent any subsequent access. > > Thanks for the review. Yes, I missed that. > > I've updated the patches to address your comments and did some other poli= shing. I've pushed these now. Thank you everyone. --=20 Thanks, Amit Langote