Why xlog stuff is done after the filetruncate op in smgrtruncate? - Mailing list pgsql-hackers

From Jacky Leng
Subject Why xlog stuff is done after the filetruncate op in smgrtruncate?
Date
Msg-id evvf43$31ft$1@news.hub.org
Whole thread Raw
Responses Re: Why xlog stuff is done after the filetruncate op in smgrtruncate?  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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





pgsql-hackers by date:

Previous
From: Zoltan Boszormenyi
Date:
Subject: Re: IDENTITY/GENERATED v36 Re: [PATCHES] Final version of IDENTITY/GENERATED patch
Next
From: Martin Langhoff
Date:
Subject: Hacking on PostgreSQL via GIT