Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZH6EZ-0004f3-QY for pgsql-hackers@arkaria.postgresql.org; Mon, 20 Jul 2015 08:15:35 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZH6EZ-0003IR-4u for pgsql-hackers@arkaria.postgresql.org; Mon, 20 Jul 2015 08:15:35 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZH6DF-0000Hi-3X for pgsql-hackers@postgresql.org; Mon, 20 Jul 2015 08:14:13 +0000 Received: from mail-wi0-x22a.google.com ([2a00:1450:400c:c05::22a]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1ZH6DB-0008WR-43 for pgsql-hackers@postgresql.org; Mon, 20 Jul 2015 08:14:12 +0000 Received: by wibud3 with SMTP id ud3so89495399wib.0 for ; Mon, 20 Jul 2015 01:14:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:reply-to:user-agent:mime-version:to :subject:content-type:content-transfer-encoding; bh=4h5NsnVfNx/SKbxwNslYBrnOFmN+LV5j82PyAufagTg=; b=goDsENH6vLkXN3uxrCRYweNyKQFxIHo5xPoc0bioCj6dTj8F+s/zXF86EF7jOyDtwR p5OYTaaS7Gf5qsbIpvpWsYmc3dGILNkMroL66y6bCq5w1uKXfteL0K62MwWBIVqmPiTj aPSJcQexllDbWApzMAzUfgNl9gIPXxleVYpJ4KgYUjwtzFWFATmok5LP/h2s65EdVtYm aP7+gGmj37gf7l0GqnukKoxfrH2WfDQ3NYYm9oRfXEJ4+1e9R8rZZtHOYR5JW4TBptlw xUPW2hs9zdBqtddzqZn0LcHKdB4Nn0ZuDNQPsjbujzGZ01bfzOlcc0CePhWO9jSstm2H WJyA== X-Received: by 10.180.77.115 with SMTP id r19mr19926129wiw.9.1437380048252; Mon, 20 Jul 2015 01:14:08 -0700 (PDT) Received: from [192.168.1.105] (dsl-hkibrasgw1-58c38f-82.dhcp.inet.fi. [88.195.143.82]) by smtp.gmail.com with ESMTPSA id fz16sm10596436wic.3.2015.07.20.01.14.07 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Jul 2015 01:14:07 -0700 (PDT) Message-ID: <55ACADCD.6020206@iki.fi> Date: Mon, 20 Jul 2015 11:14:05 +0300 From: Heikki Linnakangas Reply-To: hlinnaka@iki.fi User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.7.0 MIME-Version: 1.0 To: pgsql-hackers Subject: All-zero page in GIN index causes assertion failure Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.4 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org This is a continuation of the discussion at http://www.postgresql.org/message-id/CAMkU=1zUc=h0oCZntaJaqqW7gxxVxCWsYq8DD2t7oHgsgVEsgA@mail.gmail.com, I'm starting a new thread as this is a separate issue than the original LWLock bug. > On Thu, Jul 16, 2015 at 12:03 AM, Jeff Janes wrote: > >> On Wed, Jul 15, 2015 at 8:44 AM, Heikki Linnakangas >> wrote: >> >> I don't see how this is related to the LWLock issue, but I didn't see it >> without your patch. Perhaps the system just didn't survive long enough to >> uncover it without the patch (although it shows up pretty quickly). It >> could just be an overzealous Assert, since the casserts off didn't show >> problems. > >> bt and bt full are shown below. >> >> Cheers, >> >> Jeff >> >> #0 0x0000003dcb632625 in raise () from /lib64/libc.so.6 >> #1 0x0000003dcb633e05 in abort () from /lib64/libc.so.6 >> #2 0x0000000000930b7a in ExceptionalCondition ( >> conditionName=0x9a1440 "!(((PageHeader) (page))->pd_special >= >> (__builtin_offsetof (PageHeaderData, pd_linp)))", errorType=0x9a12bc >> "FailedAssertion", >> fileName=0x9a12b0 "ginvacuum.c", lineNumber=713) at assert.c:54 >> #3 0x00000000004947cf in ginvacuumcleanup (fcinfo=0x7fffee073a90) at >> ginvacuum.c:713 >> > > It now looks like this *is* unrelated to the LWLock issue. The assert that > it is tripping over was added just recently (302ac7f27197855afa8c) and so I > had not been testing under its presence until now. It looks like it is > finding all-zero pages (index extended but then a crash before initializing > the page?) and it doesn't like them. > > (gdb) f 3 > (gdb) p *(char[8192]*)(page) > $11 = '\000' > > Presumably before this assert, such pages would just be permanently > orphaned. Yeah, so it seems. It's normal to have all-zero pages in the index, if you crash immediately after the relation has been extended, but before the new page has been WAL-logged. What is your test case like; did you do crash-testing? ISTM ginvacuumcleanup should check for PageIsNew, and put the page to the FSM. That's what btvacuumpage() gistvacuumcleanup() do. spgvacuumpage() seems to also check for PageIsNew(), but it seems broken in a different way: it initializes the page and marks the page as dirty, but it is not WAL-logged. That is a problem at least if checksums are enabled: if you crash you might have a torn page on disk, with invalid checksum. - Heikki -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers