Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 81B78B5DBC8 for ; Sat, 18 Jun 2011 02:58:28 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 07528-03 for ; Sat, 18 Jun 2011 05:58:21 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.17.8]) by mail.postgresql.org (Postfix) with ESMTP id 742A9B5DBC2 for ; Sat, 18 Jun 2011 02:58:21 -0300 (ADT) Received: from [192.168.1.7] (mail.highperformancepostgresql.com [71.179.240.8]) by mrelayeu.kundenserver.de (node=mrbap2) with ESMTP (Nemesis) id 0MYtjH-1Q3rBf1yR1-00VGt2; Sat, 18 Jun 2011 07:58:20 +0200 Message-ID: <4DFC3E7B.9060300@2ndQuadrant.com> Date: Sat, 18 Jun 2011 01:58:19 -0400 From: Greg Smith User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.16) Gecko/20110505 Icedove/3.0.11 MIME-Version: 1.0 To: pgsql-bugs@postgresql.org Subject: Re: could not read block XXXXX in file "base/YYYYY/ZZZZZZ": read only 160 of 8192 bytes References: <1208551308255001@web137.yandex.ru> <4DFA2130020000250003E76A@gw.wicourts.gov> <438511308318660@web144.yandex.ru> <4DFB32F4020000250003E7E2@gw.wicourts.gov> <1202541308329125@web105.yandex.ru> <56961308340142@web152.yandex.ru> <1245841308343644@web94.yandex.ru> In-Reply-To: <1245841308343644@web94.yandex.ru> Content-Type: text/plain; charset=KOI8-R; format=flowed Content-Transfer-Encoding: 8bit X-Provags-ID: V02:K0:0vku6a/yY8AdgS0lkDJNVepZXUj96GBazpo/wVdEJWB WQvAhoc65E26/TxRsiB8JKnvbd0mYE3x7MrjisBZ/UkclpAf3k zQa4CqV99Y5ETyJUygrSnWH8rpVasqcR+VK9ZFoppaK3B/9Yf7 ze9XvReYyFvGRtfkQusFvn6/vIiGYvTvADa72VcgbjYS+hZSiQ w6/Cx2zpKaYw57EXpz2qTANrO8iSQcVYQTTahDn72E= X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201106/161 X-Sequence-Number: 30540 bOn 06/17/2011 04:47 PM, Антон Степаненко wrote: > Memory for shared buffers can not be ovesubscribed - because if kernel > did not provide enough shared memory postgres will not start. The block is allocated at once. But the amount of it that various client backends end up touching varies as they run, slowly increasing over time as they access more buffers. After running for a while, the individual processes will look like this: PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 2645 gsmith 20 0 12.3g 5.1g 5.1g D 45 32.8 16:59.19 postgres: gsmith pgbench [local] SELECT Where their virtual memory size becomes slightly larger than shared_buffers. I tested this out on a Debian system here, set shared_buffers to 12GB and beat on the server until every one of them was used by clients (which is proven by how they've mapped the whole memory set in the above). It worked fine. I suspect you're running into some sort of OpenVZ shared memory handling bug. The way it handles this is one of the more complicated, and therefore likely to have odd failure cases, part of the design. There's notes at http://wiki.openvz.org/Postgresql_and_shared_memory about container-specific things to tune here, so maybe there's just a setting to tweak you've missed so far. I'm guessing you already went through that though. A quick look around shows there are far more regularly reported bugs like this in OpenVZ than there are in PostgreSQL, and Ubuntu is not known for bug-free release practices either. You're probably chasing after the wrong thing trying to find a database problem here. Likely to end up in the same situation as the last one of these I remember: http://archives.postgresql.org/pgsql-general/2009-10/msg00125.php http://lists.debian.org/debian-kernel/2010/03/msg00401.html ...waiting for the OpenVZ problem that's the real cause to get fixed and make its way to your distribution. In your situation, I'd just use the smaller setting to avoid the known problem, and try to focus my energy on finding a platform that isn't as risky to deploy on instead. Even if that's not your main deployment one, just having something on real hardware to compare against would be extremely valuable for isolating the problem here. (And that's without even considering that setting shared_buffers so high on Linux is more likely to slow the server than speed it up, which you said you didn't want to discuss. Just pointing it out so no one else gets the wrong idea from your configuration.) -- Greg Smith 2ndQuadrant US greg@2ndQuadrant.com Baltimore, MD PostgreSQL Training, Services, and 24x7 Support www.2ndQuadrant.us "PostgreSQL 9.0 High Performance": http://www.2ndQuadrant.com/books