vmware/pg_rewind — pull request #24 by Samrat-Revagade (2014-01-22 12:52:19+00:00)
Title: fetchchunks table takes garbage entries because of wrong actions on files.

I think there are some incorrect actions in process_remote_file function because of which fetchchunks table takes garbage entries and pg_rewind fails.

Please correct me if I am thinking it in wrong way.

Steps to reproduce a problem which shows garbage entries in fetchchunks table:

Implement Streaming Replication (On two different machines)
create table [ create table test( id int); ]
Insert data [ insert into test (select * from generate_series(1,100000)); ]
promote standby
on old master update all the tuples in test tables[ update test set id =888 ; ] 6 .stop old master
run pg_rewind
It will show following messages:
.
.
.
pg_stat/db_0.stat (REMOVE)
pg_stat/global.stat (REMOVE)
pg_stat/db_12907.stat (REMOVE)
unexpected result while sending file list: ERROR: value "2148249920" is out of range for type integer
CONTEXT: COPY fetchchunks, line 2728, column begin: "2148249920"

The range for integer exceeds because fetchchunk table takes garbage entries.