Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 813AB632E4F for ; Sat, 21 Feb 2009 22:43:16 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 56580-06 for ; Sat, 21 Feb 2009 22:43:12 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from yx-out-2324.google.com (yx-out-2324.google.com [74.125.44.30]) by mail.postgresql.org (Postfix) with ESMTP id 3F13D63268A for ; Sat, 21 Feb 2009 22:43:13 -0400 (AST) Received: by yx-out-2324.google.com with SMTP id 3so589704yxj.73 for ; Sat, 21 Feb 2009 18:43:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=xU9yYLQ7CYaePCZHt0FuyzrPpzNvM05wcnqVsBNhPhg=; b=ERHiIu1R4hX40iUYuNQvJqgXgRYPinS4eBp+Oy2ZceqWRf2GYNcAmESkWWvnk8L6j8 mwjGYnNSmeFkF6DPsTJqNPk9DFDspQ7tla+KTGTY/5lDNaf5Z1vyxoQpTx+ipubvNIIC JFm7+7aBsF/i+ilVwyoolgEWeo4XiqBWPs3Mc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=Ehjxl0n0OnIM64BFY40cv4RQWeM70/pOwf6Ncg3Bhqh0luNDE5QpMmy/H9ooFNIbGJ 6eJHDCAJEVtSTcBkHapcD2B8YHAAjfsU0fuo54/ILlKvzXSB541AJpXfd8SCfc4lh2BJ TKY4P/864wAv6AYrKFrEwRoNUE2KOzY8f8cBI= MIME-Version: 1.0 Received: by 10.151.39.2 with SMTP id r2mr3219372ybj.10.1235270591592; Sat, 21 Feb 2009 18:43:11 -0800 (PST) In-Reply-To: <49A08309.1060809@cheapcomplexdevices.com> References: <43a3a0bccd3684972f33e0051b45f2b4@webmail.zmi.at> <200902210943.27875@zmi.at> <49A0110D.8020302@eldocomp.com> <49A08309.1060809@cheapcomplexdevices.com> Date: Sat, 21 Feb 2009 19:43:11 -0700 Message-ID: Subject: Re: 8.3.5 broken after power fail SOLVED From: Scott Marlowe To: Ron Mayer Cc: Naomi Walker , Michael Monnerie , pgsql-admin@postgresql.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200902/178 X-Sequence-Number: 31399 On Sat, Feb 21, 2009 at 3:41 PM, Ron Mayer wrote: > Naomi Walker wrote: >> Other than disaster tests, how would I know if I have an system that >> lies about fsync? > > Well, the linux kernel tries to detect it on bootup and > will give messages like this: > %dmesg | grep 'disabling barriers' > JBD: barrier-based sync failed on md1 - disabling barriers > JBD: barrier-based sync failed on hda3 - disabling barriers > when it detects certain types of unreliable fsync's. The command > %hdparm -I /dev/hdf | grep FLUSH_CACHE_EXT > will give you clues if a hard drive itself even can support > a non-lying fsync when it's internal cache is enabled. > > > Sadly some filesystems (ext3) lie even above and beyond what > Linux does - by only using the write barriers correctly > when the inode itself is modified; not when the data is modified. > A test program here: > http://archives.postgresql.org/pgsql-performance/2008-08/msg00159.php > can detect those cases where the kernel & drive don't lie > about fsync but ext3 lies in spite of them; with more background > info here: > http://article.gmane.org/gmane.linux.file-systems/21373 > http://thread.gmane.org/gmane.linux.kernel/646040 > > > Elsewhere in the archives you can find programs that measure > how fast fsyncs happen - but on your hardware, and you can > try to see if those numbers approximately match how fast your > disks spin. But then you still need to make sure the test > program used the same methods for syncing the drive that your > postgres configuration files are choosing. > > I wonder if the only really safe way is to run a very > write intensive database script and pull and kill your > system in a number of ways, including yanking power to > the system; to disk arrays, etc and see if your database died. Well, you can't prove it's 100% safe but you can usually find most of the not safe systems this way. I usually setup a big pgbench db, run 500 or so concurrent, wait 5 or 10 minutes, run a checkpoint, and halfway through it pull the plug. It's still possible for a system to fail after passing this test, but I feel a lot better knowing I've done it a couple of times and the db came back up without problems.