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 1s5Vtu-005ml9-F5 for pgsql-hackers@arkaria.postgresql.org; Fri, 10 May 2024 19:27:26 +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 1s5Vtr-000uNF-MN for pgsql-hackers@arkaria.postgresql.org; Fri, 10 May 2024 19:27:24 +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 1s5Vtr-000uN7-Bw for pgsql-hackers@lists.postgresql.org; Fri, 10 May 2024 19:27:23 +0000 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1s5Vtn-000Ohw-1l for pgsql-hackers@lists.postgresql.org; Fri, 10 May 2024 19:27:22 +0000 Received: by mail-pf1-x436.google.com with SMTP id d2e1a72fcca58-6f4ed9dc7beso114849b3a.1 for ; Fri, 10 May 2024 12:27:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; t=1715369237; x=1715974037; 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=Bb5R2XzRzImUlAvQH75lNW61dXnC2sXUf62jBYBB4/4=; b=VA7lcb/wt5vWdErZK69k1szQqQPItRGIJsZapowtrbEVXmOmMNRRFrysLM0kkrZI3t H9r4t0W0pEz/G/mxrB8ZUC9BMWqxwLliWhjyK0uEqlUBgVLkmrEpyXfjQvJJS3m8IQOP ZASpeKHwBjUv6OZ4CYvSnA2BL4GHztd5AkWBA2qrRN8i6sOFElhFH5GCdOT4E/s4XsUw pF11I9LvbN5bsR4tyhj/q6GeDq1oMXttK59EmeCvrVYDtBmiy8ZZ033Y+wil9WB+5Nik MMJD2+br64EwRkLx1DhnpW1bEgLhU9TALfDZ+krkqr3C/obrjzh8ToraWiAwAtqCm2Md 43Qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715369237; x=1715974037; 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=Bb5R2XzRzImUlAvQH75lNW61dXnC2sXUf62jBYBB4/4=; b=m4E01C3GzmeDS+OqC+nwnvDbSq0oWUZyHUiHLFhSS+7XLzdUp/28XjU0L1/yyram1h uR0lKwTQPtr6XczbBd5npYk8TgXTLVIh/IilN8W9772pV4YvZlhS0sSQE282sv7Kgp+a Dp9ih0oTdpS1G78Y95HeEtlnT/C5MlgjiPKUTdtlRDWoGgC0rODa8WvErqrFvUiAb8jL gf17jPRp9eOfjS96kkcNjY3o6R27+wzbJj4n/oTuc8/unWGiPH665k/Xb3YGJ+Ho1JZ+ Mrtm09DxFG8kgPv1MaK2J586CPPYGSXC1xGKbrG3u5pOfuCPDLB7MtlBRgomeAHoK53b MnHg== X-Forwarded-Encrypted: i=1; AJvYcCXwKZ9yI9YagoxCvje5ZRSDpGHeRYKJKuq7YNGeQzZwTveSt/QoFtbpoqmKVRMDrwuav6oypPrruof9UNB0qJ5rVbr/zkNParZkTUkneAMhym0a X-Gm-Message-State: AOJu0Ywy6y6OgC8hcyY9nkrgsqovLyUCRrqJ28XiKjCbb6VIz7v/VGMM EqFs/LPVcuUdvmKKR36OBD05MaaJJrbhlkAcHh5t2vg3cIDzJIR8Ly5ouhNNJQ== X-Google-Smtp-Source: AGHT+IEFz7FryyHuM+TZepzIdaEiH5ea4wMfRuzqDXUcNvD+WvQnu76xBfCzSyO0YLplzfv00+EXIA== X-Received: by 2002:a05:6a00:3d49:b0:6f3:e9bc:cc3d with SMTP id d2e1a72fcca58-6f4c90905a1mr10165116b3a.3.1715369236975; Fri, 10 May 2024 12:27:16 -0700 (PDT) Received: from smtpclient.apple (24-113-197-127.wavecable.com. [24.113.197.127]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-6f4d2a6664dsm3401222b3a.12.2024.05.10.12.27.15 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 May 2024 12:27:16 -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 12:27:11 -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: 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> 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 11:42 AM, Pavel Borisov = wrote: >=20 > IMO 0003 doesn't introduce nor fixes a bug. It loads rightpage into a = local variable, rather that to a BtreeCheckState that can have another = users of state->target afterb uniqueness check in the future, but don't = have now. So the original patch is correct, and the goal of this = refactoring is to untie rightpage fron state structure as it's used only = transiently for cross-page unuque check. It's the same style as already = used bt_right_page_check_scankey() that loads rightpage into a local = variable. Well, you can put an Assert(false) dead in the middle of the code we're = discussing and all the regression tests still pass, so I'd argue the = change is getting zero test coverage. This patch introduces a change that stores a new page into variable = "rightpage" rather than overwriting "state->target", which the old = implementation most certainly did. That means that after returning from = bt_target_page_check() into the calling function = bt_check_level_from_leftmost() the value in state->target is not what it = would have been prior to this patch. Now, that'd be irrelevant if = nobody goes on to consult that value, but just 44 lines further down in = bt_check_level_from_leftmost() state->target is clearly used. So the = behavior at that point is changing between the old and new versions of = the code, and I think I'm within reason to ask if it was wrong before = the patch, wrong after the patch, or something else? Is this a bug = being introduced, being fixed, or ... ? Having a regression test that actually touches this code would go a fair = way towards helping the analysis. > For 0002 I doubt I understand your actual positiob. Could you explain = what it violates or doesn't violate? v2-0002 is does not violate the post feature freeze restriction on new = features so far as I can tell, but I just don't care for the variable = initialization because it doesn't name the fields. If anybody = refactored the struct they might not notice that the need to reorder = this initialization, and depending on various factors including compiler = flags they might not get an error. =E2=80=94 Mark Dilger EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company