Cannot start PostgreSQL database: Invalid primary and secondary checkpoints

121 views Asked by At

My specific problem is that we are unable to restart our postgreSQL database.

We have an ubuntu server (release 18.04) with PostgreSQL 10 installed. I commonly revise my IP address in the pg_hba.conf file to allow connections from pgAdmin on my home machine. When changes are made to the config file, this requires a restart of postgresql to take effect. I did a stop and start: sudo /etc/init.d/postgresql stop, followed by sudo /etc/init.d/postgresql start

Unfortunately, my colleague was running some processing when I did that. I can't be exactly sure what his procedures were doing (I'm working on figuring that out), but his last issued commands before I stopped the database were:

(root) CMD (command -v debian-sa1 > /dev/null && debian-sa1 1 1)
(root) CMD (    cd / && run-parts --report /etc/cron.hourly)

Upon restart we get some serious errors in the log (below). I've tried to start the database multiple times, to no avail. I've also rebooted the server; we still get these primary and secondary checkpoint errors, which I understand to be unfixable and requiring a database to be restored.

I wanted to check and see if anyone here has any workarounds that don't require a database restore. In other words, how can we get this database restarted without having to revert to a backup? Should a database restore be required, any recommendations for best practices with these specific errors in mind are welcome. Thanks!

2023-10-26 07:17:29.628 PDT [30714] LOG:  received smart shutdown request
2023-10-26 07:17:29.629 PDT [13239] redacted@redacted FATAL:  canceling authentication due to timeout
2023-10-26 07:17:29.632 PDT [28456] redacted@redacted FATAL:  terminating connection due to administrator command
2023-10-26 07:17:29.640 PDT [29087] redacted@redacted FATAL:  terminating connection due to administrator command
2023-10-26 07:17:29.807 PDT [30714] LOG:  worker process: logical replication launcher (PID 30723) exited with exit code 1
2023-10-26 07:17:29.824 PDT [30716] LOG:  shutting down
2023-10-26 07:17:31.751 PDT [30714] LOG:  database system is shut down
2023-10-26 07:17:35.675 PDT [13261] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2023-10-26 07:17:35.675 PDT [13261] LOG:  listening on IPv6 address "::", port 5432
2023-10-26 07:17:37.826 PDT [13261] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2023-10-26 07:17:42.643 PDT [13262] LOG:  database system was interrupted; last known up at 2023-09-18 16:02:09 PDT
2023-10-26 07:17:44.553 PDT [13262] LOG:  invalid primary checkpoint record
2023-10-26 07:17:44.553 PDT [13262] LOG:  invalid secondary checkpoint record
2023-10-26 07:17:44.553 PDT [13262] PANIC:  could not locate a valid checkpoint record
pg_ctl: server did not start in time
0

There are 0 answers