From: | Amit Kapila <amit(dot)kapila(at)huawei(dot)com> |
---|---|
To: | <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Allow WAL information to recover corrupted pg_controldata |
Date: | 2012-06-14 15:39:07 |
Message-ID: | 001601cd4a43$d65373b0$82fa5b10$@kapila@huawei.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
I am planning to work on the below Todo list item for this CommitFest
Allow WAL information to recover corrupted pg_controldata
http://archives.postgresql.org/pgsql-patches/2006-06/msg00025.php
I wanted to confirm my understanding about the work involved for this patch:
The existing patch has following set of problems:
1. Memory leak and linked list code path is not proper
2. lock check for if the server is already running, is removed in patch
which needs to be reverted
3. Refactoring of the code.
Apart from above what I understood from the patch is that its intention is
to generate values for ControlFile using WAL logs when -r option is used.
The change in algorithm from current will be if control file is corrupt
which essentialy means ReadControlFile() will return False, then it should
generate values (checkPointCopy, checkPoint, prevCheckPoint, state) using
WAL if -r option is enabled.
Also for -r option, it doesn't need to call function FindEndOfXLOG() as the
that work will be achieved by above point.
It will just rewrite the control file and don't do other resets.
The algorithm of restoring the pg_control value from old xlog file:
1. Retrieve all of the active xlog files from xlog direcotry into a list
by increasing order, according their timeline, log id, segment id.
2. Search the list to find the oldest xlog file of the lastest time line.
3. Search the records from the oldest xlog file of latest time line to
the latest xlog file of latest time line, if the checkpoint record
has been found, update the latest checkpoint and previous checkpoint.
Apart from above some changes in code will be required after the Xlog patch
by Heikki.
Suggest me if my understanding is correct?
From | Date | Subject | |
---|---|---|---|
Next Message | Kohei KaiGai | 2012-06-14 15:43:39 | [v9.3] Row-Level Security |
Previous Message | Peter Geoghegan | 2012-06-14 15:36:56 | Re: sortsupport for text |