Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id AD4F668DFC for ; Wed, 16 May 2012 08:37:07 -0300 (ADT) Received: from mail12.ics.ntts.co.jp ([210.232.35.65]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SUcXS-0003qt-2Y for pgsql-bugs@postgresql.org; Wed, 16 May 2012 11:37:07 +0000 Received: from sadoku34.silk.ntts.co.jp (sadoku34 [10.7.18.34]) by mail12.ics.ntts.co.jp (8.14.4/8.13.4/NTTSOFT) with ESMTP id q4GBan4E028493; Wed, 16 May 2012 20:36:49 +0900 (JST) Received: (from root@localhost) by sadoku34.silk.ntts.co.jp (8.13.8/NTTSOFT) id q4GBannE016855; Wed, 16 May 2012 20:36:49 +0900 (JST) Received: from ccmds32.silk.ntts.co.jp [10.107.0.32] by sadoku34.silk.ntts.co.jp with SMTP id WAA16854; Wed, 16 May 2012 20:36:48 +0900 Received: from mail147.silk.ntts.co.jp (ccmds32.silk.ntts.co.jp [127.0.0.1]) by ccmds32.silk.ntts.co.jp (8.14.3/8.14.3) with ESMTP id q4GBamei000308; Wed, 16 May 2012 20:36:48 +0900 Received: from mail147.silk.ntts.co.jp (localhost.localdomain [127.0.0.1]) by mail147.silk.ntts.co.jp (8.14.5/8.14.5/NTTSOFT) with ESMTP id q4GBaifH002457; Wed, 16 May 2012 20:36:44 +0900 Received: from ccmds32 (mail145.silk.ntts.co.jp [10.107.0.145]) by mail147.silk.ntts.co.jp (8.14.5/8.14.5/NTTSOFT) with SMTP id q4GBaivA002454; Wed, 16 May 2012 20:36:44 +0900 Message-ID: <4FB39110.6070504@po.ntts.co.jp> Date: Wed, 16 May 2012 20:35:44 +0900 From: Tomonari Katsumata User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 MIME-Version: 1.0 To: Heikki Linnakangas CC: pgsql-bugs@postgresql.org Subject: Re: BUG #6643: [PostgreSQL9.2beta1] COPY after changing fillfactor gets a PANIC. References: <4FB385C9.8050001@enterprisedb.com> <4FB38C29.8070009@enterprisedb.com> In-Reply-To: <4FB38C29.8070009@enterprisedb.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-CC-Mail-RelayStamp: CC-Mail-V4.3-Client X-CC-Mail-RelayStamp: CC-Mail-V4.3-Server X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201205/92 X-Sequence-Number: 33063 Hi, Heikki I'm sorry, forgotten attach files. I've tryed to send mail with files, but I could not... (I think this is my mail server problem.) Thank you very much for fixing it! (2012/05/16 20:14), Heikki Linnakangas wrote: > On 16.05.2012 13:47, Heikki Linnakangas wrote: >> This sounds like a bug in the new page-at-a-time behavior in COPY. Can >> you send me a self-contained test, including the test data? > > Never mind. After staring at the code for a while, I spotted the bug, > and was able to reproduce with a simpler case. It's quite easy to > reproduce when you set fillfactor even lower, like 10. > > The problem is with this line in heap_multi_insert function: > > if (PageGetHeapFreeSpace(page) - saveFreeSpace < > MAXALIGN(heaptup->t_len)) > > That doesn't work as intended, because the return value of > PageGetHeapFreeSpace and saveFreeSpace are unsigned. When > saveFreeSpace is larger than the amount of free space on the page, the > left hand side of that comparison is supposed to go negative, but it > wraps around to a highly positive number because it's unsigned. > > Fixed, thanks for the report!