Why xlog stuff is done after the filetruncate op in smgrtruncate?

From: "Jacky Leng" <lengjianquan(at)163(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Why xlog stuff is done after the filetruncate op in smgrtruncate?
Date: 2007-04-16 09:15:22
Message-ID: evvf43$31ft$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Shouldn't we write xlog record before we do a physical operation?

An test case:
1. set full_page_writes off;
2. startup database; create a table; insert 100000 rows in it; shutdown
database;
3. startup database again; delete all rows from this table;
4. vacuum this table, and it will come into smgrtruncate; kill postmaster
before smgrtruncate do xlog stuff(set a breakpoint before xlog stuff);
5. startup database the 3rd time, during the recovery, the database will
crash with:
PANIC: WAL contains references to invalid pages

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Ottó Havasvölgyi 2007-04-16 09:51:24 Re: Eliminating unnecessary left joins
Previous Message Heikki Linnakangas 2007-04-16 08:42:05 Re: Adjusting index special storage for pg_filedump's convenience