Re: switch UNLOGGED to LOGGED

From: Leonardo Francalanci <m_lists(at)yahoo(dot)it>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: switch UNLOGGED to LOGGED
Date: 2011-04-22 08:13:36
Message-ID: 263033.9223.qm@web29013.mail.ird.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> Maybe you should change xl_act_commit to have a separate list of rels to
> drop the init fork for (instead of mixing those with the list of files to
> drop as a whole).

I tried to follow your suggestion, thank you very much.

Here's a first attempt at the patch.

I "tested" it with:

create table forei (v integer primary key);
insert into forei select * from generate_series(1,10000);
create unlogged table pun (c integer primary key, constraint
con foreign key (c) references forei(v));
insert into pun select * from generate_series(1,10000);
alter table pun set logged;

then shutdown the master with "immediate":

bin/pg_ctl -D data -m immediate stop
bin/pg_ctl -D data start

and "pun" still has data:

select * from pun where c=100;

Question/comments:

1) it's a very-first-stage patch; I would need to know if something is
*very* wrong before cleaning it.
2) there are some things I implemented using a logic like "let's see how it
worked 10 lines above, and I'll do the same". For example, the 2PC stuff
is totally "copied" from the other places, I have no idea if the code makes
sense at all (how can I test it?)
3) Should we have a "cascade" option? I don't know if I have to handle
inherited tables and other dependent objects
4) During the check for dependencies problems, I stop as soon as I find an
error; would it be enough?

Leonardo

Attachment Content-Type Size
unl2log_20110422.patch application/octet-stream 26.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Deka, Rajib IN MAA SL 2011-04-22 09:57:53 Re: Re: database system identifier differs between the primary and standby
Previous Message Yves Weißig 2011-04-22 07:55:34 Re: best way to test new index?