Doc Patch and test for Patch to compute Max LSN of Data Pages - Mailing list pgsql-hackers

From Amit kapila
Subject Doc Patch and test for Patch to compute Max LSN of Data Pages
Date
Msg-id 6C0B27F7206C9E4CA54AE035729E9C382852F497@szxeml509-mbs
Whole thread Raw
Responses Re: Allow WAL information to recover corrupted pg_controldata
List pgsql-hackers

>>> Based on the discussion and suggestions in this mail chain, following features can be implemented:
>>>
>>> 1. To compute the value of max LSN in data pages based on user input whether he wants it for an individual

>>>   file,  a particular directory or whole database.
>>
>>> 2a. To search the available WAL files for the latest checkpoint record and prints the value.
>>> 2b. To search the available WAL files for the latest checkpoint record and recreates a pg_control file pointing at

>>> that checkpoint.

>>> I have kept both options to address different kind of corruption scenarios.

>> I think I can see all of those things being potentially useful.  There
>> are a couple of pending patches that will revise the WAL format
>>  slightly; not sure how much those are likely to interfere with any
>> development you might do on (2) in the meantime.

> Based on above conclusion, I have prepared a patch which implements Option-1

 

This mail contains doc patch Option-1 and test cases.



Below are test scenarios corresponding to which testcases are in Test_find_max_lsn_from_datafiles

 

Scenario-1:
Validation of the maximum LSN number &  in data base directory
Steps:
1. Start the server, create table, insert some records into the table.
2. Shutdown the server in normal mode.
3. ./pg_resetxlog -P data to find the maximum LSN number and validate with the current pg_xlog directory and in pg_control file
Expected behavior:
Displayed maximum LSN number should to same as in pg_control file &
WAL segment number displayed (fileid, segnum) should be same current file in pg_xlog directory.

Scenario-2:
Validation of the maximum LSN number &  in specific directory
Steps:
1. Start the server, create table, insert some records into the table.
2. Shutdown the server in normal mode.
3. ./pg_resetxlog -p base/1/12557/ data
Expected behavior:
Displayed maximum LSN number should to same as in pg_control file &
WAL segment number displayed (fileid, segnum) should be same current file in pg_xlog directory.

Scenario-3:
Validation of the maximum LSN number &  in specific file
Steps:
1. Start the server, create table, insert some records into the table.
2. Shutdown the server in normal mode.
3. ./pg_resetxlog -p base/1/12557/16384 data
Expected behavior:
Displayed maximum LSN number should to same as in pg_control file &
WAL segment number displayed (fileid, segnum) should be same current file in pg_xlog directory.

 

With Regards,

Amit Kapila.




Attachment

pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: MySQL search query is not executing in Postgres DB
Next
From: Bruce Momjian
Date:
Subject: Re: FATAL: bogus data in lock file "postmaster.pid": ""