Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 2B0EC18E38D9 for ; Thu, 12 Jan 2012 13:24:45 -0400 (AST) Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RlOOK-0006Uu-Nd for pgsql-bugs@postgresql.org; Thu, 12 Jan 2012 17:24:45 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id q0CHOSo9023800; Thu, 12 Jan 2012 12:24:28 -0500 (EST) To: Maxim Boguk cc: Alvaro Herrera , Pg Bugs Subject: Re: BUG #6393: cluster sometime fail under heavy concurrent write load In-reply-to: References: <1326295419-sup-3436@alvh.no-ip.org> Comments: In-reply-to Maxim Boguk message dated "Thu, 12 Jan 2012 15:04:37 +1100" Date: Thu, 12 Jan 2012 12:24:28 -0500 Message-ID: <23799.1326389068@sss.pgh.pa.us> From: Tom Lane X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201201/104 X-Sequence-Number: 32171 Maxim Boguk writes: > PS: no such effects happens on 9.0.4 > I think it can be related to TOAST related changes in 9.0.6 Yes, this is a consequence of commit 44b6d53b467bfe848c34c7a8a174779bb2f43c39, which tried to preserve toast OIDs when doing a table rewrite. The problem is that CLUSTER needs to copy both the old and new versions of an updated row, since the old one is only "recently dead", and both of those versions are pointing at the same TOAST item because the update didn't affect the toasted column. So when we save those versions into the new table separately, we try to write the same TOAST item twice. We could fix this by having toast_save_datum, in the place where it decides to adopt an old toast OID for the value (line 1345 in HEAD), check to see if that OID already exists in the new table. If so, it could either just assume that the value matches, or we could add enough code to verify that there's a match. The latter seems like overkill, and yet I'm not 100% comfortable with just assuming a collision is OK. Comments? regards, tom lane