On Thursday, November 15, 2012 7:30 PM Robert Haas wrote:
On Thu, Nov 15, 2012 at 12:08 AM, Amit Kapila <amit.kap...@huawei.com> wrote:
>> Okay.
>> So as Robert and Alvaro suggested to have it separate utility rather than
>> having options in pg_resetxlog to print MAX LSN seems to be quite
>> appropriate.
>> I am planning to update the patch to make it a separate utility as
>> pg_computemaxlsn with options same as what I have proposed for pg_resetxlog
>> to print MAX LSN.
>> So considering it a separate utility there can be 2 options:
>> a. have a utility in contrib.
>> b. have a utility in bin similar to pg_resetxlog

> I guess I'd vote for contrib, but I wouldn't be crushed if it went the
> other way.

Updated test cases and patch to have separate utility in contrib for 
pg_computemaxlsn are attached with this mail.

With Regards,
Amit Kapila.

Attachment: pg_computemaxlsn.patch
Description: pg_computemaxlsn.patch

-- Test case 1
drop table if exists tbl;

create table tbl(f1 int, f2 varchar(10), f3 float, f4 char(200));

insert into tbl values(1,'postgres',2.1,'test');
insert into tbl values(3,'bangalore',4.1,'test');
insert into tbl values(2,'kiran',3.1,'test');
insert into tbl values(4,'india',5.1,'test');
checkpoint;

-- stop the server

-- run the following command
pg_computemaxlsn -P data

-- Validate the LSN number and WAL fileid, segid currently running in pg_xlog 
folder.

-- start the server and execute the following

drop table tbl;



-- Test case 2
drop table if exists tbl;

create table tbl(f1 int, f2 varchar(10), f3 float, f4 char(200));

insert into tbl values(1,'postgres',2.1,'test');
insert into tbl values(3,'bangalore',4.1,'test');
insert into tbl values(2,'kiran',3.1,'test');
insert into tbl values(4,'india',5.1,'test');
checkpoint;

-- stop the server

-- run the following command
pg_computemaxlsn -p base/12557 data

-- Validate the LSN number and WAL fileid, segid currently running in pg_xlog 
folder.

-- start the server and execute the following

drop table tbl;

-- Test case 3
drop table if exists tbl;

create table tbl(f1 int, f2 varchar(10), f3 float, f4 char(200));

insert into tbl values(1,'postgres',2.1,'test');
insert into tbl values(3,'bangalore',4.1,'test');
insert into tbl values(2,'kiran',3.1,'test');
insert into tbl values(4,'india',5.1,'test');

--Find the relfile node
select relfilenode from pg_class where relname='tbl';

checkpoint;

-- stop the server

-- run the following command with displayed refilenode 
pg_computemaxlsn -p base/12557/16384 data

-- Validate the LSN number and WAL fileid, segid currently running in pg_xlog 
folder.

-- start the server and execute the following

drop table tbl;
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to