Re: switch UNLOGGED to LOGGED

Поиск
Список
Период
Сортировка
От Leonardo Francalanci
Тема Re: switch UNLOGGED to LOGGED
Дата
Msg-id 589248.91127.qm@web29013.mail.ird.yahoo.com
обсуждение исходный текст
Ответ на Re: switch UNLOGGED to LOGGED  (Leonardo Francalanci <m_lists@yahoo.it>)
Ответы Re: switch UNLOGGED to LOGGED  (Alvaro Herrera <alvherre@commandprompt.com>)
Список pgsql-hackers
I think I coded a very basic version of the UNLOGGED to LOGGED patch
(only wal_level=minimal case for the moment).

To remove the INIT fork, I changed somehow PendingRelDelete to have
a flag "bool onlyInitFork" so that the delete would remove only the INIT
fork at commit.

Everything "works" (note the quotes...) except in the case of not-clean
shutdown ("-m immediate" to pg_ctl stop). The reason is that the replay
code doesn't have any idea that it has to remove only the INIT fork: it will
remove ALL forks; so at the end of the redo procedure (at startup, after
a "pg_ctl -m immediate stop") the table doesn't have any forks at all.

See xact_redo_commit:

/* Make sure files supposed to be dropped are dropped */
for (i = 0; i < xlrec->nrels; i++)
{  [...]  for (fork = 0; fork <= MAX_FORKNUM; fork++)     {          if (smgrexists(srel, fork))          {
   XLogDropRelation(xlrec->xnodes[i], fork);                 smgrdounlink(srel, fork, true);          }     }
smgrclose(srel);
}
[...]


Should I change xl_xact_commit in order to have, instead of:


/* Array of RelFileNode(s) to drop at commit */
RelFileNode xnodes[1];        /* VARIABLE LENGTH ARRAY */



an array of structures such as:

{   RelFileNode   relfilenode;   bool               onlyInitFork;
}

???

Otherwise I don't know how to tell the redo commit code to delete only
the INIT fork, instead of all the relation forks...
(maybe I'm doing all wrong: I'm open to any kind of suggestion here...)


Leonardo


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: WIP: Allow SQL-language functions to reference parameters by parameter name
Следующее
От: Steve Singer
Дата:
Сообщение: JDBC connections to 9.1