I am using Centos 6 and PostgresSQL 9.4. In my configuration file , fsync and full_page_writes options were enabled. Some point , My machine got crashed and restarted. After that, i checked my database, all the entries are wrongly updated. My entire databse is fully changed. I read about fsync, it will automatically recover the data at consistent point. But why My database is getting wrongly updated???.
And also i need which time my postgres server got shutdown and restarted ?? Then which checkpoint is used to update the Postgres database.?? How to make my database safe from machine crash or power failure using fsync?
Output of this command
sudo -u postgres /usr/pgsql-9.4/bin/pg_controldata /var/lib/pgsql/9.4/data/
pg_control version number: 942
Catalog version number: 201409291
Database system identifier: 6229523677101845380
Database cluster state: in production
pg_control last modified: Thu 05 May 2016 05:52:04 AM EST
Latest checkpoint location: 0/2B7A1518
Prior checkpoint location: 0/2B79D5C0
Latest checkpoint's REDO location: 0/2B7A1518
Latest checkpoint's REDO WAL file: 00000001000000000000002B
Latest checkpoint's TimeLineID: 1
Latest checkpoint's PrevTimeLineID: 1
Latest checkpoint's full_page_writes: on
Latest checkpoint's NextXID: 0/1141605
Latest checkpoint's NextOID: 78367
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
Time of latest checkpoint: Thu 05 May 2016 05:52:04 AM EST
Fake LSN counter for unlogged rels: 0/1
Minimum recovery ending location: 0/0
Min recovery ending loc's timeline: 0
Backup start location: 0/0
Backup end location: 0/0
End-of-backup record required: no
Current wal_level setting: minimal
Current wal_log_hints setting: off
Current max_connections setting: 100
Current max_worker_processes setting: 8
Current max_prepared_xacts setting: 0
Current max_locks_per_xact setting: 64
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