Re: Why copy_relation_data only use wal when WALarchiving is enabled

From: "Jacky Leng" <lengjianquan(at)163(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Why copy_relation_data only use wal when WALarchiving is enabled
Date: 2007-10-18 07:26:36
Message-ID: ff71re$2kr2$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

> You need to set $PGDATA before running the script. And psql,pg_ctl and
> pg_resetxlog need to be in $PATH. After running the script, restart
> postmaster and run "SELECT * FROM t2". There should be one row in the
> table, but it's empty.

I've tried this script on "postgres (PostgreSQL) 8.3devel", and found that
T2 is not empty after recovery(just as it should be)---but the latest
version
act just like what you said.

Then I see how cluster is done, and found that:
In "postgres (PostgreSQL) 8.3devel", unlike AlterTableSetTablespace (which
copys the whole relation block-by-block, and doesn't use wal under
non-archiving
mode), Cluster copys the relation row-by-row(simple_heap_insert), which
always uses wal regardless of archiving mode. As wal exists, recovery will
cope with everything rightly.
The latest version acts differently probably because that it removes wal of
cluser
under non-archiving mode.

So the conclusion is: we can replace wal mechanism with smgrimmedsync only
if
relfilenode is not allowed to be reused, but this's not true, so what we
should
keep wal.

Is it right?

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jacky Leng 2007-10-18 07:26:43 Re: Why copy_relation_data only use wal when WALarchiving is enabled
Previous Message Magnus Hagander 2007-10-18 06:13:19 Re: max_prepared_transactions default ... why 5?

Browse pgsql-patches by date

  From Date Subject
Next Message Jacky Leng 2007-10-18 07:26:43 Re: Why copy_relation_data only use wal when WALarchiving is enabled
Previous Message Jacky Leng 2007-10-18 06:04:15 Re: Why copy_relation_data only use wal when WALarchiving is enabled