Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TBFMc-0006KO-Gn for pgsql-bugs@postgresql.org; Tue, 11 Sep 2012 01:34:06 +0000 Received: from mail-ob0-f174.google.com ([209.85.214.174]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TBFMa-0004iH-QS for pgsql-bugs@postgresql.org; Tue, 11 Sep 2012 01:34:05 +0000 Received: by obbuo13 with SMTP id uo13so4064977obb.19 for ; Mon, 10 Sep 2012 18:34:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=subject:from:to:content-type:date:message-id:mime-version:x-mailer :content-transfer-encoding:x-gm-message-state; bh=Pvvc/F6TGJ2/2IkUPbnQqZ50Y7ZtDYYuOsWB1wqvuEk=; b=c+bgKablnY9jjAC4+ddjwmOUTInr0YOnW1XgI7bIL3ZL0BSMZCMxmywQVCpReU8nq3 WDMet7NpndiSFnG6QBdzXjkDQri+i1+ahBHyPTRAZJiBxUPUMhntjNvwM/4HRXYDm9Oa vR76wOHzVHpMu045ATKoIvQV0cB+9SPPFWLs/Hcng4xVtAxYjmVKevp5tFBfvCV7fHuW fhOGh/ojUe71iCt7h02D4NmXQEjfdTDvPDO+MQlsgaQ97MnQ1sfX/KGtqSHl8FO5k/ZL TEO5GJTTUddPrLjcODzqqriq2Kr7P/MsIBmxWSwDbb5dkm7F3r7pbRu9cn0ykwpXY8JM Tjnw== Received: by 10.60.170.18 with SMTP id ai18mr15931222oec.125.1347327243460; Mon, 10 Sep 2012 18:34:03 -0700 (PDT) Received: from ?IPv6:::1? ([2600:3c01::f03c:91ff:fe93:2ae4]) by mx.google.com with ESMTPS id q3sm11711027oef.0.2012.09.10.18.34.01 (version=SSLv3 cipher=OTHER); Mon, 10 Sep 2012 18:34:02 -0700 (PDT) Subject: Probable bug with CreateFakeRelcacheEntry From: Jeff Davis To: pgsql-bugs@postgresql.org Content-Type: text/plain; charset="ISO-8859-1" Date: Mon, 10 Sep 2012 18:33:59 -0700 Message-ID: <1347327239.4161.20.camel@sussancws0025> Mime-Version: 1.0 X-Mailer: Evolution 2.28.3 Content-Transfer-Encoding: 7bit X-Gm-Message-State: ALoCoQnGeylNoHQJix9KVW3ePyRrMTyE2zuSgu855T88d+TZ6cjcqCpNSMuXgaKRNVln+A00vOrq X-Pg-Spam-Score: -2.6 (--) X-Archive-Number: 201209/86 X-Sequence-Number: 34081 I haven't produced a real problem in a small test case (yet), but I convinced myself that it's wrong enough to be called a bug. If you add the following assertion to BufferAlloc: Assert(relpersistence == RELPERSISTENCE_PERMANENT || relpersistence == RELPERSISTENCE_UNLOGGED || relpersistence == RELPERSISTENCE_TEMP); (which seems like a reasonable assertion to me), then do: create table foo(i int); insert into foo values(1); vacuum foo; vacuum foo; insert into foo values(2); Then do an immediate shutdown, then restart, you hit the assertion. The problem is using CreateFakeRelcacheEntry, which has the following comment: Only the fields related to physical storage, like rd_rel, are initialized, so the fake entry is only usable in low-level operations like ReadBuffer(). That doesn't seem right, because ReadBuffer needs relpersistence set. One of the consequences is that you can get buffers with the wrong flags set; in particular, missing BM_PERMANENT, which seems like it could be a serious problem. Are there other areas where we might have similar problems? Regards, Jeff Davis