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.96) (envelope-from ) id 1wcskV-003j6J-22 for pgpool-hackers@arkaria.postgresql.org; Thu, 25 Jun 2026 22:40:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wcskU-007nAZ-11 for pgpool-hackers@arkaria.postgresql.org; Thu, 25 Jun 2026 22:40:42 +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.96) (envelope-from ) id 1wcskT-007nAS-3A for pgpool-hackers@lists.postgresql.org; Thu, 25 Jun 2026 22:40:42 +0000 Received: from meldrar.postgresql.org ([2a02:c0:301:0:ffff::31]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wcskR-00000000GpI-35jq for pgpool-hackers@lists.postgresql.org; Thu, 25 Jun 2026 22:40:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=postgresql.org; s=20171124; h=Content-Transfer-Encoding:Content-Type: Mime-Version:References:In-Reply-To:From:Subject:Cc:To:Message-Id:Date:Sender :Reply-To:Content-ID:Content-Description; bh=OehWEbStDizg3iX31Sf/AdPPSMrCLVN3VYHsfRa9vsc=; b=qAQOUcYWsdyzbtSOqNz6JW7lWO 5pFIYAnumZo/g5LTZsK3wDBjvzTlCQVRlpBreqUq7Bn/1CF4+zr2Lot8YsS3Kxj4h0zoM/lbba4av yAtCqIJ+qbupht35sdF0x2ZWxqSZh6zwsaX+Ka0O46rxDPwvsmWyXKLBJPvkis31cPDrTxN62SXhT 7/JzX2T2lWxajkjUuLKC1Nxc+y5HHwv/tkqmGPgbdAgwqumo2fUKqG8PywF9QqKqE93WG8RyDceJo Pw2ftiMnx2xZKdUWCsMHz1pGgkH2BVd/1tf+10+JZSZv36ugNG1PTqaIyaZZ6vgQbFVHCh2+uAcTx kSzF8yIw==; Received: from [2409:11:4120:300:bfbe:5c81:899f:2cae] (helo=localhost) by meldrar.postgresql.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1wcskP-006Drj-0q; Thu, 25 Jun 2026 22:40:39 +0000 Date: Fri, 26 Jun 2026 07:40:28 +0900 (JST) Message-Id: <20260626.074028.806271918741516663.ishii@postgresql.org> To: nadav@tailorbrands.com Cc: pgpool-hackers@lists.postgresql.org Subject: Re: Proposal: Recent mutated table tracking in memory From: Tatsuo Ishii In-Reply-To: References: <20260619.111037.159094338431818955.ishii@postgresql.org> X-Mailer: Mew version 6.8 on Emacs 29.3 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Host-Lookup-Failed: Reverse DNS lookup failed for 2409:11:4120:300:bfbe:5c81:899f:2cae (failed) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi Nadav, > Hi Tatsuo, > > Good catch -- that was a bug, and chasing it down turned up a second > one in the same area. > > The original problem you described: the flush ran in dml_adaptive() > while pgpool was *routing* the COMMIT, before the COMMIT was sent to > the backend. So a COMMIT that later failed (your deferred-constraint > example) had already marked the tables, even though the writes rolled > back. > > My first instinct was to just move the flush to handle_query_context(), > where reaching CommandComplete for the COMMIT means it succeeded. But > that path resolves table/database OIDs via pool_table_name_to_oid() / > the relcache, which on a cache miss issues a do_query() -- and at that > point the COMMIT response is still being read from the backend, so > injecting a query desyncs the protocol and hangs the session. Testing > caught this immediately. > > It turned out the existing autocommit marking branch had the very same > hazard: pool_extract_table_oids() in handle_query_context() also does a > relcache do_query() on a miss, so e.g. "DROP TABLE IF EXISTS " > (an uncacheable name -> guaranteed miss) reliably hung the session too. Are you saying that the non patched pgpool has a problem? I tried following queries with master branch and found no hang. BEGIN; DROP TABLE IF EXISTS non_existent_table; COMMIT; Regards, -- Tatsuo Ishii SRA OSS K.K. English: http://www.sraoss.co.jp/index_en/ Japanese:http://www.sraoss.co.jp