Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kIbWu-0002e9-4n for pgsql-bugs@arkaria.postgresql.org; Wed, 16 Sep 2020 17:47:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kIbWs-0002TY-UJ for pgsql-bugs@arkaria.postgresql.org; Wed, 16 Sep 2020 17:47:38 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kIbWs-0002Sk-Jq for pgsql-bugs@lists.postgresql.org; Wed, 16 Sep 2020 17:47:38 +0000 Received: from mail-ed1-x542.google.com ([2a00:1450:4864:20::542]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kIbWq-0008VO-GZ for pgsql-bugs@lists.postgresql.org; Wed, 16 Sep 2020 17:47:38 +0000 Received: by mail-ed1-x542.google.com with SMTP id j2so7157950eds.9 for ; Wed, 16 Sep 2020 10:47:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bowt-ie.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=LJPQo2KUVRwhIuznexT52O5MHHiqb0CKv0yss91kg30=; b=anOgZuNn8H8QQU7xWnROOLQyJvATEl1puWtThWnDi65vRyvAreu8dK4dRtiSgIPbT2 V3ckUUiNARRy54TeGw2H/KHYPkQvYbSNGXS4YEYLspKR/YGQXWJwq7ZCM9l4ZB7qC7Cy OsktHgxkM22my6nuiMXopk8X6/Gz7ApU2svQG8ZWAICW3eqQ3ZcfgZ1Qk41fqVQZLM9x EiSkd4ya/rrzh6NL85K1DUOjQnKJsPnCicvE3MlQcJLgjR2hTLs2Gu9Sc8fTEW+vbm4B kt0xGpzav0fn8Yd0CMJLdT7koqlwNzWCOVBGsTPqlRpbcOXOYaREMnSAL6kijnKiGXvN Bx9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=LJPQo2KUVRwhIuznexT52O5MHHiqb0CKv0yss91kg30=; b=f1oMkLamlBkmGTE8mn20qq2ramoNP55ugGHgn6XFNK2kHiEeL9n+hldm36ARQjd9Is wNL81YZyFFPkFn/FJt5cxJRTDqxuyL2AGQ9b9Xoyf1LY8wVQdEgTpJnxhOZkW9J9/O7W qSRqcZG7lHbb7jn/62Oslf1mLLm63HaJnFcO4bdyd+7J1uO+8p3Qsu+abAvfyFGZ0FqM YXCdVwkXY/M1rsOmbRVoSghJEdxzLI6x/+eVXWGHmnkK6BA+3dG7mDsR39G33EqB+isv Pl+G3vDUFvKCdIKsnLy+lJeCNvoTK/ys8Q2cfRR6FStNHQyEiYJmhJasj/RYKFQuG8qQ HhHg== X-Gm-Message-State: AOAM531Lon83/kWmE6TdLllgfAozb55hi82NoXiB2+4Ol2wyCLFvtK8D MsVI+S18tdVU7lsJJ9peJ9d+TqR+1BEGOtkrn18BFA== X-Google-Smtp-Source: ABdhPJyXVpwqRCMs+dCx02nKChHakViwwUbvoWTKq6SsSMCH5z+gKr8nzkJbI45DM5YZzTJyDqz2/6EdSPZ24DRd6E0= X-Received: by 2002:a05:6402:1656:: with SMTP id s22mr30115914edx.160.1600278455837; Wed, 16 Sep 2020 10:47:35 -0700 (PDT) MIME-Version: 1.0 References: <16619-aaba10f83fdc1c3c@postgresql.org> <8ede01d3-f09c-248e-9494-63628ff3cf56@postgrespro.ru> In-Reply-To: <8ede01d3-f09c-248e-9494-63628ff3cf56@postgrespro.ru> From: Peter Geoghegan Date: Wed, 16 Sep 2020 10:47:19 -0700 Message-ID: Subject: Re: BUG #16619: Amcheck detects corruption in hstore' btree index (ver 2) To: Anastasia Lubennikova Cc: andrewbille@gmail.com, PostgreSQL mailing lists , Alexander Korotkov Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Wed, Sep 16, 2020 at 7:24 AM Anastasia Lubennikova wrote: > For v2 indexes pivot tuple's offset can contain any random number which > will lead to bt_pivot_tuple_identical() failure. > > The fix is pretty simple - only compare data part of the tuples. I think > we can skip offnum check for all index versions to keep the code simple. I pushed a tweaked version of this patch. It seemed worth preserving the inclusion of offset number in the bt_pivot_tuple_identical() memcmp() comparison. The field contains important metadata that really should match. Also, I made sure to compare t_info field on all indexes (including pg_upgrade'd indexes) for the same reason. We already account for heapkeyspace difference in other similar routines, such as invariant_l_offset(). It's not hard to do this here as well. Thanks -- Peter Geoghegan