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 1s83Tn-009JU4-25 for pgsql-hackers@arkaria.postgresql.org; Fri, 17 May 2024 19:43:00 +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 1s83Tn-00Gz7p-4j for pgsql-hackers@arkaria.postgresql.org; Fri, 17 May 2024 19:42:59 +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 1s83Tm-00Gz7h-Ou for pgsql-hackers@lists.postgresql.org; Fri, 17 May 2024 19:42:58 +0000 Received: from mail-lf1-x12e.google.com ([2a00:1450:4864:20::12e]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1s83Tk-000i3i-B9 for pgsql-hackers@lists.postgresql.org; Fri, 17 May 2024 19:42:57 +0000 Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-51ff65b1e14so2678081e87.2 for ; Fri, 17 May 2024 12:42:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715974974; x=1716579774; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=u0JevXCftlrdDrBbQ9BcG4ksgwJKKJg/INVgapLzncY=; b=c3Ms5b6YGtINzbIjXyYnW0cJxeFtGFG0XoZnLK1bY6JO0DdfeokGKjGguQaJlYA9Ks oAWlegSGhQYzPj8WRGWCkzuORAoGlwZzd3HEKOmrSZrbGsvYQd6VorKcTn8wD4qKKXYq PT8nKKgRY8uOAf8lCqgUSY5gmAv+RU7hdORWauq93PcxvRrh0QpyiaTAKPYRPGCFJzyz 1FOZocAhjwwZFlEudjTnm/OIxEIZXZnKtBw/1cRnCHytWBbT7m6YP8cKMi1lagTB/rV9 n8lgprYfIskf8ZUADF9CsI9+fmWpp2sL0Kzd/3dKS+guuk63cpOyROnv3JyIoj9nVdbm lJDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715974974; x=1716579774; h=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=u0JevXCftlrdDrBbQ9BcG4ksgwJKKJg/INVgapLzncY=; b=MVqlNMqs1MXx3fk8dk+Bp+3CXNvHZdVBzN52CXiVkImxzkaFJyvz2nKEsxN+wq0yGh GGpOg1JUCdq1KA0UeFgiPoioQy0D2sZuNOQHbqd3CQ7u+aWZTt3WpYY23rJ41Zi6DGvb MLVBhGOxAt2VNuQ6ITTn5P62szYSu7WmKIFx0BphizykuLmLsb6cXdN3c/nprHWNyv+M U5uw7EtqW3XCQNlACc/dhYHRaJR0jPPX0l63aNYtcvkLZcYcC4Go91ti3SC44+UELjgC OC3OxEpjTZTYlcBbscYYXk9oAhVQ6J5mncxbrQHFuhACVjfOufJ/vbqadCz0p4YXFz35 vOoA== X-Forwarded-Encrypted: i=1; AJvYcCX+DdWcHI5NOMI3mqTvGTvuDz2ESroVJ9xe7cFZpzwQQUNYBWR2nid0eMIgbKgDIL88LHHJthsc5fZLU2e7dncIRatndjIytLQ8ZJEgP5T0f0tg X-Gm-Message-State: AOJu0Yyx5L/3dGAjmG+iZmMqcdd2/iDqojhMCdGwIaUvEMp2fZ0ICTkn 4w+ov1/uQDn4xKBNP+FSd+XfHds0oAFMsZwtcJZdclh2GtkgpWvSZBHLrjYAJrs6lsRaO8J1zFb 0TWl/o9NSqPF6/zOkTlZ7apXl52g= X-Google-Smtp-Source: AGHT+IHxrXoE1KBQu12eAzpVPaczLKhVNqPWPCXzJMpbyuI8E/4gZMEf3DH2Xj6ho06sx+Yx9Pdyc+tQZULD9UcgIV4= X-Received: by 2002:a05:6512:e8f:b0:51b:248b:e768 with SMTP id 2adb3069b0e04-5220fc794dfmr18708830e87.25.1715974974374; Fri, 17 May 2024 12:42:54 -0700 (PDT) MIME-Version: 1.0 References: <20220922151328.lakwdytvwnyyif3b@awork3.anarazel.de> <8c74cc5e-4b97-4cd7-9aaf-67886822a78c@eisentraut.org> <20240501022412.85@rfd.leadboat.com> <1375614.1715301775@sss.pgh.pa.us> <8635D8B1-45B7-4D67-86C7-D6ECB4F10B11@enterprisedb.com> <2EDAC2EB-E8C2-4B56-9094-288ABD45DA4E@enterprisedb.com> <28FCD9E5-795E-44F4-ADFA-DBCAC1945DA1@enterprisedb.com> In-Reply-To: <28FCD9E5-795E-44F4-ADFA-DBCAC1945DA1@enterprisedb.com> From: Pavel Borisov Date: Fri, 17 May 2024 23:42:42 +0400 Message-ID: Subject: Re: [PATCH] Improve amcheck to also check UNIQUE constraint in btree index. To: Mark Dilger Cc: Alexander Korotkov , Tom Lane , Noah Misch , Peter Eisentraut , Aleksander Alekseev , Postgres hackers , Maxim Orlov , Andres Freund , Greg Stark , Julien Rouhaud , David Steele , Peter Geoghegan , Maxim Orlov , lubennikovaav@gmail.com Content-Type: multipart/alternative; boundary="000000000000ca8c9d0618ab8ebb" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000ca8c9d0618ab8ebb Content-Type: text/plain; charset="UTF-8" Hi, Mark! On Fri, 17 May 2024 at 23:10, Mark Dilger wrote: > > > > On May 17, 2024, at 11:51 AM, Pavel Borisov > wrote: > > > > Amcheck with checkunique option does check uniqueness violation between > pages. But it doesn't warranty detection of cross page uniqueness > violations in extremely rare cases when the first equal index entry on the > next page corresponds to tuple that is not visible (e.g. dead). In this, I > followed the Peter's notion [1] that checking across a number of dead equal > entries that could theoretically span even across many pages is an unneeded > code complication and amcheck is not a tool that provides any warranty when > checking an index. > > This confuses me a bit. The regression test creates a table and index but > never performs any DELETE nor any UPDATE operations, so none of the index > entries should be dead. If I am understanding you correct, I'd be forced > to conclude that the uniqueness checking code is broken. Can you take a > look? > At the first glance it's not clear to me: - why your test creates cross-page unique constraint violations? - how do you know they are not detected? --000000000000ca8c9d0618ab8ebb Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi, Mark!

On Fri, 17 May 2024 at 23:10, Mark Dilger &l= t;mark.dilger@enterprisedb.= com> wrote:


> On May 17, 2024, at 11:51 AM, Pavel Borisov <pashkin.elfe@gmail.com> wrote:=
>
> Amcheck with checkunique option does check uniqueness violation betwee= n pages. But it doesn't warranty detection of cross page uniqueness vio= lations in extremely rare cases when the first equal index entry on the nex= t page corresponds to tuple that is not visible (e.g. dead). In this, I fol= lowed the Peter's notion [1] that checking across a number of dead equa= l entries that could theoretically span even across many pages is an unneed= ed code complication and amcheck is not a tool that provides any warranty w= hen checking an index.

This confuses me a bit.=C2=A0 The regression test creates a table and index= but never performs any DELETE nor any UPDATE operations, so none of the in= dex entries should be dead.=C2=A0 If I am understanding you correct, I'= d be forced to conclude that the uniqueness checking code is broken.=C2=A0 = Can you take a look?
At the first glance it's not = clear to me:=C2=A0
- why your test creates cross-page unique cons= traint violations?
- how do you know they are not detected?
=

--000000000000ca8c9d0618ab8ebb--