pg.ddx.io pgsql-bugs@postgresql.org mailing list archive
help / color / mirror / Atom feedBUG #15667: "could not truncate file" error caused deleted rows to become visible
6+ messages / 5 participants
[nested] [flat]
* BUG #15667: "could not truncate file" error caused deleted rows to become visible
@ 2019-03-05 06:38 PG Bug reporting form <noreply@postgresql.org>
0 siblings, 1 reply; 6+ messages in thread
From: PG Bug reporting form @ 2019-03-05 06:38 UTC (permalink / raw)
To: pgsql-bugs@lists.postgresql.org; +Cc: aki-kurosawa@vt.jp.nec.com
The following bug has been logged on the website:
Bug reference: 15667
Logged by: Akira Kurosawa
Email address: aki-kurosawa@vt.jp.nec.com
PostgreSQL version: 10.3
Operating system: Windows Server 2016 Standard
Description:
In vacuum after deletion, the following error occurred while trying to
truncate some blocks.
ERROR: could not truncate file "base/37389/42124" to 179 blocks:
Permission denied
CONTEXT: automatic vacuum of table "mydb.myschema.mytable"
I guess that "Permission denied" is caused by antivirus software.
However, this error caused data inconsistency in the table.
ERROR: missing chunk number 0 for toast value 69579 in pg_toast_42124
STATEMENT: SELECT * FROM myschema.mytable
When an error occurs in mdtruncate, buffers of related block has already
been invalidated in DropRelFileNodeBuffers.
If those buffers were dirty, the block image before deletion remains in the
table file.
I guess that because rows that should have been deleted in the table still
exist,
trying to access TOAST data that does not exist.
Following is pseudo reproduction procedure on linux.
----------
PostgreSQL 11.2
autovacuum = off
testdb=# create table sample (c1 int, c2 text, c3 text);
CREATE TABLE
testdb=# insert into sample select generate_series(1, 10, 1), repeat('a',
1000), repeat('a', 1000000);
INSERT 0 10
testdb=# checkpoint;
CHECKPOINT
testdb=# select ctid, c1 from sample;
ctid | c1
-------+----
(0,1) | 1
(0,2) | 2
(0,3) | 3
(0,4) | 4
(0,5) | 5
(0,6) | 6
(0,7) | 7
(1,1) | 8
(1,2) | 9
(1,3) | 10
(10 rows)
testdb=# delete from sample where c1 > 5;
DELETE 5
testdb=# select ctid, c1 from sample;
ctid | c1
-------+----
(0,1) | 1
(0,2) | 2
(0,3) | 3
(0,4) | 4
(0,5) | 5
(5 rows)
testdb=# vacuum sample;
ERROR: could not truncate file "base/16384/16524" to 1 blocks: Success //
gdb jump (skip FileTruncate)
testdb=# select ctid, c1 from sample;
ctid | c1
-------+----
(0,1) | 1
(0,2) | 2
(0,3) | 3
(0,4) | 4
(0,5) | 5
(1,1) | 8 //
(1,2) | 9 // deleted rows are visible
(1,3) | 10 //
(8 rows)
testdb=# select c3 from sample;
ERROR: missing chunk number 0 for toast value 16537 in pg_toast_16524
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: BUG #15667: "could not truncate file" error caused deleted rows to become visible
@ 2019-03-06 02:56 Michael Paquier <michael@paquier.xyz>
parent: PG Bug reporting form <noreply@postgresql.org>
0 siblings, 1 reply; 6+ messages in thread
From: Michael Paquier @ 2019-03-06 02:56 UTC (permalink / raw)
To: aki-kurosawa@vt.jp.nec.com; pgsql-bugs@lists.postgresql.org
On Tue, Mar 05, 2019 at 06:38:02AM +0000, PG Bug reporting form wrote:
> I guess that "Permission denied" is caused by antivirus software.
> However, this error caused data inconsistency in the table.
Most likely so. Please be very careful to disable that where Postgres
is running or apply filters. Windows is not concurrent safe by
default when it comes to handle writes, and Postgres uses a wrapper
for open() which makes use of some concurrent-safe options when
handling files to avoid such problems.
--
Michael
Attachments:
signature.asc (application/pgp-signature, 832B) download
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: BUG #15667: "could not truncate file" error caused deleted rows to become visible
@ 2019-03-06 03:04 Andres Freund <andres@anarazel.de>
parent: Michael Paquier <michael@paquier.xyz>
0 siblings, 1 reply; 6+ messages in thread
From: Andres Freund @ 2019-03-06 03:04 UTC (permalink / raw)
To: Michael Paquier <michael@paquier.xyz>; +Cc: aki-kurosawa@vt.jp.nec.com; pgsql-bugs@lists.postgresql.org
Hi,
On 2019-03-06 11:56:26 +0900, Michael Paquier wrote:
> Windows is not concurrent safe by default when it comes to handle
> writes, and Postgres uses a wrapper for open() which makes use of some
> concurrent-safe options when handling files to avoid such problems.
I don't think this has anything to do with the problem. Isn't this the
known problem around truncation that Tom has recently talked about fixing?
[1] https://www.postgresql.org/message-id/2348.1544474335%40sss.pgh.pa.us
Greetings,
Andres Freund
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: BUG #15667: "could not truncate file" error caused deleted rows to become visible
@ 2019-03-06 04:42 Tom Lane <tgl@sss.pgh.pa.us>
parent: Andres Freund <andres@anarazel.de>
0 siblings, 1 reply; 6+ messages in thread
From: Tom Lane @ 2019-03-06 04:42 UTC (permalink / raw)
To: Andres Freund <andres@anarazel.de>; +Cc: Michael Paquier <michael@paquier.xyz>; aki-kurosawa@vt.jp.nec.com; pgsql-bugs@lists.postgresql.org
Andres Freund <andres@anarazel.de> writes:
> I don't think this has anything to do with the problem. Isn't this the
> known problem around truncation that Tom has recently talked about fixing?
> [1] https://www.postgresql.org/message-id/2348.1544474335%40sss.pgh.pa.us
Yeah, it sure looks like that same old issue to me.
regards, tom lane
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: BUG #15667: "could not truncate file" error caused deleted rows to become visible
@ 2019-03-07 15:17 Akira Kurosawa <a-kurosawa@bk.jp.nec.com>
parent: Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 6+ messages in thread
From: Akira Kurosawa @ 2019-03-07 15:17 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; Andres Freund <andres@anarazel.de>; Michael Paquier <michael@paquier.xyz>; +Cc: pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>
Thank you for reply.
> Andres Freund <andres@anarazel.de> writes:
> > I don't think this has anything to do with the problem. Isn't this the
> > known problem around truncation that Tom has recently talked about fixing?
> > [1] https://www.postgresql.org/message-id/2348.1544474335%40sss.pgh.pa.us
>
> Yeah, it sure looks like that same old issue to me.
I understand.
I hope that this problem will be fixed.
Regards,
Akira Kurosawa
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: BUG #15667: "could not truncate file" error caused deleted rows to become visible
@ 2019-03-08 01:39 Michael Paquier <michael@paquier.xyz>
parent: Akira Kurosawa <a-kurosawa@bk.jp.nec.com>
0 siblings, 0 replies; 6+ messages in thread
From: Michael Paquier @ 2019-03-08 01:39 UTC (permalink / raw)
To: Akira Kurosawa <a-kurosawa@bk.jp.nec.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; Andres Freund <andres@anarazel.de>; pgsql-bugs@lists.postgresql.org <pgsql-bugs@lists.postgresql.org>
On Thu, Mar 07, 2019 at 03:17:28PM +0000, Akira Kurosawa wrote:
>> Andres Freund <andres@anarazel.de> writes:
>> > I don't think this has anything to do with the problem. Isn't this the
>> > known problem around truncation that Tom has recently talked about fixing?
>> > [1] https://www.postgresql.org/message-id/2348.1544474335%40sss.pgh.pa.us
>>
>> Yeah, it sure looks like that same old issue to me.
>
> I understand.
> I hope that this problem will be fixed.
Of course. Thanks for the reminder, Tom and Andres.
--
Michael
Attachments:
signature.asc (application/pgp-signature, 832B) download
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2019-03-08 01:39 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-03-05 06:38 BUG #15667: "could not truncate file" error caused deleted rows to become visible PG Bug reporting form <noreply@postgresql.org>
2019-03-06 02:56 ` Michael Paquier <michael@paquier.xyz>
2019-03-06 03:04 ` Andres Freund <andres@anarazel.de>
2019-03-06 04:42 ` Tom Lane <tgl@sss.pgh.pa.us>
2019-03-07 15:17 ` Akira Kurosawa <a-kurosawa@bk.jp.nec.com>
2019-03-08 01:39 ` Michael Paquier <michael@paquier.xyz>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox