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 1k5v50-0006op-2V for pgsql-hackers@arkaria.postgresql.org; Wed, 12 Aug 2020 18:02:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1k5v4z-0007Qw-0q for pgsql-hackers@arkaria.postgresql.org; Wed, 12 Aug 2020 18:02:25 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k5v4y-0007Qp-QD for pgsql-hackers@lists.postgresql.org; Wed, 12 Aug 2020 18:02:24 +0000 Received: from mail-qt1-x844.google.com ([2607:f8b0:4864:20::844]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1k5v4w-0005JP-OC for pgsql-hackers@lists.postgresql.org; Wed, 12 Aug 2020 18:02:23 +0000 Received: by mail-qt1-x844.google.com with SMTP id t23so2204830qto.3 for ; Wed, 12 Aug 2020 11:02:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=6gPH8awj7xAX30D7RoZkWzY2NqjrxFKAti8WOCIv628=; b=VDnuOI7KlRbhVEtTb1teSVys4HCVGjM/0qwU+IbUd3zRCTMtQvyDuEHSQGNuusAuNq GZSLmJUcbJUGg+JfsH2WaDZ2RmgB3PyjQ99jQwj3rAMqK0Yd+D5TJ8lOLkDryRrakRrw KbwFWD+znJJX22kgWtDNFR4Prq3ADXW8y1ogOlmgRHIgEg1AQENKTKd3b4e8/WZ2GtUC wTxMEobs/HoSvNl0K6N9chm8Flt3o0ARRa2tfoHjxNfmXiAT+vtyNp8GNmweWxLbhPcP FiXElWP57GuVBiADLeIcHO45E0e1jCncaN46d+p5XOUuYqOLaOtYTenFDAf9MDti0FET L7hA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=6gPH8awj7xAX30D7RoZkWzY2NqjrxFKAti8WOCIv628=; b=Salb42w4izUMOCPU/t86QYeV6b0RmOvB9T186phgOGZ/9jIAikp15SYUpY1c+ym2Wl m3E84lfHzCKtEBsU+FO3CYl9smS15+WMDJ0vJQQK4L0j7n2581RJG2aCPiE4mms+ycDJ iSq3x0JkX0v+mj3QJFp1S4Em3o7YVoUIOxcK+44tmCkmY8+jYARXg2+B9KWmazzQyFFJ fmRCKxsaVhwBnv8xfcUWM9pnwsBZkNVgcGcRTZuE2Qox9AR3wpywqDbDwI1yik2PIiRa otBG9P5MzpO+2FJQ5UK1WcBfXl32fYwaKi1p8QnmUa23Y1CZztBwgth/EGmJjFN5kQA7 mNrQ== X-Gm-Message-State: AOAM532jo114kphz55+X83SJcfWVR0U15O98knRnl5QytHva4ne2Qa8D XVpnUB57S3tocgCUM7G5xr2+90WioMsZhylSSC+Fnn4c9lkS8ko2NQ1vkYjR6m/DQQWoUGlEOk8 IINfMWWhSQknaBKSicGuEcFs3/NcZy0FKSJELHs89UBEETgioWH2jr8KTy/kQ+tojKyq9mSYze1 CZ2yPw1wjw3Djp/A== X-Google-Smtp-Source: ABdhPJzxHyz9Sawkmce+p1kbELXFmMSn/X0GkleG8jhM6+Vcy4qMEMbDz+NF4zWOUvLhd5cZIZ9YMg== X-Received: by 2002:ac8:4117:: with SMTP id q23mr958561qtl.186.1597255341855; Wed, 12 Aug 2020 11:02:21 -0700 (PDT) Received: from perhan.alvh.no-ip.org ([190.95.19.47]) by smtp.gmail.com with ESMTPSA id e4sm3371510qts.57.2020.08.12.11.02.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Aug 2020 11:02:20 -0700 (PDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id BA6272A1526; Wed, 12 Aug 2020 14:02:18 -0400 (-04) Date: Wed, 12 Aug 2020 14:02:18 -0400 From: Alvaro Herrera To: Anastasia Lubennikova Cc: pgsql-hackers@lists.postgresql.org Subject: Re: [BUG] Error in BRIN summarization Message-ID: <20200812180218.GA30467@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200811234321.GA17597@alvherre.pgsql> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2020-Aug-11, Alvaro Herrera wrote: > A much more troubling thought is what happens if the range is > desummarized, then the index item is used for the summary of a different > range. Then the index might end up returning corrupt results. Actually, this is not a concern because the brin tuple's bt_blkno is rechecked before returning it, and if it doesn't match what we're searching, the loop is restarted. It becomes an infinite loop problem if the revmap is pointing to a tuple that's labelled with a different range's blkno. So I think my patch as posted is a sufficient fix for this problem. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services