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 1nAmxz-0000Bz-Kd for pgsql-bugs@arkaria.postgresql.org; Fri, 21 Jan 2022 06:00:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nAmxy-00019Z-Hx for pgsql-bugs@arkaria.postgresql.org; Fri, 21 Jan 2022 06:00:06 +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 1nAmxy-00019Q-AH for pgsql-bugs@lists.postgresql.org; Fri, 21 Jan 2022 06:00:06 +0000 Received: from mail-lf1-x12c.google.com ([2a00:1450:4864:20::12c]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nAmxw-0007FU-7n for pgsql-bugs@lists.postgresql.org; Fri, 21 Jan 2022 06:00:05 +0000 Received: by mail-lf1-x12c.google.com with SMTP id bu18so30220231lfb.5 for ; Thu, 20 Jan 2022 22:00:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding:content-language; bh=tu9/kPDnFkgvgWp8sQbKBwGKk31iTSZoz/wcMmGmW2I=; b=Owvxz7dOArzM4aQGSzEaR5ivNSqvxV6qSoTb+6YyqVgjeK7t5IYvY8iSdwhBf5qKAL gNv654ZEQjMWW6MTNFYCGLhnga/RSoyhE9O/aB4esX43Cb8krDBkesp9f+Wqgc8iroX8 aBfccQXEbTb2zOZZUS7W1d084rjlqP6tNKBc3BmD5b5+w4sZnAubN+FClDUTgKpgRzV1 AtzzJyYhp8BxA5UCY4OOTNrQBMTflqBqrAUXKFz+flrcNOQ83HIiTcMr2OZvaXSK3WTF iKk2UBSTQNYAQWA257Chn22FWpzXCi4RdRmw0n5vuv0AMG42GApHo2amI1RW4bUZW/iD Y6ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=tu9/kPDnFkgvgWp8sQbKBwGKk31iTSZoz/wcMmGmW2I=; b=uetnzVOHoj3FPwR79ycTXnsw5Z9lDXVWmrldW+bM7cTXlxczWgS3Z6Vo+Mwz/unxE3 rhk4y1O5Pl/hqUn/DwE16E4jcNuI3Zn0HFpTy6wI11mDmbOa/DMDEApbMVl9AItZHufI SP75301ZY0vNFS1Fqk5Wi6rOZ1CWXJWfo2XVOf/YUqzHxNsQJd7rXhXqV7mKyiXjl8fn ASpWR7kBBwLHJkTqSWFCd4Pt8K8DriOuonzbYvimL833+LGC7/pdc43ZJt9Vg7qAbpWI Ini2Wxp8jon8Xyk8fK2wTSEUodTKOyMrjJv4GNcivmB4/Ck7/WfLWrUyLFigcHWqCvs3 WzGQ== X-Gm-Message-State: AOAM533Mxk7HVs6fP9GYVDqtt+p/v7g8KurF+fcxbHysxpPqey391cPT pgfJeTe+Co7ngnrfCM1BV/o6a8us64w= X-Google-Smtp-Source: ABdhPJxFDYISoq2Rb9J7o9Ua6UVB1EI+wVMFXt7Ht2P0IQTpAjRUHUUVaTVdT7V7SRDY4GtVa9VVBQ== X-Received: by 2002:ac2:46e2:: with SMTP id q2mr2685052lfo.287.1642744802507; Thu, 20 Jan 2022 22:00:02 -0800 (PST) Received: from [1.0.0.7] ([178.155.6.184]) by smtp.gmail.com with ESMTPSA id h37sm87158lfv.23.2022.01.20.22.00.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 20 Jan 2022 22:00:02 -0800 (PST) Subject: Re: BUG #17372: Altering statistics during concurrent drop can lead to a server crash To: Tomas Vondra , pgsql-bugs@lists.postgresql.org References: <17372-bf3b6e947e35ae77@postgresql.org> <2615f158-b790-4176-11ad-9711e4fd56c7@enterprisedb.com> From: Alexander Lakhin Message-ID: Date: Fri, 21 Jan 2022 09:00:00 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <2615f158-b790-4176-11ad-9711e4fd56c7@enterprisedb.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hello Tomas, 20.01.2022 20:57, Tomas Vondra wrote: > Thanks for the report - I've reproduced it using your script (I had to > add a short wait before the syscache lookup). The issue is fairly > simple, we never check we actually found a tuple in the syscache, i.e. > there's no HeapTupleIsValid() call. We check the OID earlier, but the > tuple may have disappeared since then. > > IMO the usual "cache lookup failed" error that we throw in other places > in similar cases is good enough. We already fail with other errors > (tuple concurrently updated/deleted) here. Yes, the rough, but simple search: grep -Porz '.*=\s*SearchSysCache1.*\n(?!(.*|.*\n.*|.*\n.*\n.*|.*\n.*\n.*\n.*)HeapTupleIsValid)' ./ finds only this place. Your fix works for me. Thanks! Best regards, Alexander