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 1s5U9e-005cWi-1y for pgsql-hackers@arkaria.postgresql.org; Fri, 10 May 2024 17:35:34 +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 1s5U9a-00HTIq-NE for pgsql-hackers@arkaria.postgresql.org; Fri, 10 May 2024 17:35:31 +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.94.2) (envelope-from ) id 1s5U9a-00HTId-BM for pgsql-hackers@lists.postgresql.org; Fri, 10 May 2024 17:35:30 +0000 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1s5U9R-000O0f-Kz for pgsql-hackers@lists.postgresql.org; Fri, 10 May 2024 17:35:29 +0000 Received: by mail-pf1-x42f.google.com with SMTP id d2e1a72fcca58-6f447260f9dso1983154b3a.0 for ; Fri, 10 May 2024 10:35:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; t=1715362519; x=1715967319; darn=lists.postgresql.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=tGIk6ir8aO9u+jR49jk0tEJBX5idY1Do2Oc6/8ml+GY=; b=hy2qmdAadalT1edVFds9Ek2Q8qb3S+GViTCWHhovgD7ewUeKpNscXdlh01fi9m19D+ OgM0c7wlewJUyG+FWxzTbDSGU0nT5fLCA+GCx1mNYqr65sOMNi7glIQN0+aCsbOlfQib I/phFKRMbv86H+ce9BKQubH8qQZhpqjA9DQJPb5atpPbgnSF8emtJpf1bTMJoBxceHZP 5HJPKSNEQenoDcsjF9FKE0GmMct1375TaflBrBZJPcIbfZ9ninnwHZdc4G+KSxqm7wwF 1P+PAW+VF7nwlB7/gpbasZN5Phxb9N8vcigrQxTkbWhzf/EZtS/+qppk8pYpRFKYrPqq gAcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715362519; x=1715967319; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tGIk6ir8aO9u+jR49jk0tEJBX5idY1Do2Oc6/8ml+GY=; b=TqoWUKwHWE02d9QTNjmDDSk/+enQ6gY5onOHQJt+xqdk1FCxCGMN9Q6MKdgD1oJYxM 8bOlcxfiZ3WmR/I9C/uCQItmSS9u/HFXhja5YsFVRXzkjdxA7NjeeK5+lxvkCSoX0IWn uNdsz7u7uWwIffjA05bdsc05Q9is6D7xKjSSShaRjbSxtds7kEtnGRVsMeu8nmaocmJv dvuU0wW4hwZVkTeZ22rCMCIEUfLce/DFkz3U2h7r5ksStKtu2iIq39bcuYHbyLSmryiC B6K7z4XsJ0Vt7ITw5jfvBj+OsTI9RSlr/y30hcsDXlCG5TMZ2WFElrwz8m9rogmqSVeu pzcg== X-Forwarded-Encrypted: i=1; AJvYcCVspdrj2z92AvFWqgZux+fVF3djFxddQ0Nsvg/l5uhUu6zDL00ajLyHIXiZc1kU5y3o42ZxUisCqMFdsT7c/4tlWcZWVJIY4CfCiG95rZNkAh6n X-Gm-Message-State: AOJu0Yx4wcTNwwdMdT51nX2a+H0IkWIg6w91k7cq/C9XSUDhPnJq8Wt0 zvaMEB+ja0JFCereH//jJzxrdHlCgya8Gu8bmIUW3Z3VI/eC4lXwNYRfsdCTzw== X-Google-Smtp-Source: AGHT+IHm6BWvqs25ACbz8nR9/doR2ULpgY0EpwVefJ0q2GuxRmtz6dQGkH646QxOwauHlyKqss8/+g== X-Received: by 2002:a05:6a00:2d05:b0:6ed:cd4c:cc11 with SMTP id d2e1a72fcca58-6f4e0348519mr3895566b3a.25.1715362519056; Fri, 10 May 2024 10:35:19 -0700 (PDT) Received: from smtpclient.apple (24-113-197-127.wavecable.com. [24.113.197.127]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-6f4d2a827f2sm3201461b3a.75.2024.05.10.10.35.17 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 May 2024 10:35:18 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.700.6.1.1\)) Subject: Re: [PATCH] Improve amcheck to also check UNIQUE constraint in btree index. From: Mark Dilger In-Reply-To: Date: Fri, 10 May 2024 10:35:13 -0700 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-Transfer-Encoding: quoted-printable Message-Id: <8635D8B1-45B7-4D67-86C7-D6ECB4F10B11@enterprisedb.com> References: <20220922151328.lakwdytvwnyyif3b@awork3.anarazel.de> <8c74cc5e-4b97-4cd7-9aaf-67886822a78c@eisentraut.org> <20240501022412.85@rfd.leadboat.com> <1375614.1715301775@sss.pgh.pa.us> To: Pavel Borisov X-Mailer: Apple Mail (2.3731.700.6.1.1) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On May 10, 2024, at 5:10 AM, Pavel Borisov = wrote: >=20 > Hi, Alexander! >=20 > On Fri, 10 May 2024 at 12:39, Alexander Korotkov = wrote: > On Fri, May 10, 2024 at 3:43=E2=80=AFAM Tom Lane = wrote: > > Alexander Korotkov writes: > > > The revised patchset is attached. I applied cosmetical changes. = I'm > > > going to push it if no objections. > > > > Is this really suitable material to be pushing post-feature-freeze? > > It doesn't look like it's fixing any new-in-v17 issues. >=20 > These are code improvements to the 5ae2087202, which answer critics in > the thread. 0001 comprises an optimization, but it's rather small and > simple. 0002 and 0003 contain refactoring. 0004 contains better > error reporting. For me this looks like pretty similar to what others > commit post-FF, isn't it? > I've re-checked patches v2. Differences from v1 are in improving = naming/pgindent's/commit messages. > In 0002 order of variables in struct BtreeLastVisibleEntry changed. = This doesn't change code behavior. >=20 > Patch v2-0003 doesn't contain credits and a discussion link. All other = patches do.=20 >=20 > Overall, patches contain small performance optimization (0001), code = refactoring and error reporting changes. IMO they could be pushed = post-FF. v2-0001's commit message itself says, "This commit implements skipping = keys". I take no position on the correctness or value of the = improvement, but it seems out of scope post feature freeze. The patch = seems to postpone uniqueness checking until later in the scan than what = the prior version did, and that kind of change could require more = analysis than we have time for at this point in the release cycle. v2-0002 does appear to just be refactoring. I don't care for a small = portion of that patch, but I doubt it violates the post feature freeze = rules. In particular: + BtreeLastVisibleEntry lVis =3D {InvalidBlockNumber, = InvalidOffsetNumber, -1, NULL}; v2-0003 may be an improvement in some way, but it compounds some = preexisting confusion also. There is already a member of the = BtreeCheckState called "target" and a memory context in that struct = called "targetcontext". That context is used to allocate pages = "state->target", "rightpage", "child" and "page", but not "metapage". = Perhaps "targetcontext" is a poor choice of name? "notmetacontext" is a = terrible name, but closer to describing the purpose of the memory = context. Care to propose something sensible? Prior to applying v2-0003, the rightpage was stored in state->target, = and continued to be in state->target later when entering /* * * Downlink check * * =20 * Additional check of child items iff this is an internal page = and * caller holds a ShareLock. This happens for every downlink = (item) * in target excluding the negative-infinity downlink (again, = this is * because it has no useful value to compare). */=20 if (!P_ISLEAF(topaque) && state->readonly) bt_child_check(state, skey, offset); and thereafter. Now, the rightpage of state->target is created, = checked, and free'd, and then the old state->target gets processed in = the downlink check and thereafter. This is either introducing a bug, or = fixing one, but the commit message is totally ambiguous about whether = this is a bugfix or a code cleanup or something else? I think this kind = of patch should have a super clear commit message about what it thinks = it is doing. v2-0004 guards against a real threat, and is reasonable post feature = freeze =E2=80=94 Mark Dilger EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company