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 1s2z4n-0085yR-CD for pgsql-bugs@arkaria.postgresql.org; Fri, 03 May 2024 20:00:13 +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 1s2z4k-00Bf6l-30 for pgsql-bugs@arkaria.postgresql.org; Fri, 03 May 2024 20:00:10 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s2z4j-00Bf6d-RL for pgsql-bugs@lists.postgresql.org; Fri, 03 May 2024 20:00:10 +0000 Received: from mail-lf1-x131.google.com ([2a00:1450:4864:20::131]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1s2z4d-001OOd-I5 for pgsql-bugs@lists.postgresql.org; Fri, 03 May 2024 20:00:10 +0000 Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-51f0f6b613dso38482e87.1 for ; Fri, 03 May 2024 13:00:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714766403; x=1715371203; darn=lists.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=0skrUYhsOFqGCOxHTlnqZSAcFPPlOqNqz185QoE6dwo=; b=f7n/tmT6KA0JmcDpnKnWAQb7JfiUGAXyiKu3jw/L0tDtn6EMkxdhvAhRH3yPJFqKXM OCUm9hJ1UwkEAW7Zg3fH7dmxjgjr0l+/2/VEB/uIRBuWdTq7PHlcpMIEfUIhGoXvRI2W lTHeZpXuyljD91jU9OYURJRjLV+6KAkqple6ulRiuq4Lc2spoeaK72cJwHcUh2pjCpg7 PNc79inarT33AxEeWU2OuiFzodHr141udrzB5IyAJmSVbaxDjRoaD1tbmLPZNJ9za4sh Be1zd1yQK3a0AIlB44t6AtOQDKIO6KH2/CkpUkHkgveOGfct73BXv8YV+lBtjyrq14SZ +dYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714766403; x=1715371203; 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=0skrUYhsOFqGCOxHTlnqZSAcFPPlOqNqz185QoE6dwo=; b=UDHhdG80T1Siac91RI+OFz8uDtpbpildF+im6iFSWCBFxq0sWzH8mLoVlqKEOEartL K3Qw7M78LWhgl/9hKBf4C6JuhxM9YXzYPb9OoHSeNruH1wlhfzTin0sdPFRNjTDmOIBS Iiy4nSf6MePnegvtoTAghlTKG0jqVPtfx7rcim84hXCJvlKQDBgkFc7QUsfJPfvoXWWC RMM5HDk7c+Qr5esYbWDwiYRnfgR5oAnyxkEXn6WU4e0oN7n234QFpRjWDh+XU2TrFpi0 fxqrWBeyG3DlE7w7ej5yUfULMtpmJlIrds7Tnj1PmwKqqU1N9SLWoSNC6Qc3fSCWmWDN fGJw== X-Gm-Message-State: AOJu0YxmJxxDzNdKzHovkm7K8/ZjJnyu9Ni78odVW+3+Bsn1R2FzFnhw n3zVubomuKvHSVQ0H/MTUT7MFp9N9EeyBBtGHUkmp1qDu4EU3bn8 X-Google-Smtp-Source: AGHT+IHTAOhVwY2CESAgfdFiLrw8GTRBeWiqMr9ttYYbXDRk+/6fOn51B7I5R0b3pzA6B8OzNoW4Fw== X-Received: by 2002:a05:6512:40b:b0:51d:1239:21ee with SMTP id u11-20020a056512040b00b0051d123921eemr2548465lfk.29.1714766402492; Fri, 03 May 2024 13:00:02 -0700 (PDT) Received: from [1.0.0.7] ([178.155.23.194]) by smtp.gmail.com with ESMTPSA id b1-20020ac25e81000000b0051b90a23899sm633946lfq.136.2024.05.03.13.00.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 03 May 2024 13:00:01 -0700 (PDT) Message-ID: <77607a48-eb82-f241-a142-21697b6faf4c@gmail.com> Date: Fri, 3 May 2024 23: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: error "can only drop stats once" brings down database Content-Language: en-US To: Floris Van Nee , Tom Lane Cc: "pgsql-bugs@lists.postgresql.org" , Andres Freund References: <215498.1708454947@sss.pgh.pa.us> <8e5cb534706a4f43bd74405c8fd91437@Optiver.com> From: Alexander Lakhin In-Reply-To: <8e5cb534706a4f43bd74405c8fd91437@Optiver.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hello Floris, 03.05.2024 21:10, Floris Van Nee wrote: >> Floris Van Nee writes: >>> Hi, >>> On a database we have we've recently seen a fatal error occur twice. The >> error happened on two different physical replicas (of the same cluster) >> during a WAL redo action in the recovery process. They're running Postgres >> 15.5. >> >>> Occurrence 1: >>> 2024-02-01 06:55:54.476 CET,,,70290,,65a29b60.11292,6,,2024-01-13 15:17:04 >> CET,1/0,0,FATAL,XX000,"can only drop stats once",,,,,"WAL redo at >> A7BD1/D6F9B6C0 for Transaction/COMMIT: 2024-02-01 06:55:54.395851+01; >> ... >> >> Hmm. This must be coming from pgstat_drop_entry_internal. >> I suspect the correct fix is in pgstat_drop_entry, along the lines of >> >> - if (shent) >> + if (shent && !shent->dropped) >> >> but it's not clear to me how the already-dropped case ought to affect the >> function's bool result. Also, how are we getting into a concurrent-drop >> situation in recovery? > Anyone has further thoughts on this? This still happens occasionally. > Please take a look at bug #17947 (maybe you encounter the same?): https://www.postgresql.org/message-id/17947-b9554521ad963c9c%40postgresql.org Best regards, Alexander