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 1qMQi5-002O2P-09 for pgsql-hackers@arkaria.postgresql.org; Thu, 20 Jul 2023 10:16:36 +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 1qMQi2-004bnt-Tk for pgsql-hackers@arkaria.postgresql.org; Thu, 20 Jul 2023 10:16:34 +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 1qMQi2-004bmD-JD for pgsql-hackers@lists.postgresql.org; Thu, 20 Jul 2023 10:16:34 +0000 Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1qMQhz-000Tr9-94 for pgsql-hackers@lists.postgresql.org; Thu, 20 Jul 2023 10:16:32 +0000 Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-4fbc0314a7bso911804e87.2 for ; Thu, 20 Jul 2023 03:16:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=enterprisedb.com; s=google; t=1689848189; x=1690452989; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=ypahIGp50s31IjNjP4uKwTmUrQs+4IEXz2F6n63aSpM=; b=RxyRhlIIQuwEZbvoVIX7bvc0loRpEyCGNDp+aM6fWfteQSowgXhFnc642nW7ACZVsu yTNQ+f1Br0vy10CsB24Mf0LJ1JGl/9UJPeyTz6xVWVFxyCm7cS29fDrcUQwHH2u+1RTR I8jJkyP+rBR1PLLNZTUveXJ8MUA5ASOno3zAECpFvfgHHVjgpXVMsmfvkUoMo75PbhaM UxvUhynTojEoq2h4xTugPRwGpHJiXUZ6F6ZuoEDsh2CpyNdbHt1pfNNxDN2JA+7l1hsy N+yUuYxA8BmOimR8iehGvHJyYCSlq7DKDKVkbzYFrDWmpvPP4HW9XQyjMNb+UyfWEijG BRLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689848189; x=1690452989; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ypahIGp50s31IjNjP4uKwTmUrQs+4IEXz2F6n63aSpM=; b=TlHN+j5Fo6+qUm3CAv9ij9r5aHAyOLg/7Pa+fTh4lmNeFXlfLuk/vyBcnI+GAJfRwr K/Rl7D9W3GLqgS12+bRi7DGYqvQo1AQdt64bqahhC206bkTIfOaTJIF1NHpka9mj+MZY 8j9Fbjr9wW0mdz/VojcyXskOxvYXEGQHkloiPN/oTlIPXpLPBYmYk8s60pkyMkVjN2mw Oe/h0fNSbmPQzGh6iRnr+WXysK//sYRRXijJVnj37B5caIeXCZ7AM0m6JbMdU4u0tRJV w41NiDVoaW7bQV/Gezl099ANTB5QEK2c+XMFZ8vRLWx9tUXlZDeT4OgV8Da5An2S9d4g jEFw== X-Gm-Message-State: ABy/qLYRPyEm7trSghEcfKQN4tfiC8u7HxQzcct9m9K8XVH1LLW/jX+5 +UQliKOavLGGnEdWxtI/4QvQyqccPSqWzcH+IoM= X-Google-Smtp-Source: APBJJlGxiDuuhjV4zP+ClkVGXhqImuZIuYV5Uuz+QyU80SdwPJGrO5iGq+AO30C1dyg3LpI2kpazMA== X-Received: by 2002:a05:6512:3e16:b0:4f8:6b57:87f9 with SMTP id i22-20020a0565123e1600b004f86b5787f9mr1705701lfv.22.1689848189508; Thu, 20 Jul 2023 03:16:29 -0700 (PDT) Received: from [10.137.0.17] (static-84-42-175-93.bb.vodafone.cz. [84.42.175.93]) by smtp.gmail.com with ESMTPSA id t23-20020a05640203d700b0050cc4461fc5sm543558edw.92.2023.07.20.03.16.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 20 Jul 2023 03:16:29 -0700 (PDT) Message-ID: <1eac7a08-b41f-1ab7-91b6-24df2dfd9c91@enterprisedb.com> Date: Thu, 20 Jul 2023 12:16:26 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: inconsistency between the VM page visibility status and the visibility status of the page To: "yanhui.xiong" , pgsql-hackers References: Content-Language: en-US From: Tomas Vondra In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 7/20/23 08:44, yanhui.xiong wrote: > Hi, > > i had a issue here, When executing a SELECT statement using an > index-only scan, i got a wrong row number because there may be an > inconsistency between the VM page visibility status and the visibility > status of the page,the VM bit is set and page-level is clear > > > i read the code and note that there has a chance to happen like this,but > how it happens? > > the code do clear the page-level visibility and vm bit at the same time, > i don not understand how it happens > Well, by only looking at the code you're assuming two things: 1) the code is correct 2) the environment is perfect Either (or both) of these assumptions may be wrong. There certainly could be some subtle bug in the visibility map code, who knows. Or maybe this is due to some sort of data corruption outside postgres. It's impossible to answer without you digging much deeper and providing much more information. What's the environment? What hardware? What PG version? How long is it running? Any crashes? Any other cases of similar issues? What does the page look like in pageinspect? regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company