I'm fairly new to Postgres, having spent years with MySQL/MariaDB. I have a Postgres 14.9 database for development with two schemas in it. When I lose power, both of the schemas still exist in the database, but the data for one of the schemas is gone. The log says:
[1199] LOG: database system was not properly shut down; automatic recovery in progress
[1199] LOG: redo starts at 0/3094A290
[1199] LOG: invalid record length at 0/3094A378: wanted 24, got 0
[1199] LOG: redo done at 0/3094A340 system usage: CPU: user: 0.00 s, system: 0.00 s, elapsed: 0.00 s
[1050] LOG: database system is ready to accept connections
Since this is for development, losing that data isn't a big deal; I just keep importing a dump, but I'd like to know why this is happening and what I can to to prevent it, especially when I take this system to production. I haven't changed any settings in Postgres or in the OS regarding disk cache. I'm using Ubuntu 22.04 in a VM, and the host is Windows 10 on an SSD.
Also, is there a way I can recover the data without importing my dump? I did some research which led me to try pg_resetxlog
and pg_resetwal
, but both said command not found
.