Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TTnd5-0002Em-KC for pgsql-admin@postgresql.org; Thu, 01 Nov 2012 05:47:47 +0000 Received: from mail-pa0-f46.google.com ([209.85.220.46]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TTncz-0003OH-D8 for pgsql-admin@postgresql.org; Thu, 01 Nov 2012 05:47:47 +0000 Received: by mail-pa0-f46.google.com with SMTP id hz1so1488956pad.19 for ; Wed, 31 Oct 2012 22:47:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:x-enigmail-version:content-type :content-transfer-encoding:x-gm-message-state; bh=VJXs007Vg4B/aR42Ve1C4EYubvHjrRdGnw8aklHcBd0=; b=MBheEXErV4/KhL37tPpBKk3lgMnZ6lFby5PRCG5IWqESMQseRQdiajXW5Lwlmxx1+M /EkJdRmiOJ53dWovU9ExeXXoEppIO5qnoqlp9YbtsWuCB0LrfMFoDO/zXIIBD4Bcc2bk F/kRII1TIy0AkCvr2qjNpHZVbZchJ/hZStVcB5xCjLRb6HpVLV8pzaKrw9FCX1RolCVb 742W2GFikaF7dT0AOuqAkVM06kPup3/YA0nfkIcOdFMqXMJywDlJpY5eOcQd7XWFu9bN T2mmFnoMON2GZF25PU8a7F99BAQ924ZJKISIE8fjXmwWdIEokJ5VVKTYcGkSGhRY3Cm7 jiOw== Received: by 10.68.224.9 with SMTP id qy9mr8200711pbc.3.1351748859114; Wed, 31 Oct 2012 22:47:39 -0700 (PDT) Received: from ayaki.localdomain (office1.postnewspapers.com.au. [150.101.171.128]) by mx.google.com with ESMTPS id se4sm3487141pbb.13.2012.10.31.22.47.35 (version=SSLv3 cipher=OTHER); Wed, 31 Oct 2012 22:47:38 -0700 (PDT) Message-ID: <50920CF5.7010506@ringerc.id.au> Date: Thu, 01 Nov 2012 13:47:33 +0800 From: Craig Ringer User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121016 Thunderbird/16.0.1 MIME-Version: 1.0 To: Scott Ribe CC: Raj Gandhi , pgsql-admin@postgresql.org Subject: Re: Detecting DB corruption References: <5091E377.2030505@ringerc.id.au> In-Reply-To: X-Enigmail-Version: 1.4.5 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQmOVqN4ejOuFlyHu7t7YOV25CiH7rTCf7HLcyvXaS4crf3rlpy4hB+XPtIVQV5Fy/LScGsZ X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201211/4 X-Sequence-Number: 40249 On 11/01/2012 01:10 PM, Scott Ribe wrote: > On Oct 31, 2012, at 8:50 PM, Craig Ringer wrote: > >> Seriously, if you're facing DB corruption then something is already >> horribly wrong with your setup. > True, but. In a past life, complaints from the db (it was a db that stored a checksum with every block) were the very first symptom when something went horribly wrong with the hardware. (Partial short between wires of an internal SCSI cable; eventually we determined that about every 1MB, 1 bit would get flipped between the controller & disk.) > > So, if there were an official db verifier tool for PG, I for one would have it run periodically. If there were a way to reliably detect corruption, so would I. As things stand there are no block checksums, so if a bit gets flipped in some random `text` field you're never going to know, corruption-checker or no. Some forms of random corruption - like bad blocks on disks causing I/O errors, zeroed blocks, truncated files, etc - will become apparent with general checking, but others won't be detectable unless you know what the expected vs actual data is. If page checksumming or any other reliable method of detecting possible incipient corruption were available I'd quite likely want to use it for much the same reason you outlined. For that matter, if there were a general "sanity check my tables and indexes" tool I'd probably use that too. However, no such tool exists - and in a good setup, none should be needed. I'd want to use one anyway purely out of paranoia. -- Craig Ringer