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 1lYWJF-0005bw-Pn for pgsql-general@arkaria.postgresql.org; Mon, 19 Apr 2021 15:59:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lYWJE-0002cv-OA for pgsql-general@arkaria.postgresql.org; Mon, 19 Apr 2021 15:59:36 +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 1lYWJD-0002co-Vj for pgsql-general@lists.postgresql.org; Mon, 19 Apr 2021 15:59:36 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lYWJB-0004ma-RL for pgsql-general@lists.postgresql.org; Mon, 19 Apr 2021 15:59:35 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 68B275C0216; Mon, 19 Apr 2021 11:59:32 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Mon, 19 Apr 2021 11:59:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; bh=JLzXKnuTdjiTDeSVGx6DZft4rpYgXJ8XlBkDDH0X8fE=; b=m0qsOyX2 sErz8T9KIeTJkKxhiuzGEZl911MumF7n9tGUptsCsvIrdX/nnEPMOwXVBJ4mdA8M PP1Q+t5NX+q6pW7nD/RZRpZuP+JLI3wY7kwikcPUd8EnPvpuBttrVannhGIrV7zM nBUyEU+a9DoXljrlEq+Edd77PR+o05ua76HYQd5OZhdnRkK0C+XXWy4D8lBDn7hI EGouKrbagcPcHGxsBVX4tYE+ks3Aaqywgr5oGzWlI9T+IeRZLsYG9tdNCsTjt1b5 EbwbV++RYKYcoryx3Iz12K/ZLQvFCcPHweqZGLk4vBsqiCQvo80qk7fFgAJ2jgdv 5G2DGHhELEuVCg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvddtgedgleeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfggtggugfgjfgesthekredttderudenucfhrhhomheptehlvhgr rhhoucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh eqnecuggftrfgrthhtvghrnhepueffhfejieeuueffgedvudekgeeltdeviedvieeufeei ieevgfetheeufeethedvnecukfhppeduledtrdelhedrudelrdelheenucevlhhushhtvg hrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhvhhgvrhhrvgesrghl vhhhrdhnohdqihhprdhorhhg X-ME-Proxy: Received: from perhan.alvh.no-ip.org (unknown [190.95.19.95]) by mail.messagingengine.com (Postfix) with ESMTPA id 0502D108005C; Mon, 19 Apr 2021 11:59:32 -0400 (EDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id F0EEE2A0C81; Mon, 19 Apr 2021 11:59:28 -0400 (-04) Date: Mon, 19 Apr 2021 11:59:28 -0400 From: Alvaro Herrera To: Reid Thompson Cc: "pgsql-general@lists.postgresql.org" Subject: Re: could not read from hash-join temporary file: SUCCESS && DB goes into recovery mode Message-ID: <20210419155928.GA3253@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2021-Apr-19, Reid Thompson wrote: > Thanks - I found that, which seems to fix the error handling right? Or > does it actually correct the cause of the segfault also? Uh, what segfault? You didn't mention one. Yes, it fixes the error handling, so when the system runs out of disk space, that's correctly reported instead of continuing. ... Ah, I see now that you mentioned that the DB goes in recovery mode in the subject line. That's exactly why I was looking at that problem last year. What I saw is that the hash-join spill-to-disk phase runs out of disk, so the disk file is corrupt; later the hash-join reads that data back in memory, but because it is incomplete, it follows a broken pointer somewhere and causes a crash. (In our customer case it was actually a bit more complicated: they had *two* sessions running the same large hash-join query, and one of them filled up disk first, then the other also did that; some time later one of them raised an ERROR freeing up disk space, which allowed the other to continue until it tried to read hash-join data back and crashed). So, yes, the fix will avoid the crash by the fact that once you run out of disk space, the hash-join will be aborted and nothing will try to read broken data. You'll probably have to rewrite your query to avoid eating 2TB of disk space. -- Álvaro Herrera Valdivia, Chile