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 1s2xMT-007lr7-RP for pgsql-bugs@arkaria.postgresql.org; Fri, 03 May 2024 18:10:21 +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 1s2xMP-00B3lv-0l for pgsql-bugs@arkaria.postgresql.org; Fri, 03 May 2024 18:10:17 +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 1s2xMO-00B3ln-NH for pgsql-bugs@lists.postgresql.org; Fri, 03 May 2024 18:10:17 +0000 Received: from mx0a-00134001.pphosted.com ([205.220.160.129]) by magus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s2xMK-001Nic-TI for pgsql-bugs@lists.postgresql.org; Fri, 03 May 2024 18:10:16 +0000 Received: from pps.filterd (m0267960.ppops.net [127.0.0.1]) by mx0a-00134001.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 443A70eF022337; Fri, 3 May 2024 18:10:07 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=optiver.com; h= from:to:cc:date:message-id:references:in-reply-to:content-type :content-transfer-encoding:mime-version:subject; s=mail; bh=eVOi 2ZlvTdePt1mOBTT+mlzb3IFvNV+wQvxL4WOSQJ4=; b=qVwMNqFYQBh7iAPxsXpz 4LN5KBMi2qCdMvwuQYhLCqz62Rez6j6/emL3bBSaVu56z0ZfMLQqGmkGCxjE+ZWC bi//4D7EGWHXMi3VImtTtbO9LIIjP67Tqw0kxYcqF8KvFh2Erz1AYOMkXS1bcHRz O+6hoyaWcVN/S5S4FSwXLq6/ggLCSkksNF/OOG/tNMHMsjOr5Flj085ahKJ9VjFY 162fxBzzhBAz8kFeMtumproLDAXI0pkoFyK5VGkbKqoyTNt13CMPipt4xq1KhZzy qzXDEobOGNVwGaxBaIf/nid2+pKGLm19wtkTMWvUbhnh1t/m+zpS9YklvkFwz/sJ qA== Received: from opammb1270.comp.optiver.com ([195.246.114.78]) by mx0a-00134001.pphosted.com (PPS) with ESMTPS id 3xt7v7f8aq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 03 May 2024 18:10:07 +0000 (GMT) Received: from opammb1267.comp.optiver.com (100.68.11.12) by opammb1270.comp.optiver.com (100.68.11.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Fri, 3 May 2024 20:10:05 +0200 Received: from opammb1267.comp.optiver.com ([fe80::5b6f:1976:98cd:68a7]) by opammb1267.comp.optiver.com ([fe80::5b6f:1976:98cd:68a7%13]) with mapi id 15.02.1118.026; Fri, 3 May 2024 20:10:05 +0200 From: Floris Van Nee To: Tom Lane CC: "pgsql-bugs@lists.postgresql.org" , Andres Freund Thread-Topic: [External] Re: error "can only drop stats once" brings down database [External] Thread-Index: AQHaZC2BJX3cZ68Gf0SnR3ukCGL5orGGQZEw Date: Fri, 3 May 2024 18:10:05 +0000 Message-ID: <8e5cb534706a4f43bd74405c8fd91437@Optiver.com> References: <215498.1708454947@sss.pgh.pa.us> In-Reply-To: <215498.1708454947@sss.pgh.pa.us> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [100.68.31.121] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: RE: error "can only drop stats once" brings down database X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1011,Hydra:6.0.650,FMLib:17.11.176.26 definitions=2024-05-03_12,2024-05-03_02,2023-05-22_02 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk =20 > Floris Van Nee writes: > > Hi, > > On a database we have we've recently seen a fatal error occur twice. Th= e > error happened on two different physical replicas (of the same cluster) > during a WAL redo action in the recovery process. They're running Postgre= s > 15.5. >=20 > > 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; > ... >=20 > Hmm. This must be coming from pgstat_drop_entry_internal. > I suspect the correct fix is in pgstat_drop_entry, along the lines of >=20 > - if (shent) > + if (shent && !shent->dropped) >=20 > 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. -Floris