BUG #10675: alter database set tablespace and unlogged table

From: maxim(dot)boguk(at)gmail(dot)com
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #10675: alter database set tablespace and unlogged table
Date: 2014-06-17 03:24:38
Message-ID: 20140617032438.2585.42918@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 10675
Logged by: Maxim Boguk
Email address: maxim(dot)boguk(at)gmail(dot)com
PostgreSQL version: 9.3.4
Operating system: Linux (Ubuntu)
Description:

Hi,

Now bug report with easy/short test case.

PostgreSQL seems doesn't flush dirty buffers related to unlogged tables in
the database during alter database set tablespace ...;

Test case:

mboguk=# create database test tablespace tmp;
CREATE DATABASE
mboguk=# \c test
You are now connected to database "test" as user "mboguk".
test=# create unlogged table test (id integer);
CREATE TABLE
test=# insert into test select * from generate_series(1,10000000);
INSERT 0 10000000
test=# \c postgres
You are now connected to database "postgres" as user "mboguk".
postgres=# alter database test set tablespace pg_default;
ALTER DATABASE
postgres=# checkpoint;
ERROR: checkpoint request failed
HINT: Consult recent messages in the server log for details.

In PostgreSQL logs:

2014-06-16 23:16:41 EDT ERROR: could not open file
"pg_tblspc/16558/PG_9.3_201306121/16559/16560": No such file or directory
2014-06-16 23:16:41 EDT CONTEXT: writing block 27059 of relation
pg_tblspc/16558/PG_9.3_201306121/16559/16560
2014-06-16 23:16:41 EDT WARNING: could not write block 27059 of
pg_tblspc/16558/PG_9.3_201306121/16559/16560
2014-06-16 23:16:41 EDT DETAIL: Multiple failures --- write error might be
permanent.

Some additional info:
select oid,* from pg_tablespace where oid=16558;
oid | spcname | spcowner | spcacl | spcoptions
-------+---------+----------+--------+------------
16558 | tmp | 16397 | |

test=# select relname from pg_class where relfilenode=16560;
relname
---------
test

So the database flush dirty shared buffers related to the unlogged table
into the old file location (pre-alter tablespace).

Kind Regards,
Maksym

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2014-06-17 04:43:59 Re: BUG #10674: syntax error with CREATE TABLE table AS SELECT (column1, column 2) FROM table2
Previous Message Tom Lane 2014-06-16 23:29:36 Re: BUG #10667: [9.2.4] Incorrect output for query involving where clause with coalesce