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 1qqe6W-000NmA-Me for pgsql-hackers@arkaria.postgresql.org; Wed, 11 Oct 2023 18:38:44 +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 1qqe6U-000fHR-7T for pgsql-hackers@arkaria.postgresql.org; Wed, 11 Oct 2023 18:38:43 +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 1qqe6T-000fGg-MH for pgsql-hackers@lists.postgresql.org; Wed, 11 Oct 2023 18:38:42 +0000 Received: from mail-yw1-x112e.google.com ([2607:f8b0:4864:20::112e]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qqe6R-001CeP-J5 for pgsql-hackers@postgresql.org; Wed, 11 Oct 2023 18:38:41 +0000 Received: by mail-yw1-x112e.google.com with SMTP id 00721157ae682-5a7cc03dee5so1964517b3.3 for ; Wed, 11 Oct 2023 11:38:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; t=1697049518; x=1697654318; darn=postgresql.org; h=user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:to :from:date:from:to:cc:subject:date:message-id:reply-to; bh=OYY0i9zc60MKnZ3D/5wGg9qf+FLXhafFaMhpMMFBMec=; b=MXdaWGXBNTaCpt1h6tYRI3kVq1iHJkepwrMjn4XzLQby3rTD1SnWjJ7q0ZmLh9Ofvc 6foYuNmMX2EaQDWUNU7JemmYfsDoy7ibqvnhFyPiN9bhKSCaYlRgN3XJRi1nj2u4SmXp j+7gqS7DjnH4L/9PPe9DsqUoAP9fFMYpMFhNA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697049518; x=1697654318; h=user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:to :from:date:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=OYY0i9zc60MKnZ3D/5wGg9qf+FLXhafFaMhpMMFBMec=; b=eTs3tUCFspjIZCZ44vq2XOiLVEQ7kG94DgDMY7ym4aLFLFyhFPaNCEw2IBtaRp6HoA +XlDKwIRHKLl1F99bqFI8Hg3UPIBZlCPD7pIH9dMpg/h2ES6EK9TWJJQ7vSNQVaNR8C+ eWtKQaMt+mUhHrjs0a9mNj9UxC4DlQvDmMWdoJAmcdSYd+9kePuUHMAm+DQokg2Rrqjr E7lju+UUvax1XR2LRj9F3GwOGwrKHn1vNvpoThOmSfUy1bu/uegwoQuqN8NhhAFAG0y0 QpsQg5XgrnqlzdE6GaH9ktzLWeH0Hncjvf7j8jUun6qpurFRIHyjwiOPwq8DDUNqAUCJ hDLg== X-Gm-Message-State: AOJu0Yysw/soGeN2uOPTJK6KdUBSwCF+3UtrU1iDpbub7o78IMsdZGv1 AnBrg6M3fT0AX/AuWJm1VxXa0Rn7ZBhseAVMP50= X-Google-Smtp-Source: AGHT+IHd1mSPPB4+NjxjLg1R3lKW5jKQtn+9DsDUJiZlV0TLwA3eKTxxKAtdHLfDs3jH18/nzDFFbQ== X-Received: by 2002:a0d:d802:0:b0:5a7:be29:19ac with SMTP id a2-20020a0dd802000000b005a7be2919acmr6382259ywe.12.1697049518398; Wed, 11 Oct 2023 11:38:38 -0700 (PDT) Received: from rfd.leadboat.com ([2600:1702:a20:5750::2e]) by smtp.gmail.com with ESMTPSA id x184-20020a814ac1000000b005869ca8da8esm5296839ywa.146.2023.10.11.11.38.37 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Oct 2023 11:38:37 -0700 (PDT) Date: Wed, 11 Oct 2023 11:38:35 -0700 From: Noah Misch To: Peter Geoghegan , pgsql-hackers@postgresql.org Subject: Re: interval_ops shall stop using btequalimage (deduplication) Message-ID: <20231011183835.32@rfd.leadboat.com> References: <20231011013317.22.nmisch@google.com> <20231011032908.35@rfd.leadboat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/2.2.12 (2023-09-09) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, Oct 10, 2023 at 09:35:45PM -0700, Peter Geoghegan wrote: > On Tue, Oct 10, 2023 at 8:51 PM Peter Geoghegan wrote: > > I don't see any reason to delay committing your fix. The issue that > > you've highlighted is exactly the kind of issue that I anticipated > > might happen at some point. This seems straightforward. > > BTW, we don't need to recommend the heapallindexed option in the > release notes. Calling bt_check_index() will reliably indicate that > corruption is present when called against existing interval_ops > indexes once your fix is in. Simply having an index whose metapage's > allequalimage field is spuriously set to true will be recognized as > corruption right away. Obviously, this will be no less true with an > existing interval_ops index that happens to be completely empty. Interesting. So, >99% of interval-type indexes, even ones WITH (deduplicate_items=off), will get amcheck failures. The <1% of exceptions might include indexes having allequalimage=off due to an additional column, e.g. a two-column (interval, numeric) index. If interval indexes are common enough and "pg_amcheck --heapallindexed" failures from $SUBJECT are relatively rare, that could argue for giving amcheck a special case. Specifically, downgrade its "metapage incorrectly indicates that deduplication is safe" from ERROR to WARNING for interval_ops only. Without that special case (i.e. with the v1 patch), the release notes should probably resemble, "After updating, run REINDEX on all indexes having an interval-type column." There's little point in recommending pg_amcheck if >99% will fail. I'm inclined to bet that interval-type indexes are rare, so I lean against adding the amcheck special case. It's not a strong preference. Other opinions? If users want to reduce their exposure now, they could do "ALTER INDEX ... SET (deduplicate_items = off)" and then REINDEX any indexes already failing "pg_amcheck --heapallindexed". allequalimage will remain wrong but have no ill effects beyond making amcheck fail. Another REINDEX after the update would let amcheck pass.