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 1rmyML-00Auzc-Fi for pgsql-bugs@arkaria.postgresql.org; Wed, 20 Mar 2024 16:00:09 +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 1rmyMK-0069vi-27 for pgsql-bugs@arkaria.postgresql.org; Wed, 20 Mar 2024 16:00:08 +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 1rmyMJ-0069vS-Q0 for pgsql-bugs@lists.postgresql.org; Wed, 20 Mar 2024 16:00:08 +0000 Received: from mail-lj1-x233.google.com ([2a00:1450:4864:20::233]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rmyMG-005WKg-LB for pgsql-bugs@postgresql.org; Wed, 20 Mar 2024 16:00:07 +0000 Received: by mail-lj1-x233.google.com with SMTP id 38308e7fff4ca-2d476d7972aso390481fa.1 for ; Wed, 20 Mar 2024 09:00:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710950403; x=1711555203; darn=postgresql.org; 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=3Lbo55tDanY+dATQR3S1dPkvqKNMcSKyTuX5PI8HMh0=; b=IyyCfNB9kwxH29UIsVYKEY9hzl1Z0nc7rJMsFQQhtcwvFUOoECkyXixxMkX73VhKx1 cjNDDl8oZib9+dzwyv1jjSkzMQNr87J/VVCh9qtS/dR1HZbosTS4S+xXQ2k0j/jvkgBc KWhIMjgoKpD7iH8sf404JSi5XN3/rv/MvSphVMRGghT+BWQh9NrhT59S3tLqofolY1ud 7E1iRDQY0h+tg5W7oiKnrN2E8Pf/VmB40aSEX9tb5GEroyaeYU9yVYeZNUX7MoKMPr1X MaCdp3jLXIskgZblMxUdnkr0WHzP7qQjFAHXJ+LXDMu8V2XKMigZ+mDz3rVSVYN51zL6 eXGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710950403; x=1711555203; 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=3Lbo55tDanY+dATQR3S1dPkvqKNMcSKyTuX5PI8HMh0=; b=LUbTFVPlV8DlbxyH0NnYXIkYWrJ0BgxJz9dzxAGJ3Jq8oWlGG/RxfmpRA77vUTi2lg qIRD0q6P31dbADAAJ8SmweF/jFczP5kjkocc3JfRUV7OlM5vYUUbB2YwvSt17gcfAYD6 I0/pUdZ+SnEyWEt0YfiCJsastaTlBHv0COeh4XkM/daw+GHziKtQMEfF3WwerfN816Gx guxPt+hnV3Sv1+o9F3N395ybaMZjvR8wSCKLMdXCMG8WDeXxCMttJhp+S44w+88slnaF PfkVfbJWDC6ApTaHnQ6QuwfqFRPmg80ALHMp3DgWlgClwK4jrpvjqULcbqCf/9U/T8Af +hVQ== X-Forwarded-Encrypted: i=1; AJvYcCXgDoCgm7/+vv6+7Egpt368vzZs9/sacLLDHk1LYjTiPE+HyqxvWYolMuDb5NrCnOGr9Sba2cdJugtTOShpnw7MZoSd4Q8ujpmA X-Gm-Message-State: AOJu0YwZ3jS0hE++ojP+KT7xL+Vp7NI+Qq4cHZuGT302JcthgOVq9R3r khEn78XSXzrqSWzcQhvR2gpTlwBddObIzkEH8UJIE/aJG7378rNg X-Google-Smtp-Source: AGHT+IHw8UUX2nufgi5/qMcoKiqRW1xSh8c+OByoykWyVYY8EYXgPOKWeGuCxOQqweHaT/hNRoUKMQ== X-Received: by 2002:ac2:5041:0:b0:515:8bde:56c3 with SMTP id a1-20020ac25041000000b005158bde56c3mr1150398lfm.26.1710950402873; Wed, 20 Mar 2024 09:00:02 -0700 (PDT) Received: from [1.0.0.7] ([91.185.78.94]) by smtp.gmail.com with ESMTPSA id q13-20020ac246ed000000b0051355ec71absm2294309lfo.220.2024.03.20.09.00.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 20 Mar 2024 09:00:02 -0700 (PDT) Message-ID: Date: Wed, 20 Mar 2024 19:00:00 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [BUG] false positive in bt_index_check in case of short 4B varlena datum Content-Language: en-US To: Alexander Korotkov Cc: "Andrey M. Borodin" , Michael Zhilin , pgsql-bugs@postgresql.org, Yura Sokolov References: <7bdbe559-d61a-4ae4-a6e1-48abdf3024cc@postgrespro.ru> <0FDE2089-D306-4CBB-AD1F-EC4B419E3B33@yandex-team.ru> <49BBA065-4C9A-4E50-9048-B457907FF219@yandex-team.ru> <76bc0dc9-4e43-4cd8-8eec-249b254ed1c9@postgrespro.ru> <8C83FCCA-2548-499A-8B1C-96C3D8ADB787@yandex-team.ru> <0b535249-a00c-a38a-85f6-d5a38c62dd55@gmail.com> From: Alexander Lakhin In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi Alexander, 20.03.2024 13:24, Alexander Korotkov wrote: > BTW, 0001 and 0002 look good to me. I'm going to push them if no objections. Maybe these patches should be polished before committing: +-- directory paths are passed to us in environment variables looks like an irrelevant change (perhaps it was relevant in v1/v2, but that's not so now.) I'm also not sure about: +-- BUG: must support different header size of short varlena datum +-- https://postgr.es/m/7bdbe559-d61a-4ae4-a6e1-48abdf3024cc@postgrespro.ru AFAICS, for most similar bug fixes, the bug report referenced in a commit message only (there is no such comment in 0002, either). I also suspect that the comment: * Also tuple had short varlena datums with 4B header. ... might looks incorrect for native English speakers. This patch also adds a couple of empty lines, which may be not needed. @@ -2973,6 +2973,7 @@ bt_normalize_tuple(BtreeCheckState *state, IndexTuple itup)          * index without further processing, so an external varlena header          * should never be encountered here          */ > +         if (VARATT_IS_EXTERNAL(DatumGetPointer(normalized[i])))             ereport(ERROR,                     (errcode(ERRCODE_INDEX_CORRUPTED), ---         } +       /* ... +           need_free[i] = true; +       } > +     } Best regards, Alexander