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 1pr3bz-0007xv-DJ for pgsql-hackers@arkaria.postgresql.org; Mon, 24 Apr 2023 21:20:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pr3by-00088i-9B for pgsql-hackers@arkaria.postgresql.org; Mon, 24 Apr 2023 21:20:38 +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 1pr3bx-00088K-VS for pgsql-hackers@lists.postgresql.org; Mon, 24 Apr 2023 21:20:37 +0000 Received: from mail-ed1-x52a.google.com ([2a00:1450:4864:20::52a]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1pr3bv-001h7M-6E for pgsql-hackers@lists.postgresql.org; Mon, 24 Apr 2023 21:20:36 +0000 Received: by mail-ed1-x52a.google.com with SMTP id 4fb4d7f45d1cf-504eccc8fc8so7242851a12.2 for ; Mon, 24 Apr 2023 14:20:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; t=1682371234; x=1684963234; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=YhBHlFtqeyvqwWrUmDg5ZlCC82jTXh7dXGunZyeWdW0=; b=c2FQpK/DZNKWTFQ9szyRuBB7wdqEBkHPr1Gatc4xrsXKbA+kdV9hAUxB8xzF61/6/e mlFJEGIGg65EGB1aLFibPHz84PjBKR2k7lYwm21MSMk9ADDmiwu6n25xt1EXgwLSw03P LvIEIXJVuTFNjDBx59Or9nrUuSesekwdhGVGkiTtlD6X9prtyLlNbZJ6KINzr+8iEjLu QNkzhP5I3DXwKP0mnhvBI7JUF1BaJRwaMM+cdnLOt9I8wFwrXQGaxRFEtM0OhcUoXxuJ pvuhQsyYb8FZb4ZbGJjunpESEW3Zt95IEmZ6DeyUkAnroJz1DG6+nyblGabvpjIz4YCl GkUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682371234; x=1684963234; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=YhBHlFtqeyvqwWrUmDg5ZlCC82jTXh7dXGunZyeWdW0=; b=WjKw4xqmScpuPwTMFYMEcla61PXSK0tKMAKfmdgSltVZZaJeeWCDN0q/ThTbO7nvQc mXUwB1r4QKbHSvLHv2b1hnRH7LjIzHQD8i55PtlyUJhD9RdecdV8ikx631NiZLf5ETdl QCVcDcKJG1x3gGs5OM9gQra3h1h3y2XqbWnrCgSOXfgpX+PHyoP2IIqs4cKR9uELKfUz kbLvN0xodbfq/EWeUk+3YndXLvVPzf/VzBpc7hGXp0o46/kQbuIZaO/6kglWV4u41IRV An6MQvS1K/oAkPpJ/qQh76Sa5HyZGrWa6G2wMQ0V9fNaRHOHWUH/hmQ3Xc/SKYHO9dv8 HZ+A== X-Gm-Message-State: AAQBX9fMasespDWMBVrNwqsf5NjuP67E5L6vJ+HccyD2tRz1HcjhP3zw HWE2MOtY7bokIcddWGkV9/KIPUCz+VIPf5gIQ28Tl7safH7i5j1DQOX+1S9oEiM1bOeVz7zJu1a fGeSQTqWjgn69bYHkzSx/vPD3QypOPP3f22eIn/Pm0eEoZodZWpMkVqAsQV6zSspBeLfBb5z6nk 6MUHXWQcmfcmVnNS+0wp1BH8IUWKMdXJXUPp7+6Ge+tbmzDF6eW+1J X-Google-Smtp-Source: AKy350Ypcxxp+3xm0xucOTYx0507IUFq22xHnlYLT/1zvNgJnlyaBgL3fbWepmU+cx2HFOjRaP0hQg== X-Received: by 2002:aa7:d98c:0:b0:506:802b:45ba with SMTP id u12-20020aa7d98c000000b00506802b45bamr12892216eds.31.1682371233648; Mon, 24 Apr 2023 14:20:33 -0700 (PDT) Received: from [10.137.0.17] (ip-86-49-225-134.bb.vodafone.cz. [86.49.225.134]) by smtp.gmail.com with ESMTPSA id d12-20020a50fb0c000000b004bf999f8e57sm4919764edq.19.2023.04.24.14.20.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 24 Apr 2023 14:20:33 -0700 (PDT) Message-ID: <491ba86b-6294-37bb-fe00-c91e829dfc82@enterprisedb.com> Date: Mon, 24 Apr 2023 23:20:32 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: Missing update of all_hasnulls in BRIN opclasses Content-Language: en-US To: Alvaro Herrera Cc: Justin Pryzby , Matthias van de Meent , pgsql-hackers@lists.postgresql.org References: <20230424153648.cyaifmcchslbcsrf@alvherre.pgsql> From: Tomas Vondra In-Reply-To: <20230424153648.cyaifmcchslbcsrf@alvherre.pgsql> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-CLOUD-SEC-AV-Info: enterprisedb,google_mail,monitor X-CLOUD-SEC-AV-Sent: true X-Gm-Spam: 0 X-Gm-Phishy: 0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 4/24/23 17:36, Alvaro Herrera wrote: > On 2023-Apr-23, Tomas Vondra wrote: > >> here's an updated version of the patch, including a backport version. I >> ended up making the code yet a bit closer to master by introducing >> add_values_to_range(). The current pre-14 code has the loop adding data >> to the BRIN tuple in two places, but with the "fixed" logic handling >> NULLs and the empty_range flag the amount of duplicated code got too >> high, so this seem reasonable. > > In backbranches, the new field to BrinMemTuple needs to be at the end of > the struct, to avoid ABI breakage. > Good point. > There's a comment in add_values_to_range with a typo "If the range was had". > Also, "So we should not see empty range that was not modified" should > perhaps be "should not see an empty range". > OK, I'll check the wording of the comments. > (As for your FIXME comment in brin_memtuple_initialize, I think you're > correct: we definitely need to reset bt_placeholder. Otherwise, we risk > places that call it in a loop using a BrinMemTuple with one range with > the flag set, in a range where that doesn't hold. It might be > impossible for this to happen, given how narrow the conditions are on > which bt_placeholder is used; but it seems safer to reset it anyway.) > Yeah. But isn't that a separate preexisting issue, strictly speaking? > Some pgindent noise would be induced by this patch. I think it's worth > cleaning up ahead of time. > True. Will do. > I did a quick experiment of turning the patches over -- applying test > first, code fix after (requires some conflict fixing). With that I > verified that the behavior of 'hasnulls' indeed changes with the code > fix. > Thanks. Could you do some testing of the union_tuples stuff too? It's a bit tricky part - the behavior is timing sensitive, so testing it requires gdb breakpoints breakpoints or something like that. I think it's correct, but it'd be nice to check that. regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company