Thank you for updating the patch. I think that the following behaviour of pg_resetxlog is bug.
$ pg_controldata data | grep "Database system identifier" Database system identifier: 6029284919152642525 -- $ pg_resetxlog -s0 -n data Current pg_control values: pg_control version number: 942 Catalog version number: 201406181 Database system identifier: 6029284919152642525 Latest checkpoint's TimeLineID: 1 Latest checkpoint's full_page_writes: on Latest checkpoint's NextXID: 0/1810 Latest checkpoint's NextOID: 13004 Latest checkpoint's NextMultiXactId: 1 Latest checkpoint's NextMultiOffset: 0 Latest checkpoint's oldestXID: 1800 Latest checkpoint's oldestXID's DB: 1 Latest checkpoint's oldestActiveXID: 0 Latest checkpoint's oldestMultiXid: 1 Latest checkpoint's oldestMulti's DB: 1 Maximum data alignment: 8 Database block size: 8192 Blocks per segment of large relation: 131072 WAL block size: 8192 Bytes per WAL segment: 16777216 Maximum length of identifiers: 64 Maximum columns in an index: 32 Maximum size of a TOAST chunk: 1996 Size of a large-object chunk: 2048 Date/time type storage: 64-bit integers Float4 argument passing: by value Float8 argument passing: by value Data page checksum version: 0 Values to be changed: First log segment after reset: 000000010000000000000002 -- $ pg_resetxlog -s0 data Transaction log reset $ pg_controldata data | grep "Database system identifier" Database system identifier: 6029284919152642525 this patch dose not works fine with -s0. Regards, -- Sawada Masahiko On Thursday, June 26, 2014, Petr Jelinek <p...@2ndquadrant.com> wrote: > On 25/06/14 19:43, Sawada Masahiko wrote: > >> Hi, >> >> I send you review comment about thie patch. >> > > Hello, thanks. > > -- >> $ pg_resetxlog -s -n data | grep "Database system identifier" >> Database system identifier: 6028907917695471865 >> >> The -s option does not worksfine with -n option. >> > > Fixed. > > -- >> $ pg_resetxlog >> -s60289079176954718651111111111111111111111111111111111111111 >> 11111111111111 >> data >> Transaction log reset >> $ pg_controldata data | grep "Database system identifier" >> Database system identifier: 18446744073709551615 >> >> pg_resetxlog is finished successfully, but system identifier was not >> changed. >> Also I think that checking data about number of digits is needed. >> >> > It actually did change the identifier, just to ULONG_MAX, since that's the > maximum value that can be set (scanf does that conversion), I added check > that limits the maximum value of system identifier input to ULONG_MAX-1 and > reports error if it's bigger. I also added some additional input validation. > > -- > Petr Jelinek http://www.2ndQuadrant.com/ > PostgreSQL Development, 24x7 Support, Training & Services > -- Regards, ------- Sawada Masahiko