Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eYXrn-000253-KQ for pgsql-admin@arkaria.postgresql.org; Mon, 08 Jan 2018 13:53:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eYXrn-0003a8-7v for pgsql-admin@arkaria.postgresql.org; Mon, 08 Jan 2018 13:53:31 +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_2) (envelope-from ) id 1eYXrm-0003Zz-Sb for pgsql-admin@lists.postgresql.org; Mon, 08 Jan 2018 13:53:31 +0000 Received: from smtp-16-i5.italiaonline.it ([213.209.9.16] helo=libero.it) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1eYXrf-0005TR-Da for pgsql-admin@lists.postgresql.org; Mon, 08 Jan 2018 13:53:30 +0000 Received: from oxapps-09-053.iol.local ([10.101.8.63]) by smtp-16.iol.local with SMTP id YXrceG5rEk4NzYXrceWG7I; Mon, 08 Jan 2018 14:53:21 +0100 x-libjamoibt: 1601 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virgilio.it; s=s2017; t=1515419601; bh=llQlwNPnjfMyeG4YDoPt4RJrhvxJ7+E67wHxzF6qhhw=; h=Date:From:To:Cc:In-Reply-To:References:Subject; b=PbHANMpQyr/MZDk0t4k820EU6AERcHbR3aREuk2tDjcfkFzt4fsz3tgDa6m0ZseS7 8sEFTO1qEosklElFuByy9V39HpmK+HKJHzFY4IQBsekblzSSt3k2sLktvonDWpeLe9 NXkYJUfqhOu2fMNDFTpwbpGLFC6kXQpJvcwQvcIMWWA11kB32+UThudiYO8OVDTC/T 3QdUvInWruP6sQTFlDEdO3UoQD/8QKq16mf706Fh+BvgGNQm0K8aKvVc2EdncPBKeB X7vwbOSULROR/5v3pu3jhTsfyrMaZ3UjK+RoMtQq/Qwro8Id1uXpoPbosOOE8IvxoJ Guc0m8sMjq1gw== X-CNFS-Analysis: v=2.2 cv=Gqkywg9C c=1 sm=1 tr=0 a=h9nG7A+Nx8W9eq05Vsxl+g==:117 a=JFonBcA4ufAA:10 a=xJTDAyycAAAA:8 a=kPg10VR9AAAA:8 a=6rSCkCATb4MpK7qMey8A:9 a=QEXdDO2ut3YA:10 a=W4GDs4CH9rzAtlaQdcEA:9 a=-QyeJ5xgiwuRyQw5:21 a=_W_S_7VecoQA:10 a=swXOJ3vSs_fEAyTCSpdh:22 a=pbkouhIAMd91kwdrYYoq:22 Date: Mon, 8 Jan 2018 14:53:20 +0100 (CET) From: flumbador@virgilio.it To: Alvaro Herrera Cc: pgsql-admin@lists.postgresql.org Message-ID: <1623608978.635173.1515419600795@mail.virgilio.it> In-Reply-To: <20180102153854.nldw2ouxnehtp63k@alvherre.pgsql> References: <524817289.230206.1514560886805@mail.virgilio.it> <20180102153854.nldw2ouxnehtp63k@alvherre.pgsql> Subject: Re: Issue on restore / recover MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_635172_1058878442.1515419600791" X-Priority: 3 Importance: Medium X-Mailer: Open-Xchange Mailer v7.8.3-Rev40 X-Originating-IP: 46.235.159.120 X-Originating-Client: open-xchange-appsuite x-libjamsun: 0akav3za+1WIiXjIjvHlpg8MTBiXCDLL x-libjamv: jKaqsx982hc= X-CMAE-Envelope: MS4wfH0d6KRg+QucHMekjEbeSP9ALCzYz6/pUx8k2L3zkyIF75ITL6AHxBvaiV5c3H7pP/J55n080ixxcJHH+3UIindLgAqlpMKTWg6JKC/ZIDgUC447edCp LW7OEpXD/pM4bv1mRskqjKr285h2CgTTBUGYmsEIrdLEUmxLosnA3TM4CWizjFvpsCEGYCc2E6sp8QNBVvtfvXWh+Pk5955J/CGkIWh8Rd/uywfbSkPYHGNL List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk ------=_Part_635172_1058878442.1515419600791 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi postgresql is 9.4.9 on SUSE 11sp4 ... The backup is a filesystem backup = with Networker. I confirm that I handle WAL archiving and backup_label file was in place wh= en I started the recovery. The table is Persistent (Relpersistence =3D 'p')= . The postgresql was succesfully restored from another backup and now is up a= nd running; i'm not able to provide further datails. I try to reproduce the issue on a test environment. I'll update the thread with further details as soon as I reproduce the issu= e. Thanks to all Best Regards Gabriele >=20 > Il 2 gennaio 2018 alle 16.38 Alvaro Herrera = ha scritto: >=20 > flumbador@virgilio.it wrote: >=20 > > >=20 > > During the restore 3 files were missing; these three files belo= ng to a table with high transaction workload, and for sure during the backu= p many transactions had modified this table and those missing files. What i= s surprising to me is that even if the files were missing the recover phase= ended successfully. I expect an error (for example file not found) raised = when postgresql try to apply the wal entries related to this table and thos= e files. After the recover I find that these three file has been created du= ring recover but when I try to query the table I get the error: > >=20 > > db4=3D# select count(*) from pgbench_accounts ; > >=20 > > ERROR: could not read block 1999996 in file "pg_tblspc/16471/PG= _9.4_201409291/16474/16593.15": read only 0 of 8192 bytes > >=20 > > >=20 > Can you please get a backtrace from this error? I suspect that the > problem here is that the planner is trying to estimate cardinality by > descending a btree index, and failing because the index points to a p= art > of the table that has been truncated. But if the table has been > truncated because it's unlogged, then the index should have been > truncated too; and if it's a permanent table, then it has been trunca= ted > improperly (because no index pointer to the truncated part should > remain). >=20 > What files do exist for pg_tblspc/16471/PG_9.4_201409291/16474/16593*= ? > (In particular I'm curious about whether 16593.14 exists and what siz= e > it is) >=20 > -- > =C3=81lvaro Herrera https://www.2ndQuadrant.com/ > PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services >=20 ------=_Part_635172_1058878442.1515419600791 MIME-Version: 1.0 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

Hi postgresql is 9.4.9 on SUSE 11sp4 ... The backup is a fi= lesystem backup with Networker.
I confirm that I handle WAL archiving an= d backup_label file was in place when I started the recovery. The table is = Persistent (Relpersistence =3D 'p').
The postgresql was succesfu= lly restored from another backup and now is up and running; i'm not abl= e to provide further datails.
I try to reproduce the issue on a test env= ironment.
I'll update the thread with further details as soon as I r= eproduce the issue.
Thanks to all
Best Regards
Gabriele

Il 2 gennaio 2018 alle 16.38 Alvaro Herrera <alvherre@alvh.no-i= p.org> ha scritto:

flumbador@virgilio.it wrote:

During the restore 3 files were missing; these three files belong to a tab= le with high transaction workload, and for sure during the backup many tran= sactions had modified this table and those missing files. What is surprisin= g to me is that even if the files were missing the recover phase ended succ= essfully. I expect an error (for example file not found) raised when postgr= esql try to apply the wal entries related to this table and those files. Af= ter the recover I find that these three file has been created during recove= r but when I try to query the table I get the error:

db4=3D# select c= ount(*) from pgbench_accounts ;

ERROR: could not read block 1999996 i= n file "pg_tblspc/16471/PG_9.4_201409291/16474/16593.15": read only= 0 of 8192 bytes

Can you please get a backtrace from thi= s error? I suspect that the
problem here is that the planner is trying t= o estimate cardinality by
descending a btree index, and failing because = the index points to a part
of the table that has been truncated. But if = the table has been
truncated because it's unlogged, then the index s= hould have been
truncated too; and if it's a permanent table, then i= t has been truncated
improperly (because no index pointer to the truncat= ed part should
remain).

What files do exist for pg_tblspc/16471/PG= _9.4_201409291/16474/16593* ?
(In particular I'm curious about wheth= er 16593.14 exists and what size
it is)

--
Álvaro Herrera = https://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services=

=20 ------=_Part_635172_1058878442.1515419600791--